Placeholder views for images in task edit; restyled importance view

pull/14/head
Sam Bosley 12 years ago
parent 9abb5e5c2b
commit 38bb7ddbab

@ -18,6 +18,10 @@
android:paddingRight="10dip"
android:gravity="center_vertical">
<View android:id="@+id/display_row_icon"
android:layout_width="25dip"
android:layout_height="25dip"
android:background="#ff0000"/>
<TextView
android:id="@+id/display_row_title"
android:layout_width="wrap_content"

@ -20,16 +20,10 @@
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:layout_height="50dip">
<TextView
android:id="@+id/display_row_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_importance_label"
style="@style/TextAppearance.GEN_EditLabel" />
<View
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"/>
<View android:id="@+id/display_row_icon"
android:layout_width="25dip"
android:layout_height="25dip"
android:background="#ff0000"/>
</LinearLayout>
<View

@ -11,6 +11,7 @@ import java.util.List;
import android.app.Activity;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ToggleButton;
@ -91,7 +92,7 @@ public class ImportanceControlSet extends TaskEditControlSet {
int width = (int) (metrics.widthPixels / metrics.density) - 20;
int usedWidth = 0;
for(int i = min; i <= max; i++) {
for(int i = max; i >= min; i--) {
final ToggleButton button = new ToggleButton(activity);
LinearLayout.LayoutParams params;
@ -119,11 +120,13 @@ public class ImportanceControlSet extends TaskEditControlSet {
button.setTag(i);
buttons.add(button);
container.addView(button);
}
if (usedWidth > width * 2 /3 ) {
getView().findViewById(R.id.display_row_title).setVisibility(View.GONE);
View padding = new View(activity);
LinearLayout.LayoutParams paddingParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
paddingParams.weight = 1.0f;
padding.setLayoutParams(paddingParams);
container.addView(padding);
container.addView(button);
}
}

Loading…
Cancel
Save