Project

General

Profile

Download (3.91 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / playui / ScreenScrambling.java @ 18b0ae9c

1 15ed3429 leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
2 18b0ae9c leszek
// Copyright 2023 Leszek Koltunski                                                               //
3 15ed3429 leszek
//                                                                                               //
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.playui;
11
12
import android.content.SharedPreferences;
13
import android.util.TypedValue;
14
import android.view.LayoutInflater;
15
import android.view.View;
16
import android.widget.LinearLayout;
17
import android.widget.TextView;
18
19
import org.distorted.helpers.TransparentImageButton;
20
import org.distorted.main.R;
21
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
24 18b0ae9c leszek
public class ScreenScrambling extends ScreenAbstract
25 15ed3429 leszek
  {
26
  private TransparentImageButton mBackButton;
27 18b0ae9c leszek
  private TextView mLabel;
28 15ed3429 leszek
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30
31
  void leaveScreen(PlayActivity act)
32
    {
33
34
    }
35
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37
38
  void enterScreen(final PlayActivity act)
39
    {
40
    float width = act.getScreenWidthInPixels();
41
    float titleSize = width*PlayActivity.TITLE_TEXT_SIZE;
42
    LayoutInflater inflater = act.getLayoutInflater();
43
44
    // TOP ////////////////////////////
45
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
46
    layoutTop.removeAllViews();
47 18b0ae9c leszek
    mLabel = (TextView)inflater.inflate(R.layout.upper_text, null);
48
    mLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
49
    layoutTop.addView(mLabel);
50
51
    // BOT ////////////////////////////
52
    LinearLayout layoutBot = act.findViewById(R.id.lowerBar);
53
    layoutBot.removeAllViews();
54
55
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
56
    LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,2);
57
58
    LinearLayout layoutLeft = new LinearLayout(act);
59
    layoutLeft.setLayoutParams(paramsL);
60
    LinearLayout layoutRight = new LinearLayout(act);
61
    layoutRight.setLayoutParams(paramsR);
62 15ed3429 leszek
63
    setupBackButton(act);
64 18b0ae9c leszek
65
    layoutRight.addView(mBackButton);
66
    layoutBot.addView(layoutLeft);
67
    layoutBot.addView(layoutRight);
68
    }
69
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71
72
  void setReady()
73
    {
74
    mLabel.setText(R.string.ready);
75 15ed3429 leszek
    }
76
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78
79
  private void setupBackButton(final PlayActivity act)
80
    {
81
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
82
    mBackButton = new TransparentImageButton(act,R.drawable.ui_back,params);
83
84
    mBackButton.setOnClickListener( new View.OnClickListener()
85
      {
86
      @Override
87
      public void onClick(View v)
88
        {
89
        ScreenList.goBack(act);
90
        }
91
      });
92
    }
93
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95
96
  public void savePreferences(SharedPreferences.Editor editor)
97
    {
98
99
    }
100
101
///////////////////////////////////////////////////////////////////////////////////////////////////
102
103
  public void restorePreferences(SharedPreferences preferences)
104
    {
105
106
    }
107
  }