diff --git a/app/build.gradle b/app/build.gradle
index 3e0d1a3..1e93f18 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -35,6 +35,7 @@ android {
dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
def lifecycle_version = "2.3.1"
+ def preference_version = '1.1.1'
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
@@ -47,6 +48,7 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
implementation "androidx.fragment:fragment:1.3.3"
+ implementation "androidx.preference:preference:$preference_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index bae710f..902381a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -19,6 +19,7 @@
-
+
+
\ No newline at end of file
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
index 878de62..714aee7 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
@@ -14,8 +14,8 @@ import androidx.room.Room;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import me.brysonsteck.wiimmfiwatcher.database.AppDatabase;
-import me.brysonsteck.wiimmfiwatcher.fragments.AboutFragment;
import me.brysonsteck.wiimmfiwatcher.fragments.WatchCodeFragment;
+import me.brysonsteck.wiimmfiwatcher.settings.SettingsActivity;
public class MainActivity extends AppCompatActivity {
AppDatabase database;
@@ -28,9 +28,9 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
- View aboutButton = findViewById(R.id.about_button);
+ View settingsButton = findViewById(R.id.settings_button);
if (savedInstanceState == null) {
- aboutButton.setVisibility(View.VISIBLE);
+ settingsButton.setVisibility(View.VISIBLE);
getSupportFragmentManager().beginTransaction()
.replace(R.id.friend_code_input_fragment, new WatchCodeFragment(), null)
.setReorderingAllowed(true)
@@ -39,18 +39,20 @@ public class MainActivity extends AppCompatActivity {
database = Room.databaseBuilder(this, AppDatabase.class, "friend-codes-db").build();
- aboutButton.setOnClickListener((about) -> {
- aboutButton.setVisibility(View.INVISIBLE);
- getSupportFragmentManager().beginTransaction()
- .setCustomAnimations(
- R.anim.slide_in,
- R.anim.fade_out,
- R.anim.fade_in,
- R.anim.slide_out)
- .replace(R.id.friend_code_input_fragment, new AboutFragment(), null)
- .setReorderingAllowed(true)
- .addToBackStack(null)
- .commit();
+ settingsButton.setOnClickListener((about) -> {
+// settingsButton.setVisibility(View.INVISIBLE);
+// getSupportFragmentManager().beginTransaction()
+// .setCustomAnimations(
+// R.anim.slide_in,
+// R.anim.fade_out,
+// R.anim.fade_in,
+// R.anim.slide_out)
+// .replace(R.id.friend_code_input_fragment, new AboutFragment(), null)
+// .setReorderingAllowed(true)
+// .addToBackStack(null)
+// .commit();
+ Intent intent = new Intent(this, SettingsActivity.class);
+ startActivity(intent);
});
}
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/ParseSettings.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/ParseSettings.java
deleted file mode 100644
index 78ecced..0000000
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/ParseSettings.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package me.brysonsteck.wiimmfiwatcher.preferences;
-
-public class ParseSettings {
-}
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/SettingsFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/SettingsFragment.java
deleted file mode 100644
index e24236b..0000000
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/SettingsFragment.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package me.brysonsteck.wiimmfiwatcher.preferences;
-
-public class SettingsFragment {
-}
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/ParseSettings.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/ParseSettings.java
new file mode 100644
index 0000000..9268bd2
--- /dev/null
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/ParseSettings.java
@@ -0,0 +1,4 @@
+package me.brysonsteck.wiimmfiwatcher.settings;
+
+public class ParseSettings {
+}
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java
new file mode 100644
index 0000000..076d6c0
--- /dev/null
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java
@@ -0,0 +1,18 @@
+package me.brysonsteck.wiimmfiwatcher.settings;
+
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.PreferenceFragmentCompat;
+
+import me.brysonsteck.wiimmfiwatcher.R;
+
+public class SettingsActivity extends PreferenceFragmentCompat {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootkey) {
+ super.onCreate(savedInstanceState);
+ setPreferencesFromResource(R.xml.preferences, rootkey);
+ }
+}
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java
new file mode 100644
index 0000000..6f9414f
--- /dev/null
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java
@@ -0,0 +1,6 @@
+package me.brysonsteck.wiimmfiwatcher.settings;
+
+import androidx.fragment.app.Fragment;
+
+public class SettingsMainFragment extends Fragment {
+}
diff --git a/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml b/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
new file mode 100644
index 0000000..31e7df2
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_settings_24.xml b/app/src/main/res/drawable/ic_baseline_settings_24.xml
new file mode 100644
index 0000000..b240b83
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_settings_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index bf5adcd..039941a 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -27,7 +27,7 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="0dp"
- app:menu="@menu/top_app_bar"
+ app:menu="@menu/top_app_bar_main"
app:title="Wiimmfi Watcher"
app:titleTextColor="@color/white" />
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
new file mode 100644
index 0000000..327dc2e
--- /dev/null
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/main_settings_fragment.xml b/app/src/main/res/layout/main_settings_fragment.xml
new file mode 100644
index 0000000..9d0a368
--- /dev/null
+++ b/app/src/main/res/layout/main_settings_fragment.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/top_app_bar.xml b/app/src/main/res/menu/top_app_bar_main.xml
similarity index 60%
rename from app/src/main/res/menu/top_app_bar.xml
rename to app/src/main/res/menu/top_app_bar_main.xml
index 0b2e0aa..6d34708 100644
--- a/app/src/main/res/menu/top_app_bar.xml
+++ b/app/src/main/res/menu/top_app_bar_main.xml
@@ -5,7 +5,14 @@
android:id="@+id/about_button"
android:icon="@drawable/ic_baseline_info_24"
android:title="About"
- android:visible="true"
+ android:visible="false"
app:showAsAction="ifRoom" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/top_app_bar_settings.xml b/app/src/main/res/menu/top_app_bar_settings.xml
new file mode 100644
index 0000000..fe187c0
--- /dev/null
+++ b/app/src/main/res/menu/top_app_bar_settings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ 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 05fc69e..cf0cc77 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -42,4 +42,6 @@
A new version of Wiimmfi Watcher is available on the Play Store (version %1$s)! You can download it by pressing \"Update\".
Update
Later
+
+ Settings
\ No newline at end of file
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
new file mode 100644
index 0000000..624ed13
--- /dev/null
+++ b/app/src/main/res/xml/preferences.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file