Revision 52d0a923
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/dialogs/RubikDialogScores.java | ||
---|---|---|
28 | 28 |
import androidx.appcompat.app.AlertDialog; |
29 | 29 |
import androidx.appcompat.app.AppCompatDialogFragment; |
30 | 30 |
import com.google.android.material.tabs.TabLayout; |
31 |
|
|
32 |
import android.util.DisplayMetrics; |
|
33 |
import android.util.TypedValue; |
|
31 | 34 |
import android.view.LayoutInflater; |
32 | 35 |
import android.view.View; |
33 | 36 |
import android.view.Window; |
34 | 37 |
import android.view.WindowManager; |
38 |
import android.widget.Button; |
|
35 | 39 |
import android.widget.ImageView; |
36 | 40 |
import android.widget.TextView; |
37 | 41 |
|
38 | 42 |
import org.distorted.main.R; |
43 |
import org.distorted.main.RubikActivity; |
|
39 | 44 |
import org.distorted.objects.RubikObjectList; |
40 | 45 |
|
41 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
53 | 58 |
FragmentActivity act = getActivity(); |
54 | 59 |
AlertDialog.Builder builder = new AlertDialog.Builder(act); |
55 | 60 |
|
61 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
|
62 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
|
63 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.MENU_BIG_TEXT_SIZE; |
|
64 |
final float okSize = displaymetrics.widthPixels * RubikActivity.MENU_MEDIUM_TEXT_SIZE; |
|
65 |
|
|
56 | 66 |
LayoutInflater layoutInflater = act.getLayoutInflater(); |
57 | 67 |
TextView tv = (TextView) layoutInflater.inflate(R.layout.dialog_title, null); |
68 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
|
58 | 69 |
tv.setText(R.string.scores); |
59 | 70 |
builder.setCustomTitle(tv); |
60 | 71 |
|
... | ... | |
122 | 133 |
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); |
123 | 134 |
} |
124 | 135 |
|
136 |
dialog.setOnShowListener(new DialogInterface.OnShowListener() |
|
137 |
{ |
|
138 |
@Override |
|
139 |
public void onShow(DialogInterface dialog) |
|
140 |
{ |
|
141 |
Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE); |
|
142 |
btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, okSize); |
|
143 |
} |
|
144 |
}); |
|
145 |
|
|
125 | 146 |
return dialog; |
126 | 147 |
} |
127 | 148 |
} |
Also available in: Unified diff
Improvements to the UI - make it proportional regardless of the physical screen size. (Part 7 - last 2 Dialogs)