Revision 31227bf6
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
283 | 283 |
RubikState.switchState(this,RubikState.PLAY); |
284 | 284 |
} |
285 | 285 |
|
286 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
287 |
|
|
288 |
public void Effects(View v) |
|
289 |
{ |
|
290 |
RubikDialogEffects settings = new RubikDialogEffects(); |
|
291 |
settings.show(getSupportFragmentManager(), null); |
|
292 |
} |
|
293 |
|
|
294 | 286 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
295 | 287 |
|
296 | 288 |
public void Scores(View v) |
src/main/java/org/distorted/states/RubikStatePlay.java | ||
---|---|---|
23 | 23 |
import android.content.SharedPreferences; |
24 | 24 |
import android.graphics.drawable.BitmapDrawable; |
25 | 25 |
import android.os.Build; |
26 |
import android.os.Bundle; |
|
27 | 26 |
import android.util.DisplayMetrics; |
28 | 27 |
import android.view.Gravity; |
29 | 28 |
import android.view.LayoutInflater; |
... | ... | |
36 | 35 |
import android.widget.PopupWindow; |
37 | 36 |
import androidx.appcompat.widget.AppCompatSpinner; |
38 | 37 |
|
39 |
import com.google.firebase.analytics.FirebaseAnalytics; |
|
40 |
|
|
38 |
import org.distorted.dialogs.RubikDialogEffects; |
|
41 | 39 |
import org.distorted.main.R; |
42 | 40 |
import org.distorted.main.RubikActivity; |
43 | 41 |
import org.distorted.objects.RubikObjectList; |
... | ... | |
50 | 48 |
public static final int DEF_OBJECT= RubikObjectList.CUBE.ordinal(); |
51 | 49 |
public static final int DEF_SIZE = 3; |
52 | 50 |
|
53 |
private ImageButton mObjButton; |
|
51 |
private ImageButton mObjButton, mSettingsButton;
|
|
54 | 52 |
private Button mBackButton, mSolveButton, mPlayButton; |
55 | 53 |
private PopupWindow mPopup; |
56 | 54 |
private int mObject = DEF_OBJECT; |
... | ... | |
88 | 86 |
|
89 | 87 |
// BOT //////////////////////////// |
90 | 88 |
|
91 |
setupSolveButton(act,scale); |
|
92 |
|
|
93 | 89 |
LinearLayout layoutLeft = act.findViewById(R.id.mainBarLeft); |
94 | 90 |
layoutLeft.removeAllViews(); |
95 |
layoutLeft.addView(mSolveButton); |
|
96 | 91 |
|
97 |
setupBackButton(act,scale); |
|
92 |
setupSettingsButton(act,scale); |
|
93 |
layoutLeft.addView(mSettingsButton); |
|
94 |
setupSolveButton(act,scale); |
|
95 |
layoutLeft.addView(mSolveButton); |
|
98 | 96 |
|
99 | 97 |
LinearLayout layoutRight = act.findViewById(R.id.mainBarRight); |
100 | 98 |
layoutRight.removeAllViews(); |
99 |
|
|
100 |
setupBackButton(act,scale); |
|
101 | 101 |
layoutRight.addView(mBackButton); |
102 | 102 |
|
103 | 103 |
setupPopupWindow(act, scale); |
... | ... | |
140 | 140 |
}); |
141 | 141 |
} |
142 | 142 |
|
143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
144 |
|
|
145 |
private void setupSettingsButton(final RubikActivity act, final float scale) |
|
146 |
{ |
|
147 |
int padding = (int)(3*scale + 0.5f); |
|
148 |
LinearLayout.LayoutParams objectParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT); |
|
149 |
mSettingsButton = new ImageButton(act); |
|
150 |
mSettingsButton.setLayoutParams(objectParams); |
|
151 |
mSettingsButton.setPadding(padding,0,padding,0); |
|
152 |
mSettingsButton.setImageResource(R.drawable.settings); |
|
153 |
|
|
154 |
mSettingsButton.setOnClickListener( new View.OnClickListener() |
|
155 |
{ |
|
156 |
@Override |
|
157 |
public void onClick(View view) |
|
158 |
{ |
|
159 |
RubikDialogEffects settings = new RubikDialogEffects(); |
|
160 |
settings.show(act.getSupportFragmentManager(), null); |
|
161 |
} |
|
162 |
}); |
|
163 |
} |
|
164 |
|
|
143 | 165 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | 166 |
|
145 | 167 |
private void setupLevelSpinner(final RubikActivity act, final float scale) |
src/main/res/layout/dialog_main.xml | ||
---|---|---|
21 | 21 |
android:layout_marginRight="10dp" |
22 | 22 |
android:text="@string/play" /> |
23 | 23 |
|
24 |
<Button |
|
25 |
android:id="@+id/rubikSettings" |
|
26 |
android:layout_width="fill_parent" |
|
27 |
android:layout_height="fill_parent" |
|
28 |
android:layout_weight="1" |
|
29 |
android:onClick="Effects" |
|
30 |
android:layout_marginLeft="10dp" |
|
31 |
android:layout_marginRight="10dp" |
|
32 |
android:text="@string/effects" /> |
|
33 |
|
|
34 | 24 |
<Button |
35 | 25 |
android:id="@+id/rubikScores" |
36 | 26 |
android:layout_width="fill_parent" |
src/main/res/layout/main.xml | ||
---|---|---|
7 | 7 |
<LinearLayout |
8 | 8 |
android:id="@+id/upperBar" |
9 | 9 |
android:layout_width="fill_parent" |
10 |
android:layout_height="52dp"
|
|
10 |
android:layout_height="60dp"
|
|
11 | 11 |
android:gravity="center" |
12 | 12 |
android:orientation="horizontal"> |
13 | 13 |
</LinearLayout> |
... | ... | |
20 | 20 |
|
21 | 21 |
<LinearLayout |
22 | 22 |
android:layout_width="match_parent" |
23 |
android:layout_height="55dp"
|
|
23 |
android:layout_height="60dp"
|
|
24 | 24 |
android:orientation="horizontal"> |
25 | 25 |
|
26 | 26 |
<LinearLayout |
Also available in: Unified diff
Move the 'Effects' thing to a button in the Play state.