mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-07 19:47:36 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a979b7dab | ||
|
|
f1d8a3341e | ||
|
|
462495b173 | ||
|
|
74d1011412 | ||
|
|
52d2a244a0 | ||
|
|
1b050f5d3c | ||
|
|
2cec483288 | ||
|
|
10019cb86b | ||
|
|
83806e0d90 | ||
|
|
30661e1a2b | ||
|
|
26326024e0 | ||
|
|
b0bd74af5a |
No files matched your search
@@ -1,7 +1,10 @@
|
|||||||
package one.nem.lacerta;
|
package one.nem.lacerta;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
@@ -10,11 +13,14 @@ 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.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
import com.google.android.material.shape.CornerFamily;
|
||||||
|
import com.google.android.material.shape.MaterialShapeDrawable;
|
||||||
|
import com.google.android.material.shape.ShapeAppearanceModel;
|
||||||
|
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
@@ -46,5 +52,38 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
// Set navigation bar color
|
// 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));
|
||||||
|
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
// // Create a new TextView
|
||||||
|
// TextView toolbarTitle = new TextView(this);
|
||||||
|
// // Set the text and center it in the TextView
|
||||||
|
// toolbarTitle.setText("App Name");
|
||||||
|
// toolbarTitle.setTextColor(Color.WHITE);
|
||||||
|
// toolbarTitle.setTextSize(20);
|
||||||
|
// toolbarTitle.setLayoutParams(new Toolbar.LayoutParams(Toolbar.LayoutParams.WRAP_CONTENT,
|
||||||
|
// Toolbar.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL));
|
||||||
|
//
|
||||||
|
// // Set the TextView as the title
|
||||||
|
// toolbar.addView(toolbarTitle);
|
||||||
|
|
||||||
|
float radius = getResources().getDimension(one.nem.lacerta.shared.ui.R.dimen.toolbar_corner_radius);
|
||||||
|
|
||||||
|
MaterialShapeDrawable materialShapeDrawable = (MaterialShapeDrawable)toolbar.getBackground();
|
||||||
|
materialShapeDrawable.setShapeAppearanceModel(materialShapeDrawable.getShapeAppearanceModel()
|
||||||
|
.toBuilder()
|
||||||
|
.setAllCorners(CornerFamily.ROUNDED,radius)
|
||||||
|
.build());
|
||||||
|
// Set the MaterialShapeDrawable as the background of the Toolbar
|
||||||
|
|
||||||
|
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||||
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||||
|
this, drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);
|
||||||
|
drawer.addDrawerListener(toggle);
|
||||||
|
toggle.syncState();
|
||||||
|
|
||||||
|
// Set the app name in the middle of the toolbar
|
||||||
|
getSupportActionBar().setTitle("App Name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,64 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:theme="@style/Theme.Lacerta"
|
android:theme="@style/Theme.Lacerta"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/nav_host_fragment"
|
android:layout_width="match_parent"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:layout_height="match_parent">
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:defaultNavHost="true"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/bottom_nav"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:navGraph="@navigation/main_nav"
|
|
||||||
tools:layout="@layout/fragment_debug_menu_container" />
|
|
||||||
|
|
||||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/bottom_nav"
|
android:id="@+id/app_bar_layout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:menu="@menu/bottom_nav_menu"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="?attr/colorSecondaryContainer"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
app:titleCentered="true" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.fragment.app.FragmentContainerView
|
||||||
|
android:id="@+id/nav_host_fragment"
|
||||||
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:defaultNavHost="true"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/bottom_nav"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/app_bar_layout"
|
||||||
|
app:navGraph="@navigation/main_nav"
|
||||||
|
tools:layout="@layout/fragment_debug_menu_container" />
|
||||||
|
|
||||||
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
|
android:id="@+id/bottom_nav"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:menu="@menu/bottom_nav_menu"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<!-- NavigationView for the navigation drawer -->
|
||||||
|
<com.google.android.material.navigation.NavigationView
|
||||||
|
android:id="@+id/nav_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
app:menu="@menu/drawer_menu" />
|
||||||
|
|
||||||
|
</androidx.drawerlayout.widget.DrawerLayout>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_home"
|
||||||
|
android:icon="@drawable/developer_mode_24px"
|
||||||
|
android:title="@string/placeholder" />
|
||||||
|
</menu>
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".HomeTopFragment"
|
tools:context=".HomeTopFragment"
|
||||||
tools:ignore="ExtraText">
|
tools:ignore="ExtraText"
|
||||||
|
android:background="@color/colorSurface">
|
||||||
|
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<!-- TODO: Update blank fragment layout -->
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<dimen name="toolbar_corner_radius">32dp</dimen>
|
||||||
|
</resources>
|
||||||
@@ -15,4 +15,6 @@
|
|||||||
|
|
||||||
<!-- common -->
|
<!-- common -->
|
||||||
|
|
||||||
|
<!-- for placeholder -->
|
||||||
|
<string name="placeholder">Placeholder(TODO: Replace)</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources></resources>
|
||||||
Reference in new issue
Block a user