Project

General

Profile

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

magiccube / src / main / java / org / distorted / screens / RubikScreenReady.java @ fcd5b990

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.screens;
21

    
22
import android.content.SharedPreferences;
23
import android.util.TypedValue;
24
import android.view.LayoutInflater;
25
import android.view.View;
26
import android.widget.ImageButton;
27
import android.widget.LinearLayout;
28
import android.widget.TextView;
29

    
30
import org.distorted.main.R;
31
import org.distorted.main.RubikActivity;
32

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
public class RubikScreenReady extends RubikScreenBase
36
  {
37
  private ImageButton mBackButton;
38

    
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40

    
41
  void leaveState(RubikActivity act)
42
    {
43

    
44
    }
45

    
46
///////////////////////////////////////////////////////////////////////////////////////////////////
47

    
48
  void enterState(final RubikActivity act)
49
    {
50
    float width = act.getScreenWidthInPixels();
51
    float titleSize = width*RubikActivity.TITLE_TEXT_SIZE;
52
    LayoutInflater inflater = act.getLayoutInflater();
53

    
54
    // TOP ////////////////////////////
55
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
56
    layoutTop.removeAllViews();
57
    TextView label = (TextView)inflater.inflate(R.layout.upper_text, null);
58
    label.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
59
    label.setText(R.string.ready);
60
    layoutTop.addView(label);
61

    
62
    setupBackButton(act,width);
63
    createBottomPane(act,width,mBackButton);
64
    }
65

    
66
///////////////////////////////////////////////////////////////////////////////////////////////////
67

    
68
  private void setupBackButton(final RubikActivity act, final float width)
69
    {
70
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
71
    mBackButton = new TransparentImageButton(act, icon, width, LinearLayout.LayoutParams.MATCH_PARENT);
72

    
73
    mBackButton.setOnClickListener( new View.OnClickListener()
74
      {
75
      @Override
76
      public void onClick(View v)
77
        {
78
        ScreenList.goBack(act);
79
        }
80
      });
81
    }
82

    
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

    
85
  public void savePreferences(SharedPreferences.Editor editor)
86
    {
87

    
88
    }
89

    
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91

    
92
  public void restorePreferences(SharedPreferences preferences)
93
    {
94

    
95
    }
96
  }
(6-6/12)