Revision 033100af
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/helpers/TransparentButton.java | ||
---|---|---|
24 | 24 |
import android.util.TypedValue; |
25 | 25 |
import android.widget.LinearLayout; |
26 | 26 |
|
27 |
import org.distorted.main.RubikActivity;
|
|
27 |
import com.google.android.material.button.MaterialButton;
|
|
28 | 28 |
|
29 | 29 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
30 | 30 |
|
31 | 31 |
@SuppressLint("ViewConstructor") |
32 |
public class TransparentButton extends androidx.appcompat.widget.AppCompatButton
|
|
32 |
public class TransparentButton extends MaterialButton
|
|
33 | 33 |
{ |
34 |
public TransparentButton(Context context, int resId, float size, float scrWidth)
|
|
34 |
public TransparentButton(Context context, int resId, float size) |
|
35 | 35 |
{ |
36 | 36 |
super(context); |
37 | 37 |
|
38 |
final int padding = (int)(scrWidth*RubikActivity.PADDING); |
|
39 |
final int margin = (int)(scrWidth*RubikActivity.MARGIN); |
|
40 |
|
|
41 | 38 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT, 1.0f); |
42 |
params.topMargin = margin; |
|
43 |
params.bottomMargin = margin; |
|
44 |
params.leftMargin = margin; |
|
45 |
params.rightMargin = margin; |
|
46 | 39 |
|
47 | 40 |
setLayoutParams(params); |
48 |
setPadding(padding,0,padding,0);
|
|
41 |
setPadding(0,0,0,0);
|
|
49 | 42 |
setTextSize(TypedValue.COMPLEX_UNIT_PX, size); |
50 | 43 |
setText(resId); |
51 | 44 |
|
src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
---|---|---|
70 | 70 |
private static final int[] mLocation = new int[2]; |
71 | 71 |
|
72 | 72 |
private TransparentImageButton mObjButton, mMenuButton, mSolveButton, mScrambleButton; |
73 |
private Button mPlayButton; |
|
73 |
private TransparentButton mPlayButton;
|
|
74 | 74 |
private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup; |
75 | 75 |
private ObjectType mObject = DEF_OBJECT; |
76 | 76 |
private int mObjectSize, mMenuLayoutWidth, mMenuLayoutHeight, mPlayLayoutWidth; |
... | ... | |
172 | 172 |
{ |
173 | 173 |
final int margin = (int)(width*RubikActivity.MARGIN); |
174 | 174 |
|
175 |
mPlayButton = new TransparentButton(act, R.string.play, mButtonSize, width);
|
|
175 |
mPlayButton = new TransparentButton(act, R.string.play, mButtonSize); |
|
176 | 176 |
|
177 | 177 |
mPlayButton.setOnClickListener( new View.OnClickListener() |
178 | 178 |
{ |
src/main/res/values/styles.xml | ||
---|---|---|
20 | 20 |
<item name="android:windowActionBar">false</item> |
21 | 21 |
<item name="android:windowFullscreen">true</item> |
22 | 22 |
<item name="android:windowContentOverlay">@null</item> |
23 |
<item name="materialThemeOverlay">@style/ButtonStyleTextColor</item> |
|
23 | 24 |
<item name="buttonBarNegativeButtonStyle">@style/NegativeButtonStyle</item> |
24 | 25 |
<item name="buttonBarPositiveButtonStyle">@style/PositiveButtonStyle</item> |
25 | 26 |
</style> |
... | ... | |
32 | 33 |
<item name="android:textColor">#ffffff</item> |
33 | 34 |
</style> |
34 | 35 |
|
36 |
<style name="ButtonStyleTextColor"> |
|
37 |
<item name="colorOnPrimary">@color/white</item> |
|
38 |
<item name="colorOnSecondary">@color/dark_grey</item> |
|
39 |
<item name="colorOnSurface">@color/light_grey</item> |
|
40 |
</style> |
|
41 |
|
|
35 | 42 |
</resources> |
Also available in: Unified diff
Convert TransparentButton to Material Design.