diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..aa724b7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..b589d56
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
new file mode 100644
index 0000000..b268ef3
--- /dev/null
+++ b/.idea/deploymentTargetSelector.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..0897082
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..8978d23
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..8306744
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..28d2bd1
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2024 { N.DZL }
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b355a6a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+## SAMPLE CODE FOR THE KC50/TD50 KIOSK SOLUTION
+
+Sample code showing how to use some Large Screens APIs from Android and how to split an application across multiple screens.
+
+### Basic functionalities
+- Open an activity on the secondary screen (TD50)
+- If the secondary screen is not available, the activity will be opened on the main screen (KC50) and when when the secondary screen is available, the activity will be moved to the secondary screen.
+- The application will be split across the two screens.
+- Each screen is showing a information specific to the display is it shown on.
+- Each screen holds some colored buttons to show how messages can be sent between the two screens.
+
+### Device set up to run this sample code
+- Ensure you have both the KC50 and TD50 devices available and connected.
+
+*Please be aware that this application / sample is provided as-is for demonstration purposes without any guarantee of support*
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..19f9b83
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,45 @@
+plugins {
+ id 'com.android.application'
+}
+
+
+
+android {
+ namespace 'com.zebra.dualscreen'
+ compileSdk 34
+
+ buildFeatures {
+ // Enables Jetpack Compose for this module
+ //compose true
+ //aidl true
+ }
+
+ defaultConfig {
+ applicationId "com.zebra.kc50_td50"
+ minSdk 30
+ targetSdk 34
+ versionCode 1
+ versionName "1.0"
+ archivesBaseName = "$applicationId-v$versionName"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ buildToolsVersion '34.0.0'
+
+}
+
+dependencies {
+
+ implementation 'androidx.appcompat:appcompat:1.6.1'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..2f91cbc
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/zebra/dualscreen/KC50Activity.java b/app/src/main/java/com/zebra/dualscreen/KC50Activity.java
new file mode 100644
index 0000000..c5943b4
--- /dev/null
+++ b/app/src/main/java/com/zebra/dualscreen/KC50Activity.java
@@ -0,0 +1,341 @@
+package com.zebra.dualscreen;
+
+import static android.provider.ContactsContract.Directory.PACKAGE_NAME;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.app.ActivityOptions;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.hardware.display.DisplayManager;
+import android.media.AudioAttributes;
+import android.media.AudioFormat;
+import android.media.AudioManager;
+import android.media.AudioTrack;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.text.method.ScrollingMovementMethod;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.Display;
+import android.view.View;
+import android.view.WindowMetrics;
+import android.widget.TextView;
+
+
+import java.util.List;
+import java.util.Random;
+
+/*
+* ZEBRA WORKSTATION CONNECT EXERCISER -
+* */
+public class KC50Activity extends AppCompatActivity {
+
+ private final static String TAG1 = "LIFECYCLE";
+ String last_activity_state ="N/A";
+ TextView tvOut;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_kc50);
+
+ tvOut = findViewById(R.id.txtOut);
+ tvOut.setMovementMethod(new ScrollingMovementMethod());
+ //tvOut.setText( largeScreenInfo() );
+ printAppendOnScreen( currentScreenInfo() );
+
+ Log.i(TAG1, "onCreate");
+ last_activity_state = "onCreate";
+
+ printAppendOnScreen( getDisplayInfo() );
+
+ registerReceiver(dualScreenReceiver, new IntentFilter("com.zebra.dualscreen.TD50_ACTION"));
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ Log.i(TAG1, "onStart");
+ last_activity_state = "onStart";
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ Log.i(TAG1, "onResume");
+ last_activity_state = "onResume";
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ Log.i(TAG1, "onPause");
+ last_activity_state = "onPause";
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ Log.i(TAG1, "onStop");
+ last_activity_state = "onStop";
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ Log.i(TAG1, "onDestroy");
+ last_activity_state = "onDestroy";
+ }
+
+
+
+
+
+ public void btClick_HDLauncher(View v) {
+ //Launch on 2nd display if available
+ ActivityOptions ao = ActivityOptions.makeBasic();
+ int other_display_id = 0;
+ int cur_display_id = getDisplay().getDisplayId();
+ if(cur_display_id>0){
+ other_display_id = cur_display_id;
+ } else {
+ DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
+ Display[] displays = displayManager.getDisplays();
+ for (Display _d : displays) {
+ if (_d.getDisplayId() >0 ) {
+ other_display_id = _d.getDisplayId();
+ break;
+ }
+ }
+ }
+
+ ao.setLaunchDisplayId(other_display_id);
+
+ Bundle bao = ao.toBundle();
+ Intent intent= new Intent(getBaseContext(), TD50Activity.class);
+ intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent, bao);
+ }
+
+
+
+ String currentScreenInfo(){
+ StringBuilder _sb = new StringBuilder();
+
+ DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
+ Display[] displays = displayManager.getDisplays();
+ int currentDisplayId = getDisplay().getDisplayId();
+ for (Display _d:displays) {
+
+ if( _d.getDisplayId() != currentDisplayId )
+ continue;
+
+ _sb.append( "DISPLAY ID="+_d.getDisplayId()+" " ) ;
+ DisplayMetrics metrics = new DisplayMetrics();
+ _d.getRealMetrics(metrics);
+
+ String DISPMETRICS_DENSITY= ""+metrics.density;
+ String DISPMETRICS_DENSITY_DPI= ""+metrics.densityDpi;
+ String DISPMETRICS_SCALED_DENSITY= ""+metrics.scaledDensity;
+ String DISPMETRICS_X_DPI= ""+metrics.xdpi;
+ String DISPMETRICS_Y_DPI= ""+metrics.ydpi;
+ String DISPMETRICS_H_PIXEL= ""+metrics.heightPixels;
+ String DISPMETRICS_W_PIXEL= ""+metrics.widthPixels;
+
+ try {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ _sb.append( _d.getDeviceProductInfo().getProductId()+"\n" ) ;
+ String PROD_ID=_d.getDeviceProductInfo().getProductId();
+ String PROD_INFO=_d.getDeviceProductInfo().getName();
+ String PROD_MANUF_PNPID=_d.getDeviceProductInfo().getManufacturerPnpId();
+ String PROD_SINKTYPE=""+_d.getDeviceProductInfo().getConnectionToSinkType();
+ String PROD_YEARWEEK=""+_d.getDeviceProductInfo().getManufactureYear()+"-"+_d.getDeviceProductInfo().getManufactureWeek();
+ String PROD_MODELYEAR=""+_d.getDeviceProductInfo().getModelYear();
+ _sb.append( "NAME="+_d.getName()+" " ) ;
+ _sb.append( "PROD_ID="+ PROD_ID +" " ) ;
+ _sb.append( "PROD_INFO="+ PROD_INFO +" " ) ;
+ _sb.append( "PROD_MANUF_PNPID="+ PROD_MANUF_PNPID +" " ) ;
+ _sb.append( "PROD_SINKTYPE="+ PROD_SINKTYPE +" " ) ;
+ _sb.append( "PROD_YEARWEEK="+ PROD_YEARWEEK +" " ) ;
+ _sb.append( "PROD_MODELYEAR="+ PROD_MODELYEAR +" " ) ;
+ }
+ } catch (Exception e) {
+ _sb.append( "NO PRODUCT INFO AVAILABLE.") ;
+ }
+ _sb.append("\n");
+
+ /*
+ DisplayMetrics metrics = getResources().getDisplayMetrics();
+ String DISPMETRICS_DENSITY= ""+metrics.density;
+ String DISPMETRICS_DENSITY_DPI= ""+metrics.densityDpi;
+ String DISPMETRICS_SCALED_DENSITY= ""+metrics.scaledDensity;
+ String DISPMETRICS_X_DPI= ""+metrics.xdpi;
+ String DISPMETRICS_Y_DPI= ""+metrics.ydpi;
+ String DISPMETRICS_H_PIXEL= ""+metrics.heightPixels;
+ String DISPMETRICS_W_PIXEL= ""+metrics.widthPixels;
+
+ */
+
+
+ _sb.append( "DISPMETRICS_DENSITY="+ DISPMETRICS_DENSITY +" " ) ;
+ _sb.append( "DISPMETRICS_DENSITY_DPI="+ DISPMETRICS_DENSITY_DPI +" " ) ;
+ _sb.append( "DISPMETRICS_SCALED_DENSITY="+ DISPMETRICS_SCALED_DENSITY +" " ) ;
+ _sb.append( "DISPMETRICS_X_DPI="+ DISPMETRICS_X_DPI +" " ) ;
+ _sb.append( "DISPMETRICS_Y_DPI="+ DISPMETRICS_Y_DPI +" " ) ;
+ _sb.append( "DISPMETRICS_H_PIXEL="+ DISPMETRICS_H_PIXEL +" " ) ;
+ _sb.append( "DISPMETRICS_W_PIXEL="+ DISPMETRICS_W_PIXEL +" " ) ;
+ _sb.append("\n");
+ }
+
+ Display activityDisplay = getDisplay();
+ _sb.append( "\nACTIVITY DISPLAY ID="+activityDisplay.getDisplayId()+"\n" ) ;
+
+ _sb.append("\n");
+ WindowMetrics maximumWindowMetrics = getWindowManager().getMaximumWindowMetrics();
+ WindowMetrics windowMetrics = getWindowManager().getCurrentWindowMetrics();
+
+ _sb.append( "METRICS MAX="+maximumWindowMetrics.getBounds().width()+"x"+maximumWindowMetrics.getBounds().height()+"\n" ) ;
+ _sb.append( "METRICS CURRENT="+windowMetrics.getBounds().width()+"x"+windowMetrics.getBounds().height()+"\n" ) ;
+ _sb.append("\n");
+
+
+ return _sb.toString();
+ }
+
+
+ boolean _IS_TOP_RESUMED_ACTIVITY=false;
+ @Override
+ public void onTopResumedActivityChanged(boolean topResumed) {
+ if (topResumed) {
+ _IS_TOP_RESUMED_ACTIVITY = true;
+ } else {
+ _IS_TOP_RESUMED_ACTIVITY = false;
+ }
+
+ tvOut.setText( currentScreenInfo() );
+ printAppendOnScreen( getDisplayInfo() );
+
+ }
+
+ private String getAppPackageName() {
+ String appPackageName = "";
+ PackageManager pm = this.getPackageManager();
+
+ final Intent secondaryIntent = new Intent(Intent.ACTION_MAIN, null);
+ secondaryIntent.addCategory(Intent.CATEGORY_SECONDARY_HOME);
+ final List appsList = pm.queryIntentActivities(secondaryIntent, 0);
+
+ for (ResolveInfo resolveInfo : appsList) {
+ if (resolveInfo.activityInfo.packageName.contains(PACKAGE_NAME)) {
+ appPackageName = resolveInfo.activityInfo.packageName;
+ }
+ }
+ return appPackageName;
+ }
+
+ void printAppendOnScreen(String txt ){
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ tvOut.setText( tvOut.getText() +"\n"+ txt );
+ }
+ });
+ }
+
+
+ String getDisplayInfo(){
+ Display activityDisplay = getDisplay();
+
+ return "ACTIVITY RUNNING ON DISPLAY ID="+activityDisplay.getDisplayId()+"\n" ;
+ }
+
+ public void onClickbtn_RED(View v) {
+ sendMessageToTD50("RED");
+ }
+ public void onClickbtn_GREEN(View v) {
+ sendMessageToTD50("GREEN");
+ }
+ public void onClickbtn_BLUE(View v) {
+ sendMessageToTD50("BLUE");
+ }
+
+ void sendMessageToTD50(String msg){
+ Intent intent = new Intent();
+ intent.setAction("com.zebra.dualscreen.KC50_ACTION");
+ intent.putExtra("msg", msg);
+ sendBroadcast(intent);
+ }
+
+
+
+ private BroadcastReceiver dualScreenReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals("com.zebra.dualscreen.TD50_ACTION")) {
+ String message = intent.getStringExtra("msg");
+ Log.i("KC50", "Received message from TD50: " + message);
+ printAppendOnScreen( "Received message from TD50: " + message );
+
+ Handler mainHandler = new Handler(Looper.getMainLooper());
+ mainHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ Random random = new Random();
+ for (int i = 0; i < 4; i++) {
+ int randomValue = 50 + random.nextInt(451); // 451 because upper bound is exclusive
+ playPCMData(generateNote((double) randomValue, 0.3, 1000));
+ }
+ }
+ });
+ }
+ }
+ };
+
+
+ public void playPCMData(byte[] data) {
+ try {
+ AudioTrack audioTrack = new AudioTrack(
+ new AudioAttributes.Builder()
+ .setUsage(AudioAttributes.USAGE_MEDIA)
+ .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
+ .build(),
+ new AudioFormat.Builder()
+ .setEncoding(AudioFormat.ENCODING_PCM_8BIT)
+ .setSampleRate(11025)
+ .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
+ .build(),
+ data.length,
+ AudioTrack.MODE_STATIC,
+ AudioManager.AUDIO_SESSION_ID_GENERATE
+ );
+
+ audioTrack.write(data, 0, data.length);
+ audioTrack.play();
+ } catch (Exception e) {
+ // Handle exception
+ }
+ }
+
+
+ public byte[] generateNote(double frequency, double durationInSeconds, int sampleRate) {
+ int numSamples = (int) (durationInSeconds * sampleRate);
+ byte[] samples = new byte[numSamples];
+
+ for (int i = 0; i < numSamples; i++) {
+ double time = i / 100.0;
+ samples[i] = (byte) ((Math.sin(frequency * time) * 127.0) + 0);
+ }
+
+ return samples;
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/zebra/dualscreen/TD50Activity.java b/app/src/main/java/com/zebra/dualscreen/TD50Activity.java
new file mode 100644
index 0000000..04c8657
--- /dev/null
+++ b/app/src/main/java/com/zebra/dualscreen/TD50Activity.java
@@ -0,0 +1,328 @@
+package com.zebra.dualscreen;
+
+import static android.widget.Toast.makeText;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.app.ActivityOptions;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.res.Configuration;
+import android.hardware.display.DisplayManager;
+import android.media.AudioAttributes;
+import android.media.AudioFormat;
+import android.media.AudioManager;
+import android.media.AudioTrack;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.Display;
+import android.view.View;
+import android.view.WindowMetrics;
+import android.widget.TextView;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Random;
+//https://developer.android.com/reference/android/hardware/display/DisplayManager#registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener,%20android.os.Handler)
+
+
+
+//HAD TO SET org.gradle.jvmargs=-Xmx8G TO BUILD....
+public class TD50Activity extends AppCompatActivity {
+
+ Intent starterIntent;
+ TextView tvOut;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ starterIntent = getIntent();
+
+ setContentView(R.layout.activity_td50);
+ DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
+ displayManager.registerDisplayListener(new DisplayManager.DisplayListener() {
+ @Override
+ public void onDisplayAdded(int displayId) { //As a multi-screen-aware app, detect a 2nd screen when available
+ //move this launcher to the 2nd screen when available
+ finish();
+ ActivityOptions ao =ActivityOptions.makeBasic();
+ ao.setLaunchDisplayId(displayId);
+ Bundle bao = ao.toBundle();
+ starterIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(starterIntent, bao);
+ }
+
+ @Override
+ public void onDisplayRemoved(int displayId) {
+ finish();
+ ActivityOptions ao =ActivityOptions.makeBasic();
+ ao.setLaunchDisplayId(0);
+ Bundle bao = ao.toBundle();
+ starterIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(starterIntent, bao);
+ }
+
+ @Override
+ public void onDisplayChanged(int displayId) {
+ recreate();
+ }
+ }, null);
+
+ tvOut = findViewById(R.id.textView);
+
+ printAppendOnScreen( currentScreenInfo() );
+
+ registerReceiver(dualScreenReceiver, new IntentFilter("com.zebra.dualscreen.KC50_ACTION"));
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ }
+
+ public void onClickbtn_CYAN(View v) {
+ sendMessageToKC50("CYAN");
+ }
+ public void onClickbtn_MAGENTA(View v) {
+ sendMessageToKC50("MAGENTA");
+ }
+ public void onClickbtn_YELLOW(View v) {
+ sendMessageToKC50("YELLOW");
+ }
+
+ void sendMessageToKC50(String msg){
+ Intent intent = new Intent();
+ intent.setAction("com.zebra.dualscreen.TD50_ACTION");
+ intent.putExtra("msg", msg);
+ sendBroadcast(intent);
+ }
+
+
+ void printAppendOnScreen(String txt ){
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ tvOut.setText( tvOut.getText() +"\n"+ txt );
+ }
+ });
+ }
+
+
+ String getDisplayInfo(){
+ Display activityDisplay = getDisplay();
+
+ return "ACTIVITY RUNNING ON DISPLAY ID="+activityDisplay.getDisplayId()+"\n" ;
+ }
+
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+
+ }
+
+
+
+ public String loadJSONFromAsset(String jsonAssetFileName) {
+ String json = null;
+ try {
+ InputStream is = this.getAssets().open(jsonAssetFileName);
+ int size = is.available();
+ byte[] buffer = new byte[size];
+ is.read(buffer);
+ is.close();
+ json = new String(buffer, "UTF-8");
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ return null;
+ }
+ return json;
+ }
+
+
+ private void saveStringToLocalFile(String srcFile, String jsonAsset) {
+ try {
+ File f = new File(srcFile);
+ if (f.exists()) {
+ f.delete();
+ }
+
+ f.createNewFile();
+ Process _p = Runtime.getRuntime().exec("chmod 666 " + srcFile); //chmod needed for /enterprise
+ _p.waitFor();
+ Log.i("TD50", "chmod 666 result="+_p.exitValue());
+
+ FileOutputStream fos = new FileOutputStream(f);
+ fos.write( jsonAsset.getBytes(StandardCharsets.UTF_8) );
+ fos.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ String currentScreenInfo(){
+ StringBuilder _sb = new StringBuilder();
+
+ DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
+ Display[] displays = displayManager.getDisplays();
+ int currentDisplayId = getDisplay().getDisplayId();
+ for (Display _d:displays) {
+
+ if( _d.getDisplayId() != currentDisplayId )
+ continue;
+
+ _sb.append( "DISPLAY ID="+_d.getDisplayId()+" " ) ;
+ DisplayMetrics metrics = new DisplayMetrics();
+ _d.getRealMetrics(metrics);
+
+ String DISPMETRICS_DENSITY= ""+metrics.density;
+ String DISPMETRICS_DENSITY_DPI= ""+metrics.densityDpi;
+ String DISPMETRICS_SCALED_DENSITY= ""+metrics.scaledDensity;
+ String DISPMETRICS_X_DPI= ""+metrics.xdpi;
+ String DISPMETRICS_Y_DPI= ""+metrics.ydpi;
+ String DISPMETRICS_H_PIXEL= ""+metrics.heightPixels;
+ String DISPMETRICS_W_PIXEL= ""+metrics.widthPixels;
+
+ try {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ _sb.append( _d.getDeviceProductInfo().getProductId()+"\n" ) ;
+ String PROD_ID=_d.getDeviceProductInfo().getProductId();
+ String PROD_INFO=_d.getDeviceProductInfo().getName();
+ String PROD_MANUF_PNPID=_d.getDeviceProductInfo().getManufacturerPnpId();
+ String PROD_SINKTYPE=""+_d.getDeviceProductInfo().getConnectionToSinkType();
+ String PROD_YEARWEEK=""+_d.getDeviceProductInfo().getManufactureYear()+"-"+_d.getDeviceProductInfo().getManufactureWeek();
+ String PROD_MODELYEAR=""+_d.getDeviceProductInfo().getModelYear();
+ _sb.append( "NAME="+_d.getName()+" " ) ;
+ _sb.append( "PROD_ID="+ PROD_ID +" " ) ;
+ _sb.append( "PROD_INFO="+ PROD_INFO +" " ) ;
+ _sb.append( "PROD_MANUF_PNPID="+ PROD_MANUF_PNPID +" " ) ;
+ _sb.append( "PROD_SINKTYPE="+ PROD_SINKTYPE +" " ) ;
+ _sb.append( "PROD_YEARWEEK="+ PROD_YEARWEEK +" " ) ;
+ _sb.append( "PROD_MODELYEAR="+ PROD_MODELYEAR +" " ) ;
+ }
+ } catch (Exception e) {
+ _sb.append( "NO PRODUCT INFO AVAILABLE.") ;
+ }
+ _sb.append("\n");
+
+ /*
+ DisplayMetrics metrics = getResources().getDisplayMetrics();
+ String DISPMETRICS_DENSITY= ""+metrics.density;
+ String DISPMETRICS_DENSITY_DPI= ""+metrics.densityDpi;
+ String DISPMETRICS_SCALED_DENSITY= ""+metrics.scaledDensity;
+ String DISPMETRICS_X_DPI= ""+metrics.xdpi;
+ String DISPMETRICS_Y_DPI= ""+metrics.ydpi;
+ String DISPMETRICS_H_PIXEL= ""+metrics.heightPixels;
+ String DISPMETRICS_W_PIXEL= ""+metrics.widthPixels;
+
+ */
+
+
+ _sb.append( "DISPMETRICS_DENSITY="+ DISPMETRICS_DENSITY +" " ) ;
+ _sb.append( "DISPMETRICS_DENSITY_DPI="+ DISPMETRICS_DENSITY_DPI +" " ) ;
+ _sb.append( "DISPMETRICS_SCALED_DENSITY="+ DISPMETRICS_SCALED_DENSITY +" " ) ;
+ _sb.append( "DISPMETRICS_X_DPI="+ DISPMETRICS_X_DPI +" " ) ;
+ _sb.append( "DISPMETRICS_Y_DPI="+ DISPMETRICS_Y_DPI +" " ) ;
+ _sb.append( "DISPMETRICS_H_PIXEL="+ DISPMETRICS_H_PIXEL +" " ) ;
+ _sb.append( "DISPMETRICS_W_PIXEL="+ DISPMETRICS_W_PIXEL +" " ) ;
+ _sb.append("\n");
+ }
+
+ Display activityDisplay = getDisplay();
+ _sb.append( "\nACTIVITY DISPLAY ID="+activityDisplay.getDisplayId()+"\n" ) ;
+
+ _sb.append("\n");
+ WindowMetrics maximumWindowMetrics = getWindowManager().getMaximumWindowMetrics();
+ WindowMetrics windowMetrics = getWindowManager().getCurrentWindowMetrics();
+
+ _sb.append( "METRICS MAX="+maximumWindowMetrics.getBounds().width()+"x"+maximumWindowMetrics.getBounds().height()+"\n" ) ;
+ _sb.append( "METRICS CURRENT="+windowMetrics.getBounds().width()+"x"+windowMetrics.getBounds().height()+"\n" ) ;
+ _sb.append("\n");
+
+
+ return _sb.toString();
+ }
+
+
+ private BroadcastReceiver dualScreenReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals("com.zebra.dualscreen.KC50_ACTION")) {
+ String message = intent.getStringExtra("msg");
+ Log.i("TD50", "Received message from KC50: " + message);
+ printAppendOnScreen( "Received message from KC50: " + message );
+ Handler mainHandler = new Handler(Looper.getMainLooper());
+ mainHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ Random random = new Random();
+ for (int i = 0; i < 4; i++) {
+ int randomValue = 50 + random.nextInt(451); // 451 because upper bound is exclusive
+ playPCMData(generateNote((double) randomValue, 0.3, 1000));
+ }
+ }
+ });
+
+ }
+ }
+ };
+
+
+ public void playPCMData(byte[] data) {
+ try {
+ AudioTrack audioTrack = new AudioTrack(
+ new AudioAttributes.Builder()
+ .setUsage(AudioAttributes.USAGE_MEDIA)
+ .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
+ .build(),
+ new AudioFormat.Builder()
+ .setEncoding(AudioFormat.ENCODING_PCM_8BIT)
+ .setSampleRate(11025)
+ .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
+ .build(),
+ data.length,
+ AudioTrack.MODE_STATIC,
+ AudioManager.AUDIO_SESSION_ID_GENERATE
+ );
+
+ audioTrack.write(data, 0, data.length);
+ audioTrack.play();
+ } catch (Exception e) {
+ // Handle exception
+ }
+ }
+
+
+ public byte[] generateNote(double frequency, double durationInSeconds, int sampleRate) {
+ int numSamples = (int) (durationInSeconds * sampleRate);
+ byte[] samples = new byte[numSamples];
+
+ for (int i = 0; i < numSamples; i++) {
+ double time = i / 100.0;
+ samples[i] = (byte) ((Math.sin(frequency * time) * 127.0) + 0);
+ }
+
+ return samples;
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_kc50.xml b/app/src/main/res/layout/activity_kc50.xml
new file mode 100644
index 0000000..c142911
--- /dev/null
+++ b/app/src/main/res/layout/activity_kc50.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_td50.xml b/app/src/main/res/layout/activity_td50.xml
new file mode 100644
index 0000000..eea0f05
--- /dev/null
+++ b/app/src/main/res/layout/activity_td50.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..66745b4
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,25 @@
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..c209e78
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..b2dfe3d
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..4f0f1d6
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..62b611d
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..948a307
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..1b9a695
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..28d4b77
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9287f50
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..aa7d642
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9126ae3
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..f90866a
--- /dev/null
+++ b/app/src/main/res/values-night/themes.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..c8524cd
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,5 @@
+
+
+ #FF000000
+ #FFFFFFFF
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..2d0f977
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ KC50-TD50
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..ed40800
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 0000000..fa0f996
--- /dev/null
+++ b/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 0000000..9ee9997
--- /dev/null
+++ b/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..a100ce0
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,5 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ id 'com.android.application' version '8.0.2' apply false
+ id 'com.android.library' version '8.0.2' apply false
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..3e927b1
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,21 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..d64cd49
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1af9e09
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..1aa94a4
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..93e3f59
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..1cee7ad
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,16 @@
+pluginManagement {
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+rootProject.name = "KC50-TD50-Sample"
+include ':app'