Revision 113d9d67
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
---|---|---|
74 | 74 |
private static final float LAST_BUTTON = 1.5f; |
75 | 75 |
private static final int[] mLocation = new int[2]; |
76 | 76 |
|
77 |
private ImageButton mAboutButton, mUpdatesButton, mExitButton; |
|
77 |
private TransparentImageButton mAboutButton, mExitButton; |
|
78 |
private ImageButton mUpdatesButton; |
|
78 | 79 |
// private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup; |
79 | 80 |
private LinearLayout mPlayLayout; |
80 | 81 |
private TextView mBubbleUpdates; |
... | ... | |
131 | 132 |
// BOTTOM ///////////////////////// |
132 | 133 |
LinearLayout layoutBot = act.findViewById(R.id.lowerBar); |
133 | 134 |
layoutBot.removeAllViews(); |
134 |
RelativeLayout relLayout = (RelativeLayout)inflater.inflate(R.layout.play_bottom_bar, null); |
|
135 |
layoutBot.addView(relLayout); |
|
136 | 135 |
|
137 |
TypedValue outValue = new TypedValue(); |
|
138 |
act.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); |
|
136 |
float D = 0.20f; |
|
137 |
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams( (int)(mScreenWidth* D ),LinearLayout.LayoutParams.MATCH_PARENT); |
|
138 |
LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams( (int)(mScreenWidth*(1-2*D)),LinearLayout.LayoutParams.MATCH_PARENT); |
|
139 |
|
|
140 |
LinearLayout layoutLeft = new LinearLayout(act); |
|
141 |
|
|
142 |
layoutLeft.setLayoutParams(params1); |
|
143 |
RelativeLayout layoutMid = (RelativeLayout)inflater.inflate(R.layout.play_bottom_bar, null); |
|
144 |
layoutMid.setLayoutParams(params2); |
|
145 |
LinearLayout layoutRight = new LinearLayout(act); |
|
146 |
layoutRight.setLayoutParams(params1); |
|
147 |
|
|
148 |
setupAboutButton(act); |
|
149 |
setupUpdatesButtonAndBubble(act,layoutMid); |
|
150 |
setupExitButton(act); |
|
139 | 151 |
|
140 |
setupAboutButton(act,relLayout,outValue); |
|
141 |
setupUpdatesButtonAndBubble(act,relLayout,outValue); |
|
142 |
setupExitButton(act,relLayout,outValue); |
|
152 |
layoutLeft.addView(mAboutButton); |
|
153 |
layoutRight.addView(mExitButton); |
|
154 |
|
|
155 |
layoutBot.addView(layoutLeft); |
|
156 |
layoutBot.addView(layoutMid); |
|
157 |
layoutBot.addView(layoutRight); |
|
143 | 158 |
|
144 | 159 |
// POPUP ////////////////////////// |
145 | 160 |
LinearLayout hiddenView = act.findViewById(R.id.hiddenView); |
... | ... | |
157 | 172 |
|
158 | 173 |
////////////////////////////////////////////////////////////////////////////////////////////////// |
159 | 174 |
|
160 |
private void setupAboutButton(final RubikActivity act, RelativeLayout relLayout, TypedValue value)
|
|
175 |
private void setupAboutButton(final RubikActivity act) |
|
161 | 176 |
{ |
162 | 177 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info); |
163 |
mAboutButton = relLayout.findViewById(R.id.buttonAbout); |
|
164 |
mAboutButton.setImageResource(icon); |
|
165 |
mAboutButton.setBackgroundResource(value.resourceId); |
|
178 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1); |
|
179 |
mAboutButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE,params); |
|
166 | 180 |
|
167 | 181 |
mAboutButton.setOnClickListener( new View.OnClickListener() |
168 | 182 |
{ |
... | ... | |
177 | 191 |
|
178 | 192 |
////////////////////////////////////////////////////////////////////////////////////////////////// |
179 | 193 |
|
180 |
private void setupUpdatesButtonAndBubble(final RubikActivity act, RelativeLayout relLayout, TypedValue value)
|
|
194 |
private void setupExitButton(final RubikActivity act)
|
|
181 | 195 |
{ |
182 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_download,R.drawable.ui_medium_download, R.drawable.ui_big_download, R.drawable.ui_huge_download); |
|
183 |
mUpdatesButton = relLayout.findViewById(R.id.buttonDown); |
|
184 |
mUpdatesButton.setImageResource(icon); |
|
185 |
mUpdatesButton.setBackgroundResource(value.resourceId); |
|
196 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_exit,R.drawable.ui_medium_exit, R.drawable.ui_big_exit, R.drawable.ui_huge_exit); |
|
197 |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1); |
|
198 |
mExitButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE,params); |
|
186 | 199 |
|
187 |
mUpdatesButton.setOnClickListener( new View.OnClickListener()
|
|
200 |
mExitButton.setOnClickListener( new View.OnClickListener()
|
|
188 | 201 |
{ |
189 | 202 |
@Override |
190 | 203 |
public void onClick(View v) |
191 | 204 |
{ |
192 |
RubikDialogUpdates uDiag = new RubikDialogUpdates(); |
|
193 |
uDiag.show( act.getSupportFragmentManager(), RubikDialogUpdates.getDialogTag() ); |
|
205 |
act.finish(); |
|
194 | 206 |
} |
195 | 207 |
}); |
196 |
|
|
197 |
mBubbleUpdates = relLayout.findViewById(R.id.bubbleUpdates); |
|
198 |
mBubbleUpdates.setVisibility(View.INVISIBLE); |
|
199 |
|
|
200 |
RubikNetwork network = RubikNetwork.getInstance(); |
|
201 |
network.signUpForUpdates(this); |
|
202 | 208 |
} |
203 | 209 |
|
204 | 210 |
////////////////////////////////////////////////////////////////////////////////////////////////// |
205 | 211 |
|
206 |
private void setupExitButton(final RubikActivity act, RelativeLayout relLayout, TypedValue value)
|
|
212 |
private void setupUpdatesButtonAndBubble(final RubikActivity act, RelativeLayout relLayout)
|
|
207 | 213 |
{ |
208 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_exit,R.drawable.ui_medium_exit, R.drawable.ui_big_exit, R.drawable.ui_huge_exit); |
|
209 |
mExitButton = relLayout.findViewById(R.id.buttonExit); |
|
210 |
mExitButton.setImageResource(icon); |
|
211 |
mExitButton.setBackgroundResource(value.resourceId); |
|
214 |
TypedValue value = new TypedValue(); |
|
215 |
act.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, value, true); |
|
216 |
final int icon = RubikActivity.getDrawable(R.drawable.ui_small_download,R.drawable.ui_medium_download, R.drawable.ui_big_download, R.drawable.ui_huge_download); |
|
217 |
mUpdatesButton = relLayout.findViewById(R.id.buttonUpdates); |
|
218 |
mUpdatesButton.setImageResource(icon); |
|
219 |
mUpdatesButton.setBackgroundResource(value.resourceId); |
|
212 | 220 |
|
213 |
mExitButton.setOnClickListener( new View.OnClickListener()
|
|
221 |
mUpdatesButton.setOnClickListener( new View.OnClickListener()
|
|
214 | 222 |
{ |
215 | 223 |
@Override |
216 | 224 |
public void onClick(View v) |
217 | 225 |
{ |
218 |
act.finish(); |
|
226 |
RubikDialogUpdates uDiag = new RubikDialogUpdates(); |
|
227 |
uDiag.show( act.getSupportFragmentManager(), RubikDialogUpdates.getDialogTag() ); |
|
219 | 228 |
} |
220 | 229 |
}); |
230 |
|
|
231 |
mBubbleUpdates = relLayout.findViewById(R.id.bubbleUpdates); |
|
232 |
mBubbleUpdates.setVisibility(View.INVISIBLE); |
|
233 |
|
|
234 |
RubikNetwork network = RubikNetwork.getInstance(); |
|
235 |
network.signUpForUpdates(this); |
|
221 | 236 |
} |
222 | 237 |
|
223 | 238 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with lower pane of the Play state.