Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ try {
}

android {
namespace 'com.github.shingyx.boomswitch'
namespace = 'com.github.shingyx.boomswitch'
signingConfigs {
release {
storeFile rootProject.file(keystoreProperties['storeFile'] ?: "default.jks")
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile = rootProject.file(keystoreProperties['storeFile'] ?: "default.jks")
storePassword = keystoreProperties['storePassword']
keyAlias = keystoreProperties['keyAlias']
keyPassword = keystoreProperties['keyPassword']
}
}
compileSdk 36
compileSdk = 36
defaultConfig {
applicationId "com.github.shingyx.boomswitch"
minSdk 23
targetSdk 36
versionCode 12
versionName "1.8"
applicationId = "com.github.shingyx.boomswitch"
minSdk = 23
targetSdk = 36
versionCode = 12
versionName = "1.8"
}
buildTypes {
debug {
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
applicationIdSuffix = ".dev"
versionNameSuffix = "-dev"
}
release {
minifyEnabled true
minifyEnabled = true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
signingConfig signingConfigs.release
signingConfig = signingConfigs.release
}
}
buildFeatures {
viewBinding true
viewBinding = true
}
kotlin {
jvmToolchain(21)
Expand All @@ -57,7 +57,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
implementation 'com.google.android.gms:play-services-oss-licenses:17.2.1'
implementation 'com.google.android.gms:play-services-oss-licenses:17.2.2'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2'
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-feature
android:name="android.hardware.bluetooth_le"
Expand All @@ -14,8 +13,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
android:theme="@style/AppTheme">

<activity
android:name=".ui.MainActivity"
Expand Down Expand Up @@ -45,7 +43,8 @@

<activity
android:name=".ui.HelpActivity"
android:exported="false" />
android:exported="false"
android:theme="@style/AppThemeNoActionBar" />

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class HelpActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
binding = ActivityHelpBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
setSystemBarColors(this, binding.root)

supportActionBar?.run {
setTitle(R.string.help)
Expand Down
48 changes: 48 additions & 0 deletions app/src/main/java/com/github/shingyx/boomswitch/ui/LayoutUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.github.shingyx.boomswitch.ui

import android.content.Context
import android.content.res.Configuration
import android.os.Build
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import com.github.shingyx.boomswitch.R

fun setSystemBarColors(activity: AppCompatActivity, rootLayout: View) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
return
}
// navigation bar visibility
activity.window.isNavigationBarContrastEnforced = false
val windowInsetsController = WindowCompat.getInsetsController(activity.window, rootLayout)
windowInsetsController.isAppearanceLightNavigationBars = !isNightMode(activity)

ViewCompat.setOnApplyWindowInsetsListener(rootLayout) { view, windowInsets ->
// ui margins
val statusBarInsets = windowInsets.getInsets(WindowInsetsCompat.Type.statusBars())
val navigationBarInsets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars())
view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarInsets.top
bottomMargin = navigationBarInsets.bottom
}
// status bar background
val statusBarView =
View(activity).apply {
layoutParams =
ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, statusBarInsets.top)
setBackgroundColor(activity.getColor(R.color.toolbar_color))
}
activity.addContentView(statusBarView, statusBarView.layoutParams)

WindowInsetsCompat.CONSUMED
}
}

private fun isNightMode(context: Context): Boolean {
val nightModeFlags = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
return nightModeFlags == Configuration.UI_MODE_NIGHT_YES
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
setSystemBarColors(this, binding.root)

handler = Handler(Looper.getMainLooper())
adapter = BluetoothDeviceAdapter(this)
Expand Down
77 changes: 48 additions & 29 deletions app/src/main/res/layout/activity_help.xml
Original file line number Diff line number Diff line change
@@ -1,48 +1,67 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".ui.HelpActivity">

<LinearLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
android:layout_height="wrap_content">

<TextView
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/help_intro"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" />
android:theme="@style/MainToolbarStyle"
app:titleTextColor="?android:attr/titleTextColor" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/select_speaker_model_container"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
</com.google.android.material.appbar.AppBarLayout>

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="32dp"
android:hint="@string/boom_speaker">
android:orientation="vertical"
android:padding="16dp">

<AutoCompleteTextView
android:id="@+id/select_speaker_model"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:editable="false"
tools:ignore="Deprecated,LabelFor"
tools:text="BOOM 3" />
android:text="@string/help_intro"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" />

</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/select_speaker_model_container"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="32dp"
android:hint="@string/boom_speaker">

<TextView
android:id="@+id/help_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." />
<AutoCompleteTextView
android:id="@+id/select_speaker_model"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:editable="false"
tools:ignore="Deprecated,LabelFor"
tools:text="BOOM 3" />

</com.google.android.material.textfield.TextInputLayout>

<TextView
android:id="@+id/help_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." />

</LinearLayout>
</LinearLayout>

</ScrollView>
</ScrollView>
</LinearLayout>
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".ui.MainActivity">

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '2.1.20'
ext.kotlin_version = '2.2.0'
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
url = "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.11.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.6'
classpath 'com.android.tools.build:gradle:8.12.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.7'
classpath "com.ncorti.ktfmt.gradle:plugin:0.23.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
Expand Down