Skip to content

Commit

Permalink
1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
can-miki committed Nov 5, 2024
1 parent d1fcf31 commit 3e4ad1c
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 39 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# StarMgsIO Android SDK Ver 1.5.0
# StarMgsIO Android SDK Ver 1.5.1
## Overview
This package contains StarMgsIO SDK.
starmgsio.jar is a library for supporting application development for Star scales. Please refer to [StarMgsIO Android SDK document](https://www.star-m.jp/products/s_print/sdk/starmgsio_sdk/manual/android/en/index.html) for detail of usage.
Expand All @@ -12,7 +12,7 @@ Supported models:
- MG-S8200
- MG-S322 USCA
- MG-S1501 USCA
- MG-S8200 USCA<br><br>
- MG-S8200 CA<br><br>
- MG-T Scale
- MG-T12
- MG-T30
Expand All @@ -22,8 +22,8 @@ Supported models:
- MG-T60 UDB

Supported OS :<br>
Android 9.0 - Android 14.0
Android 9.0 - Android 15.0

## Copyright
Copyright 2020 - 2023 Star Micronics Co., Ltd. All rights reserved.
Copyright 2020 Star Micronics Co., Ltd. All rights reserved.

Binary file added Software/Distributables/starmgsio.aar
Binary file not shown.
Binary file removed Software/Distributables/starmgsio.jar
Binary file not shown.
25 changes: 16 additions & 9 deletions Software/SDK/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 33
namespace 'com.starmicronics.starmgsiosdk'
compileSdk 35
defaultConfig {
applicationId "com.starmicronics.starmgsiosdk"
minSdkVersion 23
targetSdkVersion 33
targetSdkVersion 35
versionCode 1
versionName "1.5.0"
versionName "1.5.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -18,11 +19,17 @@ android {
}
}

configurations.implementation {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
}

dependencies {
implementation 'com.starmicronics:starmgsio:1.5.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.starmicronics:starmgsio:1.5.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
//implementation files('libs/starmgsio.aar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.6.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
31 changes: 22 additions & 9 deletions Software/SDK/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.starmicronics.starmgsiosdk">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="30" />

<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="31" />
<uses-permission
android:name="android.permission.BLUETOOTH_CONNECT"
tools:targetApi="31" />

<!-- Declare this required feature if you want to make the app available to BLE-capable
devices only. If you want to make your app available to devices that don't support BLE,
you should omit this in the manifest. Instead, determine BLE capability by using
PackageManager.hasSystemFeature(FEATURE_BLUETOOTH_LE) -->
<!--<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>-->

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true"/>

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.starmicronics.starmgsio.ConnectionInfo;
import com.starmicronics.starmgsio.Scale;
Expand Down Expand Up @@ -37,6 +40,7 @@ public class ScaleActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_scale);
setTitle("MG series Scale Sample");

Expand Down Expand Up @@ -129,9 +133,19 @@ public void onClick(View v) {

}

public void setPadding(View view) {
ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
int insetTypes = WindowInsetsCompat.Type.displayCutout() | WindowInsetsCompat.Type.systemBars();
Insets bars = insets.getInsets(insetTypes);
v.setPadding(bars.left, bars.top, bars.right, bars.bottom);
return WindowInsetsCompat.CONSUMED;
});
}

@Override
protected void onResume() {
super.onResume();
setPadding(findViewById(R.id.BottomLinerLayout));

if(mScale == null) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.starmicronics.starmgsiosdk;

import static android.os.Build.VERSION.SDK_INT;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
Expand All @@ -10,6 +12,10 @@
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
Expand Down Expand Up @@ -40,30 +46,38 @@ public class ScanActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_scan);
setTitle("MG series Scale Sample");

if (Build.VERSION_CODES.S <= Build.VERSION.SDK_INT) {
if (SDK_INT <= 30) {
if( (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this,Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this,Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) ){
// If you are using Android 12 and targetSdkVersion is 31 or later,
// you have to request Bluetooth permission (Nearby devices permission) to use the Bluetooth printer.
// https://developer.android.com/about/versions/12/features/bluetooth-permissions

ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.BLUETOOTH_CONNECT,
Manifest.permission.BLUETOOTH_SCAN}, 0x00);
(ContextCompat.checkSelfPermission(this,Manifest.permission.BLUETOOTH) != PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this,Manifest.permission.BLUETOOTH_ADMIN) != PackageManager.PERMISSION_GRANTED) ){
// If you are using Android 11 and targetSdkVersion is 30 or earlier,
// you have to request Bluetooth permission to use the Bluetooth printer.
// https://developer.android.com/develop/connectivity/bluetooth/bt-permissions#declare-android11-or-lower

ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.BLUETOOTH,
Manifest.permission.BLUETOOTH_ADMIN}, 0x00);
}
}
else
{
if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0x00);
if((ContextCompat.checkSelfPermission(this,Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) ||
(ContextCompat.checkSelfPermission(this,Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) ){
// If you are using Android 12 and targetSdkVersion is 31 or later,
// you have to request Bluetooth permission to use the Bluetooth printer.
// https://developer.android.com/develop/connectivity/bluetooth/bt-permissions#declare-android12-or-higher

ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.BLUETOOTH_SCAN,
Manifest.permission.BLUETOOTH_CONNECT}, 0x00);
}
}


ListView discoveredListView = findViewById(R.id.DiscoveredListView);

mDataMapList = new ArrayList<>();
Expand Down Expand Up @@ -102,9 +116,19 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
});
}

public void setPadding(View view) {
ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
int insetTypes = WindowInsetsCompat.Type.displayCutout() | WindowInsetsCompat.Type.systemBars();
Insets bars = insets.getInsets(insetTypes);
v.setPadding(bars.left, bars.top, bars.right, bars.bottom);
return WindowInsetsCompat.CONSUMED;
});
}

@Override
protected void onResume() {
super.onResume();
setPadding(findViewById(R.id.DiscoveredListView));

mStarDeviceManager = new StarDeviceManager(ScanActivity.this, StarDeviceManager.InterfaceType.All);

Expand Down
3 changes: 2 additions & 1 deletion Software/SDK/app/src/main/res/layout/activity_scale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:orientation="vertical">
android:orientation="vertical"
android:id="@+id/BottomLinerLayout">

<Button
android:id="@+id/ZeroPointAdjustmentButton"
Expand Down
2 changes: 1 addition & 1 deletion Software/SDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.5.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
4 changes: 2 additions & 2 deletions Software/SDK/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Nov 26 13:07:41 JST 2019
#Wed Aug 14 10:15:10 JST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

0 comments on commit 3e4ad1c

Please sign in to comment.