Project

General

Profile

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

magiccube / src / main / java / org / distorted / screens / RubikScreenDone.java @ 8feb68c2

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
import org.distorted.main.RubikActivity;
26
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
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
80 b600ccd9 Leszek Koltunski
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
81
    mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
82 807d82b7 Leszek Koltunski
83 da768c35 Leszek Koltunski
    mBackButton.setOnClickListener( new View.OnClickListener()
84 807d82b7 Leszek Koltunski
      {
85
      @Override
86
      public void onClick(View v)
87
        {
88 fcd5b990 Leszek Koltunski
        ScreenList.goBack(act);
89 da768c35 Leszek Koltunski
90
        FragmentManager mana = act.getSupportFragmentManager();
91
        RubikDialogNewRecord diag1 = (RubikDialogNewRecord) mana.findFragmentByTag(RubikDialogNewRecord.getDialogTag());
92
        RubikDialogSolved    diag2 = (RubikDialogSolved   ) mana.findFragmentByTag(RubikDialogSolved.getDialogTag());
93
94
        if( diag1 !=null ) diag1.dismiss();
95
        if( diag2 !=null ) diag2.dismiss();
96 807d82b7 Leszek Koltunski
        }
97
      });
98
    }
99
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101
102
  public void savePreferences(SharedPreferences.Editor editor)
103
    {
104
105
    }
106
107
///////////////////////////////////////////////////////////////////////////////////////////////////
108
109
  public void restorePreferences(SharedPreferences preferences)
110
    {
111
112
    }
113
  }