demo/bt Flavors
This commit is contained in:
parent
957febea67
commit
18b2dea577
|
@ -17,10 +17,25 @@ android {
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
getByName("release") {
|
getByName("release") {
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = true
|
||||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||||
}
|
}
|
||||||
|
getByName("debug") {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
flavorDimensions += "connectivity"
|
||||||
|
productFlavors {
|
||||||
|
create("demo") {
|
||||||
|
dimension = "connectivity"
|
||||||
|
applicationIdSuffix = ".demo"
|
||||||
|
}
|
||||||
|
create("bt") {
|
||||||
|
dimension = "connectivity"
|
||||||
|
applicationIdSuffix = ".bt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".bt.DeviceListActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:screenOrientation="landscape">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name=".bt.BtInputActivity"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.hc05ac.live
|
package io.gitlab.jfronny.hc05ac.bt
|
||||||
|
|
||||||
import android.bluetooth.BluetoothSocket
|
import android.bluetooth.BluetoothSocket
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.hc05ac.live
|
package io.gitlab.jfronny.hc05ac.bt
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
import android.app.Activity
|
|
@ -1,4 +1,4 @@
|
||||||
package io.gitlab.jfronny.hc05ac.live
|
package io.gitlab.jfronny.hc05ac.bt
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
|
@ -1,10 +1,9 @@
|
||||||
<?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.constraintlayout.widget.ConstraintLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".live.DeviceListActivity">
|
tools:context=".bt.DeviceListActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -23,7 +22,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Select A Pairing Device"
|
android:text="@string/device_list_title"
|
||||||
android:textColor="#0033FF"
|
android:textColor="#0033FF"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
tools:layout_editor_absoluteX="168dp"
|
tools:layout_editor_absoluteX="168dp"
|
||||||
|
@ -36,7 +35,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/holo_blue_light"
|
android:background="@android:color/holo_blue_light"
|
||||||
android:text="Pair"
|
android:text="@string/device_list_refresh"
|
||||||
tools:layout_editor_absoluteX="190dp"
|
tools:layout_editor_absoluteX="190dp"
|
||||||
tools:layout_editor_absoluteY="183dp" />
|
tools:layout_editor_absoluteY="183dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -51,6 +50,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="150dp"
|
android:layout_marginLeft="150dp"
|
||||||
|
android:layout_marginStart="150dp"
|
||||||
android:footerDividersEnabled="false"
|
android:footerDividersEnabled="false"
|
||||||
tools:layout_editor_absoluteX="8dp"
|
tools:layout_editor_absoluteX="8dp"
|
||||||
tools:layout_editor_absoluteY="8dp" />
|
tools:layout_editor_absoluteY="8dp" />
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".demo.DemoActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:screenOrientation="landscape">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -19,18 +19,6 @@
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.HC05AC"
|
android:theme="@style/Theme.HC05AC"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
|
||||||
android:name=".live.DeviceListActivity"
|
|
||||||
android:exported="true"
|
|
||||||
android:screenOrientation="landscape">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity android:name=".unused.BasicInputActivity"/>
|
|
||||||
<activity android:name=".live.BtInputActivity"/>
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -67,9 +67,7 @@ abstract class InputActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun screenToByte(y: Float): Byte {
|
private fun screenToByte(y: Float): Byte {
|
||||||
val scaled = (y * 255f / root!!.height).toInt().clamp(0, 255)
|
return (127 - (y * 255f / root!!.height).toInt().clamp(0, 255)).toByte()
|
||||||
val mapped: Byte = scaled.xor(0x80).toByte()
|
|
||||||
return (-mapped).toByte()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum class Side {
|
private enum class Side {
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<size android:height="1dp" />
|
|
||||||
<solid android:color="@color/design_default_color_primary"/>
|
|
||||||
</shape>
|
|
|
@ -1,142 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".unused.BasicInputActivity">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:layout_editor_absoluteX="8dp"
|
|
||||||
tools:layout_editor_absoluteY="8dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="progress"
|
|
||||||
android:textAlignment="center"
|
|
||||||
tools:layout_editor_absoluteX="8dp"
|
|
||||||
tools:layout_editor_absoluteY="30dp"
|
|
||||||
android:gravity="center_horizontal" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button2"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@android:color/holo_blue_light"
|
|
||||||
android:text="Combo 1"
|
|
||||||
tools:layout_editor_absoluteX="148dp"
|
|
||||||
tools:layout_editor_absoluteY="88dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button3"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@android:color/holo_blue_light"
|
|
||||||
android:text="Combo 2"
|
|
||||||
tools:layout_editor_absoluteX="192dp"
|
|
||||||
tools:layout_editor_absoluteY="64dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button5"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@android:color/holo_blue_light"
|
|
||||||
android:text="Combo 3"
|
|
||||||
tools:layout_editor_absoluteX="61dp"
|
|
||||||
tools:layout_editor_absoluteY="134dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button6"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@android:color/holo_blue_light"
|
|
||||||
android:text="Combo 4"
|
|
||||||
tools:layout_editor_absoluteX="91dp"
|
|
||||||
tools:layout_editor_absoluteY="168dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button7"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@android:color/holo_blue_light"
|
|
||||||
android:text="Combo 5"
|
|
||||||
tools:layout_editor_absoluteX="112dp"
|
|
||||||
tools:layout_editor_absoluteY="336dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button4"
|
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@android:color/holo_red_light"
|
|
||||||
android:text="Disconnect Pairing"
|
|
||||||
tools:layout_editor_absoluteX="108dp"
|
|
||||||
tools:layout_editor_absoluteY="154dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
@ -1,14 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/root"
|
android:id="@+id/root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
tools:context=".InputActivity"
|
tools:context=".InputActivity">
|
||||||
app:divider="@drawable/divider"
|
|
||||||
app:showDividers="middle">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/zero"
|
android:text="@string/zero"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">HC05AC</string>
|
<string name="app_name">HC05AC</string>
|
||||||
<string name="zero">0</string>
|
<string name="zero">0</string>
|
||||||
|
<string name="device_list_title">Select A Pairing Device</string>
|
||||||
|
<string name="device_list_refresh">Pair</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue