| @@ -22,9 +22,13 @@ | |||
| </intent-filter> | |||
| </activity> | |||
| <activity | |||
| android:name="ch.spherIC.recurvebowsight.RiserSightConfigurationActivity" | |||
| android:label="@string/title_activity_riser_sight_configuration" > | |||
| android:name="ch.spherIC.recurvebowsight.configuration.MainConfigurationActivity" | |||
| android:label="@string/title_activity_main_configuration" > | |||
| </activity> | |||
| </application> | |||
| <activity | |||
| android:name="ch.spherIC.recurvebowsight.configuration.RiserConfigurationActivity" | |||
| android:label="@string/title_activity_riser_configuration" > | |||
| </activity> | |||
| </application> | |||
| </manifest> | |||
| @@ -0,0 +1,15 @@ | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| xmlns:tools="http://schemas.android.com/tools" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:background="@drawable/bg" | |||
| android:orientation="vertical" | |||
| tools:context=".MainConfigurationActivity" > | |||
| <ListView | |||
| android:id="@+id/mainConfigListView" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" > | |||
| </ListView> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,46 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| 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" > | |||
| <LinearLayout | |||
| android:id="@+id/mainConfigListItemTxt" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:orientation="vertical" > | |||
| <ch.spherIC.recurvebowsight.components.XTextView | |||
| android:id="@+id/mainConfigListItemTxtMain" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:gravity="bottom|left" | |||
| android:lines="1" | |||
| android:paddingLeft="2dp" | |||
| android:scrollHorizontally="true" | |||
| android:text="Type" | |||
| android:textAppearance="?android:attr/textAppearanceMediumInverse" | |||
| android:textColor="@color/black" | |||
| android:textSize="18sp" | |||
| app:drawBorder="false" | |||
| app:font="@string/TitilliumWeb_Bold" /> | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/mainConfigListItemTxtSub" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:gravity="left|center_vertical" | |||
| android:lines="2" | |||
| android:paddingLeft="2dp" | |||
| android:text="Hoyt / Avalon" | |||
| android:textAppearance="?android:attr/textAppearanceSmallInverse" | |||
| android:textColor="@color/black" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| </LinearLayout> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,274 @@ | |||
| <RelativeLayout xmlns:tools="http://schemas.android.com/tools" | |||
| xmlns:android="http://schemas.android.com/apk/res/android" | |||
| xmlns:app="http://schemas.android.com/apk/res/ch.spherIC.recurvebowsight" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:background="@drawable/bg" | |||
| android:gravity="center" > | |||
| <ScrollView | |||
| android:id="@+id/riserCfgScrollView" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" > | |||
| <LinearLayout | |||
| android:id="@+id/riserConfig" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="vertical" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/riserConfigTitle" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="4dp" | |||
| android:background="@color/yellow" | |||
| android:paddingBottom="3dp" | |||
| android:paddingLeft="6dp" | |||
| android:paddingTop="3dp" | |||
| android:text="@string/rcTitleRiserConfig" | |||
| android:textColor="@color/black" | |||
| android:textStyle="bold" | |||
| app:font="@string/TitilliumWeb_Bold" /> | |||
| <TableLayout | |||
| android:id="@+id/riserConfigTbl" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:gravity="fill_vertical|fill_horizontal" | |||
| android:scrollbarStyle="insideOverlay" | |||
| android:scrollbars="vertical" > | |||
| <TableRow | |||
| android:id="@+id/tableSCRow1" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="4dp" | |||
| android:paddingLeft="8dp" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/rcRiserLbl" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="right|center_vertical" | |||
| android:gravity="right" | |||
| android:text="@string/rcRiserLbl" | |||
| android:textColor="@color/black" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| <ch.spherIC.recurvebowsight.components.RiserSpinner | |||
| android:id="@+id/scRiserSpinner" | |||
| style="@style/GlassSpinner" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginLeft="4dp" | |||
| android:layout_weight="1" | |||
| android:gravity="center_vertical" | |||
| android:paddingBottom="9dp" | |||
| android:paddingTop="9dp" /> | |||
| </TableRow> | |||
| <TableRow | |||
| android:id="@+id/tableSCRow2" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="4dp" | |||
| android:paddingLeft="8dp" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/rcManufacturer" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="right|center_vertical" | |||
| android:gravity="right" | |||
| android:text="@string/rcManufacturerLbl" | |||
| android:textColor="@color/black" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| <ch.spherIC.recurvebowsight.components.FontEditText | |||
| android:id="@+id/scaVTxtFld" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginLeft="4dp" | |||
| android:layout_weight="1" | |||
| android:ems="10" | |||
| android:gravity="center_vertical" | |||
| android:inputType="numberDecimal" | |||
| android:paddingBottom="9dp" | |||
| android:paddingTop="9dp" | |||
| android:textSize="18sp" | |||
| app:txtFont="@string/TitilliumWeb_Regular" /> | |||
| </TableRow> | |||
| <TableRow | |||
| android:id="@+id/tableSCRow3" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="4dp" | |||
| android:paddingLeft="8dp" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/rcRiserModel" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="right|center_vertical" | |||
| android:gravity="right" | |||
| android:text="@string/rcModel" | |||
| android:textColor="@color/black" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| <ch.spherIC.recurvebowsight.components.FontEditText | |||
| android:id="@+id/scVertScaleRngTxtFld" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginLeft="4dp" | |||
| android:layout_weight="2" | |||
| android:ems="10" | |||
| android:gravity="center_vertical" | |||
| android:inputType="numberDecimal" | |||
| android:paddingBottom="9dp" | |||
| android:paddingTop="9dp" | |||
| android:textSize="18sp" | |||
| app:txtFont="@string/TitilliumWeb_Regular" /> | |||
| </TableRow> | |||
| <TableRow | |||
| android:id="@+id/tableSCRow4" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="4dp" | |||
| android:paddingLeft="8dp" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/rcSize" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="right|center_vertical" | |||
| android:gravity="right" | |||
| android:text="@string/rcSizeLbl" | |||
| android:textColor="@color/black" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| <ch.spherIC.recurvebowsight.components.FontEditText | |||
| android:id="@+id/scVertSkalaMiddleTxtFld" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginLeft="4dp" | |||
| android:layout_weight="1" | |||
| android:background="@android:drawable/edit_text" | |||
| android:ems="10" | |||
| android:gravity="center_vertical" | |||
| android:inputType="numberDecimal" | |||
| android:paddingBottom="9dp" | |||
| android:paddingTop="9dp" | |||
| android:textSize="18sp" | |||
| app:txtFont="@string/TitilliumWeb_Regular" /> | |||
| </TableRow> | |||
| <TableRow | |||
| android:id="@+id/tableSCRow5" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="4dp" | |||
| android:paddingLeft="8dp" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/rcVvisHLbl" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="center_vertical" | |||
| android:gravity="right" | |||
| android:text="@string/rcVvisHLbl" | |||
| android:textColor="@color/black" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| <ch.spherIC.recurvebowsight.components.FontEditText | |||
| android:id="@+id/scVvisHTxtFld" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginLeft="4dp" | |||
| android:layout_weight="1" | |||
| android:ems="10" | |||
| android:gravity="center_vertical" | |||
| android:inputType="numberDecimal" | |||
| android:paddingBottom="9dp" | |||
| android:paddingTop="9dp" | |||
| android:textAppearance="?android:attr/textAppearanceMediumInverse" | |||
| app:txtFont="@string/TitilliumWeb_Regular" /> | |||
| </TableRow> | |||
| <TableRow | |||
| android:id="@+id/tableSCRow6" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="4dp" | |||
| android:paddingLeft="8dp" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| android:id="@+id/rcVvisVLbl" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="right|center_vertical" | |||
| android:gravity="right" | |||
| android:text="@string/rcVvisVLbl" | |||
| android:textColor="@color/black" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| <ch.spherIC.recurvebowsight.components.FontEditText | |||
| android:id="@+id/scVvisVTxtFld" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginLeft="4dp" | |||
| android:layout_weight="1" | |||
| android:ems="10" | |||
| android:gravity="center_vertical" | |||
| android:inputType="numberDecimal" | |||
| android:paddingBottom="9dp" | |||
| android:paddingTop="9dp" | |||
| android:textAppearance="?android:attr/textAppearanceMediumInverse" | |||
| app:txtFont="@string/TitilliumWeb_Regular" /> | |||
| </TableRow> | |||
| </TableLayout> | |||
| <LinearLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_margin="8dp" | |||
| android:orientation="horizontal" | |||
| android:paddingTop="10dp" > | |||
| <Button | |||
| android:id="@+id/rcBtnNew" | |||
| style="@style/GlassButton" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginRight="8dp" | |||
| android:layout_weight="1" | |||
| android:text="@string/caption_New" /> | |||
| <Button | |||
| android:id="@+id/rcBtnSave" | |||
| style="@style/GlassButton" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_marginRight="8dp" | |||
| android:layout_weight="1" | |||
| android:text="@string/caption_Save" /> | |||
| <Button | |||
| android:id="@+id/rcBtnDelete" | |||
| style="@style/GlassButton" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="40dp" | |||
| android:layout_weight="1" | |||
| android:text="@string/caption_Delete" /> | |||
| </LinearLayout> | |||
| </LinearLayout> | |||
| </ScrollView></RelativeLayout> | |||
| @@ -1,16 +0,0 @@ | |||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| xmlns:tools="http://schemas.android.com/tools" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:paddingBottom="@dimen/activity_vertical_margin" | |||
| android:paddingLeft="@dimen/activity_horizontal_margin" | |||
| android:paddingRight="@dimen/activity_horizontal_margin" | |||
| android:paddingTop="@dimen/activity_vertical_margin" | |||
| tools:context=".RiserSightConfigurationActivity" > | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:text="@string/title_activity_riser_sight_configuration" /> | |||
| </RelativeLayout> | |||
| @@ -1,8 +0,0 @@ | |||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" > | |||
| <item | |||
| android:id="@+id/action_settings" | |||
| android:orderInCategory="100" | |||
| android:title="@string/action_settings"/> | |||
| </menu> | |||
| @@ -3,9 +3,8 @@ | |||
| <string name="app_name">RBS (Recurve Bow Sight)</string> | |||
| <string name="title_rbs_main_activity">RBS Berechnung Visiereinstellung</string> | |||
| <string name="title_activity_riser_sight_configuration">Konfiguration Bogen/Visier</string> | |||
| <string name="menu_settings">Menu</string> | |||
| <string name="action_settings">Settings</string> | |||
| <string name="title_activity_main_configuration">Konfiguration Bogen/Visier/Ausrüstung</string> | |||
| <string name="title_activity_riser_configuration">Konfiguration Griffstück</string> | |||
| <!-- --> | |||
| <string name="viewParams">Parameter</string> | |||
| <string name="viewResults">Ball. Flugbahn</string> | |||
| @@ -55,6 +54,9 @@ | |||
| <string name="caption_NoSelection">Keine Auswahl…</string> | |||
| <string name="caption_FillAllMandatoryFields">Um die Berechnung durchzuführen, müssen alle Parameterfelder abgefüllt sein.</string> | |||
| <string name="caption_Calculating">Berechnung läuft…</string> | |||
| <string name="caption_New">Neu</string> | |||
| <string name="caption_Save">Speichern</string> | |||
| <string name="caption_Delete">Löschen</string> | |||
| <!-- --> | |||
| <string name="fcChart_StartAngle">Abschusswinkel:\n</string> | |||
| <string name="fcChart_MaxHeight">Max. Höhe der Flugbahn:\n</string> | |||
| @@ -63,5 +65,20 @@ | |||
| <string name="fcChart_TitleLable">Flugbahn</string> | |||
| <string name="fcChart_TitleXAxis">Distanz [m]</string> | |||
| <string name="fcChart_TitleYAxis">Höhe [m]</string> | |||
| <!-- --> | |||
| <string name="caption_MainCfg_Riser_MainText">Griffstück</string> | |||
| <string name="caption_MainCfg_Riser_SubText">Hier klicken um ein Griffstück zu Editiern, zu Löschen oder Einzufügen</string> | |||
| <string name="caption_MainCfg_Sight_MainText">Visier</string> | |||
| <string name="caption_MainCfg_Sight_SubText">Hier klicken um ein Visier zu Editiern, zu Löschen oder Einzufügen</string> | |||
| <string name="caption_MainCfg_ArcerySetup_MainText">Ausrüstung</string> | |||
| <string name="caption_MainCfg_ArcerySetup_SubText">Hier klicken um eine Ausrüstung zu Editiern, zu Löschen oder Einzufügen</string> | |||
| <!-- --> | |||
| <string name="rcTitleRiserConfig">Konfiguration Griffstück</string> | |||
| <string name="rcRiserLbl">Griffstück</string> | |||
| <string name="rcManufacturerLbl">Hersteller</string> | |||
| <string name="rcModel">Model</string> | |||
| <string name="rcSizeLbl">Größe</string> | |||
| <string name="rcVvisHLbl">VvisH [mm]</string> | |||
| <string name="rcVvisVLbl">VvisV [mm]</string> | |||
| </resources> | |||
| @@ -3,11 +3,9 @@ | |||
| <string name="app_name">RBS (Recurve Bow Sight)</string> | |||
| <string name="title_rbs_main_activity">RBS Sight Setting Calculation</string> | |||
| <string name="title_activity_riser_sight_configuration">Riser/Sight Configuration</string> | |||
| <string name="menu_settings">Menu</string> | |||
| <string name="action_settings">Settings</string> | |||
| <string name="title_activity_main_configuration">Riser/Sight/Equipment Configuration</string> | |||
| <string name="title_activity_riser_configuration">Riser Configuration</string> | |||
| <!-- --> | |||
| <string name="viewParams">Parameters</string> | |||
| <string name="viewResults">Ballistic Trajectory</string> | |||
| <string name="viewSight">Sight Setting</string> | |||
| @@ -56,6 +54,9 @@ | |||
| <string name="caption_NoSelection">No selection…</string> | |||
| <string name="caption_FillAllMandatoryFields">To start the calculation all parameter fields must be filled.</string> | |||
| <string name="caption_Calculating">Calculating…</string> | |||
| <string name="caption_New">New</string> | |||
| <string name="caption_Save">Save</string> | |||
| <string name="caption_Delete">Delete</string> | |||
| <!-- --> | |||
| <string name="fcChart_StartAngle">Elevation Angle:\n</string> | |||
| <string name="fcChart_MaxHeight">Max. Height of Trajectory:\n</string> | |||
| @@ -64,6 +65,20 @@ | |||
| <string name="fcChart_TitleLable">Trajectory</string> | |||
| <string name="fcChart_TitleXAxis">Distance [m]</string> | |||
| <string name="fcChart_TitleYAxis">Height [m]</string> | |||
| <!-- --> | |||
| <string name="caption_MainCfg_Riser_MainText">Riser</string> | |||
| <string name="caption_MainCfg_Riser_SubText">Tab to edit, delete or insert a riser</string> | |||
| <string name="caption_MainCfg_Sight_MainText">Sight</string> | |||
| <string name="caption_MainCfg_Sight_SubText">Tab to edit, delete or insert a sight</string> | |||
| <string name="caption_MainCfg_ArcerySetup_MainText">Equipment</string> | |||
| <string name="caption_MainCfg_ArcerySetup_SubText">Tab to edit, delete or insert a equipment setup</string> | |||
| <!-- --> | |||
| <string name="rcTitleRiserConfig">Riser Configuration</string> | |||
| <string name="rcRiserLbl">Riser</string> | |||
| <string name="rcManufacturerLbl">Manufacturer</string> | |||
| <string name="rcModel">Model</string> | |||
| <string name="rcSizeLbl">Size</string> | |||
| <string name="rcVvisHLbl">VvisH [mm]</string> | |||
| <string name="rcVvisVLbl">VvisV [mm]</string> | |||
| </resources> | |||
| @@ -51,6 +51,7 @@ import ch.spherIC.recurvebowsight.components.RiserSpinner; | |||
| import ch.spherIC.recurvebowsight.components.SightSpinner; | |||
| import ch.spherIC.recurvebowsight.components.XSpinner; | |||
| import ch.spherIC.recurvebowsight.components.XTextView; | |||
| import ch.spherIC.recurvebowsight.configuration.MainConfigurationActivity; | |||
| import ch.spherIC.recurvebowsight.database.RBSDatabaseHelper; | |||
| import ch.spherIC.recurvebowsight.database.dao.ArcherySetupDao; | |||
| import ch.spherIC.recurvebowsight.database.dao.RiserDao; | |||
| @@ -590,32 +591,10 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi | |||
| case R.id.addConfiguration: | |||
| // ************************************************************************ | |||
| // ** TEST WEISE AB HIER*************************************************** | |||
| // ************************************************************************ | |||
| // this.listView1 = (ListView) findViewById(R.id.listView1); | |||
| // | |||
| // String[] values = new String[] { "Riser", "Sight", "General Config" }; | |||
| // | |||
| // final ArrayList<String> list = new ArrayList<String>(Arrays.asList(values)); | |||
| // final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list); | |||
| // this.listView1.setAdapter(adapter); | |||
| // this.listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |||
| // | |||
| // @Override | |||
| // public void onItemClick(final AdapterView<?> parent, final View view, final int position, | |||
| // final long id) { | |||
| // final String item = (String) parent.getItemAtPosition(position); | |||
| // if (item.equals("Riser")) { | |||
| Intent intent = new Intent(RBSMainActivity.this, RiserSightConfigurationActivity.class); | |||
| Intent intent = new Intent(RBSMainActivity.this, MainConfigurationActivity.class); | |||
| startActivity(intent); | |||
| // } | |||
| // } | |||
| // }); | |||
| return true; | |||
| case R.id.moreItems: | |||
| this.showInfoMenu = true; | |||
| closeOptionsMenu(); | |||
| @@ -1,25 +0,0 @@ | |||
| package ch.spherIC.recurvebowsight; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.R.layout; | |||
| import ch.spherIC.recurvebowsight.R.menu; | |||
| import android.os.Bundle; | |||
| import android.app.Activity; | |||
| import android.view.Menu; | |||
| public class RiserSightConfigurationActivity extends Activity { | |||
| @Override | |||
| protected void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.rbs_riser_sight_config); | |||
| } | |||
| @Override | |||
| public boolean onCreateOptionsMenu(Menu menu) { | |||
| // Inflate the menu; this adds items to the action bar if it is present. | |||
| getMenuInflater().inflate(R.menu.riser_sight_configuration, menu); | |||
| return true; | |||
| } | |||
| } | |||
| @@ -0,0 +1,71 @@ | |||
| /** | |||
| * Copyright (C) 2005-2012 XELOG AG | |||
| */ | |||
| package ch.spherIC.recurvebowsight.components; | |||
| import android.content.Context; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.ArrayAdapter; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import java.util.List; | |||
| /** | |||
| * @author FC Smilari | |||
| */ | |||
| public class MainConfigurationArrayAdapter extends ArrayAdapter<String[]> { | |||
| /** | |||
| * Konstruktor. | |||
| * | |||
| * @param context | |||
| * @param textViewResourceId | |||
| * @param objects | |||
| */ | |||
| public MainConfigurationArrayAdapter(final Context context, final int textViewResourceId, final String[][] objects) { | |||
| super(context, textViewResourceId, objects); | |||
| } | |||
| /** | |||
| * Konstruktor. | |||
| * | |||
| * @param context | |||
| * @param textViewResourceId | |||
| * @param objects | |||
| */ | |||
| public MainConfigurationArrayAdapter(final Context context, final int textViewResourceId, final List<String[]> objects) { | |||
| super(context, textViewResourceId, objects); | |||
| } | |||
| @Override | |||
| public View getView(final int position, final View convertView, final ViewGroup parent) { | |||
| LayoutInflater inflater = getLayoutInflater(); | |||
| View item = inflater.inflate(R.layout.rbs_main_config_item, parent, false); | |||
| XTextView textViewMain = (XTextView) item.findViewById(R.id.mainConfigListItemTxtMain); | |||
| TextView textViewSub = (TextView) item.findViewById(R.id.mainConfigListItemTxtSub); | |||
| if (getItem(position) != null) { | |||
| if (getItem(position).length >= 1) { | |||
| textViewMain.setText(getItem(position)[0]); | |||
| } | |||
| if (getItem(position).length >= 2) { | |||
| textViewSub.setText(getItem(position)[1]); | |||
| } | |||
| } | |||
| return item; | |||
| } | |||
| protected LayoutInflater getLayoutInflater() { | |||
| return (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |||
| } | |||
| } | |||
| @@ -0,0 +1,82 @@ | |||
| package ch.spherIC.recurvebowsight.configuration; | |||
| import android.app.Activity; | |||
| import android.content.Intent; | |||
| import android.content.pm.ActivityInfo; | |||
| import android.os.Bundle; | |||
| import android.view.Menu; | |||
| import android.view.View; | |||
| import android.widget.AdapterView; | |||
| import android.widget.ListView; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.components.MainConfigurationArrayAdapter; | |||
| import ch.spherIC.recurvebowsight.utilities.CompatibilityUtil; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| public class MainConfigurationActivity extends Activity { | |||
| private ListView mainConfigListVIew; | |||
| @Override | |||
| protected void onCreate(final Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.rbs_main_config); | |||
| if (CompatibilityUtil.isTablet(getApplicationContext())) { | |||
| setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); | |||
| } else { | |||
| setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | |||
| } | |||
| this.mainConfigListVIew = (ListView) findViewById(R.id.mainConfigListView); | |||
| List<String[]> items = new ArrayList<String[]>(); | |||
| String[] riserItem = new String[] { | |||
| getResources().getString(R.string.caption_MainCfg_Riser_MainText), getResources().getString(R.string.caption_MainCfg_Riser_SubText) | |||
| }; | |||
| String[] sightItem = new String[] { | |||
| getResources().getString(R.string.caption_MainCfg_Sight_MainText), getResources().getString(R.string.caption_MainCfg_Sight_SubText) | |||
| }; | |||
| String[] archerySetupItem = new String[] { | |||
| getResources().getString(R.string.caption_MainCfg_ArcerySetup_MainText), getResources().getString(R.string.caption_MainCfg_ArcerySetup_SubText) | |||
| }; | |||
| items.add(riserItem); | |||
| items.add(sightItem); | |||
| items.add(archerySetupItem); | |||
| final MainConfigurationArrayAdapter adapter = new MainConfigurationArrayAdapter(this, R.layout.rbs_main_config_item, items); | |||
| this.mainConfigListVIew.setAdapter(adapter); | |||
| this.mainConfigListVIew.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |||
| @Override | |||
| public void onItemClick(final AdapterView<?> parent, final View view, final int position, | |||
| final long id) { | |||
| final String[] item = (String[]) parent.getItemAtPosition(position); | |||
| if (item[0].equals(getResources().getString(R.string.caption_MainCfg_Riser_MainText))) { | |||
| Intent intent = new Intent(MainConfigurationActivity.this, RiserConfigurationActivity.class); | |||
| startActivity(intent); | |||
| } else if (item[0].equals(getResources().getString(R.string.caption_MainCfg_Sight_MainText))) { } | |||
| else if (item[0].equals(getResources().getString(R.string.caption_MainCfg_ArcerySetup_MainText))) { } | |||
| } | |||
| }); | |||
| } | |||
| @Override | |||
| public boolean onCreateOptionsMenu(final Menu menu) { | |||
| getMenuInflater().inflate(R.menu.rbs_info_menu, menu); | |||
| return true; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| /** | |||
| * Copyright (C) 2005-2012 XELOG AG | |||
| */ | |||
| package ch.spherIC.recurvebowsight.configuration; | |||
| import android.app.Activity; | |||
| import android.content.pm.ActivityInfo; | |||
| import android.os.Bundle; | |||
| import android.view.Menu; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.utilities.CompatibilityUtil; | |||
| /** | |||
| * @author FC Smilari | |||
| */ | |||
| public class RiserConfigurationActivity extends Activity { | |||
| @Override | |||
| protected void onCreate(final Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| setContentView(R.layout.rbs_riser_config); | |||
| if (CompatibilityUtil.isTablet(getApplicationContext())) { | |||
| setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); | |||
| } else { | |||
| setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | |||
| } | |||
| } | |||
| @Override | |||
| public boolean onCreateOptionsMenu(final Menu menu) { | |||
| getMenuInflater().inflate(R.menu.rbs_info_menu, menu); | |||
| return super.onCreateOptionsMenu(menu); | |||
| } | |||
| } | |||