1 |
c7238c67
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
|
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7 |
|
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
|
|
package org.distorted.purchase;
|
11 |
|
|
|
12 |
|
|
import android.view.View;
|
13 |
|
|
import android.widget.LinearLayout;
|
14 |
|
|
|
15 |
|
|
import org.distorted.helpers.TransparentImageButton;
|
16 |
|
|
import org.distorted.main.R;
|
17 |
|
|
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
|
|
public class PurchaseScreen
|
21 |
|
|
{
|
22 |
7c9910e5
|
Leszek Koltunski
|
private TransparentImageButton mBackButton;
|
23 |
7654a99d
|
Leszek Koltunski
|
private boolean mBlocked;
|
24 |
|
|
|
25 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
26 |
|
|
|
27 |
|
|
void blockUI()
|
28 |
|
|
{
|
29 |
|
|
mBlocked = true;
|
30 |
|
|
}
|
31 |
c7238c67
|
Leszek Koltunski
|
|
32 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
33 |
|
|
|
34 |
|
|
private void setupBackButton(final PurchaseActivity act)
|
35 |
|
|
{
|
36 |
|
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
|
37 |
70688a23
|
leszek
|
mBackButton = new TransparentImageButton(act,R.drawable.ui_smallback,params);
|
38 |
c7238c67
|
Leszek Koltunski
|
|
39 |
|
|
mBackButton.setOnClickListener( new View.OnClickListener()
|
40 |
|
|
{
|
41 |
|
|
@Override
|
42 |
|
|
public void onClick(View v)
|
43 |
|
|
{
|
44 |
aa622165
|
Leszek Koltunski
|
if( !mBlocked ) act.finish();
|
45 |
c7238c67
|
Leszek Koltunski
|
}
|
46 |
|
|
});
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
50 |
|
|
|
51 |
7c9910e5
|
Leszek Koltunski
|
void onAttachedToWindow(final PurchaseActivity act, final int ordinal)
|
52 |
c7238c67
|
Leszek Koltunski
|
{
|
53 |
7654a99d
|
Leszek Koltunski
|
mBlocked = false;
|
54 |
c7238c67
|
Leszek Koltunski
|
int width = act.getScreenWidthInPixels();
|
55 |
|
|
|
56 |
|
|
LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
|
57 |
|
|
LinearLayout.LayoutParams paramsM = new LinearLayout.LayoutParams(width/2, LinearLayout.LayoutParams.MATCH_PARENT);
|
58 |
|
|
LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
|
59 |
|
|
|
60 |
|
|
LinearLayout layoutLeft = new LinearLayout(act);
|
61 |
|
|
layoutLeft.setLayoutParams(paramsL);
|
62 |
|
|
LinearLayout layoutMid = new LinearLayout(act);
|
63 |
|
|
layoutMid.setLayoutParams(paramsM);
|
64 |
|
|
LinearLayout layoutRight= new LinearLayout(act);
|
65 |
|
|
layoutRight.setLayoutParams(paramsR);
|
66 |
|
|
|
67 |
|
|
setupBackButton(act);
|
68 |
|
|
|
69 |
|
|
layoutRight.addView(mBackButton);
|
70 |
|
|
|
71 |
|
|
LinearLayout layout = act.findViewById(R.id.lowerBar);
|
72 |
|
|
layout.removeAllViews();
|
73 |
|
|
layout.addView(layoutLeft);
|
74 |
|
|
layout.addView(layoutMid);
|
75 |
|
|
layout.addView(layoutRight);
|
76 |
|
|
|
77 |
71cda061
|
Leszek Koltunski
|
PurchaseScreenPane pane = new PurchaseScreenPane(act);
|
78 |
7c9910e5
|
Leszek Koltunski
|
pane.updatePane(act,ordinal);
|
79 |
c7238c67
|
Leszek Koltunski
|
}
|
80 |
|
|
}
|