Project

General

Profile

« Previous | Next » 

Revision dd874ae8

Added by Leszek Koltunski over 2 years ago

Convert the theme to be a MaterialTheme and the TransparentImageButton to be a MaterialButton - the first forced by the second, and the second because a MaterialButton gives us control over the location of the icon in top of it. We need that because of the new 'solve/scramble' split-button in the lower right of the Play screen.

View differences:

src/main/java/org/distorted/tutorials/TutorialScreen.java
21 21

  
22 22
import android.app.Activity;
23 23
import android.view.View;
24
import android.widget.ImageButton;
25 24
import android.widget.LinearLayout;
26 25

  
27 26
import org.distorted.helpers.MovesController;
28 27
import org.distorted.objectlib.main.ObjectControl;
29
import org.distorted.objectlib.main.ObjectType;
30 28

  
31 29
import org.distorted.helpers.LockController;
32 30
import org.distorted.main.R;
......
39 37

  
40 38
public class TutorialScreen
41 39
{
42
  private ImageButton mSolveButton, mScrambleButton, mBackButton;
40
  private TransparentImageButton mSolveButton, mScrambleButton, mBackButton;
43 41
  private final LockController mLockController;
44 42
  private final MovesController mMovesController;
45 43

  
46 44
///////////////////////////////////////////////////////////////////////////////////////////////////
47 45

  
48
  private void setupSolveButton(final TutorialActivity act, final float width)
46
  private void setupSolveButton(final TutorialActivity act)
49 47
    {
50 48
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve,R.drawable.ui_medium_cube_solve, R.drawable.ui_big_cube_solve, R.drawable.ui_huge_cube_solve);
51
    mSolveButton = new TransparentImageButton(act, icon, width, LinearLayout.LayoutParams.MATCH_PARENT);
49
    mSolveButton = new TransparentImageButton(act, icon, LinearLayout.LayoutParams.MATCH_PARENT, TransparentImageButton.GRAVITY_MIDDLE);
52 50

  
53 51
    mSolveButton.setOnClickListener( new View.OnClickListener()
54 52
      {
......
63 61

  
64 62
///////////////////////////////////////////////////////////////////////////////////////////////////
65 63

  
66
  private void setupScrambleButton(final TutorialActivity act, final float width)
64
  private void setupScrambleButton(final TutorialActivity act)
67 65
    {
68 66
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_scramble,R.drawable.ui_medium_cube_scramble, R.drawable.ui_big_cube_scramble, R.drawable.ui_huge_cube_scramble);
69
    mScrambleButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
67
    mScrambleButton = new TransparentImageButton(act, icon, LinearLayout.LayoutParams.MATCH_PARENT, TransparentImageButton.GRAVITY_MIDDLE);
70 68

  
71 69
    mScrambleButton.setOnClickListener( new View.OnClickListener()
72 70
      {
......
82 80

  
83 81
///////////////////////////////////////////////////////////////////////////////////////////////////
84 82

  
85
  private void setupBackButton(final TutorialActivity act, final float width)
83
  private void setupBackButton(final TutorialActivity act)
86 84
    {
87 85
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback);
88
    mBackButton = new TransparentImageButton(act, icon, width, LinearLayout.LayoutParams.MATCH_PARENT);
86
    mBackButton = new TransparentImageButton(act, icon, LinearLayout.LayoutParams.MATCH_PARENT, TransparentImageButton.GRAVITY_MIDDLE);
89 87

  
90 88
    mBackButton.setOnClickListener( new View.OnClickListener()
91 89
      {
......
101 99

  
102 100
///////////////////////////////////////////////////////////////////////////////////////////////////
103 101

  
104
  void createRightPane(final TutorialActivity act, float width)
102
  void createRightPane(final TutorialActivity act)
105 103
    {
106 104
    LinearLayout layout = act.findViewById(R.id.tutorialRightBar);
107 105
    layout.removeAllViews();
108 106

  
109 107
    ObjectControl control = act.getControl();
110
    mMovesController.setupButton(act,control, width);
111
    mLockController.setupButton(act,control,width);
112
    setupSolveButton(act,width);
113
    setupScrambleButton(act,width);
114
    setupBackButton(act,width);
108
    mMovesController.setupButton(act,control);
109
    mLockController.setupButton(act,control);
110
    setupSolveButton(act);
111
    setupScrambleButton(act);
112
    setupBackButton(act);
115 113

  
116 114
    layout.addView(mSolveButton);
117
    layout.addView(mMovesController.getButton());
118 115
    layout.addView(mScrambleButton);
116
    layout.addView(mMovesController.getButton());
119 117
    layout.addView(mLockController.getButton());
120 118
    layout.addView(mBackButton);
121 119
    }

Also available in: Unified diff