aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-08-11 22:05:39 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-08-11 22:05:39 -0600
commitfb51cefd42871cc470253edbe9616706bfbd2361 (patch)
tree060d8848a9a630ffe2a1b41442c6f746822f9e12 /app/src/main
parent5977cfeb9bfe5efcc3457d3fdf2d10f24e5ac395 (diff)
downloadwiimmfi-watcher-fb51cefd42871cc470253edbe9616706bfbd2361.tar
wiimmfi-watcher-fb51cefd42871cc470253edbe9616706bfbd2361.tar.gz
wiimmfi-watcher-fb51cefd42871cc470253edbe9616706bfbd2361.tar.bz2
figured out preferences, going to bed now
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml3
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java32
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/ParseSettings.java4
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/preferences/SettingsFragment.java4
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/ParseSettings.java4
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java18
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java6
-rw-r--r--app/src/main/res/drawable/ic_baseline_arrow_back_24.xml5
-rw-r--r--app/src/main/res/drawable/ic_baseline_settings_24.xml5
-rw-r--r--app/src/main/res/layout/activity_main.xml2
-rw-r--r--app/src/main/res/layout/activity_settings.xml68
-rw-r--r--app/src/main/res/layout/main_settings_fragment.xml32
-rw-r--r--app/src/main/res/menu/top_app_bar_main.xml (renamed from app/src/main/res/menu/top_app_bar.xml)9
-rw-r--r--app/src/main/res/menu/top_app_bar_settings.xml4
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/preferences.xml4
16 files changed, 176 insertions, 26 deletions
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 @@
</intent-filter>
</activity>
<activity android:name=".wiimmfi.WiimmfiActivity"/>
-</application>
+ <activity android:name=".settings.SettingsActivity"/>
+ </application>
</manifest> \ 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 @@
+<vector android:autoMirrored="true" android:height="24dp"
+ android:tint="#FFFFFF" android:viewportHeight="24"
+ android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
+</vector>
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 @@
+<vector android:height="24dp" android:tint="#FFFFFF"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
+</vector>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/drawer_layout"
+ tools:context=".settings.SettingsActivity">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="true">
+
+
+
+ <com.google.android.material.appbar.AppBarLayout
+ android:id="@+id/appBarLayout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fitsSystemWindows="true"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <com.google.android.material.appbar.MaterialToolbar
+ android:id="@+id/toolbar"
+ style="@style/Widget.MaterialComponents.Toolbar.Primary"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ app:navigationIcon="@drawable/ic_baseline_arrow_back_24"
+ app:navigationIconTint="#FFFFFF"
+ android:elevation="0dp"
+ app:title="@string/settings_title"
+ app:titleTextColor="@color/white" />
+
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <androidx.fragment.app.FragmentContainerView
+ android:id="@+id/fragmentContainerView"
+ android:name="me.brysonsteck.wiimmfiwatcher.settings.SettingsMainFragment"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/appBarLayout" />
+
+ <!-- <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton-->
+ <!-- android:id="@+id/clear_button"-->
+ <!-- android:layout_width="wrap_content"-->
+ <!-- android:layout_height="wrap_content"-->
+ <!-- android:layout_gravity="bottom|right"-->
+ <!-- android:layout_margin="15dp"-->
+ <!-- android:foregroundTint="#FFFFFF"-->
+ <!-- android:text="Clear"-->
+ <!-- android:textColor="#FFFFFF"-->
+ <!-- app:backgroundTint="#1E88E5"-->
+ <!-- app:icon="@drawable/ic_baseline_clear_all_24"-->
+ <!-- app:iconTint="#FFFFFF"-->
+ <!-- app:layout_constraintBottom_toBottomOf="parent"-->
+ <!-- app:layout_constraintEnd_toEndOf="parent" />-->
+
+ <!-- Screen content -->
+ <!-- Use app:layout_behavior="@string/appbar_scrolling_view_behavior" to fit below top app bar -->
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+</androidx.drawerlayout.widget.DrawerLayout> \ 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<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="match_parent">
+
+ <Switch
+ android:id="@+id/switch1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:text="Switch"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
+ <ToggleButton
+ android:id="@+id/toggleButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="ToggleButton" />
+
+ <RadioGroup
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" >
+
+ </RadioGroup>
+
+ <Button
+ android:id="@+id/button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Button" />
+</androidx.constraintlayout.widget.ConstraintLayout> \ 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
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" />
+ <item
+ android:id="@+id/settings_button"
+ android:icon="@drawable/ic_baseline_settings_24"
+ android:visible="true"
+ app:showAsAction="ifRoom"
+ android:title="Settings" />
+
</menu> \ 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+</menu> \ 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 @@
<string name="update_message">A new version of Wiimmfi Watcher is available on the Play Store (version %1$s)! You can download it by pressing \"Update\".</string>
<string name="update_positive">Update</string>
<string name="update_negative">Later</string>
+
+ <string name="settings_title">Settings</string>
</resources> \ 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+</PreferenceScreen> \ No newline at end of file