Revision b6cce523
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/dialogs/RubikDialogAbandon.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
46 | 46 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
47 |
final float butSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
|
|
47 |
final float butSize = displaymetrics.heightPixels * 0.04f;
|
|
48 | 48 |
|
49 | 49 |
final View view = inflater.inflate(R.layout.abandon_solve, null); |
50 | 50 |
builder.setView(view); |
src/main/java/org/distorted/dialogs/RubikDialogAbout.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
48 | 48 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
49 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
50 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
51 |
final float textSize = displaymetrics.widthPixels * RubikActivity.SMALL_TEXT_SIZE; |
|
49 |
int h = displaymetrics.heightPixels; |
|
50 |
final float titleSize= h * 0.032f; |
|
51 |
final float okSize = h * 0.040f; |
|
52 |
final float textSize = h * 0.025f; |
|
52 | 53 |
|
53 | 54 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
54 | 55 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogBandagedDelete.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
45 | 45 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
46 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
47 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
46 |
int h = displaymetrics.heightPixels; |
|
47 |
final float titleSize= h * 0.032f; |
|
48 |
final float okSize = h * 0.040f; |
|
48 | 49 |
|
49 | 50 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
50 | 51 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogBandagedSave.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
46 | 46 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
47 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
48 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
47 |
int h = displaymetrics.heightPixels; |
|
48 |
final float titleSize= h * 0.032f; |
|
49 |
final float okSize = h * 0.040f; |
|
49 | 50 |
|
50 | 51 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
51 | 52 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogError.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
44 | 44 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
45 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
46 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
45 |
int h = displaymetrics.heightPixels; |
|
46 |
final float titleSize= h * 0.032f; |
|
47 |
final float okSize = h * 0.040f; |
|
47 | 48 |
|
48 | 49 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
49 | 50 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java | ||
---|---|---|
45 | 45 |
|
46 | 46 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
47 | 47 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
48 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
49 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
50 |
final float textSize = displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
48 |
int h = displaymetrics.heightPixels; |
|
49 |
final float titleSize= h*0.032f; |
|
50 |
final float okSize = h*0.040f; |
|
51 |
final float textSize = h*0.032f; |
|
51 | 52 |
|
52 | 53 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
53 | 54 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogPattern.java | ||
---|---|---|
148 | 148 |
if( window!=null && context!=null ) |
149 | 149 |
{ |
150 | 150 |
DisplayMetrics metrics = context.getResources().getDisplayMetrics(); |
151 |
final float height= metrics.heightPixels; |
|
152 |
|
|
153 | 151 |
WindowManager.LayoutParams params = window.getAttributes(); |
154 |
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
|
155 |
params.height = (int)(0.75f*height);
|
|
152 |
params.width = (int)Math.min( 0.65f*metrics.heightPixels,0.98f*metrics.widthPixels );
|
|
153 |
params.height = (int)Math.min( 0.85f*metrics.heightPixels,1.30f*metrics.widthPixels );
|
|
156 | 154 |
window.setAttributes(params); |
157 | 155 |
} |
158 | 156 |
} |
src/main/java/org/distorted/dialogs/RubikDialogPrivacy.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
48 | 48 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
49 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
50 |
final float butSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
49 |
int h = displaymetrics.heightPixels; |
|
50 |
final float titleSize= h*0.032f; |
|
51 |
final float butSize = h*0.040f; |
|
51 | 52 |
|
52 | 53 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
53 | 54 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogScores.java | ||
---|---|---|
10 | 10 |
package org.distorted.dialogs; |
11 | 11 |
|
12 | 12 |
import android.app.Dialog; |
13 |
import android.content.Context; |
|
13 | 14 |
import android.content.DialogInterface; |
14 | 15 |
import android.os.Bundle; |
15 | 16 |
import androidx.annotation.NonNull; |
... | ... | |
25 | 26 |
import android.view.View; |
26 | 27 |
import android.view.ViewGroup; |
27 | 28 |
import android.view.Window; |
29 |
import android.view.WindowManager; |
|
28 | 30 |
import android.widget.Button; |
29 | 31 |
import android.widget.ImageView; |
30 | 32 |
import android.widget.TextView; |
... | ... | |
133 | 135 |
|
134 | 136 |
return dialog; |
135 | 137 |
} |
138 |
|
|
139 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
140 |
|
|
141 |
@Override |
|
142 |
public void onResume() |
|
143 |
{ |
|
144 |
super.onResume(); |
|
145 |
|
|
146 |
Window window = getDialog().getWindow(); |
|
147 |
Context context = getContext(); |
|
148 |
|
|
149 |
if( window!=null && context!=null ) |
|
150 |
{ |
|
151 |
DisplayMetrics metrics = context.getResources().getDisplayMetrics(); |
|
152 |
WindowManager.LayoutParams params = window.getAttributes(); |
|
153 |
params.width = (int)Math.min( 0.65f*metrics.heightPixels,0.98f*metrics.widthPixels ); |
|
154 |
params.height = (int)(0.77f*metrics.heightPixels); |
|
155 |
window.setAttributes(params); |
|
156 |
} |
|
157 |
} |
|
136 | 158 |
} |
src/main/java/org/distorted/dialogs/RubikDialogSetName.java | ||
---|---|---|
74 | 74 |
|
75 | 75 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
76 | 76 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
77 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
78 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
79 |
final float textSize = displaymetrics.widthPixels * RubikActivity.SMALL_TEXT_SIZE; |
|
77 |
int h = displaymetrics.heightPixels; |
|
78 |
final float titleSize= h*0.032f; |
|
79 |
final float okSize = h*0.040f; |
|
80 |
final float textSize = h*0.022f; |
|
80 | 81 |
|
81 | 82 |
Bundle args = getArguments(); |
82 | 83 |
String name; |
src/main/java/org/distorted/dialogs/RubikDialogSolved.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
45 | 45 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
46 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
47 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
48 |
final float textSize = displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
46 |
int h = displaymetrics.heightPixels; |
|
47 |
final float titleSize= h*0.032f; |
|
48 |
final float okSize = h*0.040f; |
|
49 |
final float textSize = h*0.022f; |
|
49 | 50 |
|
50 | 51 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
51 | 52 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogSolverError.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
44 | 44 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
45 |
final float titleSize= displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
46 |
final float okSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
47 |
final float textSize = displaymetrics.widthPixels * RubikActivity.BIG_TEXT_SIZE; |
|
45 |
int h = displaymetrics.heightPixels; |
|
46 |
final float titleSize= h * 0.030f; |
|
47 |
final float okSize = h * 0.040f; |
|
48 |
final float textSize = h * 0.033f; |
|
48 | 49 |
|
49 | 50 |
TextView tv = (TextView) inflater.inflate(R.layout.dialog_title, null); |
50 | 51 |
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize); |
src/main/java/org/distorted/dialogs/RubikDialogStarsExplain.java | ||
---|---|---|
40 | 40 |
AlertDialog.Builder builder = new AlertDialog.Builder(act); |
41 | 41 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
42 | 42 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
43 |
final float butSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE;
|
|
43 |
final float butSize = displaymetrics.heightPixels * 0.04f;
|
|
44 | 44 |
final View view = inflater.inflate(R.layout.dialog_stars_explain, null); |
45 | 45 |
|
46 | 46 |
builder.setCancelable(true); |
src/main/java/org/distorted/dialogs/RubikDialogStarsStatus.java | ||
---|---|---|
10 | 10 |
package org.distorted.dialogs; |
11 | 11 |
|
12 | 12 |
import android.app.Dialog; |
13 |
import android.content.Context; |
|
13 | 14 |
import android.content.DialogInterface; |
14 | 15 |
import android.os.Bundle; |
15 | 16 |
import android.util.DisplayMetrics; |
... | ... | |
17 | 18 |
import android.view.LayoutInflater; |
18 | 19 |
import android.view.View; |
19 | 20 |
import android.view.Window; |
21 |
import android.view.WindowManager; |
|
20 | 22 |
import android.widget.Button; |
21 | 23 |
import android.widget.LinearLayout; |
22 | 24 |
import android.widget.TextView; |
... | ... | |
36 | 38 |
{ |
37 | 39 |
private static final float LAYOUT_HEIGHT = 0.110f; |
38 | 40 |
private static final float MARGIN = 0.007f; |
41 |
private static final float BUTTON_SIZE = 0.040f; |
|
39 | 42 |
|
40 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 44 |
|
... | ... | |
48 | 51 |
AlertDialog.Builder builder = new AlertDialog.Builder(act); |
49 | 52 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
50 | 53 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
51 |
final float butSize = displaymetrics.widthPixels * RubikActivity.DIALOG_BUTTON_SIZE; |
|
52 | 54 |
final View view = inflater.inflate(R.layout.dialog_stars_status, null); |
53 | 55 |
|
54 |
int height = (int)(displaymetrics.heightPixels*LAYOUT_HEIGHT); |
|
55 |
int margin = (int)(displaymetrics.heightPixels*MARGIN); |
|
56 |
int h = displaymetrics.heightPixels; |
|
57 |
final float butSize = h * BUTTON_SIZE; |
|
58 |
int height = (int)(h*LAYOUT_HEIGHT); |
|
59 |
int margin = (int)(h*MARGIN); |
|
56 | 60 |
|
57 | 61 |
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT); |
58 | 62 |
params1.setMargins(margin, margin, margin, margin); |
... | ... | |
105 | 109 |
return dialog; |
106 | 110 |
} |
107 | 111 |
|
112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
113 |
|
|
114 |
@Override |
|
115 |
public void onResume() |
|
116 |
{ |
|
117 |
super.onResume(); |
|
118 |
|
|
119 |
Window window = getDialog().getWindow(); |
|
120 |
Context context = getContext(); |
|
121 |
|
|
122 |
if( window!=null && context!=null ) |
|
123 |
{ |
|
124 |
DisplayMetrics metrics = context.getResources().getDisplayMetrics(); |
|
125 |
WindowManager.LayoutParams params = window.getAttributes(); |
|
126 |
params.width = (int)Math.min( 0.65f*metrics.heightPixels,0.95f*metrics.widthPixels ); |
|
127 |
params.height = WindowManager.LayoutParams.WRAP_CONTENT; |
|
128 |
window.setAttributes(params); |
|
129 |
} |
|
130 |
} |
|
108 | 131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
109 | 132 |
|
110 | 133 |
void fillUpNumberOfStars(View view) |
src/main/java/org/distorted/dialogs/RubikDialogTutorial.java | ||
---|---|---|
146 | 146 |
{ |
147 | 147 |
DisplayMetrics metrics = context.getResources().getDisplayMetrics(); |
148 | 148 |
WindowManager.LayoutParams params = window.getAttributes(); |
149 |
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
|
150 |
params.height = (int)Math.min( 0.85f*metrics.heightPixels,1.3f*metrics.widthPixels ); |
|
149 |
params.width = (int)Math.min( 0.65f*metrics.heightPixels,0.98f*metrics.widthPixels );
|
|
150 |
params.height = (int)Math.min( 0.85f*metrics.heightPixels,1.30f*metrics.widthPixels );
|
|
151 | 151 |
window.setAttributes(params); |
152 | 152 |
} |
153 | 153 |
} |
src/main/java/org/distorted/dialogs/RubikDialogTutorialView.java | ||
---|---|---|
121 | 121 |
private View createRow(final RubikActivity act, int countryID, final String desc, final String url, |
122 | 122 |
final String auth, int size, final int obj, int colorB, int colorT) |
123 | 123 |
{ |
124 |
float textSize = 0.5f*size;
|
|
124 |
float textSize = 0.43f*size;
|
|
125 | 125 |
View row = inflate( act, R.layout.dialog_tutorial_row, null); |
126 | 126 |
|
127 | 127 |
LinearLayout layout = row.findViewById(R.id.tutorialLayout); |
src/main/java/org/distorted/dialogs/RubikDialogUpdates.java | ||
---|---|---|
75 | 75 |
|
76 | 76 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
77 | 77 |
act.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); |
78 |
int w= displaymetrics.widthPixels; |
|
79 | 78 |
int h= displaymetrics.heightPixels; |
80 |
final float titleSize= w*RubikActivity.BIG_TEXT_SIZE;
|
|
81 |
final float okSize = w*RubikActivity.DIALOG_BUTTON_SIZE;
|
|
79 |
final float titleSize= h*0.032f;
|
|
80 |
final float okSize = h*0.04f;
|
|
82 | 81 |
mMargin = (int)(h*0.01f); |
83 | 82 |
mSize = (int)(h*0.14f); |
84 | 83 |
mFontSize = (int)(h*0.02f); |
Also available in: Unified diff
More fixes for UI in case of extreme screen (w/h) ratios ( from 1.0 to 2.0 ).