Project

General

Profile

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

magiccube / src / main / java / org / distorted / screens / RubikScreenDone.java @ 337f4660

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 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.screens;
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 androidx.fragment.app.FragmentManager;
20

    
21
import org.distorted.dialogs.RubikDialogNewRecord;
22
import org.distorted.dialogs.RubikDialogSolved;
23
import org.distorted.helpers.TransparentImageButton;
24
import org.distorted.main.R;
25
import org.distorted.main_old.RubikActivity;
26

    
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

    
29
public class RubikScreenDone extends RubikScreenAbstract
30
  {
31
  private TransparentImageButton mBackButton;
32

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

    
35
  void leaveScreen(RubikActivity act)
36
    {
37

    
38
    }
39

    
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

    
42
  void enterScreen(final RubikActivity act)
43
    {
44
    float width = act.getScreenWidthInPixels();
45
    float titleSize = width*RubikActivity.TITLE_TEXT_SIZE;
46
    LayoutInflater inflater = act.getLayoutInflater();
47

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

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

    
60
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
61
    LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,2);
62

    
63
    LinearLayout layoutLeft = new LinearLayout(act);
64
    layoutLeft.setLayoutParams(paramsL);
65
    LinearLayout layoutRight = new LinearLayout(act);
66
    layoutRight.setLayoutParams(paramsR);
67

    
68
    setupBackButton(act);
69

    
70
    layoutRight.addView(mBackButton);
71
    layoutBot.addView(layoutLeft);
72
    layoutBot.addView(layoutRight);
73
    }
74

    
75
///////////////////////////////////////////////////////////////////////////////////////////////////
76

    
77
  private void setupBackButton(final RubikActivity act)
78
    {
79
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
80
    mBackButton = new TransparentImageButton(act,R.drawable.ui_back,params);
81

    
82
    mBackButton.setOnClickListener( new View.OnClickListener()
83
      {
84
      @Override
85
      public void onClick(View v)
86
        {
87
        ScreenList.goBack(act);
88

    
89
        FragmentManager mana = act.getSupportFragmentManager();
90
        RubikDialogNewRecord diag1 = (RubikDialogNewRecord) mana.findFragmentByTag(RubikDialogNewRecord.getDialogTag());
91
        RubikDialogSolved    diag2 = (RubikDialogSolved   ) mana.findFragmentByTag(RubikDialogSolved.getDialogTag());
92

    
93
        if( diag1 !=null ) diag1.dismiss();
94
        if( diag2 !=null ) diag2.dismiss();
95
        }
96
      });
97
    }
98

    
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100

    
101
  public void savePreferences(SharedPreferences.Editor editor)
102
    {
103

    
104
    }
105

    
106
///////////////////////////////////////////////////////////////////////////////////////////////////
107

    
108
  public void restorePreferences(SharedPreferences preferences)
109
    {
110

    
111
    }
112
  }
(3-3/10)