Skip to content

Commit

Permalink
Fix tablet landscape UI. Upgrade to Java 11. Update to SDK version 33…
Browse files Browse the repository at this point in the history
…. Fix BT connect permissions issue.
  • Loading branch information
Rob Riggs committed May 16, 2023
1 parent 5f82815 commit 8ed7e4b
Show file tree
Hide file tree
Showing 15 changed files with 740 additions and 676 deletions.
3 changes: 0 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

8 changes: 0 additions & 8 deletions MobilinkdTNC.iml
@@ -1,13 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="MobilinkdTNC" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -21,8 +21,8 @@ allprojects {
// modules in the project.
ext {
// The following are only a few examples of the types of properties you can define.
compileSdkVersion = 28
compileSdkVersion = 33
// You can also create properties to specify versions for dependencies.
// Having consistent versions between modules can avoid conflicts with behavior.
supportLibVersion = "28.0.0"
supportLibVersion = "33.0.0"
}
4 changes: 2 additions & 2 deletions library/build.gradle
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 33

defaultConfig {
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 33
}

buildTypes {
Expand Down
16 changes: 10 additions & 6 deletions mobilinkdTNC/build.gradle
@@ -1,31 +1,35 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
buildToolsVersion '28.0.3'
compileSdkVersion 33
buildToolsVersion '33.0.1'

defaultConfig {
applicationId "com.mobilinkd.tncconfig"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 33

// Defines the version number of your app.
versionCode 20
versionCode 23

// Defines a user-friendly version name for your app.
versionName "1.4.1"
versionName "1.4.3"
}

buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'
}

}

dependencies {
Expand Down
6 changes: 5 additions & 1 deletion mobilinkdTNC/src/main/AndroidManifest.xml
Expand Up @@ -3,8 +3,9 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.mobilinkd.tncconfig">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" ></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" tools:node="replace" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand All @@ -19,6 +20,7 @@
android:theme="@style/AppTheme" >
<activity
android:name="com.mobilinkd.tncconfig.TncConfig"
android:exported="true"
android:theme="@style/SampleTheme.Light"
android:label="@string/app_name" >
<intent-filter>
Expand All @@ -29,6 +31,7 @@
</activity>
<activity
android:name="com.mobilinkd.tncconfig.DeviceListActivity"
android:exported="true"
android:label="@string/title_activity_device_list"
android:parentActivityName="com.mobilinkd.tncconfig.TncConfig" >
<meta-data
Expand All @@ -37,6 +40,7 @@
</activity>
<activity
android:name="com.mobilinkd.tncconfig.FirmwareUpdateActivity"
android:exported="true"
android:label="@string/title_activity_firmware_update"
android:theme="@style/FullscreenTheme" >
<meta-data
Expand Down
Expand Up @@ -32,6 +32,7 @@
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

/**
* This Activity appears as a dialog. It lists any paired devices and
Expand Down Expand Up @@ -86,15 +87,15 @@ protected void onCreate(Bundle savedInstanceState) {
// Get a set of currently paired devices
Set<BluetoothDevice> pairedDevices = mBtAdapter.getBondedDevices();

if (pairedDevices.size() == 0) {
Toast.makeText(this, R.string.msg_not_paired, Toast.LENGTH_LONG).show();
finish();
}

// If there are paired devices, add each one to the ArrayAdapter
if (pairedDevices.size() > 0) {
findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
for (BluetoothDevice device : pairedDevices) {
mPairedDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
}
} else {
String noDevices = getResources().getText(R.string.none_paired).toString();
mPairedDevicesArrayAdapter.add(noDevices);
findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
for (BluetoothDevice device : pairedDevices) {
mPairedDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
}
}

Expand All @@ -108,6 +109,11 @@ protected void onDestroy() {
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) {
// Get the device MAC address, which is the last 17 chars in the View
String info = ((TextView) v).getText().toString();

if (info == getResources().getText(R.string.none_paired).toString()) {
// do nothing...
return;
}
String address = info.substring(info.length() - 17);
if (D) Log.d(TAG, "onItemClick() -> " + address);

Expand Down

0 comments on commit 8ed7e4b

Please sign in to comment.