aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-05-04 17:59:55 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-05-04 17:59:55 -0600
commit99643e5be84af7e8da217ed48597ceb3c9d3bc85 (patch)
tree91c314dc3a0f4b60d731ccb8854869302eb9bd8d
parentaf7a395b8c707fe5be3c03e9de878fae1d16b997 (diff)
downloadwiimmfi-watcher-99643e5be84af7e8da217ed48597ceb3c9d3bc85.tar
wiimmfi-watcher-99643e5be84af7e8da217ed48597ceb3c9d3bc85.tar.gz
wiimmfi-watcher-99643e5be84af7e8da217ed48597ceb3c9d3bc85.tar.bz2
before i get too deep in the database stuff
-rw-r--r--app/build.gradle66
-rw-r--r--app/src/main/AndroidManifest.xml1
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/MainActivity.java13
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java53
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesFragment.java94
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java4
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java41
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java4
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/model/FriendCode.java10
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/viewmodel/FriendCodeViewModel.java79
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/Player.java15
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomAdapter.java100
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomData.java134
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java64
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java97
-rw-r--r--app/src/main/res/drawable/ic_baseline_assignment_ind_24.xml10
-rw-r--r--app/src/main/res/layout/activity_main.xml2
-rw-r--r--app/src/main/res/layout/activity_wiimmfi.xml24
-rw-r--r--app/src/main/res/layout/fragment_recent_friend_codes.xml14
-rw-r--r--app/src/main/res/layout/fragment_room.xml18
-rw-r--r--app/src/main/res/layout/friend_code_input_fragment.xml13
-rw-r--r--app/src/main/res/layout/recent_friend_codes_item.xml2
-rw-r--r--app/src/main/res/layout/room_player_data_item.xml7
-rw-r--r--app/src/main/res/menu/drawer_navigation_menu.xml2
-rw-r--r--app/src/main/res/values/colors.xml2
25 files changed, 803 insertions, 66 deletions
diff --git a/app/build.gradle b/app/build.gradle
index ecfb534..37f338e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -26,35 +26,59 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+ dataBinding {
+ enabled = true
+ }
}
+
dependencies {
- 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.+'
- androidTestImplementation 'androidx.test.ext:junit:1.1.2'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
dependencies {
- def room_version = "2.3.0"
+ dependencies {
+ def lifecycle_version = "2.3.1"
+ def arch_version = "2.1.0"
- implementation "androidx.room:room-runtime:$room_version"
- annotationProcessor "androidx.room:room-compiler:$room_version"
+ // 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"
- // optional - RxJava2 support for Room
- implementation "androidx.room:room-rxjava2:$room_version"
+ // ViewModel
+ implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
+ // LiveData
+ implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
- // optional - RxJava3 support for Room
- implementation "androidx.room:room-rxjava3:$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'
+ dependencies {
+ def room_version = "2.3.0"
- // optional - Guava support for Room, including Optional and ListenableFuture
- implementation "androidx.room:room-guava:$room_version"
+ implementation "androidx.room:room-runtime:$room_version"
+ annotationProcessor "androidx.room:room-compiler:$room_version"
- // optional - Test helpers
- testImplementation "androidx.room:room-testing:$room_version"
- }
+ // optional - RxJava2 support for Room
+ implementation "androidx.room:room-rxjava2:$room_version"
+
+ // optional - RxJava3 support for Room
+ implementation "androidx.room:room-rxjava3:$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"
+ }
+
+ }
} \ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index bfbddd2..3fa2f1f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -18,6 +18,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity android:name=".wiimmfi.WiimmfiActivity"/>
</application>
</manifest> \ No newline at end of file
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/MainActivity.java b/app/src/main/java/com/example/wiimmterfaceandroid/MainActivity.java
index b8f7905..45c20da 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/MainActivity.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/MainActivity.java
@@ -9,25 +9,32 @@ import androidx.room.Room;
import android.os.Bundle;
import com.example.wiimmterfaceandroid.database.AppDatabase;
+import com.example.wiimmterfaceandroid.model.FriendCode;
+
+import java.util.List;
public class MainActivity extends AppCompatActivity {
+ List<FriendCode> recentFCList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- FragmentContainerView fcInput = findViewById(R.id.recent_friend_codes_fragment);
+ FragmentContainerView fcInput = findViewById(R.id.room_fragment);
AppDatabase database = Room.databaseBuilder(this, AppDatabase.class, "friend-codes-db").build();
+ recentFCList = database.getFriendCodeDao().getAll();
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
- .replace(R.id.friend_code_input_fragment, WatchCodeFragment.class, null)
+ .replace(R.id.friend_code_input_fragment, new WatchCodeFragment(database, recentFCList), null)
.setReorderingAllowed(true)
.commit();
getSupportFragmentManager().beginTransaction()
- .replace(R.id.recent_friend_codes_fragment, RecentCodesFragment.class, null)
+ .replace(R.id.room_fragment, new RecentCodesFragment(database, recentFCList), null)
.setReorderingAllowed(true)
.commit();
}
+
+
}
} \ No newline at end of file
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java b/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java
index dd7db5b..1aad0a5 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesAdapter.java
@@ -1,4 +1,55 @@
package com.example.wiimmterfaceandroid;
-public class RecentCodesAdapter {
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+
+import androidx.annotation.NonNull;
+import androidx.databinding.ObservableArrayList;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.example.wiimmterfaceandroid.model.FriendCode;
+
+import java.util.List;
+
+public class RecentCodesAdapter extends RecyclerView.Adapter<RecentCodesAdapter.ViewHolder>{
+ ObservableArrayList<FriendCode> entries;
+ OnFriendCodeClicked listener;
+ public interface OnFriendCodeClicked {
+ public void onClick(FriendCode entry);
+ }
+
+ public RecentCodesAdapter (ObservableArrayList<FriendCode> entries, OnFriendCodeClicked listener) {
+ this.entries = entries;
+ this.listener = listener;
+ }
+
+ @NonNull
+ @Override
+ public RecentCodesAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recent_friend_codes_item, parent, false);
+ return new RecentCodesAdapter.ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull RecentCodesAdapter.ViewHolder holder, int position) {
+ Button fcButton = holder.itemView.findViewById(R.id.recent_friend_code_button);
+ FriendCode currentFC = entries.get(position);
+ fcButton.setText(currentFC.friendCode);
+ fcButton.setOnClickListener(view -> {
+ if (listener == null) return;
+ listener.onClick(currentFC);
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return entries.size();
+ }
+ class ViewHolder extends RecyclerView.ViewHolder {
+ public ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ }
+ }
}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesFragment.java b/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesFragment.java
index 7dff276..c7554f9 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesFragment.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/RecentCodesFragment.java
@@ -1,9 +1,101 @@
package com.example.wiimmterfaceandroid;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.fragment.app.Fragment;
+
+import com.example.wiimmterfaceandroid.database.AppDatabase;
+import com.example.wiimmterfaceandroid.model.FriendCode;
+import com.example.wiimmterfaceandroid.viewmodel.FriendCodeViewModel;
+import com.example.wiimmterfaceandroid.wiimmfi.WiimmfiActivity;
+
+import java.util.List;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.databinding.ObservableList;
import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProvider;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
public class RecentCodesFragment extends Fragment {
- public RecentCodesFragment() { super(R.layout.fragment_recent_friend_codes); }
+ public RecentCodesFragment() {
+ super(R.layout.fragment_recent_friend_codes);
+ }
+ FriendCodeViewModel viewModel;
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ viewModel = new ViewModelProvider(getActivity()).get(FriendCodeViewModel.class);
+
+ RecentCodesAdapter adapter = new RecentCodesAdapter(
+ viewModel.getEntries(),
+ (entry) -> {
+ viewModel.setCurrentEntry(entry);
+ Intent intent = new Intent(view.getContext(), WiimmfiActivity.class);
+ intent.putExtra("friendCode", entry.friendCode);
+ startActivity(intent);
+ }
+ );
+ viewModel.getEntries().addOnListChangedCallback(new ObservableList.OnListChangedCallback<ObservableList<FriendCode>>() {
+ @Override
+ public void onChanged(ObservableList<FriendCode> sender) {
+ getActivity().runOnUiThread(adapter::notifyDataSetChanged);
+ }
+
+ @Override
+ public void onItemRangeChanged(ObservableList<FriendCode> sender, int positionStart, int itemCount) {
+ getActivity().runOnUiThread(() -> {
+ adapter.notifyItemRangeChanged(positionStart, itemCount);
+ });
+ }
+
+ @Override
+ public void onItemRangeInserted(ObservableList<FriendCode> sender, int positionStart, int itemCount) {
+ getActivity().runOnUiThread(() -> {
+ adapter.notifyItemRangeInserted(positionStart, itemCount);
+ });
+ }
+
+ @Override
+ public void onItemRangeMoved(ObservableList<FriendCode> sender, int fromPosition, int toPosition, int itemCount) {
+ getActivity().runOnUiThread(() -> {
+ adapter.notifyItemMoved(fromPosition, toPosition);
+ });
+ }
+
+ @Override
+ public void onItemRangeRemoved(ObservableList<FriendCode> sender, int positionStart, int itemCount) {
+ getActivity().runOnUiThread(() -> {
+ adapter.notifyItemRangeRemoved(positionStart, itemCount);
+ });
+ }
+ });
+ RecyclerView recyclerView = view.findViewById(R.id.recent_friend_codes_recycler_view);
+ recyclerView.setAdapter(adapter);
+ recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+
+// view.findViewById(R.id.fab).setOnClickListener((button) -> {
+// viewModel.setCurrentEntry(null);
+// getActivity().getSupportFragmentManager().beginTransaction()
+// .replace(R.id.fragment_container_view, CreateOrUpdateFriendCodeFragment.class, null)
+// .setReorderingAllowed(true)
+// .addToBackStack(null)
+// .commit();
+// });
+// RecyclerView recyclerView = view.findViewById(R.id.recent_friend_codes_recycler_view);
+// recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+// recyclerView.setAdapter(new RecentCodesAdapter(recentFCList));
+ }
}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java b/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java
deleted file mode 100644
index ae7f3e4..0000000
--- a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeAdapter.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.example.wiimmterfaceandroid;
-
-public class WatchCodeAdapter {
-}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java b/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java
index 145fb2c..55c6a63 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/WatchCodeFragment.java
@@ -1,19 +1,56 @@
package com.example.wiimmterfaceandroid;
+import android.content.Intent;
import android.os.Bundle;
import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
+import com.example.wiimmterfaceandroid.database.AppDatabase;
+import com.example.wiimmterfaceandroid.model.FriendCode;
+import com.example.wiimmterfaceandroid.viewmodel.FriendCodeViewModel;
+import com.example.wiimmterfaceandroid.wiimmfi.WiimmfiActivity;
+import com.google.android.material.textview.MaterialTextView;
+
+import java.util.List;
+
public class WatchCodeFragment extends Fragment {
+ List<FriendCode> recentFCList;
+ AppDatabase database;
- public WatchCodeFragment() { super(R.layout.friend_code_input_fragment); }
+ public WatchCodeFragment(AppDatabase database, List<FriendCode> recentFCList) {
+ super(R.layout.friend_code_input_fragment);
+ this.database = database;
+ this.recentFCList = recentFCList;
+ }
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
-
+ 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);
+ FriendCodeViewModel friendCodeViewModel = new FriendCodeViewModel(friendCode.getText().toString());
+ if (friendCodeViewModel.getFullFriendCode() == null) {
+ errorText.setText("ERROR: Insert a friend code in the format XXXX-XXXX-XXXX");
+ friendCode.setText("");
+ } else {
+ errorText.setText("");
+// FriendCodeObj friendCodeObj = new FriendCodeObj();
+// friendCodeObj.friendCode = friendCode.getText().toString();
+// database.getFriendCodeDao().insert(friendCodeObj);
+ intent.putExtra("friendCode", friendCodeViewModel.getFullFriendCode());
+ startActivity(intent);
+ }
+ }
+ });
}
}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java b/app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java
index e9762fd..dbfb9c5 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/database/FriendCodeDao.java
@@ -16,8 +16,8 @@ public interface FriendCodeDao {
@Query("SELECT * FROM friendcode")
public List<FriendCode> getAll();
- @Query("SELECT * FROM friendcode")
- public FriendCode findByCode(String friendCode);
+// @Query("SELECT * FROM friendcodeobj")
+// public FriendCodeObj findByCode(String friendCode);
@Insert
public void insert(FriendCode friendCode);
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/model/FriendCode.java b/app/src/main/java/com/example/wiimmterfaceandroid/model/FriendCode.java
index 4d1cc5e..cb13138 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/model/FriendCode.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/model/FriendCode.java
@@ -1,13 +1,19 @@
package com.example.wiimmterfaceandroid.model;
+import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+
+import java.io.Serializable;
@Entity
-public class FriendCode {
+public class FriendCode implements Serializable {
@ColumnInfo(name="name")
public String name;
+ @PrimaryKey
@ColumnInfo(name="friendCode")
public String friendCode;
-}
+
+} \ No newline at end of file
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/viewmodel/FriendCodeViewModel.java b/app/src/main/java/com/example/wiimmterfaceandroid/viewmodel/FriendCodeViewModel.java
index 82b892a..cf31868 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/viewmodel/FriendCodeViewModel.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/viewmodel/FriendCodeViewModel.java
@@ -1,9 +1,82 @@
package com.example.wiimmterfaceandroid.viewmodel;
+import android.app.Application;
+
+import androidx.lifecycle.AndroidViewModel;
+import androidx.lifecycle.MutableLiveData;
+
+import com.example.wiimmterfaceandroid.database.AppDatabase;
import com.example.wiimmterfaceandroid.model.FriendCode;
-public class FriendCodeViewModel {
- FriendCode friendCode = new FriendCode();
+import androidx.databinding.ObservableArrayList;
+import androidx.lifecycle.AndroidViewModel;
+import androidx.lifecycle.MutableLiveData;
+import androidx.lifecycle.ViewModel;
+import androidx.room.Room;
+import androidx.room.RoomDatabase;
+
+import androidx.databinding.ObservableArrayList;
+
+public class FriendCodeViewModel extends AndroidViewModel {
+ ObservableArrayList<FriendCode> entries = new ObservableArrayList<>();
+ MutableLiveData<Boolean> saving = new MutableLiveData<>();
+ MutableLiveData<FriendCode> currentEntry = new MutableLiveData<>();
+ AppDatabase db;
+ public FriendCodeViewModel(Application app) {
+ super(app);
+ saving.setValue(false);
+ db = Room.databaseBuilder(app, AppDatabase.class, "fc-database").build();
+ new Thread(() -> {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ entries.addAll(db.getFriendCodeDao().getAll());
+ }).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 void saveFriendCode(String name, String friendCode) {
+ saving.setValue(true);
+ new Thread(() -> {
+ if (currentEntry.getValue() != null) {
+ FriendCode current = currentEntry.getValue();
+ current.name = name;
+ current.friendCode = friendCode;
+ db.getFriendCodeDao().update(current);
+ int index = entries.indexOf(current);
+ entries.set(index, current);
+ } else {
+ FriendCode newEntry = new FriendCode();
+ newEntry.name = name;
+ newEntry.friendCode = friendCode;
+ entries.add(newEntry);
+ }
+ saving.postValue(false);
+ }).start();
+ }
-}
+ public void deleteEntry(FriendCode entry) {
+ new Thread(() -> {
+ db.getFriendCodeDao().delete(entry);
+ entries.remove(entry);
+ }).start();
+ }
+ }
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/Player.java b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/Player.java
new file mode 100644
index 0000000..792f14f
--- /dev/null
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/Player.java
@@ -0,0 +1,15 @@
+package com.example.wiimmterfaceandroid.wiimmfi;
+
+public class Player {
+ String rosterNumber;
+ String miiName;
+ String friendCode;
+ String role;
+ String loginRegion;
+ String roomMatch;
+ String world;
+ String connFail;
+ String vr;
+ String br;
+ boolean watching;
+}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomAdapter.java b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomAdapter.java
index 4145db7..dfa51e7 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomAdapter.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomAdapter.java
@@ -1,4 +1,102 @@
package com.example.wiimmterfaceandroid.wiimmfi;
-public class RoomAdapter {
+import android.annotation.SuppressLint;
+import android.graphics.Color;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import org.jsoup.*;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.example.wiimmterfaceandroid.R;
+import com.google.android.material.card.MaterialCardView;
+import com.google.android.material.color.MaterialColors;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+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;
+ this.header = header;
+ this.players = players;
+ }
+
+ @NonNull
+ @Override
+ public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.room_player_data_item, parent, false);
+ return new ViewHolder(view);
+ }
+
+ @SuppressLint("ResourceAsColor")
+ @Override
+ public void onBindViewHolder(@NonNull RoomAdapter.ViewHolder holder, int position) {
+ MaterialCardView cardView = holder.itemView.findViewById(R.id.player_card_view);
+ TextView rosterNumber = holder.itemView.findViewById(R.id.roster_number);
+ TextView miiName = holder.itemView.findViewById(R.id.mii_names);
+ TextView variableDisplay = holder.itemView.findViewById(R.id.variable_side_data);
+ Player currentPlayer = players.get(position);
+ if (currentPlayer.watching) {
+ cardView.setCardBackgroundColor(Color.parseColor("#0D47A1"));
+ rosterNumber.setTextColor(Color.WHITE);
+ miiName.setTextColor(Color.WHITE);
+ variableDisplay.setTextColor(Color.WHITE);
+ }
+ rosterNumber.setText(currentPlayer.rosterNumber + ") ");
+ miiName.setText(currentPlayer.miiName);
+
+ switch (display) {
+ case "fc":
+ variableDisplay.setText(currentPlayer.friendCode);
+ break;
+ case "roles":
+ variableDisplay.setText(currentPlayer.role);
+ break;
+ case "login_regions":
+ variableDisplay.setText(currentPlayer.loginRegion);
+ break;
+ case "room_match":
+ variableDisplay.setText(currentPlayer.roomMatch);
+ break;
+ case "world":
+ variableDisplay.setText(currentPlayer.world);
+ break;
+ case "conn_fail":
+ variableDisplay.setText(currentPlayer.connFail);
+ break;
+ case "vr_br":
+ variableDisplay.setText("VR: " + currentPlayer.vr + " / BR: " + currentPlayer.br);
+ break;
+ }
+
+ }
+
+ @Override
+ public int getItemCount() {
+ if (players == null) {
+ return 0;
+ } else {
+ return players.size();
+ }
+ }
+
+ class ViewHolder extends RecyclerView.ViewHolder {
+ public ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ }
+ }
}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomData.java b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomData.java
new file mode 100644
index 0000000..2fccffc
--- /dev/null
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomData.java
@@ -0,0 +1,134 @@
+package com.example.wiimmterfaceandroid.wiimmfi;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class RoomData {
+ String roomHeader;
+ String playerLink;
+ String friendCode;
+ ArrayList<Player> players = new ArrayList<>();
+
+ public RoomData (ArrayList<Player> players, String playerLink, String friendCode) {
+ this.playerLink = getPlayerLink();
+ this.friendCode = friendCode;
+ Document doc = null;
+
+ if (playerLink == null) {
+ System.out.println("The player link is null for some reason");
+ } else {
+
+ try {
+ doc = Jsoup.connect("https://wiimmfi.de/" + this.playerLink).get();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ Element table = doc.select("table").get(0);
+ Elements rows = table.select("tr");
+
+ for (int i = 0; i < rows.size(); i++) {
+ Element row = rows.get(i);
+ Elements colPlayers = row.select("td");
+ Elements colHeader = row.select("th");
+
+ if (colHeader.size() > 0) {
+ if (!colHeader.get(0).text().equals("friend code")) {
+ roomHeader = colHeader.get(0).text();
+ }
+ }
+ if (colPlayers.size() > 0) {
+
+ Player currentPlayer = new Player();
+ for (int j = 0; j < colPlayers.size(); j++) {
+ System.out.println("Player Data: " + colPlayers.get(j).text());
+ switch (j) {
+ case 0:
+ currentPlayer.friendCode = colPlayers.get(0).text();
+ break;
+ case 1:
+ currentPlayer.role = colPlayers.get(1).text().split(" ")[1];
+ currentPlayer.rosterNumber = colPlayers.get(1).text().split(" ")[0].replaceAll("\\s", "");
+ break;
+ case 2:
+ currentPlayer.loginRegion = colPlayers.get(2).text();
+ break;
+ case 3:
+ currentPlayer.roomMatch = colPlayers.get(3).text();
+ break;
+ case 4:
+ currentPlayer.world = colPlayers.get(4).text();
+ break;
+ case 5:
+ currentPlayer.connFail = colPlayers.get(5).text();
+ break;
+ case 6:
+ currentPlayer.vr = colPlayers.get(6).text();
+ break;
+ case 7:
+ currentPlayer.br = colPlayers.get(7).text();
+ break;
+ case 8:
+ currentPlayer.miiName = colPlayers.get(8).text();
+ break;
+ }
+ }
+ if (currentPlayer.friendCode.equals(friendCode)) {
+ currentPlayer.watching = true;
+ }
+ players.add(currentPlayer);
+ }
+
+ }
+ }
+ }
+
+ public String getPlayerLink() {
+ try {
+ Document doc = null;
+
+ doc = Jsoup.connect("https://wiimmfi.de/stats/mkw").get();
+ Element table = doc.select("table").get(0);
+ Elements rows = table.select("tr");
+
+ 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];
+ System.out.println("Player link: " + playerLink);
+
+ }
+ }
+ }
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return playerLink;
+ }
+ public ArrayList<Player> getPlayers() { return players; }
+
+ public String getRoomHeader() { return this.roomHeader; }
+
+ public RoomData refresh() {
+ players.clear();
+ roomHeader = "";
+ RoomData returningData = new RoomData(players, playerLink, friendCode);
+ return returningData;
+ }
+}
+
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java
index 98c5235..9592186 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/RoomFragment.java
@@ -1,4 +1,66 @@
package com.example.wiimmterfaceandroid.wiimmfi;
-public class RoomFragment {
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.example.wiimmterfaceandroid.R;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+
+import java.util.ArrayList;
+
+public class RoomFragment extends Fragment {
+ String display;
+ String header;
+ String playerLink;
+ ArrayList<Player> players;
+ RoomData roomData;
+
+ public RoomFragment(String friendCode, String header, ArrayList<Player> players, String playerLink, String display) {
+ super(R.layout.fragment_room);
+ this.roomData = new RoomData(players, playerLink, friendCode);
+ this.header = roomData.getRoomHeader();
+ this.display = display;
+ this.players = players;
+ this.playerLink = playerLink;
+
+ }
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ FloatingActionButton refreshButton = view.findViewById(R.id.refresh_button);
+ TextView headerTextView = view.findViewById(R.id.room_header_text);
+ if (header == null || playerLink == null || players == 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 recyclerView = view.findViewById(R.id.player_data_recycler_view);
+ recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+ recyclerView.setAdapter(new RoomAdapter(display, playerLink, header, players));
+
+ refreshButton.setOnClickListener((buttonView) -> {
+ refreshButton.setEnabled(false);
+ players.clear();
+ this.header = "";
+ roomData = roomData.refresh();
+ RoomData newRoomData = roomData.refresh();
+ players = roomData.getPlayers();
+ playerLink = roomData.getPlayerLink();
+ String otherPlayerLink = newRoomData.getPlayerLink();
+ header = newRoomData.getRoomHeader();
+ if (playerLink == 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);
+ });
+ }
}
diff --git a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java
index 2a2ce0d..1d1101d 100644
--- a/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java
+++ b/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java
@@ -1,19 +1,114 @@
package com.example.wiimmterfaceandroid.wiimmfi;
import android.content.Intent;
+import android.os.AsyncTask;
import android.os.Bundle;
+import android.os.StrictMode;
+import android.widget.TextView;
+
import org.jsoup.*;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.room.Room;
import com.example.wiimmterfaceandroid.R;
+import com.google.android.material.appbar.MaterialToolbar;
+import com.google.android.material.navigation.NavigationView;
+
+import java.io.IOException;
+import java.util.ArrayList;
public class WiimmfiActivity extends AppCompatActivity {
+ ArrayList<Player> players = new ArrayList<>();
+ final String[] playerLink = new String[1];
+ String friendCode;
+ String roomHeader;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
- String friendCode;
+ friendCode = intent.getStringExtra("friendCode");
+ System.out.println(friendCode);
setContentView(R.layout.activity_wiimmfi);
+ StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
+ StrictMode.setThreadPolicy(policy);
+
+
+ MaterialToolbar toolbar = findViewById(R.id.toolbar);
+ DrawerLayout drawerLayout = findViewById(R.id.drawer_layout);
+ NavigationView drawer = findViewById(R.id.navigation_view);
+
+ toolbar.setTitle("Watching " + friendCode);
+
+ if (savedInstanceState == null) {
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.room_fragment, new RoomFragment(friendCode, roomHeader, players, playerLink[0], "fc"), null)
+ .setReorderingAllowed(true)
+ .commit();
+ }
+ toolbar.setNavigationOnClickListener(view -> {
+ drawerLayout.open();
+ });
+ drawer.setNavigationItemSelectedListener(menuItem -> {
+ menuItem.setChecked(true);
+ drawerLayout.close();
+ 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)
+ .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)
+ .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)
+ .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)
+ .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)
+ .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)
+ .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)
+ .setReorderingAllowed(true)
+ .commit();
+ }
+ return true;
+ });
}
+
}
+
diff --git a/app/src/main/res/drawable/ic_baseline_assignment_ind_24.xml b/app/src/main/res/drawable/ic_baseline_assignment_ind_24.xml
new file mode 100644
index 0000000..d3ebec9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_assignment_ind_24.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,3c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM12,7c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM18,19L6,19v-1.4c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1L18,19z"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index e13dc7b..05b6e5b 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -38,7 +38,7 @@
app:layout_constraintTop_toBottomOf="@+id/appBarLayout" />
<androidx.fragment.app.FragmentContainerView
- android:id="@+id/recent_friend_codes_fragment"
+ android:id="@+id/room_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hapticFeedbackEnabled="false"
diff --git a/app/src/main/res/layout/activity_wiimmfi.xml b/app/src/main/res/layout/activity_wiimmfi.xml
index 1d4d077..92fe378 100644
--- a/app/src/main/res/layout/activity_wiimmfi.xml
+++ b/app/src/main/res/layout/activity_wiimmfi.xml
@@ -2,10 +2,10 @@
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/drawer_layout"
- tools:context=".MainActivity">
+ tools:context=".wiimmfi.WiimmfiActivity">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
@@ -13,28 +13,30 @@
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
+ style="@style/Widget.MaterialComponents.AppBarLayout.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/Widget.MaterialComponents.AppBarLayout.Primary"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
+ style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
- app:title="Watching 0000-0000-0000"
- app:navigationIcon="@drawable/ic_baseline_menu_24"
- style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:background="@android:color/transparent"
- android:elevation="0dp" />
+ android:elevation="0dp"
+ app:navigationIcon="@drawable/ic_baseline_menu_24"
+ app:title="Watching 0000-0000-0000" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
- android:id="@+id/recent_friend_codes_fragment"
+ android:id="@+id/room_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
+
+ </androidx.fragment.app.FragmentContainerView>
<!-- Screen content -->
<!-- Use app:layout_behavior="@string/appbar_scrolling_view_behavior" to fit below top app bar -->
@@ -47,8 +49,8 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
- app:menu="@menu/drawer_navigation_menu"
- >
+ app:menu="@menu/drawer_navigation_menu">
+
</com.google.android.material.navigation.NavigationView>
diff --git a/app/src/main/res/layout/fragment_recent_friend_codes.xml b/app/src/main/res/layout/fragment_recent_friend_codes.xml
index b1cbfe7..e05ce4a 100644
--- a/app/src/main/res/layout/fragment_recent_friend_codes.xml
+++ b/app/src/main/res/layout/fragment_recent_friend_codes.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/recent_friend_codes_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -12,7 +12,8 @@
android:padding="15dp"
android:text="Recently Watched Friend Codes:"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent" />
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recent_friend_codes_recycler_view"
@@ -20,4 +21,11 @@
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
+
+ <!-- <androidx.recyclerview.widget.RecyclerView-->
+ <!-- android:id="@+id/recent_friend_codes_recycler_view"-->
+ <!-- android:layout_width="match_parent"-->
+ <!-- android:layout_height="0dp"-->
+ <!-- app:layout_constraintBottom_toBottomOf="parent"-->
+ <!-- app:layout_constraintTop_toBottomOf="@+id/textView" />-->
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_room.xml b/app/src/main/res/layout/fragment_room.xml
index 42d0d60..467348b 100644
--- a/app/src/main/res/layout/fragment_room.xml
+++ b/app/src/main/res/layout/fragment_room.xml
@@ -5,21 +5,33 @@
android:layout_height="match_parent"
android:foregroundTint="@color/white">
+ <TextView
+ android:id="@+id/room_header_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:padding="18dp"
+ android:text="TextView"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/player_data_recycler_view"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="0dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/room_header_text" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
- android:id="@+id/floatingActionButton"
+ android:id="@+id/refresh_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:clickable="true"
+ android:enabled="true"
android:foregroundTint="#FFFFFF"
app:backgroundTint="#1E88E5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/ic_baseline_refresh_24"
- app:tint="@color/white"/>
+ app:tint="@color/white" />
</androidx.constraintlayout.widget.ConstraintLayout> \ 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
index b834f75..4f3b9ea 100644
--- a/app/src/main/res/layout/friend_code_input_fragment.xml
+++ b/app/src/main/res/layout/friend_code_input_fragment.xml
@@ -16,7 +16,7 @@
tools:layout_editor_absoluteY="15dp" />
<EditText
- android:id="@+id/editTextTextPersonName"
+ android:id="@+id/friend_code_edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawablePadding="15dp"
@@ -33,6 +33,15 @@
android:text="Watch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName" />
+ 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" />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/recent_friend_codes_item.xml b/app/src/main/res/layout/recent_friend_codes_item.xml
index cc2e5db..e56629a 100644
--- a/app/src/main/res/layout/recent_friend_codes_item.xml
+++ b/app/src/main/res/layout/recent_friend_codes_item.xml
@@ -6,7 +6,7 @@
android:layout_height="match_parent">
<Button
- android:id="@+id/button"
+ android:id="@+id/recent_friend_code_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="15dp"
diff --git a/app/src/main/res/layout/room_player_data_item.xml b/app/src/main/res/layout/room_player_data_item.xml
index e6e6ed8..e6fb5c2 100644
--- a/app/src/main/res/layout/room_player_data_item.xml
+++ b/app/src/main/res/layout/room_player_data_item.xml
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView 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/player_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_margin="16dp">
+ android:layout_margin="16dp"
+ app:cardBackgroundColor="#FFFFFF">
<LinearLayout
android:layout_width="wrap_content"
@@ -32,6 +35,6 @@
android:layout_height="match_parent"
android:layout_margin="10dp"
android:text="0000-0000-0000"
- tools:textAlignment="viewEnd" />
+ android:textDirection="rtl" />
</com.google.android.material.card.MaterialCardView> \ No newline at end of file
diff --git a/app/src/main/res/menu/drawer_navigation_menu.xml b/app/src/main/res/menu/drawer_navigation_menu.xml
index 4482202..458698a 100644
--- a/app/src/main/res/menu/drawer_navigation_menu.xml
+++ b/app/src/main/res/menu/drawer_navigation_menu.xml
@@ -11,7 +11,7 @@
<item
android:id="@+id/roles"
android:title="Roles"
- android:icon="@drawable/ic_baseline_person_24"
+ android:icon="@drawable/ic_baseline_assignment_ind_24"
/>
<item
android:id="@+id/login_regions"
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index f8c6127..e3b20f7 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -7,4 +7,6 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
+ <color name="blue_700">#1E88E5</color>
+ <color name="blue_900">#0D47A1</color>
</resources> \ No newline at end of file