WIP: More progress towards getting app to work properly again

This commit is contained in:
2023-11-19 13:55:23 -06:00
parent 8d0602e83a
commit a06e62a944
10 changed files with 47 additions and 49 deletions

2
.idea/.name generated
View File

@@ -1 +1 @@
TimeCraftersConfigurationTool
TimeCrafters Configuration Tool

View File

@@ -1,6 +1,11 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="RIGHT_MARGIN" value="140" />
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
@@ -112,5 +117,8 @@
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

6
.idea/kotlinc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.8.10" />
</component>
</project>

6
.idea/render.experimental.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

View File

@@ -8,7 +8,7 @@ android {
compileSdk = 34
defaultConfig {
applicationId = "org.timecrafters.timecraftersconfigurationtool"
applicationId = "org.timecrafters.TimeCraftersConfigurationTool"
minSdk = 24
targetSdk = 34
versionCode = 1
@@ -49,6 +49,7 @@ android {
dependencies {
implementation("com.google.code.gson:gson:2.10.1")
implementation("androidx.navigation:navigation-ui:2.7.5")
implementation("androidx.navigation:navigation-fragment:2.7.5")
val appcompat_version = "1.6.1"
implementation("androidx.appcompat:appcompat:$appcompat_version")

View File

@@ -1,24 +0,0 @@
package org.timecrafters.timecraftersconfigurationtool
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("org.timecrafters.timecraftersconfigurationtool", appContext.packageName)
}
}

View File

@@ -14,6 +14,7 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.fragment.NavHostFragment;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
@@ -43,7 +44,11 @@ public class MainActivity extends AppCompatActivity {
R.id.navigation_tacnet, R.id.navigation_editor, R.id.navigation_settings,
R.id.navigation_search)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavHostFragment navHostFragment =
(NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
NavController navController = navHostFragment.getNavController();
navController.setGraph(R.navigation.mobile_navigation);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);
@@ -72,7 +77,7 @@ public class MainActivity extends AppCompatActivity {
registerReceiver(new TACNETOnBootReceiver(), new IntentFilter(Intent.ACTION_BOOT_COMPLETED));
if (getIntent().getBooleanExtra("navigate_to_tacnet", false)) {
Navigation.findNavController(this, R.id.nav_host_fragment).navigate(R.id.navigation_tacnet);
navController.navigate(R.id.navigation_tacnet);
}
startTACNETStatusIndictator();
@@ -104,7 +109,10 @@ public class MainActivity extends AppCompatActivity {
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavHostFragment navHostFragment =
(NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
NavController navController = navHostFragment.getNavController();
return NavigationUI.navigateUp(navController, appBarConfiguration) || super.onSupportNavigateUp();
}

View File

@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res"
xmlns:app2="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
@@ -29,11 +31,14 @@
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="56dp"
android:visibility="visible"
app2:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/nav_host_fragment"
app:menu="@menu/bottom_nav_menu" />
app:menu="@menu/bottom_nav_menu"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,17 +0,0 @@
package org.timecrafters.timecraftersconfigurationtool
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}