aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java
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 /app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java
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
Diffstat (limited to 'app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java')
-rw-r--r--app/src/main/java/com/example/wiimmterfaceandroid/wiimmfi/WiimmfiActivity.java97
1 files changed, 96 insertions, 1 deletions
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;
+ });
}
+
}
+