Project

General

Profile

« Previous | Next » 

Revision eb49fa90

Added by Leszek Koltunski over 2 years ago

Use the off-center objects to display the object in Tutorial mode properly.
Now it is not covered by the right bar!

View differences:

src/main/java/org/distorted/tutorials/TutorialActivity.java
41 41
import org.distorted.main.R;
42 42
import org.distorted.dialogs.RubikDialogError;
43 43

  
44
import static org.distorted.main.RubikRenderer.BRIGHTNESS;
45

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

  
48 46
public class TutorialActivity extends AppCompatActivity
49 47
{
50 48
    private static final String URL = "https://www.youtube.com/embed/";
51 49

  
50
    public static final float BAR_RATIO = 0.15f;
52 51
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
53 52
    public static final float MENU_BIG_TEXT_SIZE  = 0.05f;
54 53

  
......
128 127
      {
129 128
      super.onAttachedToWindow();
130 129

  
131
      final float RATIO = 0.15f;
132 130
      float width = getScreenWidthInPixels();
133 131

  
134
      TutorialSurfaceView viewL = findViewById(R.id.tutorialSurfaceView);
135
      ViewGroup.LayoutParams paramsL = viewL.getLayoutParams();
136
      paramsL.width = (int)(width*(1.0f-RATIO));
137
      viewL.setLayoutParams(paramsL);
138

  
139 132
      LinearLayout viewR = findViewById(R.id.tutorialRightBar);
140 133
      ViewGroup.LayoutParams paramsR = viewR.getLayoutParams();
141
      paramsR.width = (int)(width*RATIO);
134
      paramsR.width = (int)(width*BAR_RATIO);
142 135
      viewR.setLayoutParams(paramsR);
143 136

  
144
      final int color = (int)(BRIGHTNESS*255);
145
      viewR.setBackgroundColor( (0xFF<<24)+(color<<16)+(color<<8)+color);
146

  
147 137
      if( mState==null ) mState = new TutorialScreen();
148 138

  
149 139
      mState.createRightPane(this,width);

Also available in: Unified diff