diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-05-18 20:48:17 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-05-18 20:48:17 -0600 |
commit | 11aa7c75e16d6819d0681f408c720cbc6a6754ba (patch) | |
tree | 0b9ca87486a52bcdaf3a964406132c12146e3b4f | |
parent | 39e2d4248878b4b8e501c271d8df5f05f0179b97 (diff) | |
download | wiimmfi-watcher-11aa7c75e16d6819d0681f408c720cbc6a6754ba.tar wiimmfi-watcher-11aa7c75e16d6819d0681f408c720cbc6a6754ba.tar.gz wiimmfi-watcher-11aa7c75e16d6819d0681f408c720cbc6a6754ba.tar.bz2 |
did a ton of stuff i dont remember like a dark mode and small enhancements
30 files changed, 409 insertions, 156 deletions
@@ -26,6 +26,14 @@ This is officially my first project and Google Play app that I'm maintaining, so If you found any bugs in the `master` branch (i. e. the most recent Google Play release), **PLEASE READ MY [TODO LIST](https://github.com/brysonsteck/wiimmfi-watcher/blob/dev/TODO.md) FIRST** to make sure that the bug you found isn't something I'm already aware of. Once you have made sure of that, you can then create an issue or fill out this [Google Form](https://docs.google.com/forms/d/e/1FAIpQLSd6qCONAP2tsbHPgzu_CdZcHVHL5nx7q0XFqrVfExEc84kqUQ/viewform). +## Devices + +Wiimmfi Watcher has been officially tested and confirmed to work on the following devices: +* x86_64 emulated Pixel 4 (Android 5.0.2) by brysonsteck +* x86_64 emulated Pixel 4 (Android 11) by brysonsteck +* x86_64 emulated Nexus 7 (Android 10) by brysonsteck +* x86_64 emulated Nexus 10 (Android 10) by brysonsteck + ## Donations This application is completely free, ad-less and open source. That means that no income is coming from this app and the work done on this app is purely a labor of love <3 @@ -2,15 +2,23 @@ These are issues in Wiimmfi Watcher I am at least aware of. Please **DO NOT** submit a bug report on the Google Form or an issue here on GitHub if it is mentioned on this list, unless you found a way that the bug can crash the app. ## Completed For Next Release -* Lowered minimum SDK to 16 (Jelly Bean 4.1) +* Lowered minimum SDK to 19 (Jelly Bean 4.4) + * originally lowered to 16 (Jelly Bean 4.1), but after adding Fragment animations this had to be changed. +* Created the dark mode ## Working On * The last player in the list has the potential to hide behind the refresh button +* Fixing lag when pressing the watch button + * Working with threads should fix this +* Recent friend codes do not scroll like they should + * Problem with ConstraintLayout probably, convert to a new Layout? ## Aware Of * Fix the repeating recent friend codes -* Recent friend codes do not scroll like they should - * Problem with ConstraintLayout probably, convert to a new Layout? +* The about page causes part of the screen to get cut off as the animation plays +* The navigation menu in Dark Mode is messed up + * The selected player detail text and icon is black + * The highlight color is barely visible # Features I would like to add * The watcher activity does not refresh automatically like the official website does @@ -19,5 +27,8 @@ These are issues in Wiimmfi Watcher I am at least aware of. Please **DO NOT** su * Add 'sections' I guess??? * Add the Mario Kart Wii font * Add pictures for Nintendo and CTGP tracks +* The ability to save friend codes and name them, not just save recent friend codes +* Create a more feature rich settings and about page + * manual dark mode toggles, clear recent codes button, etc. diff --git a/app/build.gradle b/app/build.gradle index 795156a..1994cca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,10 +9,10 @@ android { defaultConfig { applicationId "me.brysonsteck.wiimmfiwatcher" - minSdkVersion 16 + minSdkVersion 19 targetSdkVersion 30 versionCode 1 - versionName "1.0" + versionName "1.0.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -33,53 +33,43 @@ android { } dependencies { - dependencies { - dependencies { - def lifecycle_version = "2.3.1" - def arch_version = "2.1.0" + def lifecycle_version = "2.3.1" - // ViewModel - implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" - // LiveData - implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version" - } - def lifecycle_version = "2.3.1" - def arch_version = "2.1.0" - - // ViewModel - implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" - // LiveData - implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version" + // ViewModel + implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" + // LiveData + implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version" - implementation "androidx.fragment:fragment:1.3.3" - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.3.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - implementation files('libs/jsoup-1.13.1.jar') - implementation 'com.android.support:cardview-v7:28.0.0' - testImplementation 'junit:junit:4.+' - implementation "androidx.drawerlayout:drawerlayout:1.1.1" - androidTestImplementation 'androidx.test.ext:junit:1.1.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - dependencies { - def room_version = "2.3.0" + // ViewModel + implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" + // LiveData + implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version" - implementation "androidx.room:room-runtime:$room_version" - annotationProcessor "androidx.room:room-compiler:$room_version" + implementation "androidx.fragment:fragment:1.3.3" + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.3.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation files('libs/jsoup-1.13.1.jar') + implementation 'com.android.support:cardview-v7:28.0.0' + testImplementation 'junit:junit:4.+' + implementation "androidx.drawerlayout:drawerlayout:1.1.1" + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + def room_version = "2.3.0" - // optional - RxJava2 support for Room - implementation "androidx.room:room-rxjava2:$room_version" + implementation "androidx.room:room-runtime:$room_version" + annotationProcessor "androidx.room:room-compiler:$room_version" - // optional - RxJava3 support for Room - implementation "androidx.room:room-rxjava3:$room_version" + // optional - RxJava2 support for Room + implementation "androidx.room:room-rxjava2:$room_version" - // optional - Guava support for Room, including Optional and ListenableFuture - implementation "androidx.room:room-guava:$room_version" + // optional - RxJava3 support for Room + implementation "androidx.room:room-rxjava3:$room_version" - // optional - Test helpers - testImplementation "androidx.room:room-testing:$room_version" - } + // optional - Guava support for Room, including Optional and ListenableFuture + implementation "androidx.room:room-guava:$room_version" - } + // optional - Test helpers + testImplementation "androidx.room:room-testing:$room_version" } android.buildTypes.release.ndk.debugSymbolLevel = 'FULL'
\ No newline at end of file diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java index aaf9073..a0229ff 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java @@ -1,9 +1,13 @@ package me.brysonsteck.wiimmfiwatcher; import android.annotation.SuppressLint; +import android.content.res.Configuration; +import android.graphics.Color; import android.os.Bundle; import android.text.method.LinkMovementMethod; +import android.transition.TransitionInflater; import android.view.View; +import android.widget.ScrollView; import android.widget.TextView; import androidx.annotation.NonNull; @@ -12,18 +16,37 @@ import androidx.fragment.app.Fragment; import com.google.android.material.appbar.MaterialToolbar; +import java.util.Objects; + public class AboutFragment extends Fragment { View aboutButton; MaterialToolbar toolbar; + ScrollView scrollView; public AboutFragment() { super(R.layout.about_fragment); } + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + TransitionInflater inflater = TransitionInflater.from(requireContext()); + setEnterTransition(inflater.inflateTransition(R.transition.slide_right)); + setExitTransition(inflater.inflateTransition(R.transition.slide_right)); + } @SuppressLint("SetTextI18n") @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + scrollView = view.findViewById(R.id.about_view); + + int nightModeFlags = + getContext().getResources().getConfiguration().uiMode & + Configuration.UI_MODE_NIGHT_MASK; + if (nightModeFlags == Configuration.UI_MODE_NIGHT_YES) { + // Night mode is active, we're using dark theme + scrollView.setBackgroundColor(Color.parseColor("#151515")); + } aboutButton = getActivity().findViewById(R.id.about_button); toolbar = getActivity().findViewById(R.id.toolbar); @@ -34,10 +57,11 @@ public class AboutFragment extends Fragment { TextView github = view.findViewById(R.id.github_text); TextView contact = view.findViewById(R.id.contact_text); TextView bugs = view.findViewById(R.id.bugs_text); + TextView license = view.findViewById(R.id.license_text); aboutWatcher.setText("Wiimmfi Watcher is an UNOFFICIAL application created for a school project that I have decided to turn into a full application. " + "This application was made to provide an easy shortcut to the Wiimmfi website and display data in a mobile friendly way, since the official website doesn't have a mobile friendly version. " + - "Free and open source, you can watch your Wiimmfi Mario Kart Wii matches on your phone in a quick and easy way. " + + "Free and open source, you can watch your Wiimmfi matches on your phone in a quick and easy way. " + ""); aboutMe.setText("Hi there! My name is Bryson Steck. I am a student studying Computer Science. This is my first official application that I'm maintaining. " + @@ -49,13 +73,20 @@ public class AboutFragment extends Fragment { github.setText(R.string.github); - contact.setText("If you would like to get ahold of me for any reason unrelated to bug reports or this app in general, you can contact me through email at steck.bryson@gmail.com " + - "or on Discord at bryzinga#9971."); + contact.setClickable(true); + contact.setMovementMethod(LinkMovementMethod.getInstance()); + + contact.setText(R.string.contact); bugs.setClickable(true); bugs.setMovementMethod(LinkMovementMethod.getInstance()); bugs.setText(R.string.bugs); + + license.setClickable(true); + license.setMovementMethod(LinkMovementMethod.getInstance()); + + license.setText(R.string.license); } @Override diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java index c37aaf7..bb7663c 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java @@ -1,8 +1,10 @@ package me.brysonsteck.wiimmfiwatcher; +import android.os.Build; import android.os.Bundle; import android.view.View; +import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.databinding.ObservableArrayList; import androidx.room.Room; @@ -14,6 +16,7 @@ public class MainActivity extends AppCompatActivity { ObservableArrayList<FriendCode> recentFCList = new ObservableArrayList<>(); AppDatabase database; + @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -35,6 +38,11 @@ public class MainActivity extends AppCompatActivity { 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) diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java index 715dce8..ded5e65 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeAdapter.java @@ -2,6 +2,8 @@ package me.brysonsteck.wiimmfiwatcher; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; +import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -39,6 +41,13 @@ public class WatchCodeAdapter extends RecyclerView.Adapter<WatchCodeAdapter.View public void onBindViewHolder(@NonNull ViewHolder holder, int position) { String currentFC = entries.get(position).friendCode; MaterialButton fcButton = holder.itemView.findViewById(R.id.recent_friend_code_button); + int nightModeFlags = + context.getResources().getConfiguration().uiMode & + Configuration.UI_MODE_NIGHT_MASK; + if (nightModeFlags == Configuration.UI_MODE_NIGHT_YES) { + // Night mode is active, we're using dark theme + fcButton.setBackgroundColor(Color.parseColor("#313131")); + } fcButton.setText(currentFC); fcButton.setOnClickListener(view -> { Intent intent = new Intent(view.getContext(), WiimmfiActivity.class); diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java index c1ba705..94006a0 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java @@ -1,10 +1,15 @@ package me.brysonsteck.wiimmfiwatcher; import android.content.Intent; +import android.content.res.Configuration; +import android.graphics.Color; import android.os.Bundle; +import android.transition.TransitionInflater; +import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -23,7 +28,7 @@ import me.brysonsteck.wiimmfiwatcher.wiimmfi.WiimmfiActivity; public class WatchCodeFragment extends Fragment { public WatchCodeFragment() { - super(R.layout.friend_code_input_fragment); + super(R.layout.watch_code_fragment); } public boolean isValidFriendCode(String friendCode) { @@ -41,6 +46,15 @@ public class WatchCodeFragment extends Fragment { } @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + TransitionInflater inflater = TransitionInflater.from(requireContext()); + setEnterTransition(inflater.inflateTransition(R.transition.fade)); + setExitTransition(inflater.inflateTransition(R.transition.fade)); + } + + + @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); FriendCodeViewModel viewModel = new ViewModelProvider(getActivity()).get(FriendCodeViewModel.class); @@ -88,26 +102,58 @@ public class WatchCodeFragment extends Fragment { linearLayoutManager.setStackFromEnd(true); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(adapter); - Button watchButton = view.findViewById(R.id.watch_button); EditText friendCode = view.findViewById(R.id.friend_code_edit_text); + MaterialTextView errorText = view.findViewById(R.id.error_text); - watchButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(view.getContext(), WiimmfiActivity.class); - if (!isValidFriendCode(friendCode.getText().toString())) { - errorText.setText("ERROR: Insert a friend code in the format XXXX-XXXX-XXXX"); - friendCode.setText(""); - } else { - errorText.setText(""); - viewModel.saveFriendCode("", friendCode.getText().toString()); - intent.putExtra("friendCode", friendCode.getText().toString()); - startActivity(intent); + Button watchButton = view.findViewById(R.id.watch_button); + watchButton.setOnClickListener(buttonClick -> { + startWiimmfiActivity( + view, + friendCode, + errorText, + watchButton, + viewModel + ); + watchButton.setText("Watch"); + }); + friendCode.setOnKeyListener(new View.OnKeyListener() + { + public boolean onKey(View view1, int keyCode, KeyEvent event) + { + if (event.getAction() == KeyEvent.ACTION_DOWN) + { + switch (keyCode) + { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_ENTER: + startWiimmfiActivity( + view, + friendCode, + errorText, + watchButton, + viewModel + ); + watchButton.setText("Watch"); + return true; + default: + break; + } } + return false; } }); + } - - + public void startWiimmfiActivity(View view, EditText friendCode, MaterialTextView errorText, Button watchButton, FriendCodeViewModel viewModel) { + Intent intent = new Intent(view.getContext(), WiimmfiActivity.class); + if (!isValidFriendCode(friendCode.getText().toString())) { + errorText.setText("ERROR: Insert a friend code in the format XXXX-XXXX-XXXX"); + } else { + errorText.setText(""); + watchButton.setText("Loading..."); + viewModel.saveFriendCode("", friendCode.getText().toString()); + intent.putExtra("friendCode", friendCode.getText().toString()); + startActivity(intent); + } } } diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomAdapter.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomAdapter.java index c7a0f29..5538869 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomAdapter.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomAdapter.java @@ -1,10 +1,13 @@ package me.brysonsteck.wiimmfiwatcher.wiimmfi; import android.annotation.SuppressLint; +import android.content.Context; +import android.content.res.Configuration; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; @@ -23,12 +26,14 @@ public class RoomAdapter extends RecyclerView.Adapter<RoomAdapter.ViewHolder>{ String playerLink; String header; ArrayList<Player> players; + Context context; - public RoomAdapter (String display, String playerLink, String header, ArrayList<Player> players) { + public RoomAdapter (String display, String playerLink, String header, ArrayList<Player> players, Context context) { this.display = display; this.playerLink = playerLink; this.header = header; this.players = players; + this.context = context; } @NonNull @@ -46,6 +51,20 @@ public class RoomAdapter extends RecyclerView.Adapter<RoomAdapter.ViewHolder>{ TextView miiName = holder.itemView.findViewById(R.id.mii_names); TextView variableDisplay = holder.itemView.findViewById(R.id.variable_side_data); Player currentPlayer = players.get(position); + LinearLayout.LayoutParams cardViewParams = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT); + cardView.setLayoutParams(cardViewParams); + ViewGroup.MarginLayoutParams cardViewMarginParams = (ViewGroup.MarginLayoutParams) cardView.getLayoutParams(); + cardViewMarginParams.setMargins(40,40,40,40); + cardView.requestLayout(); + int nightModeFlags = + context.getResources().getConfiguration().uiMode & + Configuration.UI_MODE_NIGHT_MASK; + if (nightModeFlags == Configuration.UI_MODE_NIGHT_YES) { + // Night mode is active, we're using dark theme + cardView.setCardBackgroundColor(Color.parseColor("#313131")); + } if (currentPlayer.watching) { cardView.setCardBackgroundColor(Color.parseColor("#0D47A1")); rosterNumber.setTextColor(Color.WHITE); @@ -78,6 +97,10 @@ public class RoomAdapter extends RecyclerView.Adapter<RoomAdapter.ViewHolder>{ variableDisplay.setText("VR: " + currentPlayer.vr + " / BR: " + currentPlayer.br); break; } + if (position + 1 == getItemCount()) { + cardViewMarginParams.setMargins(40,40,40,250); + cardView.requestLayout(); + } } diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java index afb21d6..2c17476 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java @@ -1,8 +1,10 @@ package me.brysonsteck.wiimmfiwatcher.wiimmfi; import android.os.Bundle; +import android.os.Looper; import android.view.View; import android.widget.TextView; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -24,9 +26,11 @@ public class RoomFragment extends Fragment { RoomData roomData; public RoomFragment(String friendCode, ArrayList<Player> players, String playerLink, String display) { - super(R.layout.fragment_room); + super(R.layout.room_fragment); this.roomData = new RoomData(players, friendCode); - this.header = roomData.getRoomHeader(); + new Thread(() -> { + this.header = roomData.getRoomHeader(); + }).start(); this.display = display; this.players = players; this.playerLink = playerLink; @@ -43,23 +47,23 @@ public class RoomFragment extends Fragment { headerTextView.setText(header); RecyclerView recyclerView = view.findViewById(R.id.player_data_recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); - recyclerView.setAdapter(new RoomAdapter(display, playerLink, header, players)); + recyclerView.setAdapter(new RoomAdapter(display, playerLink, header, players, getContext())); refreshButton.setOnClickListener((buttonView) -> { - refreshButton.setEnabled(false); - players.clear(); + this.players.clear(); this.header = ""; - roomData = roomData.refresh(); + this.roomData = roomData.refresh(); RoomData newRoomData = roomData.refresh(); - players = roomData.getPlayers(); + this.players = roomData.getPlayers(); header = newRoomData.getRoomHeader(); if (header == null) { header = "This player is not online, not inside a room or does not exist. Click the refresh button to try again, or click on the back button to enter a different friend code."; } - headerTextView.setText(header); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); - recyclerView.setAdapter(new RoomAdapter(display, playerLink, header, players)); - refreshButton.setEnabled(true); + recyclerView.setAdapter(new RoomAdapter(display, playerLink, header, players, getContext())); + headerTextView.setText(header); + }); } } diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java index f3029af..1a9576a 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java @@ -1,6 +1,8 @@ package me.brysonsteck.wiimmfiwatcher.wiimmfi; import android.content.Intent; +import android.content.res.Configuration; +import android.graphics.Color; import android.os.Bundle; import android.os.StrictMode; @@ -37,6 +39,14 @@ public class WiimmfiActivity extends AppCompatActivity { DrawerLayout drawerLayout = findViewById(R.id.drawer_layout); NavigationView drawer = findViewById(R.id.navigation_view); + int nightModeFlags = + this.getResources().getConfiguration().uiMode & + Configuration.UI_MODE_NIGHT_MASK; + if (nightModeFlags == Configuration.UI_MODE_NIGHT_YES) { + // Night mode is active, we're using dark theme + drawer.setBackgroundColor(Color.parseColor("#313131")); + } + toolbar.setTitle("Watching " + friendCode); if (savedInstanceState == null) { diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml new file mode 100644 index 0000000..119faa5 --- /dev/null +++ b/app/src/main/res/anim/fade_in.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android"> + <alpha + android:duration="@android:integer/config_shortAnimTime" + android:interpolator="@android:anim/decelerate_interpolator" + android:fromAlpha="0" + android:toAlpha="1" /> +</set>
\ No newline at end of file diff --git a/app/src/main/res/anim/fade_out.xml b/app/src/main/res/anim/fade_out.xml new file mode 100644 index 0000000..7d171fc --- /dev/null +++ b/app/src/main/res/anim/fade_out.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android"> + <alpha + android:duration="@android:integer/config_shortAnimTime" + android:interpolator="@android:anim/decelerate_interpolator" + android:fromAlpha="1" + android:toAlpha="0" /> +</set>
\ No newline at end of file diff --git a/app/src/main/res/anim/slide_in.xml b/app/src/main/res/anim/slide_in.xml new file mode 100644 index 0000000..2c4f7ff --- /dev/null +++ b/app/src/main/res/anim/slide_in.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android"> + <translate + android:duration="@android:integer/config_shortAnimTime" + android:interpolator="@android:anim/decelerate_interpolator" + android:fromXDelta="0%" + android:toXDelta="100%" /> +</set>
\ No newline at end of file diff --git a/app/src/main/res/anim/slide_out.xml b/app/src/main/res/anim/slide_out.xml new file mode 100644 index 0000000..5cc6127 --- /dev/null +++ b/app/src/main/res/anim/slide_out.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android"> + <translate + android:duration="@android:integer/config_shortAnimTime" + android:interpolator="@android:anim/decelerate_interpolator" + android:fromXDelta="100%" + android:toXDelta="0%" /> +</set>
\ No newline at end of file diff --git a/app/src/main/res/layout/about_fragment.xml b/app/src/main/res/layout/about_fragment.xml index 7fb085a..90a63ca 100644 --- a/app/src/main/res/layout/about_fragment.xml +++ b/app/src/main/res/layout/about_fragment.xml @@ -2,8 +2,10 @@ <ScrollView 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:id="@+id/about_view" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:background="#FFFFFF"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" @@ -47,8 +49,8 @@ android:id="@+id/about_me_text" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="TextView" android:paddingBottom="15dp" + android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView5" /> @@ -68,8 +70,8 @@ android:id="@+id/github_text" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="TextView" android:paddingBottom="15dp" + android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView7" /> @@ -90,8 +92,8 @@ android:id="@+id/contact_text" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="TextView" android:paddingBottom="15dp" + android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView9" /> @@ -100,13 +102,23 @@ android:id="@+id/bugs_text" android:layout_width="0dp" android:layout_height="wrap_content" - android:paddingBottom="65dp" + android:paddingBottom="15dp" android:text="TextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView13" /> <TextView + android:id="@+id/license_text" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:paddingBottom="65dp" + android:text="TextView" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView4" /> + + <TextView android:id="@+id/textView13" android:layout_width="0dp" android:layout_height="wrap_content" @@ -117,5 +129,17 @@ app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/contact_text" /> + + <TextView + android:id="@+id/textView4" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:text="License and Copyright" + android:textSize="24sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/bugs_text" /> </androidx.constraintlayout.widget.ConstraintLayout> - </ScrollView>
\ No newline at end of file +</ScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 1116b4b..08083c2 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -24,10 +24,10 @@ style="@style/Widget.MaterialComponents.Toolbar.Primary" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" - android:background="@android:color/transparent" android:elevation="0dp" app:menu="@menu/top_app_bar" - app:title="Wiimmfi Watcher" /> + app:title="Wiimmfi Watcher" + app:titleTextColor="@color/white" /> </com.google.android.material.appbar.AppBarLayout> diff --git a/app/src/main/res/layout/activity_wiimmfi.xml b/app/src/main/res/layout/activity_wiimmfi.xml index 92fe378..f62fe15 100644 --- a/app/src/main/res/layout/activity_wiimmfi.xml +++ b/app/src/main/res/layout/activity_wiimmfi.xml @@ -26,7 +26,9 @@ android:background="@android:color/transparent" android:elevation="0dp" app:navigationIcon="@drawable/ic_baseline_menu_24" - app:title="Watching 0000-0000-0000" /> + app:navigationIconTint="#FFFFFF" + app:title="Watching 0000-0000-0000" + app:titleTextColor="#FFFFFF" /> </com.google.android.material.appbar.AppBarLayout> @@ -49,6 +51,8 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" + android:theme="@style/Theme.WiimmfiWatcher" + app:headerLayout="@layout/header_navigation_drawer" app:menu="@menu/drawer_navigation_menu"> </com.google.android.material.navigation.NavigationView> diff --git a/app/src/main/res/layout/friend_code_input_fragment.xml b/app/src/main/res/layout/friend_code_input_fragment.xml deleted file mode 100644 index 0dcf568..0000000 --- a/app/src/main/res/layout/friend_code_input_fragment.xml +++ /dev/null @@ -1,65 +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" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="15dp"> - - <TextView - android:id="@+id/textView2" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:text="Enter a friend code to watch:" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - tools:layout_editor_absoluteY="15dp" /> - - <EditText - android:id="@+id/friend_code_edit_text" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:drawablePadding="15dp" - android:ems="10" - android:inputType="textPersonName" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/textView2" /> - - <Button - android:id="@+id/watch_button" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:text="Watch" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/friend_code_edit_text" /> - - <TextView - android:id="@+id/error_text" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:textColor="#B71C1C" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/watch_button" /> - - <TextView - android:id="@+id/textView3" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:text="Recently Watched Friend Codes:" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/error_text" /> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recent_friend_codes_recycler_view" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.0" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/textView3" /> - -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/header_navigation_drawer.xml b/app/src/main/res/layout/header_navigation_drawer.xml new file mode 100644 index 0000000..8fc058d --- /dev/null +++ b/app/src/main/res/layout/header_navigation_drawer.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="match_parent" + android:layout_height="match_parent"> + + + <TextView + android:id="@+id/user_navigation_drawer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginTop="50dp" + android:layout_marginEnd="24dp" + android:text="Player Details" + android:textAppearance="?attr/textAppearanceHeadline6" /> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_room.xml b/app/src/main/res/layout/room_fragment.xml index 467348b..81f8419 100644 --- a/app/src/main/res/layout/fragment_room.xml +++ b/app/src/main/res/layout/room_fragment.xml @@ -1,6 +1,7 @@ <?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" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:foregroundTint="@color/white"> @@ -19,7 +20,9 @@ android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintTop_toBottomOf="@+id/room_header_text" /> + app:layout_constraintTop_toBottomOf="@+id/room_header_text" > + + </androidx.recyclerview.widget.RecyclerView> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/refresh_button" @@ -34,4 +37,5 @@ app:layout_constraintEnd_toEndOf="parent" app:srcCompat="@drawable/ic_baseline_refresh_24" app:tint="@color/white" /> + </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/watch_code_fragment.xml b/app/src/main/res/layout/watch_code_fragment.xml new file mode 100644 index 0000000..ad8745b --- /dev/null +++ b/app/src/main/res/layout/watch_code_fragment.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout 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:id="@+id/watch_code_layout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="15dp"> + + <com.google.android.material.textfield.TextInputLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:endIconMode="clear_text"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/friend_code_edit_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:drawablePadding="15dp" + android:ems="10" + android:hint="Enter a friend code to watch" + android:inputType="phone" + android:textColorHint="#1E88E5" /> + </com.google.android.material.textfield.TextInputLayout> + + <Button + android:id="@+id/watch_button" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Watch" + app:backgroundTint="@color/blue_700" /> + + <TextView + android:id="@+id/error_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="#B71C1C" /> + + <TextView + android:id="@+id/textView3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Recently Watched Friend Codes:" /> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recent_friend_codes_recycler_view" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + </LinearLayout> + </ScrollView> + +</LinearLayout> diff --git a/app/src/main/res/menu/drawer_navigation_menu.xml b/app/src/main/res/menu/drawer_navigation_menu.xml index 458698a..bedb665 100644 --- a/app/src/main/res/menu/drawer_navigation_menu.xml +++ b/app/src/main/res/menu/drawer_navigation_menu.xml @@ -18,7 +18,6 @@ android:title="Login Regions" android:icon="@drawable/ic_baseline_login_24" /> - <item android:id="@+id/room_match" android:title="Room, Match" diff --git a/app/src/main/res/transition/delayed_fade.xml b/app/src/main/res/transition/delayed_fade.xml new file mode 100644 index 0000000..00ff99c --- /dev/null +++ b/app/src/main/res/transition/delayed_fade.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <fade + android:startDelay="300" + android:duration="@android:integer/config_shortAnimTime"/> +</transitionSet>
\ No newline at end of file diff --git a/app/src/main/res/transition/fade.xml b/app/src/main/res/transition/fade.xml new file mode 100644 index 0000000..148d5b1 --- /dev/null +++ b/app/src/main/res/transition/fade.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <fade + android:duration="@android:integer/config_shortAnimTime"/> +</transitionSet>
\ No newline at end of file diff --git a/app/src/main/res/transition/slide_right.xml b/app/src/main/res/transition/slide_right.xml new file mode 100644 index 0000000..b7d42ce --- /dev/null +++ b/app/src/main/res/transition/slide_right.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <slide + android:duration="300" + android:startDelay="0" + android:slideEdge="right" /> +</transitionSet>
\ No newline at end of file diff --git a/app/src/main/res/transition/slide_right_delayed.xml b/app/src/main/res/transition/slide_right_delayed.xml new file mode 100644 index 0000000..aa49c80 --- /dev/null +++ b/app/src/main/res/transition/slide_right_delayed.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <slide + android:duration="300" + android:startDelay="300" + android:slideEdge="right" /> +</transitionSet>
\ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index efb6bec..d028cf7 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -2,13 +2,13 @@ <!-- Base application theme. --> <style name="Theme.WiimmfiWatcher" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <!-- Primary brand color. --> - <item name="colorPrimary">@color/purple_200</item> - <item name="colorPrimaryVariant">@color/purple_700</item> - <item name="colorOnPrimary">@color/black</item> + <item name="colorPrimary">#212121</item> + <item name="colorPrimaryVariant">#000000</item> + <item name="colorOnPrimary">@color/white</item> <!-- Secondary brand color. --> <item name="colorSecondary">@color/blue_200</item> <item name="colorSecondaryVariant">@color/blue_200</item> - <item name="colorOnSecondary">@color/black</item> + <item name="colorOnSecondary">@color/white</item> <!-- Status bar color. --> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f508026..f565c4c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -5,6 +5,7 @@ <color name="purple_700">#FF3700B3</color> <color name="blue_200">#42A5F5</color> <color name="black">#FF000000</color> + <color name="backgroundNight">#151515</color> <color name="white">#FFFFFFFF</color> <color name="blue_700">#1E88E5</color> <color name="blue_900">#0D47A1</color> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2a6f8a6..bb66ede 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,4 +2,13 @@ <string name="app_name">Wiimmfi</string> <string name="github">All of the code in this project is open source on my GitHub repository <a href='https://github.com/brysonsteck/wiimmfi-watcher/tree/master'>here.</a> You are free to use this code and expand upon it under the GNU General Public License.</string> <string name="bugs">Speaking of bugs, did you find a bug? First, make sure that the issue you found is not listed on my <a href='https://github.com/brysonsteck/wiimmfi-watcher/blob/master/TODO.md'>todo list.</a> It\'s possible I\'m already aware of it or working on it. If your issue is not addressed on the todo list, then you can create an issue on my GitHub repository <a href='https://github.com/brysonsteck/wiimmfi-watcher/issues'>here.</a> If you don\'t know how to use GitHub, you can fill out this <a href='https://docs.google.com/forms/d/e/1FAIpQLSd6qCONAP2tsbHPgzu_CdZcHVHL5nx7q0XFqrVfExEc84kqUQ/viewform?usp=sf_link'>Google Form</a> instead.</string> + <string name="license">© Copyright 2021 Bryson Steck\n\nWiimmfi Watcher is available under the GNU General Public License Version 3. You can view the license <a href='https://github.com/brysonsteck/wiimmfi-watcher/tree/dev/LICENSE'>here.</a>\n\nWiimmfi Watcher is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version.\n\nWiimmfi Watcher is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License + along with Wiimmfi Watcher. If not, see <<a href='https://www.gnu.org/licenses/'>https://www.gnu.org/licenses/</a>>.</string> + <string name="contact">If you would like to get ahold of me for any reason unrelated to bug reports or this app in general, you can contact me through email at <a href='mailto:steck.bryson@gmail.com'>steck.bryson@gmail.com</a> or on Discord at bryzinga#9971.</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index b166e7b..73a1e00 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -5,10 +5,11 @@ <item name="colorPrimary">#1E88E5</item> <item name="colorPrimaryVariant">#0D47A1</item> <item name="colorOnPrimary">@color/white</item> + <item name="backgroundColor">#ffffff</item> <!-- Secondary brand color. --> <item name="colorSecondary">@color/blue_200</item> <item name="colorSecondaryVariant">@color/blue_200</item> - <item name="colorOnSecondary">@color/black</item> + <item name="colorOnSecondary">@color/white</item> <!-- Status bar color. --> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> |