Revision 033100af
Added by Leszek Koltunski over 2 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 |
|
Also available in: Unified diff
Convert TransparentButton to Material Design.