General layout (WIP), Broken navigation

This commit is contained in:
MrLetsplay 2023-06-16 23:04:28 +02:00
parent 1a123f6b8d
commit f2c182e69a
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
8 changed files with 18 additions and 17 deletions

View File

@ -12,6 +12,6 @@
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-06-16T19:25:50.154175976Z" />
<timeTargetWasSelectedWithDropDown value="2023-06-16T20:57:31.174436180Z" />
</component>
</project>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -1,10 +1,13 @@
package com.cringe_studios.cringe_authenticator;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.Menu;
import com.cringe_studios.cringe_authenticator.ui.dynamic.DynamicFragment;
import com.cringe_studios.cringe_authenticator.ui.home.HomeFragment;
import com.cringe_studios.cringe_authenticator.ui.settings.SettingsFragment;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.navigation.NavigationView;
@ -42,7 +45,7 @@ public class MainActivity extends AppCompatActivity {
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_settings, R.id.nav_credits)
R.id.nav_home, R.id.nav_credits)
.setOpenableLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
@ -57,6 +60,11 @@ public class MainActivity extends AppCompatActivity {
return true;
}
public void onSettings(MenuItem item) {
NavHostFragment f = (NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment_content_main);
f.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment_content_main, new SettingsFragment()).commit();
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);

View File

@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
tools:context=".ui.dynamic.DynamicFragment">
<TextView
android:id="@+id/text_dynamic"

View File

@ -8,10 +8,6 @@
android:id="@+id/nav_home"
android:icon="@drawable/ic_launcher_foreground"
android:title="Home" />
<item
android:id="@+id/nav_settings"
android:icon="@drawable/ic_launcher_foreground"
android:title="Settings" />
<item
android:id="@+id/nav_credits"
android:icon="@drawable/ic_launcher_foreground"

View File

@ -5,5 +5,6 @@
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
app:showAsAction="never"
android:onClick="onSettings" />
</menu>

View File

@ -11,12 +11,6 @@
android:label="@string/menu_home"
tools:layout="@layout/fragment_home" />
<fragment
android:id="@+id/nav_settings"
android:name="com.cringe_studios.cringe_authenticator.ui.settings.SettingsFragment"
android:label="Settings"
tools:layout="@layout/fragment_settings" />
<fragment
android:id="@+id/nav_credits"
android:name="com.cringe_studios.cringe_authenticator.ui.credits.CreditsFragment"

View File

@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.1' apply false
id 'com.android.library' version '8.0.1' apply false
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
}