Project

General

Profile

« Previous | Next » 

Revision 4a6b3b53

Added by Leszek Koltunski 6 months ago

Progress with Tutorial activity; make the main ObjectPopup look nicer.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogTutorialSingle.java
12 12
import static android.view.View.inflate;
13 13

  
14 14
import android.app.Dialog;
15
import android.content.Context;
15 16
import android.content.res.Resources;
17
import android.util.DisplayMetrics;
16 18
import android.util.TypedValue;
17 19
import android.view.View;
18 20
import android.view.Window;
......
36 38

  
37 39
public class RubikDialogTutorialSingle extends RubikDialogAbstract
38 40
  {
39
  public static final float PANE_HEIGHT  = 0.06f;
41
  public static final float PANE_HEIGHT= 0.06f;
42
  public static final float TEXT_SIZE  = 0.41f;
43

  
40 44
  private Dialog mDialog;
41 45

  
42 46
///////////////////////////////////////////////////////////////////////////////////////////////////
......
51 55
    if( window!=null )
52 56
      {
53 57
      WindowManager.LayoutParams params = window.getAttributes();
54
      params.width  = (int)Math.min( mHeight*0.65f,mWidth*0.98f );
58
      params.width  = (int)Math.min( mHeight*0.67f,mWidth*0.98f );
55 59
      //params.height = (int)Math.min( mHeight*0.85f,mWidth*1.30f );
56 60
      window.setAttributes(params);
57 61
      }
......
132 136
  private View createRow(final FragmentActivity act, int countryID, final String desc, final String url,
133 137
                         final String auth, int size, int colorB, int colorT, boolean last)
134 138
    {
135
    float textSize = 0.43f*size;
139
    float textSize = size*TEXT_SIZE;
136 140
    View row = inflate( act, R.layout.dialog_tutorial_row, null);
137 141

  
138 142
    LinearLayout layout = row.findViewById(R.id.tutorialLayout);
......
171 175

  
172 176
    if( last )
173 177
      {
174
      int m = 20;
178
      int m = (int)convertDpToPixel(10,act);
175 179
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
176 180
      params.bottomMargin = m;
177 181
      params.leftMargin   = m;
......
182 186
    return row;
183 187
    }
184 188

  
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190

  
191
  private static float convertDpToPixel(float dp, Context context)
192
    {
193
    return dp*((float) context.getResources().getDisplayMetrics().densityDpi/DisplayMetrics.DENSITY_DEFAULT);
194
    }
195

  
185 196
///////////////////////////////////////////////////////////////////////////////////////////////////
186 197

  
187 198
  public static String getDialogTag()

Also available in: Unified diff