34 |
34 |
import android.widget.ImageButton;
|
35 |
35 |
import android.widget.LinearLayout;
|
36 |
36 |
import android.widget.PopupWindow;
|
|
37 |
import android.widget.RelativeLayout;
|
37 |
38 |
|
38 |
39 |
import org.distorted.network.RubikNetwork;
|
39 |
40 |
import org.distorted.network.RubikUpdates;
|
... | ... | |
231 |
232 |
mObjectSize = (int)(cubeWidth + 2*margin + 0.5f);
|
232 |
233 |
mMaxRowCount = (int)((height-1.8f*mUpperBarHeight)/mObjectSize);
|
233 |
234 |
|
234 |
|
RubikNetwork network = RubikNetwork.getInstance();
|
235 |
|
network.signUpForUpdates(this);
|
236 |
|
|
237 |
235 |
LinearLayout view = (LinearLayout)inflate( act, R.layout.popup_object, null);
|
238 |
236 |
GridLayout objectGrid = view.findViewById(R.id.objectGrid);
|
239 |
237 |
|
... | ... | |
243 |
241 |
objectGrid.setColumnCount(mColCount);
|
244 |
242 |
objectGrid.setRowCount(mRowCount);
|
245 |
243 |
|
246 |
|
LinearLayout bottomLayout = view.findViewById(R.id.bottomLayout);
|
247 |
|
setupBottomLayout(act,bottomLayout,(NUM_COLUMNS-2)*mObjectSize);
|
|
244 |
RelativeLayout bottomLayout = view.findViewById(R.id.bottomLayout);
|
|
245 |
setupBottomLayout(act,bottomLayout);
|
248 |
246 |
|
249 |
247 |
mObjectPopup = new PopupWindow(act);
|
250 |
248 |
mObjectPopup.setFocusable(true);
|
... | ... | |
307 |
305 |
|
308 |
306 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
309 |
307 |
|
310 |
|
private void setupBottomLayout(final RubikActivity act, final LinearLayout layout, int width)
|
|
308 |
private void setupBottomLayout(final RubikActivity act, final RelativeLayout layout)
|
311 |
309 |
{
|
312 |
|
int iconD = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info);
|
313 |
310 |
int iconT = RubikActivity.getDrawable(R.drawable.ui_small_tutorial,R.drawable.ui_medium_tutorial, R.drawable.ui_big_tutorial, R.drawable.ui_huge_tutorial);
|
|
311 |
int iconD = RubikActivity.getDrawable(R.drawable.ui_small_download,R.drawable.ui_medium_download, R.drawable.ui_big_download, R.drawable.ui_huge_download);
|
|
312 |
int iconI = RubikActivity.getDrawable(R.drawable.ui_small_info,R.drawable.ui_medium_info, R.drawable.ui_big_info, R.drawable.ui_huge_info);
|
314 |
313 |
|
315 |
314 |
ImageButton buttonTut = layout.findViewById(R.id.buttonTut);
|
316 |
|
Button buttonNul = layout.findViewById(R.id.buttonNul);
|
317 |
|
ImageButton buttonDet = layout.findViewById(R.id.buttonDet);
|
|
315 |
ImageButton buttonDow = layout.findViewById(R.id.buttonDow);
|
|
316 |
ImageButton buttonInf = layout.findViewById(R.id.buttonInf);
|
318 |
317 |
|
319 |
318 |
buttonTut.setImageResource(iconT);
|
320 |
|
buttonDet.setImageResource(iconD);
|
321 |
|
buttonNul.setVisibility(View.INVISIBLE);
|
322 |
|
|
323 |
|
buttonNul.setWidth(width);
|
|
319 |
buttonDow.setImageResource(iconD);
|
|
320 |
buttonInf.setImageResource(iconI);
|
324 |
321 |
|
325 |
322 |
Resources res = act.getResources();
|
326 |
|
BitmapDrawable bd = (BitmapDrawable)res.getDrawable(iconD);
|
|
323 |
BitmapDrawable bd = (BitmapDrawable)res.getDrawable(iconI);
|
327 |
324 |
mBottomHeight = bd.getIntrinsicHeight();
|
328 |
325 |
|
329 |
326 |
TypedValue outValue = new TypedValue();
|
330 |
327 |
act.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true);
|
331 |
328 |
buttonTut.setBackgroundResource(outValue.resourceId);
|
332 |
|
buttonDet.setBackgroundResource(outValue.resourceId);
|
|
329 |
buttonDow.setBackgroundResource(outValue.resourceId);
|
|
330 |
buttonInf.setBackgroundResource(outValue.resourceId);
|
333 |
331 |
|
334 |
332 |
buttonTut.setOnClickListener( new View.OnClickListener()
|
335 |
333 |
{
|
... | ... | |
342 |
340 |
}
|
343 |
341 |
});
|
344 |
342 |
|
345 |
|
buttonDet.setOnClickListener( new View.OnClickListener()
|
|
343 |
buttonDow.setOnClickListener( new View.OnClickListener()
|
|
344 |
{
|
|
345 |
@Override
|
|
346 |
public void onClick(View v)
|
|
347 |
{
|
|
348 |
android.util.Log.e("D", "Download!!");
|
|
349 |
}
|
|
350 |
});
|
|
351 |
|
|
352 |
buttonInf.setOnClickListener( new View.OnClickListener()
|
346 |
353 |
{
|
347 |
354 |
@Override
|
348 |
355 |
public void onClick(View v)
|
... | ... | |
352 |
359 |
act.switchConfig(currObject);
|
353 |
360 |
}
|
354 |
361 |
});
|
|
362 |
|
|
363 |
RubikNetwork network = RubikNetwork.getInstance();
|
|
364 |
network.signUpForUpdates(this);
|
355 |
365 |
}
|
356 |
366 |
|
357 |
367 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Progress downloading updates.