diff --git a/.idea/misc.xml b/.idea/misc.xml
index 406ac20..738edfe 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -56,7 +56,7 @@
-
+
diff --git a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/DatabaseHandler.java b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/DatabaseHandler.java
index c577cbb..ca31f6e 100644
--- a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/DatabaseHandler.java
+++ b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/DatabaseHandler.java
@@ -70,7 +70,7 @@ public class DatabaseHandler extends SQLiteAssetHelper {
values.put(Constants.KEY_GAME, track.getGame());
values.put(Constants.KEY_NAME, track.getName());
values.put(Constants.KEY_PACKAGE, track.getPackage());
- values.put(Constants.KEY_NUMBER, track.getmNumber());
+ values.put(Constants.KEY_NUMBER, track.getNumber());
if (isAvailable) {
values.put(Constants.KEY_AVAILABLE, String.valueOf(Constants.TRUE));
} else {
diff --git a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/database_models/Track.java b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/database_models/Track.java
index 8808c3e..13a2746 100644
--- a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/database_models/Track.java
+++ b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/database_models/Track.java
@@ -152,7 +152,7 @@ public class Track {
*
* @return the number of the track within the package.
*/
- public int getmNumber() {
+ public int getNumber() {
return mNumber;
}
@@ -161,7 +161,7 @@ public class Track {
*
* @param number the number of the track within the package.
*/
- public void setmNumber(int number) {
+ public void setNumber(int number) {
mNumber = number;
}
diff --git a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleAccessoryFragment.java b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleAccessoryFragment.java
new file mode 100644
index 0000000..a3189c6
--- /dev/null
+++ b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleAccessoryFragment.java
@@ -0,0 +1,124 @@
+package com.de.aldo_apps.aldo.mariokartcircuitselector.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+
+import com.de.aldo_apps.aldo.mariokartcircuitselector.DatabaseHandler;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.R;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.database_models.Accessory;
+
+/**
+ * The SingleAccessoryFragment which displays all information of a single accessory object. Also
+ * this fragment handles the onClick. Based on the Click we will toggle the availability of this
+ * object in the database.
+ *
+ * @author aldo7224
+ * @version 0.1
+ * @since 10.08.2017
+ */
+public class SingleAccessoryFragment extends Fragment {
+
+ /**
+ * The Tag for Debugging Output.
+ */
+ private static final String TAG = "SingleAccessoryFragment";
+
+ /**
+ * Checkbox indicating the current availability status of the single accessory object.
+ */
+ private CheckBox mAccessoryAvailable;
+
+ /**
+ * TextView displaying the name of the single accessory object.
+ */
+ private TextView mAccessoryName;
+
+ /**
+ * The accessory object assigned to this fragment.
+ */
+ private Accessory mAccessory;
+
+ /**
+ * The Database handler passed from the activity to handle database operations.
+ */
+ private DatabaseHandler mHandler;
+
+ @Override
+ public View onCreateView(final LayoutInflater inflater,
+ final ViewGroup container,
+ final Bundle savedInstanceState) {
+ // Inflate the GenericListItem and return it. All Operations on the View will be handled
+ // in own functions.
+ return inflater.inflate(R.layout.generic_list_item, container, false);
+ }
+
+
+ @Override
+ public void onViewCreated(final View view, final Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Initialize the Views and member variables.
+ // Make all the Visible/Invisible/Gone Actions here as we know which information will be
+ // shown here.
+ initViews(view);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(final View view) {
+ if (mAccessoryAvailable != null) {
+ mAccessoryAvailable.toggle();
+ }
+ }
+ });
+ }
+
+ /**
+ * Helper method to initialize all View objects and toggle the visibility as we now know which
+ * object should be passed into the fragment.
+ *
+ * @param view The Parent View.
+ */
+ private void initViews(final View view) {
+ mAccessoryAvailable = (CheckBox) view.findViewById(R.id.availability_checkbox);
+ // Assign a CheckedChange Listener to the Checkbox, so we can update the status in the
+ // database as well.
+ mAccessoryAvailable.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(final CompoundButton compoundButton,
+ final boolean availability) {
+ if (mHandler != null && mAccessory != null) {
+ mHandler.changeAccessoryAvailability(mAccessory, availability);
+ } else {
+ Log.d(TAG, "onCheckedChanged: Either Handler or Accessory are null!");
+ }
+ }
+ });
+
+ // Mark the Container as GONE.
+ final View additionalInfoContainer = view.findViewById(R.id.multiple_information_container);
+ additionalInfoContainer.setVisibility(View.GONE);
+
+ // Initialize all single views and make them visible.
+ mAccessoryName = (TextView) view.findViewById(R.id.single_info_name);
+ mAccessoryName.setVisibility(View.VISIBLE);
+ }
+
+ /**
+ * Helper method which sets the real texts/arguments to the view objects.
+ *
+ * @param accessory The Accessory object of which we will retrieve our texts/arguments.
+ * @param handler The Database handler which handles the database operations.
+ */
+ public void setArguments(final Accessory accessory, final DatabaseHandler handler) {
+ mAccessory = accessory;
+ mHandler = handler;
+ mAccessoryAvailable.setChecked(accessory.getAvailable());
+ mAccessoryName.setText(accessory.getName());
+ }
+}
diff --git a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleCharacterFragment.java b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleCharacterFragment.java
new file mode 100644
index 0000000..91a3213
--- /dev/null
+++ b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleCharacterFragment.java
@@ -0,0 +1,140 @@
+package com.de.aldo_apps.aldo.mariokartcircuitselector.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+
+import com.de.aldo_apps.aldo.mariokartcircuitselector.DatabaseHandler;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.R;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.database_models.Character;
+
+/**
+ * The SingleCharacterFragment which displays all information of a single character object. Also
+ * this fragment handles the onClick. Based on the Click we will toggle the availability of this
+ * object in the database.
+ *
+ * @author aldo7224
+ * @version 0.1
+ * @since 10.08.2017
+ */
+public class SingleCharacterFragment extends Fragment {
+
+ /**
+ * The Tag for Debugging Output.
+ */
+ private static final String TAG = "SingleCharacterFragment";
+
+ /**
+ * Checkbox indicating the current availability status of the single character object.
+ */
+ private CheckBox mCharacterAvailable;
+
+ /**
+ * TextView displaying the name of the single character object.
+ */
+ private TextView mCharacterName;
+
+ /**
+ * TextView displaying the package (Cup) of the single character object.
+ */
+ private TextView mCharacterWeight;
+
+ /**
+ * The character object assigned to this fragment.
+ */
+ private Character mCharacter;
+
+ /**
+ * The Database handler passed from the activity to handle database operations.
+ */
+ private DatabaseHandler mHandler;
+
+ @Override
+ public View onCreateView(final LayoutInflater inflater,
+ final ViewGroup container,
+ final Bundle savedInstanceState) {
+ // Inflate the GenericListItem and return it. All Operations on the View will be handled
+ // in own functions.
+ return inflater.inflate(R.layout.generic_list_item, container, false);
+ }
+
+
+ @Override
+ public void onViewCreated(final View view, final Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Initialize the Views and member variables.
+ // Make all the Visible/Invisible/Gone Actions here as we know which information will be
+ // shown here.
+ initViews(view);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(final View view) {
+ if (mCharacterAvailable != null) {
+ mCharacterAvailable.toggle();
+ }
+ }
+ });
+ }
+
+ /**
+ * Helper method to initialize all View objects and toggle the visibility as we now know which
+ * object should be passed into the fragment.
+ *
+ * @param view The Parent View.
+ */
+ private void initViews(final View view) {
+ mCharacterAvailable = (CheckBox) view.findViewById(R.id.availability_checkbox);
+ // Assign a CheckedChange Listener to the Checkbox, so we can update the status in the
+ // database as well.
+ mCharacterAvailable.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(final CompoundButton compoundButton,
+ final boolean availability) {
+ if (mHandler != null && mCharacter != null) {
+ mHandler.changeCharacterAvailability(mCharacter, availability);
+ } else {
+ Log.d(TAG, "onCheckedChanged: Either Handler or Character are null!");
+ }
+ }
+ });
+
+ // Make the Container Visible.
+ final View additionalInfoContainer = view.findViewById(R.id.multiple_information_container);
+ additionalInfoContainer.setVisibility(View.VISIBLE);
+
+ // Initialize all single views and make them visible.
+ mCharacterName = (TextView) view.findViewById(R.id.multi_view_name);
+ mCharacterWeight = (TextView) view.findViewById(R.id.additional_info_first);
+ mCharacterWeight.setVisibility(View.VISIBLE);
+ final View separator = view.findViewById(R.id.additional_information_separator);
+ separator.setVisibility(View.GONE);
+ final View secondInfo = view.findViewById(R.id.additional_info_second);
+ secondInfo.setVisibility(View.GONE);
+
+ // Mark the single name view (without additional information) as GONE
+ final View singleName = view.findViewById(R.id.single_info_name);
+ singleName.setVisibility(View.GONE);
+ }
+
+ /**
+ * Helper method which sets the real texts/arguments to the view objects.
+ *
+ * @param character The Character object of which we will retrieve our texts/arguments.
+ * @param handler The Database handler which handles the database operations.
+ */
+ public void setArguments(final Character character, final DatabaseHandler handler) {
+ mCharacter = character;
+ mHandler = handler;
+ mCharacterAvailable.setChecked(character.getAvailable());
+ mCharacterName.setText(character.getName());
+ mCharacterWeight.setText(character.getWeight());
+ }
+
+}
diff --git a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleKartFragment.java b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleKartFragment.java
new file mode 100644
index 0000000..47045cf
--- /dev/null
+++ b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleKartFragment.java
@@ -0,0 +1,146 @@
+package com.de.aldo_apps.aldo.mariokartcircuitselector.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+
+import com.de.aldo_apps.aldo.mariokartcircuitselector.DatabaseHandler;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.R;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.database_models.Kart;
+
+/**
+ * The SingleKartFragment which displays all information of a single kart object. Also this fragment
+ * handles the onClick. Based on the Click we will toggle the availability of this object in the
+ * database.
+ *
+ * @author aldo7224
+ * @version 0.1
+ * @since 10.08.2017
+ */
+public class SingleKartFragment extends Fragment {
+
+ /**
+ * The Tag for Debugging Output.
+ */
+ private static final String TAG = "SingleKartFragment";
+
+ /**
+ * Checkbox indicating the current availability status of the single kart object.
+ */
+ private CheckBox mKartAvailable;
+
+ /**
+ * TextView displaying the name of the single kart object.
+ */
+ private TextView mKartName;
+
+ /**
+ * TextView displaying the weight of the single kart object.
+ */
+ private TextView mKartWeight;
+
+ /**
+ * TextView displaying the dedicated Driver of the single kart object.
+ */
+ private TextView mKartDedicatedDriver;
+
+ /**
+ * The kart object assigned to this fragment.
+ */
+ private Kart mKart;
+
+ /**
+ * The Database handler passed from the activity to handle database operations.
+ */
+ private DatabaseHandler mHandler;
+
+ @Override
+ public View onCreateView(final LayoutInflater inflater,
+ final ViewGroup container,
+ final Bundle savedInstanceState) {
+ // Inflate the GenericListItem and return it. All Operations on the View will be handled
+ // in own functions.
+ return inflater.inflate(R.layout.generic_list_item, container, false);
+ }
+
+
+ @Override
+ public void onViewCreated(final View view, final Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Initialize the Views and member variables.
+ // Make all the Visible/Invisible/Gone Actions here as we know which information will be
+ // shown here.
+ initViews(view);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(final View view) {
+ if (mKartAvailable != null) {
+ mKartAvailable.toggle();
+ }
+ }
+ });
+ }
+
+ /**
+ * Helper method to initialize all View objects and toggle the visibility as we now know which
+ * object should be passed into the fragment.
+ *
+ * @param view The Parent View.
+ */
+ private void initViews(final View view) {
+ mKartAvailable = (CheckBox) view.findViewById(R.id.availability_checkbox);
+ // Assign a CheckedChange Listener to the Checkbox, so we can update the status in the
+ // database as well.
+ mKartAvailable.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(final CompoundButton compoundButton,
+ final boolean availability) {
+ if (mHandler != null && mKart != null) {
+ mHandler.changeKartAvailability(mKart, availability);
+ } else {
+ Log.d(TAG, "onCheckedChanged: Either Handler or Kart are null!");
+ }
+ }
+ });
+
+ // Make the Container Visible.
+ final View additionalInfoContainer = view.findViewById(R.id.multiple_information_container);
+ additionalInfoContainer.setVisibility(View.VISIBLE);
+
+ // Initialize all single views and make them visible.
+ mKartName = (TextView) view.findViewById(R.id.multi_view_name);
+ mKartWeight = (TextView) view.findViewById(R.id.additional_info_first);
+ mKartWeight.setVisibility(View.VISIBLE);
+ final View separator = view.findViewById(R.id.additional_information_separator);
+ separator.setVisibility(View.VISIBLE);
+ mKartDedicatedDriver = (TextView) view.findViewById(R.id.additional_info_second);
+ mKartDedicatedDriver.setVisibility(View.VISIBLE);
+
+ // Mark the single name view (without additional information) as GONE
+ final View singleName = view.findViewById(R.id.single_info_name);
+ singleName.setVisibility(View.GONE);
+ }
+
+ /**
+ * Helper method which sets the real texts/arguments to the view objects.
+ *
+ * @param kart The Kart object of which we will retrieve our texts/arguments.
+ * @param handler The Database handler which handles the database operations.
+ */
+ public void setArguments(final Kart kart, final DatabaseHandler handler) {
+ mKart = kart;
+ mHandler = handler;
+ mKartAvailable.setChecked(kart.getAvailable());
+ mKartName.setText(kart.getName());
+ mKartWeight.setText(kart.getWeight());
+ mKartDedicatedDriver.setText(kart.getDedicatedDriver());
+ }
+
+}
diff --git a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleTrackFragment.java b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleTrackFragment.java
new file mode 100644
index 0000000..d0fadd7
--- /dev/null
+++ b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleTrackFragment.java
@@ -0,0 +1,145 @@
+package com.de.aldo_apps.aldo.mariokartcircuitselector.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+
+import com.de.aldo_apps.aldo.mariokartcircuitselector.DatabaseHandler;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.R;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.database_models.Track;
+
+/**
+ * The SingleTrackFragment which displays all information of a single track object. Also this
+ * fragment handles the onClick. Based on the Click we will toggle the availability of this object
+ * in the database.
+ *
+ * @author aldo7224
+ * @version 0.1
+ * @since 10.08.2017
+ */
+public class SingleTrackFragment extends Fragment {
+
+ /**
+ * The Tag for Debugging Output.
+ */
+ private static final String TAG = "SingleTrackFragment";
+
+ /**
+ * Checkbox indicating the current availability status of the single track object.
+ */
+ private CheckBox mTrackAvailable;
+
+ /**
+ * TextView displaying the name of the single track object.
+ */
+ private TextView mTrackName;
+
+ /**
+ * TextView displaying the package (Cup) of the single track object.
+ */
+ private TextView mTrackPackage;
+
+ /**
+ * TextView displaying the number of the single track object.
+ */
+ private TextView mTrackNumber;
+
+ /**
+ * The track object assigned to this fragment.
+ */
+ private Track mTrack;
+
+ /**
+ * The Database handler passed from the activity to handle database operations.
+ */
+ private DatabaseHandler mHandler;
+
+ @Override
+ public View onCreateView(final LayoutInflater inflater,
+ final ViewGroup container,
+ final Bundle savedInstanceState) {
+ // Inflate the GenericListItem and return it. All Operations on the View will be handled
+ // in own functions.
+ return inflater.inflate(R.layout.generic_list_item, container, false);
+ }
+
+
+ @Override
+ public void onViewCreated(final View view, final Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Initialize the Views and member variables.
+ // Make all the Visible/Invisible/Gone Actions here as we know which information will be
+ // shown here.
+ initViews(view);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(final View view) {
+ if (mTrackAvailable != null) {
+ mTrackAvailable.toggle();
+ }
+ }
+ });
+ }
+
+ /**
+ * Helper method to initialize all View objects and toggle the visibility as we now know which
+ * object should be passed into the fragment.
+ *
+ * @param view The Parent View.
+ */
+ private void initViews(final View view) {
+ mTrackAvailable = (CheckBox) view.findViewById(R.id.availability_checkbox);
+ // Assign a CheckedChange Listener to the Checkbox, so we can update the status in the
+ // database as well.
+ mTrackAvailable.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(final CompoundButton compoundButton,
+ final boolean availability) {
+ if (mHandler != null && mTrack != null) {
+ mHandler.changeTrackAvailability(mTrack, availability);
+ } else {
+ Log.d(TAG, "onCheckedChanged: Either Handler or Track are null!");
+ }
+ }
+ });
+
+ // Make the Container Visible.
+ final View additionalInfoContainer = view.findViewById(R.id.multiple_information_container);
+ additionalInfoContainer.setVisibility(View.VISIBLE);
+
+ // Initialize all single views and make them visible.
+ mTrackName = (TextView) view.findViewById(R.id.multi_view_name);
+ mTrackPackage = (TextView) view.findViewById(R.id.additional_info_first);
+ mTrackPackage.setVisibility(View.VISIBLE);
+ final View separator = view.findViewById(R.id.additional_information_separator);
+ separator.setVisibility(View.VISIBLE);
+ mTrackNumber = (TextView) view.findViewById(R.id.additional_info_second);
+ mTrackNumber.setVisibility(View.VISIBLE);
+
+ // Mark the single name view (without additional information) as GONE
+ final View singleName = view.findViewById(R.id.single_info_name);
+ singleName.setVisibility(View.GONE);
+ }
+
+ /**
+ * Helper method which sets the real texts/arguments to the view objects.
+ *
+ * @param track The Track object of which we will retrieve our texts/arguments.
+ * @param handler The Database handler which handles the database operations.
+ */
+ public void setArguments(final Track track, final DatabaseHandler handler) {
+ mTrack = track;
+ mHandler = handler;
+ mTrackAvailable.setChecked(track.getAvailable());
+ mTrackName.setText(track.getName());
+ mTrackPackage.setText(track.getPackage());
+ mTrackNumber.setText(track.getNumber());
+ }
+}
diff --git a/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleWheelsFragment.java b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleWheelsFragment.java
new file mode 100644
index 0000000..db69a2d
--- /dev/null
+++ b/app/src/main/java/com/de/aldo_apps/aldo/mariokartcircuitselector/fragments/SingleWheelsFragment.java
@@ -0,0 +1,125 @@
+package com.de.aldo_apps.aldo.mariokartcircuitselector.fragments;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+
+import com.de.aldo_apps.aldo.mariokartcircuitselector.DatabaseHandler;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.R;
+import com.de.aldo_apps.aldo.mariokartcircuitselector.database_models.Wheels;
+
+/**
+ * The SingleWheelsFragment which displays all information of a single wheels object. Also this
+ * fragment handles the onClick. Based on the Click we will toggle the availability of this object
+ * in the database.
+ *
+ * @author aldo7224
+ * @version 0.1
+ * @since 10.08.2017
+ */
+public class SingleWheelsFragment extends Fragment {
+
+ /**
+ * The Tag for Debugging Output.
+ */
+ private static final String TAG = "SingleWheelsFragment";
+
+ /**
+ * Checkbox indicating the current availability status of the single wheels object.
+ */
+ private CheckBox mWheelsAvailable;
+
+ /**
+ * TextView displaying the name of the single wheels object.
+ */
+ private TextView mWheelsName;
+
+ /**
+ * The wheels object assigned to this fragment.
+ */
+ private Wheels mWheels;
+
+ /**
+ * The Database handler passed from the activity to handle database operations.
+ */
+ private DatabaseHandler mHandler;
+
+ @Override
+ public View onCreateView(final LayoutInflater inflater,
+ final ViewGroup container,
+ final Bundle savedInstanceState) {
+ // Inflate the GenericListItem and return it. All Operations on the View will be handled
+ // in own functions.
+ return inflater.inflate(R.layout.generic_list_item, container, false);
+ }
+
+
+ @Override
+ public void onViewCreated(final View view, final Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Initialize the Views and member variables.
+ // Make all the Visible/Invisible/Gone Actions here as we know which information will be
+ // shown here.
+ initViews(view);
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(final View view) {
+ if (mWheelsAvailable != null) {
+ mWheelsAvailable.toggle();
+ }
+ }
+ });
+ }
+
+ /**
+ * Helper method to initialize all View objects and toggle the visibility as we now know which
+ * object should be passed into the fragment.
+ *
+ * @param view The Parent View.
+ */
+ private void initViews(final View view) {
+ mWheelsAvailable = (CheckBox) view.findViewById(R.id.availability_checkbox);
+ // Assign a CheckedChange Listener to the Checkbox, so we can update the status in the
+ // database as well.
+ mWheelsAvailable.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(final CompoundButton compoundButton,
+ final boolean availability) {
+ if (mHandler != null && mWheels != null) {
+ mHandler.changeWheelsAvailability(mWheels, availability);
+ } else {
+ Log.d(TAG, "onCheckedChanged: Either Handler or Wheels are null!");
+ }
+ }
+ });
+
+ // Mark the Container as GONE.
+ final View additionalInfoContainer = view.findViewById(R.id.multiple_information_container);
+ additionalInfoContainer.setVisibility(View.GONE);
+
+ // Initialize all single views and make them visible.
+ mWheelsName = (TextView) view.findViewById(R.id.single_info_name);
+ mWheelsName.setVisibility(View.VISIBLE);
+ }
+
+ /**
+ * Helper method which sets the real texts/arguments to the view objects.
+ *
+ * @param wheels The Wheels object of which we will retrieve our texts/arguments.
+ * @param handler The Database handler which handles the database operations.
+ */
+ public void setArguments(final Wheels wheels, final DatabaseHandler handler) {
+ mWheels = wheels;
+ mHandler = handler;
+ mWheelsAvailable.setChecked(wheels.getAvailable());
+ mWheelsName.setText(wheels.getName());
+ }
+
+}
diff --git a/app/src/main/res/layout/generic_list_item.xml b/app/src/main/res/layout/generic_list_item.xml
new file mode 100644
index 0000000..611754b
--- /dev/null
+++ b/app/src/main/res/layout/generic_list_item.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..e14eb0c
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 10dp
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e31be65..81b2188 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,5 @@
MarioKartCircuitSelector
+
+ -