Revision f8a21f6b
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/dialogs/RubikDialogSolved.java | ||
---|---|---|
10 | 10 |
package org.distorted.dialogs; |
11 | 11 |
|
12 | 12 |
import android.app.Dialog; |
13 |
import android.content.DialogInterface; |
|
14 | 13 |
import androidx.fragment.app.FragmentActivity; |
15 |
import androidx.appcompat.app.AlertDialog; |
|
16 | 14 |
|
17 | 15 |
import android.util.TypedValue; |
18 | 16 |
import android.view.View; |
19 |
import android.widget.Button; |
|
20 | 17 |
import android.widget.TextView; |
21 | 18 |
|
22 | 19 |
import org.distorted.main.R; |
... | ... | |
27 | 24 |
|
28 | 25 |
public class RubikDialogSolved extends RubikDialogAbstract |
29 | 26 |
{ |
30 |
public int getResource() |
|
31 |
{ |
|
32 |
return R.layout.dialog_solved; |
|
33 |
} |
|
27 |
public int getResource() { return R.layout.dialog_solved; } |
|
28 |
public int getTitleResource() { return R.string.solved; } |
|
29 |
public boolean hasArgument() { return true; } |
|
30 |
public int getPositive() { return R.string.ok; } |
|
31 |
public int getNegative() { return -1; } |
|
34 | 32 |
|
35 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 34 |
|
37 |
public int getTitleResource()
|
|
35 |
public void positiveAction()
|
|
38 | 36 |
{ |
39 |
return R.string.solved; |
|
37 |
RubikActivity act = (RubikActivity)getActivity(); |
|
38 |
ScreenList.switchScreen(act, ScreenList.PLAY); |
|
40 | 39 |
} |
41 | 40 |
|
42 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 42 |
|
44 |
public boolean hasArgument()
|
|
43 |
public void negativeAction()
|
|
45 | 44 |
{ |
46 |
return true; |
|
47 |
} |
|
48 |
|
|
49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
50 | 45 |
|
51 |
public void setPositive(AlertDialog.Builder builder) |
|
52 |
{ |
|
53 |
builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() |
|
54 |
{ |
|
55 |
@Override |
|
56 |
public void onClick(DialogInterface dialog, int which) |
|
57 |
{ |
|
58 |
RubikActivity act = (RubikActivity)getActivity(); |
|
59 |
ScreenList.switchScreen(act, ScreenList.PLAY); |
|
60 |
} |
|
61 |
}); |
|
62 |
} |
|
63 |
|
|
64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
65 |
|
|
66 |
public void setNegative(AlertDialog.Builder builder) |
|
67 |
{ |
|
68 |
|
|
69 |
} |
|
70 |
|
|
71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
72 |
|
|
73 |
public void onShowDialog(DialogInterface dialog, float size) |
|
74 |
{ |
|
75 |
Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE); |
|
76 |
btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); |
|
77 | 46 |
} |
78 | 47 |
|
79 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Unify all dialogs.