mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
リファクタリング
This commit is contained in:
parent
fc712a131a
commit
725d541316
|
@ -9,6 +9,7 @@ import androidx.navigation.ui.NavigationUI;
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
@ -27,18 +28,23 @@ public class MainActivity extends AppCompatActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
// Debug
|
// Init navigation
|
||||||
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
try {
|
||||||
|
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
||||||
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment);
|
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment);
|
||||||
NavController navController = navHostFragment.getNavController();
|
assert navHostFragment != null;
|
||||||
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
|
NavController navController = navHostFragment.getNavController();
|
||||||
|
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
|
||||||
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set navigation bar color
|
||||||
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
|
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user