Project

General

Profile

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

magiccube / src / main / java / org / distorted / states / RubikStateDone.java @ 4f36e418

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

    
22
import android.content.SharedPreferences;
23
import android.util.DisplayMetrics;
24
import android.view.LayoutInflater;
25
import android.view.View;
26
import android.widget.Button;
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 RubikStateDone extends RubikStateAbstract
36
  {
37
  void leaveState(RubikActivity act)
38
    {
39

    
40
    }
41

    
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

    
44
  void enterState(final RubikActivity act)
45
    {
46
    LayoutInflater inflater = act.getLayoutInflater();
47
    DisplayMetrics metrics = act.getResources().getDisplayMetrics();
48
    float scale = metrics.density;
49

    
50
    // TOP ////////////////////////////
51
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
52
    layoutTop.removeAllViews();
53
    TextView label = (TextView)inflater.inflate(R.layout.upper_text, null);
54
    label.setText(R.string.solved);
55
    layoutTop.addView(label);
56

    
57
    // BOT ////////////////////////////
58
    LinearLayout layoutLeft = act.findViewById(R.id.mainBarLeft);
59
    layoutLeft.removeAllViews();
60

    
61
    LinearLayout layoutRight = act.findViewById(R.id.mainBarRight);
62
    layoutRight.removeAllViews();
63

    
64
    int padding = (int)(5*scale + 0.5f);
65
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
66

    
67
    Button back = new Button(act);
68
    back.setLayoutParams(params);
69
    back.setPadding(padding,0,padding,0);
70
    back.setText(R.string.back);
71

    
72
    back.setOnClickListener( new View.OnClickListener()
73
      {
74
      @Override
75
      public void onClick(View v)
76
        {
77
        RubikState.goBack(act);
78
        }
79
      });
80

    
81
    layoutRight.addView(back);
82
    }
83

    
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85

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

    
89
    }
90

    
91
///////////////////////////////////////////////////////////////////////////////////////////////////
92

    
93
  public void restorePreferences(SharedPreferences preferences)
94
    {
95

    
96
    }
97
  }
(3-3/10)