Project

General

Profile

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

magiccube / src / main / java / org / distorted / playui / ScreenReady.java @ 4c6cbfa2

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2023 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.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
public class ScreenReady extends ScreenAbstract
25
  {
26
  private TransparentImageButton mBackButton;
27

    
28
///////////////////////////////////////////////////////////////////////////////////////////////////
29

    
30
  void leaveScreen(PlayActivity act)
31
    {
32

    
33
    }
34

    
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36

    
37
  void enterScreen(final PlayActivity act)
38
    {
39
    float width = act.getScreenWidthInPixels();
40
    float titleSize = width*PlayActivity.TITLE_TEXT_SIZE;
41
    LayoutInflater inflater = act.getLayoutInflater();
42

    
43
    // TOP ////////////////////////////
44
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
45
    layoutTop.removeAllViews();
46
    TextView label = (TextView)inflater.inflate(R.layout.upper_text, null);
47
    label.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
48
    label.setText(R.string.ready);
49
    layoutTop.addView(label);
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

    
63
    setupBackButton(act);
64

    
65
    layoutRight.addView(mBackButton);
66
    layoutBot.addView(layoutLeft);
67
    layoutBot.addView(layoutRight);
68
    }
69

    
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71

    
72
  private void setupBackButton(final PlayActivity act)
73
    {
74
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
75
    mBackButton = new TransparentImageButton(act,R.drawable.ui_back,params);
76

    
77
    mBackButton.setOnClickListener( new View.OnClickListener()
78
      {
79
      @Override
80
      public void onClick(View v)
81
        {
82
        ScreenList.goBack(act);
83
        }
84
      });
85
    }
86

    
87
///////////////////////////////////////////////////////////////////////////////////////////////////
88

    
89
  public void savePreferences(SharedPreferences.Editor editor)
90
    {
91

    
92
    }
93

    
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95

    
96
  public void restorePreferences(SharedPreferences preferences)
97
    {
98

    
99
    }
100
  }
(10-10/12)