From 130e2cf1ac4d1e8a29aac0f04403fe0ee8abc62d Mon Sep 17 00:00:00 2001 From: MrLetsplay Date: Sat, 24 Jun 2023 23:19:15 +0200 Subject: [PATCH] Remove NavController, Fix reference to missing array --- .../cringe_authenticator/MainActivity.java | 19 ------------------- .../fragment/SettingsFragment.java | 2 -- 2 files changed, 21 deletions(-) diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java index 88ff400..250b4d3 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java @@ -1,8 +1,6 @@ package com.cringe_studios.cringe_authenticator; -import android.content.Intent; import android.os.Bundle; -import android.renderscript.ScriptGroup; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -10,8 +8,6 @@ import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; -import android.widget.ListAdapter; -import android.widget.SimpleAdapter; import android.widget.Toast; import androidx.activity.result.ActivityResultLauncher; @@ -21,9 +17,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.biometric.BiometricPrompt; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; -import androidx.navigation.NavController; import androidx.navigation.Navigation; -import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.NavigationUI; import com.cringe_studios.cringe_authenticator.databinding.ActivityMainBinding; @@ -33,7 +27,6 @@ import com.cringe_studios.cringe_authenticator.fragment.DynamicFragment; import com.cringe_studios.cringe_authenticator.fragment.HomeFragment; import com.cringe_studios.cringe_authenticator.fragment.MenuFragment; import com.cringe_studios.cringe_authenticator.fragment.SettingsFragment; -import com.cringe_studios.cringe_authenticator.scanner.QRScannerActivity; import com.cringe_studios.cringe_authenticator.scanner.QRScannerContract; import com.cringe_studios.cringe_authenticator.util.NavigationUtil; import com.cringe_studios.cringe_authenticator.util.SettingsUtil; @@ -44,7 +37,6 @@ import java.util.concurrent.Executor; public class MainActivity extends AppCompatActivity { - private AppBarConfiguration appBarConfiguration; private ActivityMainBinding binding; private ActivityResultLauncher startQRCodeScan; @@ -104,10 +96,6 @@ public class MainActivity extends AppCompatActivity { setSupportActionBar(binding.toolbar); - NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); - appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build(); - NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); - binding.fabMenu.setOnClickListener(view -> NavigationUtil.navigate(this, MenuFragment.class, null)); binding.fabScan.setOnClickListener(view -> scanCode()); binding.fabInput.setOnClickListener(view -> inputCode()); @@ -153,13 +141,6 @@ public class MainActivity extends AppCompatActivity { } } - @Override - public boolean onSupportNavigateUp() { - NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); - return NavigationUI.navigateUp(navController, appBarConfiguration) - || super.onSupportNavigateUp(); - } - public void openSettings(MenuItem item) { NavigationUtil.navigate(this, SettingsFragment.class, null); } diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/SettingsFragment.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/SettingsFragment.java index 9d265c5..4fa1347 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/SettingsFragment.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/SettingsFragment.java @@ -39,8 +39,6 @@ public class SettingsFragment extends Fragment { binding.settingsEnableIntroVideo.setChecked(SettingsUtil.isIntroVideoEnabled(requireContext())); binding.settingsEnableIntroVideo.setOnCheckedChangeListener((view, checked) -> SettingsUtil.setEnableIntroVideo(requireContext(), checked)); - getResources().getStringArray(R.array.themes); - binding.settingsTheme.setAdapter(new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, SettingsUtil.THEME_NAMES.toArray(new String[0]))); binding.settingsTheme.setSelection(SettingsUtil.THEME_NAMES.indexOf(SettingsUtil.getTheme(requireContext()))); binding.settingsTheme.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {