Project

General

Profile

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

magiccube / src / main / java / org / distorted / screens / RubikScreenDone.java @ e9245b7b

1 807d82b7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6 3782bd44 Leszek Koltunski
// 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 807d82b7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
9
10 fcd5b990 Leszek Koltunski
package org.distorted.screens;
11 807d82b7 Leszek Koltunski
12
import android.content.SharedPreferences;
13 e3c74c0f Leszek Koltunski
import android.util.TypedValue;
14 807d82b7 Leszek Koltunski
import android.view.LayoutInflater;
15
import android.view.View;
16
import android.widget.LinearLayout;
17
import android.widget.TextView;
18
19 dca3888a Leszek Koltunski
import androidx.fragment.app.FragmentManager;
20
21
import org.distorted.dialogs.RubikDialogNewRecord;
22
import org.distorted.dialogs.RubikDialogSolved;
23 55e6be1d Leszek Koltunski
import org.distorted.helpers.TransparentImageButton;
24 807d82b7 Leszek Koltunski
import org.distorted.main.R;
25 1c04d054 leszek
import org.distorted.main_old.RubikActivity;
26 807d82b7 Leszek Koltunski
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28
29 fcd5b990 Leszek Koltunski
public class RubikScreenDone extends RubikScreenAbstract
30 807d82b7 Leszek Koltunski
  {
31 dd874ae8 Leszek Koltunski
  private TransparentImageButton mBackButton;
32 da768c35 Leszek Koltunski
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34
35 f5da732a Leszek Koltunski
  void leaveScreen(RubikActivity act)
36 807d82b7 Leszek Koltunski
    {
37
38
    }
39
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41
42 f5da732a Leszek Koltunski
  void enterScreen(final RubikActivity act)
43 807d82b7 Leszek Koltunski
    {
44 e3c74c0f Leszek Koltunski
    float width = act.getScreenWidthInPixels();
45
    float titleSize = width*RubikActivity.TITLE_TEXT_SIZE;
46 807d82b7 Leszek Koltunski
    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 e3c74c0f Leszek Koltunski
    label.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
53 807d82b7 Leszek Koltunski
    label.setText(R.string.solved);
54
    layoutTop.addView(label);
55
56
    // BOT ////////////////////////////
57 92843d3b Leszek Koltunski
    LinearLayout layoutBot = act.findViewById(R.id.lowerBar);
58
    layoutBot.removeAllViews();
59 807d82b7 Leszek Koltunski
60 92843d3b Leszek Koltunski
    LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
61 4fb1fc0d Leszek Koltunski
    LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,2);
62
63 92843d3b Leszek Koltunski
    LinearLayout layoutLeft = new LinearLayout(act);
64
    layoutLeft.setLayoutParams(paramsL);
65
    LinearLayout layoutRight = new LinearLayout(act);
66 4fb1fc0d Leszek Koltunski
    layoutRight.setLayoutParams(paramsR);
67 807d82b7 Leszek Koltunski
68 dd874ae8 Leszek Koltunski
    setupBackButton(act);
69 ad0c8e0e Leszek Koltunski
70 da768c35 Leszek Koltunski
    layoutRight.addView(mBackButton);
71
    layoutBot.addView(layoutLeft);
72
    layoutBot.addView(layoutRight);
73
    }
74 807d82b7 Leszek Koltunski
75 da768c35 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
76 4fb1fc0d Leszek Koltunski
77 dd874ae8 Leszek Koltunski
  private void setupBackButton(final RubikActivity act)
78 da768c35 Leszek Koltunski
    {
79 b600ccd9 Leszek Koltunski
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
80 70688a23 leszek
    mBackButton = new TransparentImageButton(act,R.drawable.ui_back,params);
81 807d82b7 Leszek Koltunski
82 da768c35 Leszek Koltunski
    mBackButton.setOnClickListener( new View.OnClickListener()
83 807d82b7 Leszek Koltunski
      {
84
      @Override
85
      public void onClick(View v)
86
        {
87 fcd5b990 Leszek Koltunski
        ScreenList.goBack(act);
88 da768c35 Leszek Koltunski
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 807d82b7 Leszek Koltunski
        }
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
  }