Improve looks of the app
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
f1890ca010
commit
8ba1a79f8b
12 changed files with 57 additions and 88 deletions
|
@ -35,7 +35,7 @@ android {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'androidx.core:core-ktx:1.7.0'
|
implementation 'androidx.core:core-ktx:1.7.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||||
implementation 'com.google.android.material:material:1.6.1'
|
implementation 'com.google.android.material:material:1.7.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".MagSendApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package dev.kaderli.magsend
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import com.google.android.material.color.DynamicColors
|
||||||
|
|
||||||
|
class MagSendApplication: Application() {
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,7 @@ package dev.kaderli.magsend.activity
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.widget.Toolbar
|
import com.google.android.material.elevation.SurfaceColors
|
||||||
import dev.kaderli.magsend.R
|
|
||||||
|
|
||||||
|
|
||||||
abstract class BaseActivity : AppCompatActivity() {
|
abstract class BaseActivity : AppCompatActivity() {
|
||||||
|
@ -14,15 +13,10 @@ abstract class BaseActivity : AppCompatActivity() {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(getLayoutId())
|
setContentView(getLayoutId())
|
||||||
|
|
||||||
val toolbar: Toolbar = findViewById(R.id.toolbar)
|
val color = SurfaceColors.SURFACE_2.getColor(this)
|
||||||
setSupportActionBar(toolbar)
|
window.statusBarColor = color
|
||||||
if (getLayoutId() != R.layout.activity_main) {
|
window.navigationBarColor = color
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
supportActionBar?.title = title
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract fun getLayoutId(): Int
|
protected abstract fun getLayoutId(): Int
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,22 +6,23 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".activity.CalibrationActivity">
|
tools:context=".activity.CalibrationActivity">
|
||||||
|
|
||||||
<include layout="@layout/toolbar" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/calibrationDescription"
|
android:id="@+id/calibrationDescription"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/layout_margins"
|
||||||
|
android:paddingHorizontal="@dimen/layout_margins"
|
||||||
android:text="@string/calibration_description"
|
android:text="@string/calibration_description"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/calibrationValue"
|
android:id="@+id/calibrationValue"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/component_spacing"
|
android:layout_marginTop="@dimen/component_spacing"
|
||||||
|
android:paddingHorizontal="@dimen/layout_margins"
|
||||||
android:textSize="48sp"
|
android:textSize="48sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
|
@ -7,20 +7,40 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".activity.MainActivity">
|
tools:context=".activity.MainActivity">
|
||||||
|
|
||||||
<include layout="@layout/toolbar" />
|
<TextView
|
||||||
|
android:id="@+id/homeReceiveDescription"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/layout_margins"
|
||||||
|
android:paddingHorizontal="@dimen/layout_margins"
|
||||||
|
android:text="@string/home_receive_description"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/receiveButton"
|
android:id="@+id/receiveButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="@dimen/component_spacing_small"
|
||||||
android:onClick="startReceiveActivity"
|
android:onClick="startReceiveActivity"
|
||||||
android:text="@string/receive_button_label"
|
android:text="@string/receive_button_label"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.498"
|
app:layout_constraintHorizontal_bias="0.488"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/homeReceiveDescription" />
|
app:layout_constraintTop_toBottomOf="@+id/homeReceiveDescription" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/homeCalibrationDescription"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/component_spacing"
|
||||||
|
android:paddingHorizontal="@dimen/layout_margins"
|
||||||
|
android:text="@string/home_calibration_description"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/receiveButton" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/calibrateButton"
|
android:id="@+id/calibrateButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -32,22 +52,4 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/homeCalibrationDescription" />
|
app:layout_constraintTop_toBottomOf="@+id/homeCalibrationDescription" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/homeReceiveDescription"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/home_receive_description"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/homeCalibrationDescription"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/component_spacing"
|
|
||||||
android:text="@string/home_calibration_description"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/receiveButton" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
|
@ -6,17 +6,16 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".activity.ReceiveActivity">
|
tools:context=".activity.ReceiveActivity">
|
||||||
|
|
||||||
<include layout="@layout/toolbar" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/receiveDescription"
|
android:id="@+id/receiveDescription"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/layout_margins"
|
||||||
android:paddingHorizontal="@dimen/layout_margins"
|
android:paddingHorizontal="@dimen/layout_margins"
|
||||||
android:text="@string/receive_description"
|
android:text="@string/receive_description"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/preambleStatus"
|
android:id="@+id/preambleStatus"
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
android:minHeight="?attr/actionBarSize"
|
|
||||||
android:theme="?attr/actionBarTheme"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
|
|
@ -1,16 +1,4 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources>
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="Theme.MagSend" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
<style name="Theme.MagSend" parent="Theme.Material3.Dark" />
|
||||||
<!-- Primary brand color. -->
|
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</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">?attr/colorPrimaryVariant</item>
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
</style>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="purple_200">#FFBB86FC</color>
|
|
||||||
<color name="purple_500">#FF6200EE</color>
|
|
||||||
<color name="purple_700">#FF3700B3</color>
|
|
||||||
<color name="teal_200">#FF03DAC5</color>
|
|
||||||
<color name="teal_700">#FF018786</color>
|
|
||||||
<color name="black">#FF000000</color>
|
|
||||||
<color name="white">#FFFFFFFF</color>
|
|
||||||
<color name="error">#FFFF0000</color>
|
<color name="error">#FFFF0000</color>
|
||||||
<color name="success">#FF00FF00</color>
|
<color name="success">#FF00FF00</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
<dimen name="layout_margins">16dp</dimen>
|
<dimen name="layout_margins">16dp</dimen>
|
||||||
<dimen name="component_spacing">24dp</dimen>
|
<dimen name="component_spacing">24dp</dimen>
|
||||||
<dimen name="title_text_size">48sp</dimen>
|
<dimen name="title_text_size">48sp</dimen>
|
||||||
<dimen name="component_spacing_small">8dp</dimen>
|
<dimen name="component_spacing_small">8dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources>
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="Theme.MagSend" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
<style name="Theme.MagSend" parent="Theme.Material3.Light" >
|
||||||
<!-- Primary brand color. -->
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
<item name="colorPrimary">@color/purple_500</item>
|
<item name="android:windowLightNavigationBar">true</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
</style>
|
||||||
<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">?attr/colorPrimaryVariant</item>
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
</style>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Reference in a new issue