From 11aa7c75e16d6819d0681f408c720cbc6a6754ba Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Tue, 18 May 2021 20:48:17 -0600 Subject: did a ton of stuff i dont remember like a dark mode and small enhancements --- README.md | 8 +++ TODO.md | 17 ++++- app/build.gradle | 74 +++++++++----------- .../brysonsteck/wiimmfiwatcher/AboutFragment.java | 37 +++++++++- .../brysonsteck/wiimmfiwatcher/MainActivity.java | 8 +++ .../wiimmfiwatcher/WatchCodeAdapter.java | 9 +++ .../wiimmfiwatcher/WatchCodeFragment.java | 78 +++++++++++++++++----- .../wiimmfiwatcher/wiimmfi/RoomAdapter.java | 25 ++++++- .../wiimmfiwatcher/wiimmfi/RoomFragment.java | 24 ++++--- .../wiimmfiwatcher/wiimmfi/WiimmfiActivity.java | 10 +++ app/src/main/res/anim/fade_in.xml | 8 +++ app/src/main/res/anim/fade_out.xml | 8 +++ app/src/main/res/anim/slide_in.xml | 8 +++ app/src/main/res/anim/slide_out.xml | 8 +++ app/src/main/res/layout/about_fragment.xml | 36 ++++++++-- app/src/main/res/layout/activity_main.xml | 4 +- app/src/main/res/layout/activity_wiimmfi.xml | 6 +- app/src/main/res/layout/fragment_room.xml | 37 ---------- .../main/res/layout/friend_code_input_fragment.xml | 65 ------------------ .../main/res/layout/header_navigation_drawer.xml | 17 +++++ app/src/main/res/layout/room_fragment.xml | 41 ++++++++++++ app/src/main/res/layout/watch_code_fragment.xml | 62 +++++++++++++++++ app/src/main/res/menu/drawer_navigation_menu.xml | 1 - app/src/main/res/transition/delayed_fade.xml | 6 ++ app/src/main/res/transition/fade.xml | 5 ++ app/src/main/res/transition/slide_right.xml | 7 ++ .../main/res/transition/slide_right_delayed.xml | 7 ++ app/src/main/res/values-night/themes.xml | 8 +-- app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 9 +++ app/src/main/res/values/themes.xml | 3 +- 31 files changed, 445 insertions(+), 192 deletions(-) create mode 100644 app/src/main/res/anim/fade_in.xml create mode 100644 app/src/main/res/anim/fade_out.xml create mode 100644 app/src/main/res/anim/slide_in.xml create mode 100644 app/src/main/res/anim/slide_out.xml delete mode 100644 app/src/main/res/layout/fragment_room.xml delete mode 100644 app/src/main/res/layout/friend_code_input_fragment.xml create mode 100644 app/src/main/res/layout/header_navigation_drawer.xml create mode 100644 app/src/main/res/layout/room_fragment.xml create mode 100644 app/src/main/res/layout/watch_code_fragment.xml create mode 100644 app/src/main/res/transition/delayed_fade.xml create mode 100644 app/src/main/res/transition/fade.xml create mode 100644 app/src/main/res/transition/slide_right.xml create mode 100644 app/src/main/res/transition/slide_right_delayed.xml diff --git a/README.md b/README.md index d95b88f..84bbe74 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/TODO.md b/TODO.md index 028871a..80f17ef 100644 --- a/TODO.md +++ b/TODO.md @@ -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 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 { 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) { @@ -40,6 +45,15 @@ public class WatchCodeFragment extends Fragment { return valid; } + @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); @@ -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{ String playerLink; String header; ArrayList players; + Context context; - public RoomAdapter (String display, String playerLink, String header, ArrayList players) { + public RoomAdapter (String display, String playerLink, String header, ArrayList 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{ 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{ 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 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 @@ + + + + \ 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 @@ + + + + \ 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 @@ + + + + \ 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 @@ + + + + \ 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 @@ + android:layout_height="match_parent" + android:background="#FFFFFF"> @@ -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,12 +102,22 @@ 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" /> + + + + - \ No newline at end of file + \ 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" /> 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" /> @@ -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"> diff --git a/app/src/main/res/layout/fragment_room.xml b/app/src/main/res/layout/fragment_room.xml deleted file mode 100644 index 467348b..0000000 --- a/app/src/main/res/layout/fragment_room.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - \ No newline at end of file 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 @@ - - - - - - - -