| 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)
|
Move the 'Effects' thing to a button in the Play state.