Revision dd874ae8
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/helpers/LockController.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.app.Activity; |
26 | 26 |
import android.view.View; |
27 |
import android.widget.ImageButton; |
|
28 | 27 |
import android.widget.LinearLayout; |
29 | 28 |
|
30 | 29 |
import org.distorted.main.R; |
... | ... | |
37 | 36 |
{ |
38 | 37 |
private static final int LOCK_TIME = 300; |
39 | 38 |
|
40 |
private ImageButton mLockButton; |
|
39 |
private TransparentImageButton mLockButton;
|
|
41 | 40 |
private long mLockTime; |
42 | 41 |
private Timer mTimer; |
43 | 42 |
private boolean mTimerRunning; |
... | ... | |
57 | 56 |
{ |
58 | 57 |
control.toggleLock(); |
59 | 58 |
boolean locked = control.retLocked(); |
60 |
mLockButton.setImageResource(getLockIcon(locked,false));
|
|
59 |
mLockButton.setIconResource(getLockIcon(locked,false));
|
|
61 | 60 |
} |
62 | 61 |
|
63 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
100 | 99 |
public void run() |
101 | 100 |
{ |
102 | 101 |
if( mLockButton!=null ) |
103 |
mLockButton.setImageResource(getLockIcon(locked,red));
|
|
102 |
mLockButton.setIconResource(getLockIcon(locked,red));
|
|
104 | 103 |
} |
105 | 104 |
}); |
106 | 105 |
} |
... | ... | |
151 | 150 |
|
152 | 151 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
153 | 152 |
|
154 |
public void setupButton(final Activity act, ObjectControl control, final float width)
|
|
153 |
public void setupButton(final Activity act, ObjectControl control) |
|
155 | 154 |
{ |
156 | 155 |
boolean locked = control.retLocked(); |
157 | 156 |
final int icon = getLockIcon(locked,false); |
158 |
mLockButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
|
|
157 |
mLockButton = new TransparentImageButton(act, icon, LinearLayout.LayoutParams.MATCH_PARENT,TransparentImageButton.GRAVITY_MIDDLE);
|
|
159 | 158 |
|
160 | 159 |
mLockButton.setOnClickListener( new View.OnClickListener() |
161 | 160 |
{ |
... | ... | |
177 | 176 |
public void run() |
178 | 177 |
{ |
179 | 178 |
if( mLockButton!=null ) |
180 |
mLockButton.setImageResource(getLockIcon(locked,false));
|
|
179 |
mLockButton.setIconResource(getLockIcon(locked,false));
|
|
181 | 180 |
} |
182 | 181 |
}); |
183 | 182 |
} |
184 | 183 |
|
185 | 184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
186 | 185 |
|
187 |
public ImageButton getButton() |
|
186 |
public TransparentImageButton getButton()
|
|
188 | 187 |
{ |
189 | 188 |
return mLockButton; |
190 | 189 |
} |
Also available in: Unified diff
Convert the theme to be a MaterialTheme and the TransparentImageButton to be a MaterialButton - the first forced by the second, and the second because a MaterialButton gives us control over the location of the icon in top of it. We need that because of the new 'solve/scramble' split-button in the lower right of the Play screen.