| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | <project version="4"> | ||||
| <component name="Encoding"> | <component name="Encoding"> | ||||
| <file url="file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java" charset="windows-1252" /> | |||||
| <file url="file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/IEntity.java" charset="windows-1252" /> | |||||
| <file url="file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java" charset="UTF-8" /> | |||||
| <file url="file://$PROJECT_DIR$/app/src/main/java/ch/spherIC/recurvebowsight/model/IEntity.java" charset="UTF-8" /> | |||||
| <file url="PROJECT" charset="UTF-8" /> | |||||
| </component> | </component> | ||||
| </project> | </project> |
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight.xml" value="0.15812841530054644" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_calcsight.xml" value="0.15812841530054644" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment.xml" value="0.12361111111111112" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment.xml" value="0.12361111111111112" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_add.xml" value="0.15812841530054644" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_add.xml" value="0.15812841530054644" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_choose.xml" value="0.12361111111111112" /> | |||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_choose.xml" value="0.33" /> | |||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_choose_list.xml" value="0.25" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_equipment_choose_list.xml" value="0.25" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_gallery.xml" value="0.1480978260869565" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_gallery.xml" value="0.1480978260869565" /> | ||||
| <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_home.xml" value="0.14855072463768115" /> | <entry key="..\:/Work/Java Projects/Android/RecurveBowSight/V2/app/src/main/res/layout/fragment_home.xml" value="0.14855072463768115" /> |
| <property name="format.on.save" value="true" /> | <property name="format.on.save" value="true" /> | ||||
| <property name="last_opened_file_path" value="$PROJECT_DIR$/.." /> | <property name="last_opened_file_path" value="$PROJECT_DIR$/.." /> | ||||
| <property name="optimize.imports.on.save" value="true" /> | <property name="optimize.imports.on.save" value="true" /> | ||||
| <property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.Java" /> | |||||
| <property name="settings.editor.selected.configurable" value="File.Encoding" /> | |||||
| </component> | </component> | ||||
| <component name="RecentsManager"> | <component name="RecentsManager"> | ||||
| <key name="CopyFile.RECENT_KEYS"> | <key name="CopyFile.RECENT_KEYS"> |
| return this.sight; | return this.sight; | ||||
| } | } | ||||
| @Override | |||||
| public String getSightName() { | |||||
| return this.sight != null ? this.sight.getManufacturer() + " " + this.sight.getModel() : ""; | |||||
| } | |||||
| /** | /** | ||||
| * @param sight the sight to set | * @param sight the sight to set | ||||
| */ | */ | ||||
| return this.riser; | return this.riser; | ||||
| } | } | ||||
| @Override | |||||
| public String getRiserName() { | |||||
| return this.riser != null ? this.riser.getManufacturer() + " " + this.riser.getModel() : ""; | |||||
| } | |||||
| /** | /** | ||||
| * @param riser the riser to set | * @param riser the riser to set | ||||
| */ | */ |
| ISight getSight(); | ISight getSight(); | ||||
| String getSightName(); | |||||
| void setSight(ISight sight); | void setSight(ISight sight); | ||||
| IRiser getRiser(); | IRiser getRiser(); | ||||
| String getRiserName(); | |||||
| void setRiser(IRiser riser); | void setRiser(IRiser riser); | ||||
| Double getArrowDiameter(); | Double getArrowDiameter(); |
| package ch.spherIC.recurvebowsight.model; | package ch.spherIC.recurvebowsight.model; | ||||
| /** | /** | ||||
| * Vaterklasse aller Entitäten. | |||||
| * Baseclass for all entities. | |||||
| * | * | ||||
| * @author F. Smilari | * @author F. Smilari | ||||
| */ | */ |
| import android.view.View; | import android.view.View; | ||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import androidx.fragment.app.Fragment; | import androidx.fragment.app.Fragment; | ||||
| import androidx.recyclerview.widget.GridLayoutManager; | import androidx.recyclerview.widget.GridLayoutManager; | ||||
| import androidx.recyclerview.widget.LinearLayoutManager; | import androidx.recyclerview.widget.LinearLayoutManager; | ||||
| import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||
| import ch.spherIC.recurvebowsight.R; | import ch.spherIC.recurvebowsight.R; | ||||
| import ch.spherIC.recurvebowsight.placeholder.PlaceholderContent; | |||||
| import ch.spherIC.recurvebowsight.database.dao.ArcherySetupDao; | |||||
| import ch.spherIC.recurvebowsight.model.ArcherySetup; | |||||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||||
| /** | /** | ||||
| * A fragment representing a list of Items. | * A fragment representing a list of Items. | ||||
| } else { | } else { | ||||
| recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount)); | recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount)); | ||||
| } | } | ||||
| recyclerView.setAdapter(new EquipmentRecyclerViewAdapter(PlaceholderContent.ITEMS)); | |||||
| recyclerView.setAdapter(new EquipmentRecyclerViewAdapter(getAllArcherySetups(), context)); | |||||
| } | } | ||||
| return view; | return view; | ||||
| } | } | ||||
| private List<IArcherySetup> getAllArcherySetups() { | |||||
| 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, null, null)); | |||||
| setups.addAll(ArcherySetupDao.getInstance().loadAll()); | |||||
| return setups; | |||||
| } | |||||
| } | } |
| package ch.spherIC.recurvebowsight.ui.equipment; | package ch.spherIC.recurvebowsight.ui.equipment; | ||||
| import android.content.Context; | |||||
| import android.view.LayoutInflater; | import android.view.LayoutInflater; | ||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||
| import android.widget.TextView; | import android.widget.TextView; | ||||
| import java.util.List; | import java.util.List; | ||||
| import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||
| import ch.spherIC.recurvebowsight.R; | |||||
| import ch.spherIC.recurvebowsight.databinding.FragmentEquipmentChooseBinding; | import ch.spherIC.recurvebowsight.databinding.FragmentEquipmentChooseBinding; | ||||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||||
| import ch.spherIC.recurvebowsight.placeholder.PlaceholderContent.PlaceholderItem; | import ch.spherIC.recurvebowsight.placeholder.PlaceholderContent.PlaceholderItem; | ||||
| /** | /** | ||||
| */ | */ | ||||
| public class EquipmentRecyclerViewAdapter extends RecyclerView.Adapter<EquipmentRecyclerViewAdapter.ViewHolder> { | public class EquipmentRecyclerViewAdapter extends RecyclerView.Adapter<EquipmentRecyclerViewAdapter.ViewHolder> { | ||||
| private final List<PlaceholderItem> mValues; | |||||
| private final List<IArcherySetup> archerySetups; | |||||
| private final Context context; | |||||
| public EquipmentRecyclerViewAdapter(List<PlaceholderItem> items) { | |||||
| mValues = items; | |||||
| public EquipmentRecyclerViewAdapter(List<IArcherySetup> items, Context context) { | |||||
| this.context = context; | |||||
| this.archerySetups = items; | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||||
| return new ViewHolder(FragmentEquipmentChooseBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | return new ViewHolder(FragmentEquipmentChooseBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void onBindViewHolder(final ViewHolder holder, int position) { | public void onBindViewHolder(final ViewHolder holder, int position) { | ||||
| holder.mItem = mValues.get(position); | |||||
| holder.mIdView.setText(mValues.get(position).id); | |||||
| holder.mContentView.setText(mValues.get(position).content); | |||||
| IArcherySetup archerySetup = archerySetups.get(position); | |||||
| holder.archerySetup = archerySetup; | |||||
| holder.mSetupNameView.setText(getSetupName(archerySetup)); | |||||
| holder.mRiserNameView.setText(getRiserName(archerySetup)); | |||||
| holder.mSightNameView.setText(getSightName(archerySetup)); | |||||
| } | |||||
| private String getSetupName(IArcherySetup archerySetup) { | |||||
| return archerySetup.getId() == -999 ? this.context.getString(R.string.caption_NoSelection) : archerySetup.getName(); | |||||
| } | |||||
| private String getRiserName(IArcherySetup archerySetup) { | |||||
| return archerySetup.getId() == -999 ? "-" : archerySetup.getRiserName(); | |||||
| } | |||||
| private String getSightName(IArcherySetup archerySetup) { | |||||
| return archerySetup.getId() == -999 ? "-" : archerySetup.getSightName(); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int getItemCount() { | public int getItemCount() { | ||||
| return mValues.size(); | |||||
| return archerySetups.size(); | |||||
| } | } | ||||
| public class ViewHolder extends RecyclerView.ViewHolder { | public class ViewHolder extends RecyclerView.ViewHolder { | ||||
| public final TextView mIdView; | |||||
| public final TextView mContentView; | |||||
| public PlaceholderItem mItem; | |||||
| public final TextView mSetupNameView; | |||||
| public final TextView mRiserNameView; | |||||
| public final TextView mSightNameView; | |||||
| public IArcherySetup archerySetup; | |||||
| public ViewHolder(FragmentEquipmentChooseBinding binding) { | public ViewHolder(FragmentEquipmentChooseBinding binding) { | ||||
| super(binding.getRoot()); | super(binding.getRoot()); | ||||
| mIdView = binding.itemNumber; | |||||
| mContentView = binding.content; | |||||
| mSetupNameView = binding.setupName; | |||||
| mRiserNameView = binding.riserName; | |||||
| mSightNameView = binding.sightName; | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return super.toString() + " '" + mContentView.getText() + "'"; | |||||
| return super.toString() + " '" + mSetupNameView.getText() + "'"; | |||||
| } | } | ||||
| } | } | ||||
| } | } |
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| android:layout_width="wrap_content" | |||||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
| android:orientation="horizontal"> | android:orientation="horizontal"> | ||||
| <TextView | |||||
| android:id="@+id/item_number" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| <androidx.cardview.widget.CardView | |||||
| android:id="@+id/card_view_border" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent" | |||||
| android:layout_margin="@dimen/text_margin" | android:layout_margin="@dimen/text_margin" | ||||
| android:textAppearance="?attr/textAppearanceListItem" /> | |||||
| android:backgroundTint="#54AAD1" | |||||
| app:cardCornerRadius="20dp" | |||||
| app:cardElevation="10dp" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent"> | |||||
| <TextView | |||||
| android:id="@+id/content" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="@dimen/text_margin" | |||||
| android:textAppearance="?attr/textAppearanceListItem" /> | |||||
| </LinearLayout> | |||||
| <androidx.constraintlayout.widget.ConstraintLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent"> | |||||
| <androidx.cardview.widget.CardView | |||||
| android:id="@+id/card_view_setup" | |||||
| android:layout_width="fill_parent" | |||||
| android:layout_height="fill_parent" | |||||
| android:layout_marginBottom="4dp" | |||||
| android:layout_marginEnd="4dp" | |||||
| android:layout_marginStart="4dp" | |||||
| android:layout_marginTop="4dp" | |||||
| app:cardBackgroundColor="#74CBF3" | |||||
| app:cardCornerRadius="16dp" | |||||
| app:cardElevation="0dp" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintEnd_toEndOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent"> | |||||
| <androidx.constraintlayout.widget.ConstraintLayout | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent"> | |||||
| <TextView | |||||
| android:id="@+id/setup_name" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_margin="@dimen/text_margin" | |||||
| android:layout_marginStart="16dp" | |||||
| android:layout_marginTop="20dp" | |||||
| android:text="setup_name" | |||||
| android:textAppearance="@style/TextAppearance.AppCompat.Large" | |||||
| app:layout_constraintStart_toEndOf="@+id/setup_image_view" | |||||
| app:layout_constraintTop_toTopOf="parent" /> | |||||
| <TextView | |||||
| android:id="@+id/riser_name" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginBottom="20dp" | |||||
| android:layout_marginStart="16dp" | |||||
| android:text="riser_name" | |||||
| android:textAppearance="@style/TextAppearance.AppCompat.Medium" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintStart_toEndOf="@+id/setup_image_view" /> | |||||
| <TextView | |||||
| android:id="@+id/spacer" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginBottom="20dp" | |||||
| android:layout_marginStart="10dp" | |||||
| android:text="●" | |||||
| android:textAppearance="@style/TextAppearance.AppCompat.Medium" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintStart_toEndOf="@+id/riser_name" /> | |||||
| <TextView | |||||
| android:id="@+id/sight_name" | |||||
| android:layout_width="wrap_content" | |||||
| android:layout_height="wrap_content" | |||||
| android:layout_marginBottom="20dp" | |||||
| android:layout_marginStart="10dp" | |||||
| android:text="sight_name" | |||||
| android:textAppearance="@style/TextAppearance.AppCompat.Medium" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintStart_toEndOf="@+id/spacer" /> | |||||
| <androidx.cardview.widget.CardView | |||||
| android:id="@+id/setup_image_view" | |||||
| android:layout_width="64dp" | |||||
| android:layout_height="64dp" | |||||
| android:layout_marginBottom="20dp" | |||||
| android:layout_marginStart="20dp" | |||||
| android:layout_marginTop="20dp" | |||||
| android:contentDescription="@string/menu_equipment" | |||||
| app:cardCornerRadius="8dp" | |||||
| app:cardElevation="0dp" | |||||
| app:layout_constraintBottom_toBottomOf="parent" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent"> | |||||
| <ImageView | |||||
| android:id="@+id/setup_image" | |||||
| android:layout_width="match_parent" | |||||
| android:layout_height="match_parent" | |||||
| android:background="@drawable/side_nav_bar" | |||||
| android:contentDescription="@string/menu_equipment" | |||||
| app:layout_constraintStart_toStartOf="parent" | |||||
| app:layout_constraintTop_toTopOf="parent" | |||||
| app:srcCompat="@drawable/ic_menu_equipment" /> | |||||
| </androidx.cardview.widget.CardView> | |||||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||||
| </androidx.cardview.widget.CardView> | |||||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||||
| </androidx.cardview.widget.CardView> | |||||
| </androidx.constraintlayout.widget.ConstraintLayout> |
| <string name="menu_equipment_add">Ausrüstung hinzufügen</string> | <string name="menu_equipment_add">Ausrüstung hinzufügen</string> | ||||
| <string name="menu_equipment_choose">Ausrüstung wählen</string> | <string name="menu_equipment_choose">Ausrüstung wählen</string> | ||||
| <string name="menu_calculate_sight">Visiereinstellung berechnen</string> | <string name="menu_calculate_sight">Visiereinstellung berechnen</string> | ||||
| <string name="caption_NoSelection">Keine Auswahl...</string> | |||||
| </resources> | </resources> |
| <string name="menu_equipment_add">Add Equipment</string> | <string name="menu_equipment_add">Add Equipment</string> | ||||
| <string name="menu_equipment_choose">Choose Equipment</string> | <string name="menu_equipment_choose">Choose Equipment</string> | ||||
| <string name="menu_calculate_sight">Calculate Sight</string> | <string name="menu_calculate_sight">Calculate Sight</string> | ||||
| <string name="caption_NoSelection">No Selection...</string> | |||||
| <!-- TODO: Remove or change this placeholder text --> | <!-- TODO: Remove or change this placeholder text --> | ||||
| <string name="hello_blank_fragment">Hello blank fragment</string> | |||||
| </resources> | </resources> |