From fc908199f136acd2a5030e5085f024857cd2cfb5 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sat, 8 May 2021 14:58:18 -0600 Subject: changed api and package name --- .../wiimmfiwatcher/wiimmfi/WiimmfiActivity.java | 108 +++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java') diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java new file mode 100644 index 0000000..24affee --- /dev/null +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/wiimmfi/WiimmfiActivity.java @@ -0,0 +1,108 @@ +package me.brysonsteck.wiimmfiwatcher.wiimmfi; + +import android.content.Intent; +import android.os.Bundle; +import android.os.StrictMode; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.drawerlayout.widget.DrawerLayout; + +import com.google.android.material.appbar.MaterialToolbar; +import com.google.android.material.navigation.NavigationView; + +import org.jsoup.*; + +import java.util.ArrayList; + +import me.brysonsteck.wiimmfiwatcher.R; + +public class WiimmfiActivity extends AppCompatActivity { + ArrayList 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(); + 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; + }); + } + +} + -- cgit v1.2.3