From 793241fe47c09c63e2a2e5a4429deed8e7401754 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Mon, 10 May 2021 12:54:31 -0600 Subject: added todo list file, app icon and implemented about fragment --- .../brysonsteck/wiimmfiwatcher/AboutFragment.java | 43 ++++++++++++++++------ .../brysonsteck/wiimmfiwatcher/MainActivity.java | 32 +++++++++------- .../wiimmfiwatcher/WatchCodeFragment.java | 5 ++- 3 files changed, 53 insertions(+), 27 deletions(-) (limited to 'app/src/main/java/me') diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java index 4cd51fd..c74c8c5 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java @@ -11,14 +11,25 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +import com.google.android.material.appbar.MaterialToolbar; + public class AboutFragment extends Fragment { - public AboutFragment() { super(R.layout.about_fragment); } + View aboutButton; + MaterialToolbar toolbar; + + public AboutFragment() { + super(R.layout.about_fragment); + } @SuppressLint("SetTextI18n") @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + aboutButton = getActivity().findViewById(R.id.about_button); + toolbar = getActivity().findViewById(R.id.toolbar); + toolbar.setTitle("About Wiimmfi Watcher"); + TextView aboutWatcher = view.findViewById(R.id.about_watcher_text); TextView aboutMe = view.findViewById(R.id.about_me_text); TextView github = view.findViewById(R.id.github_text); @@ -31,18 +42,15 @@ public class AboutFragment extends Fragment { "Free and open source, you can watch your Wiimmfi Mario Kart Wii 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 at Utah State University. This is my first official application that I'm maintaining. " + + 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. " + "This whole \"application on the Google Play Store\" thing is new to me, so please be patient as I am learning how to maintain something like this. " + - "I hope you enjoy my first application!"); + "I hope you enjoy!"); github.setClickable(true); github.setMovementMethod(LinkMovementMethod.getInstance()); - String githubLink = "here."; -// github.setText("All of the code in this project is open source on my GitHub repository " + Html.fromHtml(githubLink) + " You are free to use this code and expand upon it under the GNU General Public License."); github.setText(R.string.github); -// donations.setMovementMethod(LinkMovementMethod.getInstance()); -// String donationsLink = "here."; + donations.setText("Since this application is free and the code is open source, I do not receive income from maintaining this app. Because of that, I'd appreciate any donation in the following methods:\n\n" + "PayPal: @bryzinga\n" + "Venmo: @brysonsteck\n" + @@ -53,12 +61,23 @@ public class AboutFragment extends Fragment { 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."); -// String todoList = "todo list."; -// String issueGithub = "here."; -// bugs.setText("Speaking of bugs, did you find a bug? First, make sure that the issue you found is not listed on my " + Html.fromHtml(todoList) + -// "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 " + Html.fromHtml(issueGithub) + -// "If you aren't sure how to use GitHub, you can also fill out this Google Forum."); + bugs.setClickable(true); + bugs.setMovementMethod(LinkMovementMethod.getInstance()); + bugs.setText(R.string.bugs); } + @Override + public void onStop() { + super.onStop(); + aboutButton.setVisibility(View.VISIBLE); + toolbar.setTitle("Wiimmfi Watcher"); + } + @Override + public void onResume() { + super.onResume(); + aboutButton.setVisibility(View.INVISIBLE); + toolbar.setTitle("About Wiimmfi Watcher"); + } + } diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java index c3933ee..d935d48 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java @@ -24,8 +24,12 @@ public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + View aboutButton = findViewById(R.id.about_button); if (savedInstanceState == null) { + aboutButton.setVisibility(View.VISIBLE); getSupportFragmentManager().beginTransaction() .replace(R.id.friend_code_input_fragment, new WatchCodeFragment(), null) .setReorderingAllowed(true) @@ -33,25 +37,25 @@ public class MainActivity extends AppCompatActivity { } - setContentView(R.layout.activity_main); database = Room.databaseBuilder(this, AppDatabase.class, "friend-codes-db").build(); - View aboutButton = findViewById(R.id.about_button); - ExtendedFloatingActionButton clearButton = findViewById(R.id.clear_button); - FriendCodeViewModel viewModel = new ViewModelProvider(MainActivity.this).get(FriendCodeViewModel.class); - clearButton.setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(View view) { - new Thread(() -> { - database.clearAllTables(); - database.query(new SimpleSQLiteQuery("DELETE FROM friendcode")); - }); - } - }); +// aboutButton.setVisibility(View.INVISIBLE); +// ExtendedFloatingActionButton clearButton = findViewById(R.id.clear_button); + FriendCodeViewModel viewModel = new ViewModelProvider(MainActivity.this).get(FriendCodeViewModel.class); +// clearButton.setOnClickListener(new View.OnClickListener() { +// +// +// @Override +// public void onClick(View view) { +// getApplicationContext().deleteDatabase("friend-codes-db"); +// database = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "friend-codes-db").build(); +// } +// }); aboutButton.setOnClickListener((about) -> { +// aboutButton.setClickable(false); + aboutButton.setVisibility(View.INVISIBLE); getSupportFragmentManager().beginTransaction() .replace(R.id.friend_code_input_fragment, new AboutFragment(), null) .setReorderingAllowed(true) diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java index 414519c..465cccf 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java @@ -84,7 +84,10 @@ public class WatchCodeFragment extends Fragment { } }); RecyclerView recyclerView = view.findViewById(R.id.recent_friend_codes_recycler_view); - recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); + linearLayoutManager.setReverseLayout(true); + 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); -- cgit v1.2.3