Selaa lähdekoodia

GUI Layouting

master
gitsvn 12 vuotta sitten
vanhempi
commit
e0fb1de311

BIN
res/drawable-hdpi/btn_check_on.png Näytä tiedosto


BIN
res/drawable-ldpi/btn_check_on.png Näytä tiedosto


BIN
res/drawable-mdpi/btn_check_on.png Näytä tiedosto


BIN
res/drawable-xhdpi/btn_check_on.png Näytä tiedosto


+ 293
- 32
res/layout/rbs_main.xml Näytä tiedosto

@@ -88,6 +88,285 @@
android:layout_below="@id/views"
android:scrollbarAlwaysDrawVerticalTrack="false" >
<LinearLayout
android:id="@+id/sightConfig"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:id="@+id/sightConfigTbl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="fill_vertical|fill_horizontal"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical" >
<TableRow
android:id="@+id/tableSCRow0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/sightConfigTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/yellow"
android:paddingBottom="3dip"
android:paddingLeft="3dip"
android:paddingTop="3dip"
android:text="@string/titleSightConfig"
android:textColor="@color/black"
android:textStyle="bold"
app:font="@string/TitilliumWeb_Bold" />
</TableRow>
<TableRow
android:id="@+id/tableSCRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scRiserLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scRiserLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.XSpinner
android:id="@+id/scRiserTxtFld"
style="@style/GlassSpinner"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:gravity="center_vertical"
android:paddingBottom="9dp"
android:paddingTop="9dp"/>
</TableRow>
<TableRow
android:id="@+id/tableSCRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scVvisHLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scVvisHLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/scVvisHTxtFld"
android:layout_width="100dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="22"
android:textSize="18sp"
app:txtFont="@string/TitilliumWeb_Regular" />
</TableRow>
<TableRow
android:id="@+id/tableSCRow3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scVvisVLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scVvisVLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/scVvisVTxtFld"
android:layout_width="100dp"
android:layout_height="36dp"
android:layout_gravity="fill_horizontal"
android:layout_marginLeft="4dp"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="22"
android:textSize="18sp"
app:txtFont="@string/TitilliumWeb_Regular" />
</TableRow>
<TableRow
android:id="@+id/tableSCRow4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scSightLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scSightLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.XSpinner
android:id="@+id/scSightSpinner"
style="@style/GlassSpinner"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:gravity="center_vertical"
android:paddingBottom="9dp"
android:paddingTop="9dp"/>
</TableRow>
<TableRow
android:id="@+id/tableSCRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scHeVSLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scHeVSLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.XSpinner
android:id="@+id/scHeVSTxtFld"
style="@style/GlassSpinner"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:gravity="center_vertical"
android:paddingBottom="9dp"
android:paddingTop="9dp"/>
</TableRow>
<TableRow
android:id="@+id/tableSCRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scaVLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scaVLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/scaVTxtFld"
android:layout_width="150dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="22"
android:textSize="18sp"
app:txtFont="@string/TitilliumWeb_Regular" />
</TableRow>
<TableRow
android:id="@+id/tableSCRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scVertSkalaMiddleLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scVertScaleRngLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/scVertSkalaMiddleTxtFld"
android:layout_width="150dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="22"
android:textSize="18sp"
app:txtFont="@string/TitilliumWeb_Regular" />
</TableRow>
<TableRow
android:id="@+id/tableSCRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/scVertSkalaMiddleLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:text="@string/scVertSkalaMiddleLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/scVertSkalaMiddleTxtFld"
android:layout_width="150dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:text="22"
android:textSize="18sp"
app:txtFont="@string/TitilliumWeb_Regular" />
</TableRow>
</TableLayout>
</LinearLayout>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
@@ -135,7 +414,7 @@
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/arrowDiameterLbl"
android:id="@+id/scRiserLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
@@ -144,7 +423,7 @@
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/arrowDiameterTxtFld"
android:id="@+id/scRiserTxtFld"
android:layout_width="150dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
@@ -168,7 +447,7 @@
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/arrowCwLbl"
android:id="@+id/scVvisHLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
@@ -177,7 +456,7 @@
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/arrowCwTxtFld"
android:id="@+id/scVvisHTxtFld"
android:layout_width="100dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
@@ -200,7 +479,7 @@
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/arrowWeightLbl"
android:id="@+id/scVvisVLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
@@ -209,7 +488,7 @@
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/arrowWeightTxtFld"
android:id="@+id/scVvisVTxtFld"
android:layout_width="100dp"
android:layout_height="36dp"
android:layout_gravity="fill_horizontal"
@@ -232,7 +511,7 @@
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/bowPulloutLbl"
android:id="@+id/scSightLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
@@ -241,7 +520,7 @@
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/bowPulloutTxtFld"
android:id="@+id/scSightTxtFld"
android:layout_width="100dp"
android:layout_height="36dp"
android:layout_gravity="fill_horizontal"
@@ -265,7 +544,7 @@
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/arrowV0Lbl"
android:id="@+id/scHeVSLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
@@ -274,7 +553,7 @@
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/arrowV0TxtFld"
android:id="@+id/scHeVSTxtFld"
android:layout_width="100dp"
android:layout_height="36dp"
android:layout_gravity="fill_horizontal"
@@ -320,7 +599,7 @@
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/airTemperatureLbl"
android:id="@+id/scaVLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
@@ -329,7 +608,7 @@
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/airTemperatureTxtFld"
android:id="@+id/scaVTxtFld"
android:layout_width="150dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
@@ -352,7 +631,7 @@
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/airRelativeHumidityLbl"
android:id="@+id/scVertSkalaMiddleLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
@@ -361,7 +640,7 @@
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/airRelativeHumidityTxtFld"
android:id="@+id/scVertSkalaMiddleTxtFld"
android:layout_width="150dp"
android:layout_height="36dp"
android:layout_marginLeft="4dp"
@@ -518,8 +797,6 @@
</TableRow>
</TableLayout>
</ScrollView>
@@ -545,22 +822,6 @@
</ListView>
</LinearLayout>
<LinearLayout
android:id="@+id/sightConfig"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/editText11"
android:layout_width="match_parent"
android:layout_height="36dp"
android:inputType="numberDecimal"
android:text="62"
android:textSize="18sp"
app:txtFont="@string/TitilliumWeb_Regular" />
</LinearLayout>
</ViewFlipper>
</RelativeLayout>

+ 26
- 3
res/layout/rbs_spinner_item.xml Näytä tiedosto

@@ -1,7 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
xmlns:app="http://schemas.android.com/apk/res/ch.spherIC.recurvebowsight"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="8dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/spinner_item_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="bottom|left"
android:lines="1"
android:paddingLeft="2dp"
android:text="FontTextView"
android:textColor="@color/white"
android:textSize="18sp"
android:typeface="sans"
app:font="@string/TitilliumWeb_Regular" />
<ImageView
android:id="@+id/spinner_item_checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_check_on" />
</LinearLayout>

+ 11
- 1
res/values-de/strings.xml Näytä tiedosto

@@ -30,5 +30,15 @@
<string name="titleCalculationParams">Berechnungsparameter</string>
<string name="deltaTimeLbl">Zeitintervall Berechnung [sec]</string>
<string name="calcPrecisionLbl">Berechnungsgenauigkeit [%]</string>

<string name="titleSightConfig">Visiereinstellung</string>
<string name="scRiserLbl">Griffstück</string>
<string name="scVvisHLbl">VvisH [mm]</string>
<string name="scVvisVLbl">VvisV [mm]</string>
<string name="scSightLbl">Visier</string>
<string name="scHeVSLbl">Horz. Einst. Visierschlitten [mm]</string>
<string name="scaVLbl">aV [mm] / aH [mm]</string>
<string name="scVertScaleRngLbl">Bereich vert. Skala [mm]</string>
<string name="scVertSkalaMiddleLbl">Mittelstellung M vert. Skala [mm]</string>
</resources>

+ 11
- 1
res/values/strings.xml Näytä tiedosto

@@ -30,5 +30,15 @@
<string name="titleCalculationParams">Calculation Parameters</string>
<string name="deltaTimeLbl">Time Intervall Calculation [sec]</string>
<string name="calcPrecisionLbl">Calculation Accuracy [%]</string>

<string name="titleSightConfig">Sight Setting</string>
<string name="scRiserLbl">Riser</string>
<string name="scVvisHLbl">VvisH [mm]</string>
<string name="scVvisVLbl">VvisV [mm]</string>
<string name="scSightLbl">Sight</string>
<string name="scHeVSLbl">Horz. Sight Sliding Carriage [mm]</string>
<string name="scaVLbl">aV [mm] / aH [mm]</string>
<string name="scVertScaleRngLbl">Vertical Scale Range [mm]</string>
<string name="scVertSkalaMiddleLbl">Vertical Scale Middle Setting M [mm]</string>
</resources>

+ 3
- 0
src/ch/spherIC/recurvebowsight/RBSMainActivity.java Näytä tiedosto

@@ -122,6 +122,9 @@ public class RBSMainActivity extends Activity {
case MotionEvent.ACTION_UP: {
RBSMainActivity.this.viewFlipper.setInAnimation(RBSMainActivity.this, R.anim.in_from_right);
RBSMainActivity.this.viewFlipper.setOutAnimation(RBSMainActivity.this, R.anim.out_to_left);
if (v == RBSMainActivity.this.txtViewParams) {
if (RBSMainActivity.this.viewFlipper.getDisplayedChild() != 0) {
RBSMainActivity.this.viewFlipper.setDisplayedChild(0);

+ 24
- 19
src/ch/spherIC/recurvebowsight/components/FontArrayAdapter.java Näytä tiedosto

@@ -10,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
@@ -28,44 +29,48 @@ public class FontArrayAdapter<O extends Object> extends ArrayAdapter<O> {
* @param textViewResourceId
* @param objects
*/
public FontArrayAdapter(final Context context, final int textViewResourceId, final O[] objects, final Spinner parent) {
public FontArrayAdapter(final Context context, final int textViewResourceId, final O[] objects,
final Spinner parent) {
super(context, textViewResourceId, objects);
this.parentSpinner = parent;
}
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
return getCustomView(position, convertView, parent, false);
}
LayoutInflater inflater = getLayoutInflater();
View spinnerTxtView = inflater.inflate(R.layout.rbs_spinner, parent, false);
TextView textView = (TextView) spinnerTxtView.findViewById(R.id.spinner_view);
textView.setText(getItem(position).toString());
@Override
public View getDropDownView(final int position, final View convertView, final ViewGroup parent) {
return getCustomView(position, convertView, parent, true);
return spinnerTxtView;
}
protected LayoutInflater getLayoutInflater() {
return (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
protected View getCustomView(final int position, final View convertView, final ViewGroup parent, final boolean dropdown) {
@Override
public View getDropDownView(final int position, final View convertView, final ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View spinnerItem = inflater.inflate(R.layout.rbs_spinner, parent, false);
TextView textView = (TextView) spinnerItem.findViewById(R.id.spinner_view);
View spinnerItem = inflater.inflate(R.layout.rbs_spinner_item, parent, false);
TextView textView = (TextView) spinnerItem.findViewById(R.id.spinner_item_view);
ImageView checkBoxView = (ImageView) spinnerItem.findViewById(R.id.spinner_item_checkBox);
textView.setText(getItem(position).toString());
if (dropdown) {
if (this.parentSpinner.getSelectedItemPosition() == position) {
textView.setTextColor(getContext().getResources().getColor(R.color.android_blue_dark));
} else {
textView.setTextColor(getContext().getResources().getColor(R.color.black));
}
textView.setPadding(20, 20, 20, 20);
if (this.parentSpinner.getSelectedItemPosition() == position) {
textView.setTextColor(getContext().getResources().getColor(R.color.android_blue_dark));
checkBoxView.setVisibility(View.VISIBLE);
} else {
textView.setTextColor(getContext().getResources().getColor(R.color.black));
checkBoxView.setVisibility(View.INVISIBLE);
}
return spinnerItem;
}
protected LayoutInflater getLayoutInflater() {
return (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
}

Loading…
Peruuta
Tallenna