diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java index c4740e15..5c6f5717 100644 --- a/app/src/main/java/one/nem/lacerta/MainActivity.java +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -18,8 +18,9 @@ import android.widget.TextView; import android.widget.Toast; 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; @@ -55,17 +56,29 @@ public class MainActivity extends AppCompatActivity { 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)); +// // 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); - // Set the TextView as the title - toolbar.addView(toolbarTitle); + // Create a ShapeAppearanceModel with rounded corners + ShapeAppearanceModel shapeAppearanceModel = new ShapeAppearanceModel() + .toBuilder() + .setAllCorners(CornerFamily.ROUNDED, getResources().getDimension(one.nem.lacerta.shared.ui.R.dimen.toolbar_corner_radius)) + .build(); + + // Create a MaterialShapeDrawable with the ShapeAppearanceModel + MaterialShapeDrawable shapeDrawable = new MaterialShapeDrawable(shapeAppearanceModel); + + // Set the MaterialShapeDrawable as the background of the Toolbar + toolbar.setBackground(shapeDrawable); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 535812da..9c748f82 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -22,9 +22,9 @@ android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" - android:background="?attr/colorPrimary" + android:background="?attr/colorSecondaryContainer" app:layout_scrollFlags="scroll|enterAlways" - app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> + app:titleCentered="true" /> diff --git a/shared/ui/src/main/res/values/dimens.xml b/shared/ui/src/main/res/values/dimens.xml new file mode 100644 index 00000000..ee14962f --- /dev/null +++ b/shared/ui/src/main/res/values/dimens.xml @@ -0,0 +1,4 @@ + + + 16dp + \ No newline at end of file