Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
d9dfccfc6a | |||
fb51cefd42 | |||
5977cfeb9b | |||
ed69b7725f |
17 changed files with 230 additions and 19 deletions
1
TODO.md
1
TODO.md
|
@ -15,6 +15,7 @@ These are issues in Wiimmfi Watcher I am at least aware of. Please **DO NOT** su
|
|||
* The selected player detail text and icon is black
|
||||
* The highlight color is barely visible
|
||||
* Adding the option to toggle dark mode manually so older devices can have that privledge as well
|
||||
* Stop forcing a refresh after changing the data on the right
|
||||
|
||||
# Features I would like to add
|
||||
* The watcher activity does not refresh automatically like the official website does
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".wiimmfi.WiimmfiActivity"/>
|
||||
</application>
|
||||
<activity android:name=".settings.SettingsActivity"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -6,6 +6,7 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.room.Room;
|
||||
|
@ -13,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;
|
||||
|
@ -27,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)
|
||||
|
@ -38,18 +39,9 @@ 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) -> {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -59,6 +51,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
super.onStart();
|
||||
final String[] newestRelease = {""};
|
||||
final boolean[] outdated = {false};
|
||||
final boolean[] failed = {false};
|
||||
Thread thread = new Thread() {
|
||||
public void run() {
|
||||
Updater updater = new Updater();
|
||||
|
@ -68,6 +61,10 @@ public class MainActivity extends AppCompatActivity {
|
|||
System.out.println("\tA newer version of Wiimmfi Watcher is available! (" + updater.getNewestRelease() + ")");
|
||||
System.out.println("\tView the release notes and the source code here: " + updater.getGithubRelease());
|
||||
System.out.println("\t---------------------------------------------------------------");
|
||||
} else if (updater.hasFailed()) {
|
||||
System.out.println("---------------------------------------------------------------");
|
||||
System.out.println("\t\t An error has occurred while getting information from the update server.");
|
||||
System.out.println("\t\t---------------------------------------------------------------");
|
||||
} else {
|
||||
System.out.println("---------------------------------------------------------------");
|
||||
System.out.println("\t\t" + updater.getNewestRelease() + " is the latest release of Wiimmfi Watcher.");
|
||||
|
@ -75,6 +72,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
newestRelease[0] = updater.getNewestRelease();
|
||||
outdated[0] = updater.isOutdated();
|
||||
failed[0] = updater.hasFailed();
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
|
@ -105,6 +103,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
})
|
||||
.show();
|
||||
} else if (failed[0] && !shownUpdate) {
|
||||
shownUpdate = true;
|
||||
Toast.makeText(this, "An error occurred while checking for updates for Wiimmfi Watcher.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.net.URLConnection;
|
|||
public class Updater {
|
||||
|
||||
public boolean outdated = false;
|
||||
public boolean failed = false;
|
||||
public String newestRelease;
|
||||
public String githubRelease;
|
||||
public String playStore = "https://play.google.com/store/apps/details?id=me.brysonsteck.wiimmfiwatcher";
|
||||
|
@ -54,7 +55,10 @@ public class Updater {
|
|||
}
|
||||
|
||||
public void compareRelease(String deviceRelease) {
|
||||
if (!deviceRelease.equals(newestRelease)) {
|
||||
if (newestRelease == null) {
|
||||
failed = true;
|
||||
}
|
||||
else if (!deviceRelease.equals(newestRelease)) {
|
||||
outdated = true;
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +67,8 @@ public class Updater {
|
|||
return outdated;
|
||||
}
|
||||
|
||||
public boolean hasFailed() { return failed; }
|
||||
|
||||
public String getNewestRelease() {
|
||||
return newestRelease;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package me.brysonsteck.wiimmfiwatcher.settings;
|
||||
|
||||
public class ParseSettings {
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package me.brysonsteck.wiimmfiwatcher.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import me.brysonsteck.wiimmfiwatcher.R;
|
||||
import me.brysonsteck.wiimmfiwatcher.fragments.WatchCodeFragment;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_settings);
|
||||
if (savedInstanceState != null) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.settings_fragment_view, new SettingsMainFragment(), null)
|
||||
.setReorderingAllowed(true)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package me.brysonsteck.wiimmfiwatcher.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import me.brysonsteck.wiimmfiwatcher.R;
|
||||
|
||||
public class SettingsMainFragment extends PreferenceFragmentCompat {
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootkey) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setPreferencesFromResource(R.xml.preferences, rootkey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
ListPreference mListPreference = (ListPreference) getPreferenceManager().findPreference("preference_key");
|
||||
mListPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
// your code here
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return inflater.inflate(R.layout.main_settings_fragment, container, false);
|
||||
}
|
||||
}
|
5
app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
Normal file
5
app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
Normal file
|
@ -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>
|
5
app/src/main/res/drawable/ic_baseline_settings_24.xml
Normal file
5
app/src/main/res/drawable/ic_baseline_settings_24.xml
Normal file
|
@ -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>
|
|
@ -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" />
|
||||
|
||||
|
|
65
app/src/main/res/layout/activity_settings.xml
Normal file
65
app/src/main/res/layout/activity_settings.xml
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?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/settings_fragment_view"
|
||||
android:name="me.brysonsteck.wiimmfiwatcher.settings.SettingsMainFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout_editor_absoluteY="56dp" />
|
||||
|
||||
<!-- <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>
|
32
app/src/main/res/layout/main_settings_fragment.xml
Normal file
32
app/src/main/res/layout/main_settings_fragment.xml
Normal file
|
@ -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>
|
|
@ -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>
|
4
app/src/main/res/menu/top_app_bar_settings.xml
Normal file
4
app/src/main/res/menu/top_app_bar_settings.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</menu>
|
|
@ -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>
|
13
app/src/main/res/xml/preferences.xml
Normal file
13
app/src/main/res/xml/preferences.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Preference
|
||||
android:key="theme"
|
||||
android:title="Theme"
|
||||
android:summary="Blue (Default)" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="dark_mode"
|
||||
android:title="Dark mode"/>
|
||||
|
||||
</PreferenceScreen>
|
Reference in a new issue