Compare commits

..

No commits in common. "d9dfccfc6a8ba167ba38efdf83368e790f35a636" and "3c10ea67a3dab3d221e609d8dc6bc0df145f1220" have entirely different histories.

17 changed files with 19 additions and 230 deletions

View file

@ -15,7 +15,6 @@ 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 selected player detail text and icon is black
* The highlight color is barely visible * The highlight color is barely visible
* Adding the option to toggle dark mode manually so older devices can have that privledge as well * 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 # Features I would like to add
* The watcher activity does not refresh automatically like the official website does * The watcher activity does not refresh automatically like the official website does

View file

@ -35,7 +35,6 @@ android {
dependencies { dependencies {
implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.code.gson:gson:2.8.6'
def lifecycle_version = "2.3.1" def lifecycle_version = "2.3.1"
def preference_version = '1.1.1'
// ViewModel // ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
@ -48,7 +47,6 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
implementation "androidx.fragment:fragment:1.3.3" implementation "androidx.fragment:fragment:1.3.3"
implementation "androidx.preference:preference:$preference_version"
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

View file

@ -19,7 +19,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".wiimmfi.WiimmfiActivity"/> <activity android:name=".wiimmfi.WiimmfiActivity"/>
<activity android:name=".settings.SettingsActivity"/> </application>
</application>
</manifest> </manifest>

View file

@ -6,7 +6,6 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.room.Room; import androidx.room.Room;
@ -14,8 +13,8 @@ import androidx.room.Room;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import me.brysonsteck.wiimmfiwatcher.database.AppDatabase; import me.brysonsteck.wiimmfiwatcher.database.AppDatabase;
import me.brysonsteck.wiimmfiwatcher.fragments.AboutFragment;
import me.brysonsteck.wiimmfiwatcher.fragments.WatchCodeFragment; import me.brysonsteck.wiimmfiwatcher.fragments.WatchCodeFragment;
import me.brysonsteck.wiimmfiwatcher.settings.SettingsActivity;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
AppDatabase database; AppDatabase database;
@ -28,9 +27,9 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
View settingsButton = findViewById(R.id.settings_button); View aboutButton = findViewById(R.id.about_button);
if (savedInstanceState == null) { if (savedInstanceState == null) {
settingsButton.setVisibility(View.VISIBLE); aboutButton.setVisibility(View.VISIBLE);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.replace(R.id.friend_code_input_fragment, new WatchCodeFragment(), null) .replace(R.id.friend_code_input_fragment, new WatchCodeFragment(), null)
.setReorderingAllowed(true) .setReorderingAllowed(true)
@ -39,9 +38,18 @@ public class MainActivity extends AppCompatActivity {
database = Room.databaseBuilder(this, AppDatabase.class, "friend-codes-db").build(); database = Room.databaseBuilder(this, AppDatabase.class, "friend-codes-db").build();
settingsButton.setOnClickListener((about) -> { aboutButton.setOnClickListener((about) -> {
Intent intent = new Intent(this, SettingsActivity.class); aboutButton.setVisibility(View.INVISIBLE);
startActivity(intent); 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();
}); });
} }
@ -51,7 +59,6 @@ public class MainActivity extends AppCompatActivity {
super.onStart(); super.onStart();
final String[] newestRelease = {""}; final String[] newestRelease = {""};
final boolean[] outdated = {false}; final boolean[] outdated = {false};
final boolean[] failed = {false};
Thread thread = new Thread() { Thread thread = new Thread() {
public void run() { public void run() {
Updater updater = new Updater(); Updater updater = new Updater();
@ -61,10 +68,6 @@ public class MainActivity extends AppCompatActivity {
System.out.println("\tA newer version of Wiimmfi Watcher is available! (" + updater.getNewestRelease() + ")"); 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("\tView the release notes and the source code here: " + updater.getGithubRelease());
System.out.println("\t---------------------------------------------------------------"); 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 { } else {
System.out.println("---------------------------------------------------------------"); System.out.println("---------------------------------------------------------------");
System.out.println("\t\t" + updater.getNewestRelease() + " is the latest release of Wiimmfi Watcher."); System.out.println("\t\t" + updater.getNewestRelease() + " is the latest release of Wiimmfi Watcher.");
@ -72,7 +75,6 @@ public class MainActivity extends AppCompatActivity {
} }
newestRelease[0] = updater.getNewestRelease(); newestRelease[0] = updater.getNewestRelease();
outdated[0] = updater.isOutdated(); outdated[0] = updater.isOutdated();
failed[0] = updater.hasFailed();
} }
}; };
thread.start(); thread.start();
@ -103,9 +105,6 @@ public class MainActivity extends AppCompatActivity {
} }
}) })
.show(); .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();
} }
} }

View file

@ -13,7 +13,6 @@ import java.net.URLConnection;
public class Updater { public class Updater {
public boolean outdated = false; public boolean outdated = false;
public boolean failed = false;
public String newestRelease; public String newestRelease;
public String githubRelease; public String githubRelease;
public String playStore = "https://play.google.com/store/apps/details?id=me.brysonsteck.wiimmfiwatcher"; public String playStore = "https://play.google.com/store/apps/details?id=me.brysonsteck.wiimmfiwatcher";
@ -55,10 +54,7 @@ public class Updater {
} }
public void compareRelease(String deviceRelease) { public void compareRelease(String deviceRelease) {
if (newestRelease == null) { if (!deviceRelease.equals(newestRelease)) {
failed = true;
}
else if (!deviceRelease.equals(newestRelease)) {
outdated = true; outdated = true;
} }
} }
@ -67,8 +63,6 @@ public class Updater {
return outdated; return outdated;
} }
public boolean hasFailed() { return failed; }
public String getNewestRelease() { public String getNewestRelease() {
return newestRelease; return newestRelease;
} }

View file

@ -1,4 +0,0 @@
package me.brysonsteck.wiimmfiwatcher.settings;
public class ParseSettings {
}

View file

@ -1,26 +0,0 @@
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();
}
}
}

View file

@ -1,37 +0,0 @@
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);
}
}

View file

@ -1,5 +0,0 @@
<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>

View file

@ -1,5 +0,0 @@
<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>

View file

@ -27,7 +27,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:elevation="0dp" android:elevation="0dp"
app:menu="@menu/top_app_bar_main" app:menu="@menu/top_app_bar"
app:title="Wiimmfi Watcher" app:title="Wiimmfi Watcher"
app:titleTextColor="@color/white" /> app:titleTextColor="@color/white" />

View file

@ -1,65 +0,0 @@
<?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>

View file

@ -1,32 +0,0 @@
<?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>

View file

@ -5,14 +5,7 @@
android:id="@+id/about_button" android:id="@+id/about_button"
android:icon="@drawable/ic_baseline_info_24" android:icon="@drawable/ic_baseline_info_24"
android:title="About" android:title="About"
android:visible="false" android:visible="true"
app:showAsAction="ifRoom" /> 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> </menu>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
</menu>

View file

@ -42,6 +42,4 @@
<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_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_positive">Update</string>
<string name="update_negative">Later</string> <string name="update_negative">Later</string>
<string name="settings_title">Settings</string>
</resources> </resources>

View file

@ -1,13 +0,0 @@
<?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>