Merge pull request #81 from lacerta-doc/refactor/refactor1

リファクタリング
This commit is contained in:
ろむねこ 2024-01-19 15:20:52 +09:00 committed by GitHub
commit 4101f75685
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 45 deletions

View File

@ -59,30 +59,6 @@ dependencies {
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
//
// Feature
implementation project(':feature:home')
implementation project(':feature:search')
implementation project(':feature:library')
implementation project(':feature:scan')
implementation project(':feature:debug') //
// // Component
// implementation project(':component:common')
// implementation project(':component:scanner')
// implementation project(':component:viewer')
// // Data
// implementation project(':data:repository')
//
// // Source
// implementation project(':data:source:database')
// implementation project(':data:source:preference')
//
implementation project(':data')
implementation project(':shared:ui')
// Hilt (DI)
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
@ -92,4 +68,13 @@ dependencies {
implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment
// Feature
implementation project(':feature:home')
implementation project(':feature:search')
implementation project(':feature:library')
implementation project(':feature:scan')
implementation project(':feature:debug') //
implementation project(':data')
implementation project(':shared:ui')
}

View File

@ -1,6 +1,7 @@
package one.nem.lacerta;
import android.app.Application;
import android.util.Log;
import com.google.android.material.color.DynamicColors;
@ -12,8 +13,12 @@ public class LacertaApplication extends Application {
public void onCreate() {
super.onCreate();
// DynamicColorを有効化
if (DynamicColors.isDynamicColorAvailable()) {
Log.d("DynamicColors", "DynamicColors is available. Applying to activities...");
DynamicColors.applyToActivitiesIfAvailable(this);
} else {
Log.d("DynamicColors", "DynamicColors is not available.");
}
}

View File

@ -9,6 +9,7 @@ import androidx.navigation.ui.NavigationUI;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
@ -27,20 +28,23 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Debug
// Init navigation
try {
FragmentManager supportFragmentManager = getSupportFragmentManager();
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment);
assert navHostFragment != null;
NavController navController = navHostFragment.getNavController();
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
NavigationUI.setupWithNavController(bottomNavigationView, navController);
}
catch (Exception e) {
Log.e("Init", "Failed to init navigation");
Log.e("Init", "Searchable Error code: " + "894b5941-3bc0-46fe-b752-0dbc88be29a8");
Toast.makeText(this, "Failed to init navigation", Toast.LENGTH_LONG).show();
finish(); // Exit app
}
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show();
// Set navigation bar color
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
}
}

View File

@ -6,20 +6,19 @@
android:icon="@drawable/home_24px"
android:title="Home"/>
<item
android:id="@id/feature_library_navigation"
android:icon="@drawable/folder_24px"
android:title="Library"/>
<item
android:id="@id/feature_search_navigation"
android:icon="@drawable/search_24px"
android:title="Search"/>
<item
android:id="@id/feature_library_navigation"
android:icon="@drawable/folder_24px"
android:title="Library"/>
<item
android:id="@id/feature_debug_navigation"
android:icon="@drawable/developer_mode_24px"
android:title="Debug menu"/>
</menu>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>