| @@ -0,0 +1,7 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <item android:state_selected="true" android:state_pressed="false" android:color="@color/android_yellow_dark" /> | |||
| <item android:state_selected="true" android:state_pressed="true" android:color="@color/black" /> | |||
| <item android:state_pressed="true" android:color="@color/black" /> | |||
| <item android:state_pressed="false" android:color="@color/white" /> | |||
| </selector> | |||
| @@ -0,0 +1,7 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <item android:state_window_focused="false" android:state_selected="true" android:drawable="@android:color/transparent" /> | |||
| <item android:state_selected="true" android:drawable="@android:color/transparent" /> | |||
| <item android:state_pressed="true" android:state_selected="false" android:drawable="@android:color/transparent" /> | |||
| <item android:state_selected="false" android:drawable="@color/black" /> | |||
| </selector> | |||
| @@ -13,10 +13,10 @@ | |||
| android:layout_height="50dp" | |||
| android:layout_marginRight="10dp" | |||
| android:background="@drawable/glassbg_black" | |||
| android:src="@drawable/ic_menu_choose_equipment" | |||
| app:drawBorder="true" | |||
| app:drawBorderColor="@color/android_blue_dark" | |||
| app:drawBorderWidth="3dp"/> | |||
| android:src="@drawable/ic_menu_choose_equipment" | |||
| app:drawImgBorder="true" | |||
| app:drawImgBorderColor="@color/white" | |||
| app:drawImgBorderWidth="4dp" /> | |||
| <LinearLayout | |||
| android:id="@+id/chooseArcherySetupTxt" | |||
| @@ -25,18 +25,23 @@ | |||
| android:layout_weight="1" | |||
| android:orientation="vertical" > | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| <ch.spherIC.recurvebowsight.components.XTextView | |||
| android:id="@+id/chooseArcherySetupTxtMain" | |||
| android:layout_width="match_parent" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:background="@color/qrt_translucent_white" | |||
| android:gravity="bottom|left" | |||
| android:lines="1" | |||
| android:paddingLeft="2dp" | |||
| android:paddingRight="2dp" | |||
| android:scrollHorizontally="true" | |||
| android:text="Hoyt / Avalon" | |||
| android:textAppearance="?android:attr/textAppearanceMediumInverse" | |||
| android:textColor="@color/android_blue_dark" | |||
| android:textColor="@color/black" | |||
| android:textSize="18sp" | |||
| app:drawBorder="true" | |||
| app:drawBorderColor="@color/black" | |||
| app:drawBorderWidth="1dp" | |||
| app:font="@string/TitilliumWeb_Bold" /> | |||
| <ch.spherIC.recurvebowsight.components.FontTextView | |||
| @@ -4,8 +4,7 @@ | |||
| android:layout_width="fill_parent" | |||
| android:layout_height="fill_parent" | |||
| android:background="@drawable/bg_about" | |||
| android:orientation="vertical" | |||
| android:padding="10dp" > | |||
| android:orientation="vertical" > | |||
| <ListView | |||
| android:id="@+id/chooseArcerySetupItemsList" | |||
| @@ -17,7 +17,7 @@ | |||
| android:lines="1" | |||
| android:paddingLeft="2dp" | |||
| android:textAppearance="?android:attr/textAppearanceMediumInverse" | |||
| android:textColor="@color/white" | |||
| android:textColor="@color/list_item_textcolor" | |||
| android:textSize="18sp" | |||
| app:font="@string/TitilliumWeb_Regular" /> | |||
| @@ -3,6 +3,8 @@ | |||
| <color name="translucent">#00000000</color> | |||
| <color name="semi_translucent_black">#80000000</color> | |||
| <color name="semi_translucent_white">#80FFFFFF</color> | |||
| <color name="qrt_translucent_white">#BDFFFFFF</color> | |||
| <color name="black">#FF000000</color> | |||
| <color name="yellow">#AAFFFFAA</color> | |||
| <color name="white">#FFFFFFFF</color> | |||
| @@ -130,11 +130,14 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi | |||
| List<IRiser> risers = RiserDao.getInstance().loadAll(); | |||
| risers.add(0, new Riser(-999, getResources().getString(R.string.caption_NoSelection), "", null, null, null)); | |||
| this.scRiserSpinner.setAdapter(new FontArrayAdapter<IRiser>(this, R.layout.rbs_spinner, risers, this.scRiserSpinner)); | |||
| this.scRiserSpinner.setAdapter(new FontArrayAdapter<IRiser>(this, R.layout.rbs_spinner, risers, | |||
| this.scRiserSpinner)); | |||
| List<ISight> sights = SightDao.getInstance().loadAll(); | |||
| sights.add(0, new Sight(-999, getResources().getString(R.string.caption_NoSelection), "", null, null, "", null, null)); | |||
| this.scSightSpinner.setAdapter(new FontArrayAdapter<ISight>(this, R.layout.rbs_spinner, sights, this.scSightSpinner)); | |||
| sights.add(0, | |||
| new Sight(-999, getResources().getString(R.string.caption_NoSelection), "", null, null, "", null, null)); | |||
| this.scSightSpinner.setAdapter(new FontArrayAdapter<ISight>(this, R.layout.rbs_spinner, sights, | |||
| this.scSightSpinner)); | |||
| addRiserAndSightSpinnerListeners(); | |||
| @@ -244,10 +247,9 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi | |||
| } | |||
| RBSMainActivity.this.scHeVSTxtFld.setVisibility(View.INVISIBLE); | |||
| RBSMainActivity.this.scHeVSTxtFld.setLayoutParams(new LinearLayout.LayoutParams(RBSMainActivity.this.scHeVSTxtFld | |||
| .getLayoutParams().width, | |||
| RBSMainActivity.this.scHeVSTxtFld | |||
| .getLayoutParams().height, 0f)); | |||
| RBSMainActivity.this.scHeVSTxtFld.setLayoutParams(new LinearLayout.LayoutParams(RBSMainActivity.this.scHeVSTxtFld.getLayoutParams().width, | |||
| RBSMainActivity.this.scHeVSTxtFld.getLayoutParams().height, | |||
| 0f)); | |||
| RBSMainActivity.this.scHeVSSpinner.setVisibility(View.VISIBLE); | |||
| LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(RBSMainActivity.this.scHeVSSpinner.getLayoutParams().width, | |||
| @@ -255,13 +257,14 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi | |||
| 1f); | |||
| params.gravity = Gravity.FILL_VERTICAL; | |||
| RBSMainActivity.this.scHeVSSpinner.setLayoutParams(params); | |||
| RBSMainActivity.this.scHeVSSpinner.setAdapter(new FontArrayAdapter<String>(RBSMainActivity.this, R.layout.rbs_spinner, | |||
| listHeVis, RBSMainActivity.this.scHeVSSpinner)); | |||
| RBSMainActivity.this.scHeVSSpinner.setAdapter(new FontArrayAdapter<String>(RBSMainActivity.this, | |||
| R.layout.rbs_spinner, | |||
| listHeVis, | |||
| RBSMainActivity.this.scHeVSSpinner)); | |||
| RBSMainActivity.this.scHeVSSpinner.setSelection(0); | |||
| if (RBSMainActivity.this.selectedArcherySetup != null | |||
| && RBSMainActivity.this.selectedArcherySetup.getSight().getId() == sight.getId()) { | |||
| RBSMainActivity.this.scHeVSSpinner.setSelectionByVal(DF.format(RBSMainActivity.this.selectedArcherySetup | |||
| .getSightHorSetting())); | |||
| RBSMainActivity.this.scHeVSSpinner.setSelectionByVal(DF.format(RBSMainActivity.this.selectedArcherySetup.getSightHorSetting())); | |||
| } | |||
| RBSMainActivity.this.scaVTxtFld.setText(DF.format(sight.getAV())); | |||
| RBSMainActivity.this.scaHTxtFld.setText(DF.format(sight.getAH())); | |||
| @@ -269,16 +272,15 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi | |||
| + DF.format(sight.getVertSkalaRangeMax())); | |||
| } else { | |||
| RBSMainActivity.this.scHeVSSpinner.setVisibility(View.INVISIBLE); | |||
| RBSMainActivity.this.scHeVSSpinner.setLayoutParams(new LinearLayout.LayoutParams(RBSMainActivity.this.scHeVSSpinner | |||
| .getLayoutParams().width, | |||
| RBSMainActivity.this.scHeVSSpinner | |||
| .getLayoutParams().height, 0f)); | |||
| RBSMainActivity.this.scHeVSSpinner.setLayoutParams(new LinearLayout.LayoutParams(RBSMainActivity.this.scHeVSSpinner.getLayoutParams().width, | |||
| RBSMainActivity.this.scHeVSSpinner.getLayoutParams().height, | |||
| 0f)); | |||
| RBSMainActivity.this.scHeVSTxtFld.setVisibility(View.VISIBLE); | |||
| RBSMainActivity.this.scHeVSTxtFld.setLayoutParams(new LinearLayout.LayoutParams(RBSMainActivity.this.scHeVSTxtFld | |||
| .getLayoutParams().width, | |||
| RBSMainActivity.this.scHeVSTxtFld | |||
| .getLayoutParams().height, 1f)); | |||
| RBSMainActivity.this.scHeVSSpinner.setAdapter(new FontArrayAdapter<String>(RBSMainActivity.this, R.layout.rbs_spinner, | |||
| RBSMainActivity.this.scHeVSTxtFld.setLayoutParams(new LinearLayout.LayoutParams(RBSMainActivity.this.scHeVSTxtFld.getLayoutParams().width, | |||
| RBSMainActivity.this.scHeVSTxtFld.getLayoutParams().height, | |||
| 1f)); | |||
| RBSMainActivity.this.scHeVSSpinner.setAdapter(new FontArrayAdapter<String>(RBSMainActivity.this, | |||
| R.layout.rbs_spinner, | |||
| new ArrayList<String>(), | |||
| RBSMainActivity.this.scHeVSSpinner)); | |||
| RBSMainActivity.this.scaVTxtFld.setText(""); | |||
| @@ -562,13 +564,13 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi | |||
| private void xTextViewDown(final XTextView view) { | |||
| view.setDrawborderColor(getResources().getColor(R.color.android_blue_dark)); | |||
| view.setTextColor(getResources().getColor(R.color.android_blue_dark)); | |||
| view.setDrawborderColor(getResources().getColor(R.color.android_yellow_dark)); | |||
| view.setTextColor(getResources().getColor(R.color.android_yellow_dark)); | |||
| } | |||
| private void xTextViewUp(final XTextView view) { | |||
| view.setDrawborderColor(getResources().getColor(R.color.android_blue)); | |||
| view.setTextColor(getResources().getColor(R.color.android_blue)); | |||
| view.setDrawborderColor(getResources().getColor(R.color.android_yellow)); | |||
| view.setTextColor(getResources().getColor(R.color.android_yellow)); | |||
| } | |||
| private void deactivateXTextView(final XTextView view) { | |||
| @@ -686,21 +688,15 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi | |||
| Double vVh = Double.valueOf(this.scVvisHTxtFld.getText().toString()) + Double.valueOf(this.scaHTxtFld.getText().toString()); | |||
| Double vVv = Double.valueOf(this.scVvisVTxtFld.getText().toString()) + Double.valueOf(this.scaVTxtFld.getText().toString()); | |||
| Double a = Double.valueOf(this.bowPulloutTxtFld.getText().toString()) * 10; | |||
| Double heVs = this.scHeVSSpinner.getVisibility() == View.VISIBLE ? Double.valueOf(this.scHeVSSpinner.getSelectedItem().toString()) | |||
| : Double.valueOf(this.scHeVSTxtFld.getText().toString()); | |||
| Double heVs = this.scHeVSSpinner.getVisibility() == View.VISIBLE ? Double.valueOf(this.scHeVSSpinner.getSelectedItem().toString()) : Double.valueOf(this.scHeVSTxtFld.getText().toString()); | |||
| Double lhNA = this.selectedArcherySetup.getHNA() * 10; | |||
| Double dltH = (Double.valueOf(this.arrowNockHeightTxtFld.getText().toString()) | |||
| - Double.valueOf(this.targetCenterHeightTxtFld.getText().toString())) * Math.pow(10, 3); | |||
| Double ldistH = Double.valueOf(this.shootingDistanzTxtFld.getText().toString()) * Math.pow(10, 3); | |||
| Double minSkala = this.scVertScaleRngTxtFld.getText().toString().contains("-") | |||
| ? Double.valueOf(this.scVertScaleRngTxtFld.getText().toString().substring(0, | |||
| this.scVertScaleRngTxtFld.getText().toString() | |||
| .indexOf('-'))) : 0d; | |||
| Double maxSkala = this.scVertScaleRngTxtFld.getText().toString().contains("-") | |||
| ? Double.valueOf(this.scVertScaleRngTxtFld.getText().toString().substring(this.scVertScaleRngTxtFld.getText().toString() | |||
| .indexOf('-') + 1, | |||
| this.scVertScaleRngTxtFld.getText().toString() | |||
| .length())) : 0d; | |||
| Double minSkala = this.scVertScaleRngTxtFld.getText().toString().contains("-") ? Double.valueOf(this.scVertScaleRngTxtFld.getText().toString().substring(0, | |||
| this.scVertScaleRngTxtFld.getText().toString().indexOf('-'))) : 0d; | |||
| Double maxSkala = this.scVertScaleRngTxtFld.getText().toString().contains("-") ? Double.valueOf(this.scVertScaleRngTxtFld.getText().toString().substring(this.scVertScaleRngTxtFld.getText().toString().indexOf('-') + 1, | |||
| this.scVertScaleRngTxtFld.getText().toString().length())) : 0d; | |||
| // PIN auf Höhe Pfeil | |||
| x0 = (a + vVh + heVs) * Math.cos(Math.toRadians(this.startAngle)); | |||
| @@ -6,11 +6,7 @@ package ch.spherIC.recurvebowsight.components; | |||
| import android.content.Context; | |||
| import android.view.LayoutInflater; | |||
| import android.view.MotionEvent; | |||
| import android.view.View; | |||
| import android.view.View.OnTouchListener; | |||
| import android.view.ViewGroup; | |||
| import android.widget.ArrayAdapter; | |||
| @@ -73,12 +69,12 @@ public class FontArrayAdapter<O extends Object> extends ArrayAdapter<O> { | |||
| ImageView checkBoxView = (ImageView) spinnerItem.findViewById(R.id.spinner_item_checkBox); | |||
| textView.setText(getItem(position).toString()); | |||
| spinnerItem.setBackgroundColor(getContext().getResources().getColor(android.R.color.background_dark)); | |||
| spinnerItem.setOnTouchListener(new DropDownOnTouchListener()); | |||
| spinnerItem.setBackgroundResource(R.drawable.list_item_background); | |||
| if (this.parentSpinner.getSelectedItemPosition() == position) { | |||
| textView.setFont(getContext(), "fonts/TitilliumWeb-Bold.ttf"); | |||
| textView.setTextColor(getContext().getResources().getColor(R.color.android_blue_dark)); | |||
| textView.setSelected(true); | |||
| // textView.setTextColor(getContext().getResources().getColor(R.color.android_blue_dark)); | |||
| checkBoxView.setVisibility(View.VISIBLE); | |||
| } else { | |||
| checkBoxView.setVisibility(View.INVISIBLE); | |||
| @@ -90,28 +86,4 @@ public class FontArrayAdapter<O extends Object> extends ArrayAdapter<O> { | |||
| protected LayoutInflater getLayoutInflater() { | |||
| return (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |||
| } | |||
| /** | |||
| * @author FC Smilari | |||
| */ | |||
| class DropDownOnTouchListener implements OnTouchListener { | |||
| @Override | |||
| public boolean onTouch(final View v, final MotionEvent event) { | |||
| switch (event.getAction()) { | |||
| case MotionEvent.ACTION_DOWN: { | |||
| v.setBackgroundColor(getContext().getResources().getColor(R.color.android_blue)); | |||
| ((FontTextView) v.findViewById(R.id.spinner_item_view)).setTextColor(getContext().getResources().getColor(R.color.black)); | |||
| break; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| } | |||
| @@ -82,10 +82,10 @@ public class XImageView extends ImageView { | |||
| */ | |||
| private void init(final AttributeSet attrs) { | |||
| TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.XTextView); | |||
| this.drawborder = a.getBoolean(R.styleable.XTextView_drawBorder, false); | |||
| this.drawborderColor = a.getColor(R.styleable.XTextView_drawBorderColor, 0xffff0000); | |||
| this.drawborderWidth = a.getDimensionPixelSize(R.styleable.XTextView_drawBorderWidth, 1); | |||
| TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.XImageView); | |||
| this.drawborder = a.getBoolean(R.styleable.XImageView_drawImgBorder, false); | |||
| this.drawborderColor = a.getColor(R.styleable.XImageView_drawImgBorderColor, 0xffff0000); | |||
| this.drawborderWidth = a.getDimensionPixelSize(R.styleable.XImageView_drawImgBorderWidth, 1); | |||
| if (this.drawborder) { | |||
| setPadding(getPaddingLeft() + this.drawborderWidth, getPaddingTop() + this.drawborderWidth, getPaddingRight() + this.drawborderWidth, | |||
| @@ -18,7 +18,6 @@ import android.widget.AdapterView; | |||
| import android.widget.AdapterView.OnItemClickListener; | |||
| import android.widget.ListView; | |||
| import android.widget.TextView; | |||
| import ch.spherIC.recurvebowsight.R; | |||
| import ch.spherIC.recurvebowsight.RBSMainActivity; | |||
| @@ -56,19 +55,21 @@ public class ChooseArcherySetupDlg extends Dialog { | |||
| final ListView listView = (ListView) findViewById(R.id.chooseArcerySetupItemsList); | |||
| List<IArcherySetup> setups = new ArrayList<IArcherySetup>(); | |||
| setups.add(new ArcherySetup(-999, "", null, null, null, null, null, null, null, null, null, null, null, null, null, null)); | |||
| setups.add(new ArcherySetup(-999, "", null, null, null, null, null, null, null, null, null, null, null, null, | |||
| null, null)); | |||
| setups.addAll(ArcherySetupDao.getInstance().loadAll()); | |||
| listView.setAdapter(new ArcerySetupArrayAdapter(getContext(), R.layout.rbs_archerysetup_item, setups)); | |||
| listView.setOnItemClickListener(new OnItemClickListener() { | |||
| @Override | |||
| public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) { | |||
| public void onItemClick(final AdapterView<?> parent, final View view, final int position, | |||
| final long id) { | |||
| ChooseArcherySetupDlg.this.archerySetup = (IArcherySetup) listView.getItemAtPosition(position); | |||
| dismiss(); | |||
| } | |||
| }); | |||
| ((TextView) findViewById(android.R.id.title)).setTextColor(getContext().getResources().getColor(R.color.android_blue)); | |||
| // ((TextView) findViewById(android.R.id.title)).setTextColor(getContext().getResources().getColor(R.color.android_blue)); | |||
| setOnDismissListener(new OnDismissListener() { | |||
| @Override | |||