| android:id="@+id/deltaTimeCboBox" | android:id="@+id/deltaTimeCboBox" | ||||
| style="@style/GlassSpinner" | style="@style/GlassSpinner" | ||||
| android:layout_width="150dp" | android:layout_width="150dp" | ||||
| android:layout_height="36dp" | |||||
| android:layout_height="40dp" | |||||
| android:layout_marginLeft="4dp" | android:layout_marginLeft="4dp" | ||||
| android:ems="10" | android:ems="10" | ||||
| android:entries="@array/CalculationTimeIntervals" | |||||
| android:gravity="center_vertical" | android:gravity="center_vertical" | ||||
| android:inputType="numberDecimal" | android:inputType="numberDecimal" | ||||
| android:paddingBottom="9dp" | android:paddingBottom="9dp" | ||||
| android:paddingTop="9dp" | android:paddingTop="9dp" | ||||
| android:textSize="18sp" | |||||
| app:txtFont="@string/TitilliumWeb_Regular" /> | |||||
| android:textSize="18sp" /> | |||||
| </TableRow> | </TableRow> | ||||
| android:id="@+id/calcPrecisionCboBox" | android:id="@+id/calcPrecisionCboBox" | ||||
| style="@style/GlassSpinner" | style="@style/GlassSpinner" | ||||
| android:layout_width="150dp" | android:layout_width="150dp" | ||||
| android:layout_height="36dp" | |||||
| android:layout_height="40dp" | |||||
| android:layout_marginLeft="4dp" | android:layout_marginLeft="4dp" | ||||
| android:ems="10" | android:ems="10" | ||||
| android:entries="@array/CalculationAccuracies" | android:entries="@array/CalculationAccuracies" | ||||
| android:inputType="numberDecimal" | android:inputType="numberDecimal" | ||||
| android:paddingBottom="9dp" | android:paddingBottom="9dp" | ||||
| android:paddingTop="9dp" | android:paddingTop="9dp" | ||||
| android:textSize="18sp" | |||||
| app:txtFont="@string/TitilliumWeb_Regular" /> | |||||
| android:textSize="18sp" /> | |||||
| </TableRow> | </TableRow> | ||||
| <?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" > | |||||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||||
| android:id="@+id/spinner_view" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | |||||
| 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" /> | |||||
| </LinearLayout> |
| <?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" > | |||||
| </LinearLayout> |
| </declare-styleable> | </declare-styleable> | ||||
| <declare-styleable | |||||
| name="FontSpinner"> | |||||
| <attr | |||||
| name="spinnerFont" | |||||
| format="string" /> | |||||
| </declare-styleable> | |||||
| </resources> | </resources> |
| import android.widget.ArrayAdapter; | import android.widget.ArrayAdapter; | ||||
| import android.widget.ListView; | import android.widget.ListView; | ||||
| import android.widget.ScrollView; | import android.widget.ScrollView; | ||||
| import android.widget.Spinner; | |||||
| import android.widget.ViewFlipper; | import android.widget.ViewFlipper; | ||||
| import ch.spherIC.recurvebowsight.R; | |||||
| import ch.spherIC.recurvebowsight.components.FontArrayAdapter; | |||||
| import ch.spherIC.recurvebowsight.components.XSpinner; | import ch.spherIC.recurvebowsight.components.XSpinner; | ||||
| import ch.spherIC.recurvebowsight.components.XTextView; | import ch.spherIC.recurvebowsight.components.XTextView; | ||||
| import ch.spherIC.recurvebowsight.database.RBSDatabaseHelper; | import ch.spherIC.recurvebowsight.database.RBSDatabaseHelper; | ||||
| private XTextView txtViewParams; | private XTextView txtViewParams; | ||||
| private XTextView txtViewResults; | private XTextView txtViewResults; | ||||
| private XTextView txtViewSight; | private XTextView txtViewSight; | ||||
| private XSpinner calcTimeIntervalCboBox; | |||||
| private Spinner calcTimeIntervalCboBox; | |||||
| private XSpinner calcAccuracyCboBox; | private XSpinner calcAccuracyCboBox; | ||||
| private Activity riserSightConfigActivity; | private Activity riserSightConfigActivity; | ||||
| this.txtViewParams = (XTextView) findViewById(R.id.viewParams); | this.txtViewParams = (XTextView) findViewById(R.id.viewParams); | ||||
| this.txtViewResults = (XTextView) findViewById(R.id.viewResults); | this.txtViewResults = (XTextView) findViewById(R.id.viewResults); | ||||
| this.txtViewSight = (XTextView) findViewById(R.id.viewSight); | this.txtViewSight = (XTextView) findViewById(R.id.viewSight); | ||||
| this.calcTimeIntervalCboBox = (XSpinner) findViewById(R.id.deltaTimeCboBox); | |||||
| this.calcTimeIntervalCboBox = (Spinner) findViewById(R.id.deltaTimeCboBox); | |||||
| this.calcAccuracyCboBox = (XSpinner) findViewById(R.id.calcPrecisionCboBox); | this.calcAccuracyCboBox = (XSpinner) findViewById(R.id.calcPrecisionCboBox); | ||||
| this.scrollView.setOnTouchListener(new OnTouchListener() { | this.scrollView.setOnTouchListener(new OnTouchListener() { | ||||
| this.txtViewResults.setOnTouchListener(tabListener); | this.txtViewResults.setOnTouchListener(tabListener); | ||||
| this.txtViewSight.setOnTouchListener(tabListener); | this.txtViewSight.setOnTouchListener(tabListener); | ||||
| xTextViewUp(this.txtViewParams); | |||||
| this.calcTimeIntervalCboBox.setAdapter(new FontArrayAdapter<String>(this, R.layout.rbs_spinner, | |||||
| getResources().getStringArray(R.array.CalculationTimeIntervals), | |||||
| this.calcTimeIntervalCboBox)); | |||||
| this.calcAccuracyCboBox.setAdapter(new FontArrayAdapter<String>(this, R.layout.rbs_spinner, | |||||
| getResources().getStringArray(R.array.CalculationAccuracies), | |||||
| this.calcAccuracyCboBox)); | |||||
| // ** TEST WEISE AB HIER******* | // ** TEST WEISE AB HIER******* | ||||
| /** | |||||
| * 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.Spinner; | |||||
| import android.widget.TextView; | |||||
| import ch.spherIC.recurvebowsight.R; | |||||
| /** | |||||
| * @author FC Smilari | |||||
| */ | |||||
| public class FontArrayAdapter<O extends Object> extends ArrayAdapter<O> { | |||||
| private Spinner parentSpinner; | |||||
| /** | |||||
| * @param context | |||||
| * @param textViewResourceId | |||||
| * @param objects | |||||
| */ | |||||
| 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); | |||||
| } | |||||
| @Override | |||||
| public View getDropDownView(final int position, final View convertView, final ViewGroup parent) { | |||||
| return getCustomView(position, convertView, parent, true); | |||||
| } | |||||
| 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) { | |||||
| LayoutInflater inflater = getLayoutInflater(); | |||||
| View spinnerItem = inflater.inflate(R.layout.rbs_spinner, parent, false); | |||||
| TextView textView = (TextView) spinnerItem.findViewById(R.id.spinner_view); | |||||
| 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); | |||||
| } | |||||
| return spinnerItem; | |||||
| } | |||||
| } |