Project

General

Profile

« Previous | Next » 

Revision d6e7c7fb

Added by Leszek Koltunski almost 3 years ago

Progress downloading updates.

View differences:

src/main/java/org/distorted/screens/RubikScreenPlay.java
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
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/res/drawable/badge_circle.xml
1
<shape xmlns:android="http://schemas.android.com/apk/res/android"
2
  android:shape="rectangle">
3
  <corners
4
    android:radius="10dip"/>
5
  <solid
6
    android:color="#F00" />
7
  <stroke
8
    android:width="2dip"
9
    android:color="#FFF" />
10
  <padding
11
    android:left="8dip"
12
    android:right="8dip"
13
    android:top="5dip"
14
    android:bottom="5dip" />
15
</shape>
16

  
17

  
src/main/res/layout/popup_object.xml
18 18

  
19 19
   </ScrollView>
20 20

  
21
   <LinearLayout
21
   <RelativeLayout
22 22
       android:id="@+id/bottomLayout"
23
       android:background="@color/grey"
24 23
       android:layout_width="match_parent"
24
       android:background="@color/grey"
25 25
       android:layout_height="wrap_content"
26
       android:paddingEnd="5dp"
27
       android:paddingStart="5dp"
28
       android:orientation="horizontal">
26
       android:paddingEnd="10dp"
27
       android:paddingStart="10dp">
29 28

  
30 29
       <ImageButton
31 30
           android:id="@+id/buttonTut"
31
           android:layout_alignParentStart="true"
32 32
           android:layout_width="wrap_content"
33
           android:layout_height="wrap_content"
34
           android:layout_weight="1.0"/>
33
           android:layout_height="wrap_content"/>
35 34

  
36
       <Button
37
           android:id="@+id/buttonNul"
35
       <ImageButton
36
           android:id="@+id/buttonDow"
37
           android:layout_centerHorizontal="true"
38
           android:layout_width="wrap_content"
39
           android:layout_height="wrap_content"/>
40
       <TextView
41
           android:id="@+id/bubbleUpdates"
38 42
           android:layout_width="wrap_content"
39 43
           android:layout_height="wrap_content"
40
           android:layout_weight="1.0"/>
44
           android:layout_alignTop="@+id/buttonDow"
45
           android:layout_alignEnd="@+id/buttonDow"
46
           android:text="4"
47
           android:textColor="#FFF"
48
           android:textSize="16sp"
49
           android:textStyle="bold"
50
           android:background="@drawable/badge_circle"/>
41 51

  
42 52
       <ImageButton
43
           android:id="@+id/buttonDet"
53
           android:id="@+id/buttonInf"
54
           android:layout_alignParentEnd="true"
44 55
           android:layout_width="wrap_content"
45
           android:layout_height="wrap_content"
46
           android:layout_weight="1.0"/>
56
           android:layout_height="wrap_content"/>
47 57

  
48
   </LinearLayout>
58
     </RelativeLayout>
49 59

  
50 60
</LinearLayout>

Also available in: Unified diff