Project

General

Profile

« Previous | Next » 

Revision b9d062cf

Added by Leszek Koltunski about 2 years ago

Bandaged: progress.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorActivity.java
51 51
{
52 52
    private static final int ACTIVITY_NUMBER = 3;
53 53
    private static final float RATIO_BAR   = 0.10f;
54
    private static final float RATIO_BUT   = 0.07f;
54 55
    static final float RATIO_SCROLL= 0.30f;
55 56

  
56 57
    public static final float DIALOG_BUTTON_SIZE  = 0.06f;
......
97 98
    private void computeHeights()
98 99
      {
99 100
      int barHeight    = (int)(mScreenHeight*RATIO_BAR);
101
      int butHeight    = (int)(mScreenHeight*RATIO_BUT);
100 102
      int viewHeight   = (int)(mScreenHeight*RATIO_SCROLL);
101 103
      int objectHeight = (int)(mScreenHeight*(1-RATIO_SCROLL+RATIO_BAR));
104
      int padding      = (int)(mScreenHeight* RubikActivity.PADDING);
102 105

  
103
      LinearLayout layout = findViewById(R.id.lowerBar);
104
      ViewGroup.LayoutParams paramsL = layout.getLayoutParams();
106
      LinearLayout botLayout = findViewById(R.id.lowerBar);
107
      ViewGroup.LayoutParams paramsL = botLayout.getLayoutParams();
105 108
      paramsL.height = barHeight;
106
      layout.setLayoutParams(paramsL);
109
      botLayout.setLayoutParams(paramsL);
110

  
111
      LinearLayout butLayout = findViewById(R.id.bandagedCreatorButtons);
112
      ViewGroup.LayoutParams paramsB = butLayout.getLayoutParams();
113
      paramsB.height = butHeight;
114
      butLayout.setPadding(padding,0,padding,padding);
115
      butLayout.setLayoutParams(paramsB);
107 116

  
108 117
      LinearLayout topLayout = findViewById(R.id.bandagedCreatorTopView);
109 118
      ViewGroup.LayoutParams paramsT = topLayout.getLayoutParams();
110 119
      paramsT.height = viewHeight;
111

  
112
      int p = (int)(mScreenHeight* RubikActivity.PADDING);
113
      topLayout.setPadding(p,p,p,p);
120
      topLayout.setPadding(padding,padding,padding,padding);
114 121
      topLayout.setLayoutParams(paramsT);
115 122

  
116 123
      BandagedCreatorView creator = findViewById(R.id.bandagedCreatorObjectView);
......
221 228
      {
222 229
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
223 230
      SharedPreferences.Editor editor = preferences.edit();
224
      String objects = mScreen.generateObjectStrings();
225
      editor.putString("bandagedObjects", objects );
231
      mScreen.savePreferences(editor);
226 232
      editor.apply();
227 233
      }
228 234

  
......
231 237
    private void restorePreferences()
232 238
      {
233 239
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
234
      String objects = preferences.getString("bandagedObjects","");
235
      mScreen.addObjects(this,objects);
240
      mScreen.restorePreferences(this,preferences);
236 241
      }
237 242

  
238 243
///////////////////////////////////////////////////////////////////////////////////////////////////
......
244 249
      return mFirebaseAnalytics;
245 250
      }
246 251

  
252
///////////////////////////////////////////////////////////////////////////////////////////////////
253

  
254
    public void changeObject(int x, int y, int z)
255
      {
256
      BandagedCreatorRenderer renderer = getRenderer();
257
      renderer.changeObject(x,y,z);
258
      }
259

  
247 260
///////////////////////////////////////////////////////////////////////////////////////////////////
248 261

  
249 262
    public BandagedCreatorRenderer getRenderer()

Also available in: Unified diff