Project

General

Profile

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

magiccube / src / main / java / org / distorted / uistate / RubikStateSolving.java @ ad9e8bb3

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.uistate;
21

    
22
import android.content.SharedPreferences;
23
import android.util.DisplayMetrics;
24
import android.view.LayoutInflater;
25
import android.widget.Button;
26
import android.widget.LinearLayout;
27
import android.widget.TextView;
28

    
29
import org.distorted.magic.R;
30
import org.distorted.magic.RubikActivity;
31

    
32
import static android.view.View.INVISIBLE;
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
public class RubikStateSolving extends RubikStateAbstract
37
  {
38
  public void leaveState(RubikActivity act)
39
    {
40

    
41
    }
42

    
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44

    
45
  public void enterState(RubikActivity act)
46
    {
47
    LayoutInflater inflater = act.getLayoutInflater();
48

    
49
    // TOP ////////////////////////////
50
    LinearLayout layoutTop = act.findViewById(R.id.mainTitle);
51
    layoutTop.removeAllViews();
52
    final TextView text = (TextView)inflater.inflate(R.layout.upper_text, null);
53
    text.setText(R.string.ready);
54
    layoutTop.addView(text);
55

    
56
    // BOT ////////////////////////////
57
    LinearLayout layoutBot = act.findViewById(R.id.mainBar);
58
    layoutBot.removeAllViews();
59

    
60
    DisplayMetrics metrics = act.getResources().getDisplayMetrics();
61
    float scale = metrics.density;
62
    int size = (int)(60*scale +0.5f);
63
    int padding = (int)(5*scale + 0.5f);
64
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,size,0.5f);
65

    
66
    Button buttonL = new Button(act);
67
    buttonL.setLayoutParams(params);
68
    buttonL.setId(BUTTON_ID_BACK);
69
    buttonL.setPadding(padding,0,padding,0);
70
    buttonL.setText(R.string.back);
71
    buttonL.setOnClickListener(act);
72
    layoutBot.addView(buttonL);
73

    
74
    Button buttonR = new Button(act);
75
    buttonR.setLayoutParams(params);
76
    buttonR.setId(BUTTON_ID_BACK);
77
    buttonR.setPadding(padding,0,padding,0);
78
    buttonR.setText(R.string.back);
79
    buttonR.setOnClickListener(act);
80
    layoutBot.addView(buttonR);
81

    
82
    buttonL.setVisibility(INVISIBLE);
83
    }
84

    
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86

    
87
  public void savePreferences(SharedPreferences.Editor editor)
88
    {
89

    
90
    }
91

    
92
///////////////////////////////////////////////////////////////////////////////////////////////////
93

    
94
  public void restorePreferences(SharedPreferences preferences)
95
    {
96

    
97
    }
98
  }
(5-5/5)