Project

General

Profile

« Previous | Next » 

Revision 113d9d67

Added by Leszek Koltunski over 2 years ago

Progress with lower pane of the Play state.

View differences:

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
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/res/layout/play_bottom_bar.xml
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
       android:id="@+id/bottomLayout"
4 3
       android:layout_width="match_parent"
5 4
       android:layout_height="match_parent"
6
       android:background="@android:color/transparent"
7
       android:paddingTop="5dp"
8
       android:paddingEnd="15dp"
9
       android:paddingStart="15dp">
5
       android:paddingTop="7dp"
6
       android:layout_gravity="center"
7
       android:background="@android:color/transparent">
10 8

  
11 9
       <ImageButton
12
           android:id="@+id/buttonAbout"
13
           android:layout_alignParentStart="true"
14
           android:layout_width="wrap_content"
15
           android:layout_height="wrap_content"/>
16

  
17
       <ImageButton
18
           android:id="@+id/buttonDown"
10
           android:id="@+id/buttonUpdates"
19 11
           android:layout_centerHorizontal="true"
20 12
           android:layout_width="wrap_content"
21 13
           android:layout_height="wrap_content"/>
......
24 16
           android:layout_width="wrap_content"
25 17
           android:layout_height="wrap_content"
26 18
           android:layout_marginStart="100dp"
27
           android:layout_alignTop="@+id/buttonDown"
28
           android:layout_alignEnd="@+id/buttonDown"
19
           android:layout_alignTop="@+id/buttonUpdates"
20
           android:layout_alignEnd="@+id/buttonUpdates"
29 21
           android:textColor="#FFF"
30 22
           android:textSize="16sp"
31 23
           android:textStyle="bold"
32 24
           android:background="@drawable/badge_circle"/>
33

  
34
       <ImageButton
35
           android:id="@+id/buttonExit"
36
           android:layout_alignParentEnd="true"
37
           android:layout_width="wrap_content"
38
           android:layout_height="wrap_content"/>
39

  
40 25
</RelativeLayout>

Also available in: Unified diff