Project

General

Profile

« Previous | Next » 

Revision 316889cf

Added by Leszek Koltunski about 4 years ago

Improve the Effects Dialog so it looks good on 'thin' screens ( 720x1440 )

View differences:

src/main/java/org/distorted/dialogs/RubikDialogEffects.java
107 107
    ///// STUFF INSIDE INNER LAYOUT1 /////////////////////////////////////////////////////
108 108

  
109 109
    int text1Padding = (int)(scale*5 + 0.5f);
110
    LinearLayout.LayoutParams text1LayoutParams = new LinearLayout.LayoutParams(0,layoutHeight,0.2f);
110
    LinearLayout.LayoutParams text1LayoutParams = new LinearLayout.LayoutParams(0,layoutHeight,0.25f);
111 111

  
112 112
    TextView text1View = new TextView(act);
113 113
    text1View.setText(R.string.duration);
......
118 118
    innerLayout1.addView(text1View);
119 119
    //////////////////////////////////////////////////////////////////
120 120
    int text2Padding = (int)(scale*5 + 0.5f);
121
    LinearLayout.LayoutParams text2LayoutParams = new LinearLayout.LayoutParams(0,layoutHeight,0.2f);
121
    LinearLayout.LayoutParams text2LayoutParams = new LinearLayout.LayoutParams(0,layoutHeight,0.25f);
122 122

  
123 123
    mDurationText[index] = new TextView(act);
124 124
    mDurationText[index].setLayoutParams(text2LayoutParams);
125
    mDurationText[index].setGravity(Gravity.END|Gravity.CENTER);
125
    mDurationText[index].setGravity(Gravity.START|Gravity.CENTER);
126 126
    mDurationText[index].setPadding(text2Padding,0,text2Padding,0);
127 127
    mDurationText[index].setTextAppearance(act,android.R.style.TextAppearance_Small);
128 128
    innerLayout1.addView(mDurationText[index]);
129 129
    //////////////////////////////////////////////////////////////////
130 130
    int seekPadding = (int)(scale*10 + 0.5f);
131
    LinearLayout.LayoutParams seekLayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.6f);
131
    LinearLayout.LayoutParams seekLayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.5f);
132 132

  
133 133
    SeekBar seekBar = new SeekBar(act);
134 134
    seekBar.setLayoutParams(seekLayoutParams);
......
153 153
    ///// STUFF INSIDE INNER LAYOUT2 /////////////////////////////////////////////////////
154 154

  
155 155
    int text3Padding = (int)(scale*5 + 0.5f);
156
    LinearLayout.LayoutParams text3LayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.4f);
156
    LinearLayout.LayoutParams text3LayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.25f);
157 157

  
158 158
    TextView text3View = new TextView(act);
159 159
    text3View.setText(R.string.type);
......
165 165
    //////////////////////////////////////////////////////////////////
166 166
    int spinnerPadding = (int)(scale*10 + 0.5f);
167 167
    int spinnerMargin  = (int)(scale* 3 + 0.5f);
168
    LinearLayout.LayoutParams spinnerLayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.6f);
168
    LinearLayout.LayoutParams spinnerLayoutParams = new LinearLayout.LayoutParams(0,LinearLayout.LayoutParams.MATCH_PARENT,0.75f);
169 169
    spinnerLayoutParams.topMargin    =   spinnerMargin;
170 170
    spinnerLayoutParams.bottomMargin =   spinnerMargin;
171 171
    spinnerLayoutParams.leftMargin   =   spinnerMargin;
......
175 175
    spinner.setLayoutParams(spinnerLayoutParams);
176 176
    spinner.setPadding(spinnerPadding,0,spinnerPadding,0);
177 177
    spinner.setBackgroundResource(R.drawable.spinner);
178
    spinner.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
178
    spinner.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START);
179 179
    spinner.setId(index+BaseEffect.Type.LENGTH);
180 180
    innerLayout2.addView(spinner);
181 181

  
......
240 240
        }
241 241
      });
242 242

  
243
    final View view = inflater.inflate(R.layout.dialog_settings, null);
243
    final View view = inflater.inflate(R.layout.dialog_effects, null);
244 244
    builder.setView(view);
245 245

  
246 246
    LinearLayout linearLayout = view.findViewById(R.id.settingsLayout);
src/main/res/layout/dialog_effects.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:id="@+id/settingsScroll"
4
    android:layout_width="match_parent"
5
    android:layout_height="match_parent">
6

  
7
    <LinearLayout
8
        android:id="@+id/settingsLayout"
9
        android:layout_width="match_parent"
10
        android:layout_height="wrap_content"
11
        android:orientation="vertical" >
12
    </LinearLayout>
13

  
14
</ScrollView>
src/main/res/layout/dialog_settings.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:id="@+id/settingsScroll"
4
    android:layout_width="match_parent"
5
    android:layout_height="match_parent">
6

  
7
    <LinearLayout
8
        android:id="@+id/settingsLayout"
9
        android:layout_width="match_parent"
10
        android:layout_height="wrap_content"
11
        android:orientation="vertical" >
12
    </LinearLayout>
13

  
14
</ScrollView>

Also available in: Unified diff