Added custom action bar with USB icon.

This commit is contained in:
vsuryakumar
2023-01-31 17:41:29 +05:30
parent 8c1da820e0
commit ab6e0d50da
10 changed files with 125 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15,7v4h1v2h-3V5h2l-3,-4 -3,4h2v8H8v-2.07c0.7,-0.37 1.2,-1.08 1.2,-1.93 0,-1.21 -0.99,-2.2 -2.2,-2.2 -1.21,0 -2.2,0.99 -2.2,2.2 0,0.85 0.5,1.56 1.2,1.93V13c0,1.11 0.89,2 2,2h3v3.05c-0.71,0.37 -1.2,1.1 -1.2,1.95 0,1.22 0.99,2.2 2.2,2.2 1.21,0 2.2,-0.98 2.2,-2.2 0,-0.85 -0.49,-1.58 -1.2,-1.95V15h3c1.11,0 2,-0.89 2,-2v-2h1V7h-4z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#B40000" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15,8h4v4h-1v2c0,0.34 -0.08,0.66 -0.23,0.94L16,13.17V12h-1V8zM11,8.17l2,2V6h2l-3,-4L9,6h2V8.17zM13,16v2.28c0.6,0.34 1,0.98 1,1.72c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2c0,-0.74 0.4,-1.37 1,-1.72V16H8c-1.11,0 -2,-0.89 -2,-2v-2.28C5.4,11.38 5,10.74 5,10c0,-0.59 0.26,-1.13 0.68,-1.49L1.39,4.22l1.41,-1.41l18.38,18.38l-1.41,1.41L13.17,16H13zM11,14v-0.17l-2.51,-2.51c-0.14,0.16 -0.31,0.29 -0.49,0.4V14H11z"/>
</vector>

View File

@@ -5,12 +5,35 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:titleTextColor="#FFFFFF"
android:elevation="4dp"
app:menu="@menu/my_menu"
android:theme="@style/ToolbarTheme"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<FrameLayout
android:id="@+id/fl_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_toolbar"
app:layout_constraintBottom_toBottomOf="parent"
tools:context=".presentation.testRight.TestRightActivity">
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@@ -2,11 +2,14 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- "Mark Favorite", should appear as action button if possible -->
<item
android:id="@+id/action_favorite"
android:id="@+id/action_usb"
android:checkable="false"
android:enabled="true"
android:icon="@drawable/ic_baseline_usb_24"
android:title="@string/usb_connection"
app:showAsAction="always"/>
android:visible="true"
app:showAsAction="always" />
</menu>

View File

@@ -21,4 +21,26 @@
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.HPOS.ActionBar" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- <style name="Theme.RefactoredApp" parent="Theme.MaterialComponents.Light.DarkActionBar">-->
<!-- Primary brand color. -->
<!-- <item name="colorPrimary">@color/purple_200</item>-->
<!-- <item name="colorPrimary">@color/purple_500</item>-->
<item name="colorPrimary">@color/blue_app</item>
<!-- <item name="colorPrimaryVariant">@color/purple_700</item>-->
<item name="colorPrimaryVariant">@color/blue_app_dark</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -6,6 +6,10 @@
<item name="android:windowFullscreen">true</item>
</style>
<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<item name="colorControlNormal">@color/white</item>
</style>
<style name="title1">
<item name="android:textSize">20.5sp</item>
<item name="android:letterSpacing">-0.01</item>

View File

@@ -15,4 +15,20 @@
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.HPOS.ActionBar" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- <style name="Theme.RefactoredApp" parent="Theme.MaterialComponents.Light.DarkActionBar">-->
<!-- Primary brand color. -->
<item name="colorPrimary">@color/blue_app</item>
<!-- <item name="colorPrimaryVariant">@color/purple_700</item>-->
<item name="colorPrimaryVariant">@color/blue_app_dark</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>