aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/me/brysonsteck/wiimmfiwatcher
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-05-10 13:23:25 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-05-10 13:23:25 -0600
commit27b36802b876805ae30c322ecbadf7286d2239fb (patch)
tree4ef9f2d216cf585315b435b926e9082f35fbed40 /app/src/main/java/me/brysonsteck/wiimmfiwatcher
parenteb45e67349cc3ebec45aaca7822f9d7881db7aeb (diff)
downloadwiimmfi-watcher-27b36802b876805ae30c322ecbadf7286d2239fb.tar
wiimmfi-watcher-27b36802b876805ae30c322ecbadf7286d2239fb.tar.gz
wiimmfi-watcher-27b36802b876805ae30c322ecbadf7286d2239fb.tar.bz2
final cleanup before first release
Diffstat (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher')
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java1
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java24
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java4
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java36
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomAdapter.java3
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java12
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java6
-rw-r--r--app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java16
8 files changed, 28 insertions, 74 deletions
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java
index c74c8c5..8f9111c 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/AboutFragment.java
@@ -2,7 +2,6 @@ package me.brysonsteck.wiimmfiwatcher;
import android.annotation.SuppressLint;
import android.os.Bundle;
-import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.TextView;
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
index d935d48..c37aaf7 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/MainActivity.java
@@ -1,21 +1,14 @@
package me.brysonsteck.wiimmfiwatcher;
-
-import android.content.ClipData;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.ObservableArrayList;
-import androidx.lifecycle.ViewModelProvider;
import androidx.room.Room;
-import androidx.sqlite.db.SimpleSQLiteQuery;
-
-import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import me.brysonsteck.wiimmfiwatcher.database.AppDatabase;
import me.brysonsteck.wiimmfiwatcher.model.FriendCode;
-import me.brysonsteck.wiimmfiwatcher.viewmodel.FriendCodeViewModel;
public class MainActivity extends AppCompatActivity {
ObservableArrayList<FriendCode> recentFCList = new ObservableArrayList<>();
@@ -27,7 +20,6 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
View aboutButton = findViewById(R.id.about_button);
-
if (savedInstanceState == null) {
aboutButton.setVisibility(View.VISIBLE);
getSupportFragmentManager().beginTransaction()
@@ -37,24 +29,10 @@ public class MainActivity extends AppCompatActivity {
}
- database = Room.databaseBuilder(this, AppDatabase.class, "friend-codes-db").build();
-
-// 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();
-// }
-// });
+ database = Room.databaseBuilder(this, 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)
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java
index 465cccf..c1ba705 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/WatchCodeFragment.java
@@ -14,7 +14,6 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
-import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import com.google.android.material.textview.MaterialTextView;
import me.brysonsteck.wiimmfiwatcher.model.FriendCode;
@@ -102,9 +101,6 @@ public class WatchCodeFragment extends Fragment {
} else {
errorText.setText("");
viewModel.saveFriendCode("", friendCode.getText().toString());
-// FriendCodeObj friendCodeObj = new FriendCodeObj();
-// friendCodeObj.friendCode = friendCode.getText().toString();
-// database.getFriendCodeDao().insert(friendCodeObj);
intent.putExtra("friendCode", friendCode.getText().toString());
startActivity(intent);
}
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java
index 87db049..25cdd64 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/viewmodel/FriendCodeViewModel.java
@@ -30,28 +30,16 @@ public class FriendCodeViewModel extends AndroidViewModel {
}).start();
}
- public void setCurrentEntry(FriendCode entry) {
- currentEntry.postValue(entry);
- }
-
- public MutableLiveData<FriendCode> getCurrentEntry() {
- return currentEntry;
- }
-
- public MutableLiveData<Boolean> getSaving() {
- return saving;
- }
-
public ObservableArrayList<FriendCode> getEntries() {
return entries;
}
- public boolean deleteAll() {
- for (FriendCode entry: entries) {
- db.getFriendCodeDao().nukeTable();
- }
- return true;
- }
+// public boolean deleteAll() {
+// for (FriendCode entry: entries) {
+// db.getFriendCodeDao().nukeTable();
+// }
+// return true;
+// }
public void saveFriendCode(String name, String friendCode) {
saving.setValue(true);
@@ -70,10 +58,10 @@ public class FriendCodeViewModel extends AndroidViewModel {
}).start();
}
- public void deleteEntry(FriendCode entry) {
- new Thread(() -> {
- db.getFriendCodeDao().delete(entry);
- entries.remove(entry);
- }).start();
- }
+// public void deleteEntry(FriendCode entry) {
+// new Thread(() -> {
+// db.getFriendCodeDao().delete(entry);
+// entries.remove(entry);
+// }).start();
+// }
}
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 0cf7a6e..c7a0f29 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomAdapter.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomAdapter.java
@@ -19,12 +19,11 @@ import java.util.ArrayList;
import me.brysonsteck.wiimmfiwatcher.R;
public class RoomAdapter extends RecyclerView.Adapter<RoomAdapter.ViewHolder>{
-
String display;
String playerLink;
String header;
ArrayList<Player> players;
- boolean online = true;
+
public RoomAdapter (String display, String playerLink, String header, ArrayList<Player> players) {
this.display = display;
this.playerLink = playerLink;
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java
index f0d9db7..284b735 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomData.java
@@ -14,7 +14,7 @@ public class RoomData {
String friendCode;
ArrayList<Player> players = new ArrayList<>();
- public RoomData (ArrayList<Player> players, String playerLink, String friendCode) {
+ public RoomData (ArrayList<Player> players, String friendCode) {
this.friendCode = friendCode;
getPlayerLink();
Document doc = null;
@@ -91,10 +91,8 @@ public class RoomData {
public void getPlayerLink() {
try {
- Document doc = null;
-
- doc = Jsoup.connect("https://wiimmfi.de/stats/mkw")
- .userAgent("Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher) (UNDER DEVELOPMENT)")
+ Document doc = Jsoup.connect("https://wiimmfi.de/stats/mkw")
+ .userAgent("Wiimmfi Watcher for Android (https://github.com/brysonsteck/wiimmfi-watcher) (Developer testing)")
.get();
Element table = doc.select("table").get(0);
Elements rows = table.select("tr");
@@ -102,13 +100,11 @@ public class RoomData {
for (int i = 0; i < rows.size(); i++) {
Element row = rows.get(i);
Elements colPlayers = row.select("td");
- Elements colHeader = row.select("th");
if (colPlayers.size() > 0) {
String data = colPlayers.get(0).select("a").toString();
-// System.out.println(data);
if (data.contains(friendCode)) {
System.out.println("Found friend code");
playerLink = data.split("\"")[3];
@@ -130,7 +126,7 @@ public class RoomData {
public RoomData refresh() {
players.clear();
roomHeader = "";
- return new RoomData(players, playerLink, friendCode);
+ return new RoomData(players, friendCode);
}
}
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 cbadf63..afb21d6 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/RoomFragment.java
@@ -23,9 +23,9 @@ public class RoomFragment extends Fragment {
ArrayList<Player> players;
RoomData roomData;
- public RoomFragment(String friendCode, String header, ArrayList<Player> players, String playerLink, String display) {
+ public RoomFragment(String friendCode, ArrayList<Player> players, String playerLink, String display) {
super(R.layout.fragment_room);
- this.roomData = new RoomData(players, playerLink, friendCode);
+ this.roomData = new RoomData(players, friendCode);
this.header = roomData.getRoomHeader();
this.display = display;
this.players = players;
@@ -52,8 +52,6 @@ public class RoomFragment extends Fragment {
roomData = roomData.refresh();
RoomData newRoomData = roomData.refresh();
players = roomData.getPlayers();
-// playerLink = roomData.getPlayerLink();
-// String otherPlayerLink = newRoomData.getPlayerLink();
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.";
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 24affee..f3029af 100644
--- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java
+++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java
@@ -41,7 +41,7 @@ public class WiimmfiActivity extends AppCompatActivity {
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "fc"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "fc"), null)
.setReorderingAllowed(true)
.commit();
}
@@ -54,49 +54,49 @@ public class WiimmfiActivity extends AppCompatActivity {
if (menuItem.getItemId() == R.id.friend_code) {
players.clear();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "fc"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "fc"), null)
.setReorderingAllowed(true)
.commit();
}
if (menuItem.getItemId() == R.id.roles) {
players.clear();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "roles"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "roles"), null)
.setReorderingAllowed(true)
.commit();
}
if (menuItem.getItemId() == R.id.login_regions) {
players.clear();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "login_regions"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "login_regions"), null)
.setReorderingAllowed(true)
.commit();
}
if (menuItem.getItemId() == R.id.room_match) {
players.clear();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "room_match"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "room_match"), null)
.setReorderingAllowed(true)
.commit();
}
if (menuItem.getItemId() == R.id.world) {
players.clear();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "world"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "world"), null)
.setReorderingAllowed(true)
.commit();
}
if (menuItem.getItemId() == R.id.conn_fail) {
players.clear();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "conn_fail"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "conn_fail"), null)
.setReorderingAllowed(true)
.commit();
}
if (menuItem.getItemId() == R.id.vr_br) {
players.clear();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "vr_br"), null)
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, players, playerLink[0], "vr_br"), null)
.setReorderingAllowed(true)
.commit();
}