1 |
344f290c
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
1c327853
|
Leszek Koltunski
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7 |
|
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8 |
344f290c
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
55e6be1d
|
Leszek Koltunski
|
package org.distorted.helpers;
|
11 |
344f290c
|
Leszek Koltunski
|
|
12 |
|
|
import android.annotation.SuppressLint;
|
13 |
|
|
import android.content.Context;
|
14 |
|
|
import android.util.TypedValue;
|
15 |
|
|
import android.widget.LinearLayout;
|
16 |
|
|
|
17 |
033100af
|
Leszek Koltunski
|
import com.google.android.material.button.MaterialButton;
|
18 |
344f290c
|
Leszek Koltunski
|
|
19 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
20 |
|
|
|
21 |
|
|
@SuppressLint("ViewConstructor")
|
22 |
033100af
|
Leszek Koltunski
|
public class TransparentButton extends MaterialButton
|
23 |
344f290c
|
Leszek Koltunski
|
{
|
24 |
c41c5ae3
|
Leszek Koltunski
|
public TransparentButton(Context context, int resId, float textSize)
|
25 |
|
|
{
|
26 |
|
|
this(context, resId, textSize, 1.0f);
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
30 |
|
|
|
31 |
|
|
public TransparentButton(Context context, int resId, float textSize, float weight)
|
32 |
344f290c
|
Leszek Koltunski
|
{
|
33 |
|
|
super(context);
|
34 |
|
|
|
35 |
c41c5ae3
|
Leszek Koltunski
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT, weight);
|
36 |
344f290c
|
Leszek Koltunski
|
|
37 |
|
|
setLayoutParams(params);
|
38 |
033100af
|
Leszek Koltunski
|
setPadding(0,0,0,0);
|
39 |
c41c5ae3
|
Leszek Koltunski
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
40 |
344f290c
|
Leszek Koltunski
|
setText(resId);
|
41 |
|
|
|
42 |
|
|
TypedValue outValue = new TypedValue();
|
43 |
|
|
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true);
|
44 |
|
|
setBackgroundResource(outValue.resourceId);
|
45 |
|
|
}
|
46 |
|
|
}
|