Revision 4f470e00
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/dialog/RubikDialogPatternView.java | ||
---|---|---|
29 | 29 |
import android.widget.LinearLayout; |
30 | 30 |
|
31 | 31 |
import org.distorted.magic.R; |
32 |
import org.distorted.magic.RubikActivity; |
|
33 |
import org.distorted.uistate.RubikState; |
|
32 | 34 |
|
33 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 36 |
|
35 | 37 |
public class RubikDialogPatternView extends FrameLayout |
36 | 38 |
{ |
37 |
LinearLayout mLayout; |
|
39 |
private LinearLayout mLayout; |
|
40 |
private RubikDialogPattern mDialog; |
|
38 | 41 |
|
39 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 43 |
|
... | ... | |
52 | 55 |
|
53 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
54 | 57 |
|
55 |
public RubikDialogPatternView(FragmentActivity act, String[] categories) |
|
58 |
public RubikDialogPatternView(FragmentActivity act, RubikDialogPattern dialog, String[] categories)
|
|
56 | 59 |
{ |
57 | 60 |
super(act); |
58 | 61 |
|
62 |
mDialog = dialog; |
|
59 | 63 |
View tab = inflate( act, R.layout.dialog_tab, null); |
60 | 64 |
mLayout = tab.findViewById(R.id.tabLayout); |
61 | 65 |
createSection(act,categories); |
... | ... | |
65 | 69 |
|
66 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
67 | 71 |
|
68 |
private void createSection(FragmentActivity act, final String[] categories) |
|
72 |
private void createSection(final FragmentActivity act, final String[] categories)
|
|
69 | 73 |
{ |
70 | 74 |
DisplayMetrics metrics = act.getResources().getDisplayMetrics(); |
71 | 75 |
final float scale = metrics.density; |
... | ... | |
74 | 78 |
LinearLayout.LayoutParams bParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT); |
75 | 79 |
bParams.setMargins(margin, margin, margin, margin); |
76 | 80 |
|
81 |
final RubikActivity ract = (RubikActivity)getContext(); |
|
82 |
|
|
77 | 83 |
for(int i=0; i<len; i++) |
78 | 84 |
{ |
79 | 85 |
final int fi = i; |
... | ... | |
86 | 92 |
@Override |
87 | 93 |
public void onClick(View view) |
88 | 94 |
{ |
89 |
android.util.Log.e("view", "category "+categories[fi]+" clicked"); |
|
95 |
RubikState.switchState(ract,RubikState.PATT); |
|
96 |
mDialog.dismiss(); |
|
90 | 97 |
} |
91 | 98 |
}); |
92 | 99 |
|
Also available in: Unified diff
Progress with Pretty Patterns.