Skip to content
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.

Commit

Permalink
Updated themes for paid vs. free releases. Added LAST_UID button. Upd…
Browse files Browse the repository at this point in the history
…ated display of threshold signal strength bars at top of the app.
  • Loading branch information
maxieds committed May 12, 2018
1 parent 0ef1aea commit 162e386
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
applicationId "com.maxieds.chameleonminilivedebugger"
minSdkVersion 21
targetSdkVersion 27
versionCode 42
versionName "0.4.2"
versionCode 43
versionName "0.4.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public static class DeviceStatusSettings {
*/
public String CONFIG;
public String UID;
public String LASTUID = "00000000000000";
public int UIDSIZE;
public int MEMSIZE;
public int LOGSIZE;
Expand Down Expand Up @@ -248,17 +249,7 @@ private boolean updateAllStatus(boolean resetTimer) {
LiveLoggerActivity.serialPortLock.release();

// setup threshold signal bars:
double signalStrength = THRESHOLD / 4500.0;
if (signalStrength >= 0.80)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars5);
else if (signalStrength >= 0.60)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars4);
else if (signalStrength >= 0.40)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars3);
else if (signalStrength >= 0.20)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars2);
else
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars1);
LiveLoggerActivity.setSignalStrengthIndicator(THRESHOLD);

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,16 @@ private void setLocalTheme(String themeDesc) {
public void actionButtonAppSettings(View view) {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
final View dialogView = getLayoutInflater().inflate(R.layout.theme_config, null);
if(!BuildConfig.FLAVOR.equals("paid")) { // restore the "bonus" for upgrading to the paid flavor:
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonAtlanta)).setEnabled(false);
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonBlack)).setEnabled(false);
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonChocolate)).setEnabled(false);
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonGoldenrod)).setEnabled(false);
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonLightblue)).setEnabled(false);
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonPurple)).setEnabled(false);
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonUrbanaDesfire)).setEnabled(false);
((RadioButton) dialogView.findViewById(R.id.themeRadioButtonWinter)).setEnabled(false);
}
dialog.setView(dialogView);
dialog.setIcon(R.drawable.settingsgears24);
dialog.setTitle( "Application Theme Configuration: ");
Expand Down Expand Up @@ -929,6 +939,7 @@ else if(createCmd.equals("RESET") || createCmd.equals("resetmy")) { // need to r
return;
}
else if(createCmd.equals("RANDOM UID")) {
ChameleonIO.deviceStatus.LASTUID = ChameleonIO.deviceStatus.UID;
String uidCmd = ChameleonIO.REVE_BOARD ? "uidmy=" : "UID=";
byte[] randomBytes = Utils.getRandomBytes(ChameleonIO.deviceStatus.UIDSIZE);
String sendCmd = uidCmd + Utils.bytes2Hex(randomBytes).replace(" ", "");
Expand Down Expand Up @@ -1081,6 +1092,7 @@ else if(isChecked && actionFlag.equals("COPY")) {
public void actionButtonModifyUID(View view) {
if(ChameleonIO.deviceStatus.UID == null || ChameleonIO.deviceStatus.UID.equals("DEVICE UID") || ChameleonIO.deviceStatus.UID.equals("NO UID."))
return;
ChameleonIO.deviceStatus.LASTUID = ChameleonIO.deviceStatus.UID;
String uidAction = ((Button) view).getTag().toString();
byte[] uid = Utils.hexString2Bytes(ChameleonIO.deviceStatus.UID);
int uidSize = uid.length - 1;
Expand All @@ -1102,6 +1114,10 @@ else if(uidAction.equals("SHIFT_LEFT")){
System.arraycopy(uid, 0, nextUID, 1, uid.length - 1);
uid = nextUID;
}
else if(uidAction.equals("LAST_UID")) {
uid = Utils.hexString2Bytes(ChameleonIO.deviceStatus.LASTUID);
ChameleonIO.deviceStatus.LASTUID = ChameleonIO.deviceStatus.UID;
}
String uidCmd = ChameleonIO.REVE_BOARD ? "uidmy" : "UID";
getSettingFromDevice(serialPort, String.format(Locale.ENGLISH, "%s=%s", uidCmd, Utils.bytes2Hex(uid).replace(" ", "")));
ChameleonIO.deviceStatus.updateAllStatusAndPost(false);
Expand Down Expand Up @@ -1612,4 +1628,18 @@ public void actionButtonAPDUCopyCmd(View view) {
ApduUtils.updateAssembledAPDUCmd();
}

public static void setSignalStrengthIndicator(int threshold) {
double signalStrength = threshold / 4500.0;
if (signalStrength >= 0.80)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars5);
else if (signalStrength >= 0.60)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars4);
else if (signalStrength >= 0.40)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars3);
else if (signalStrength >= 0.20)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars2);
else
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars1);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,12 @@ public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
int nextThreshold = seekBar.getProgress();
LiveLoggerActivity.setSignalStrengthIndicator(nextThreshold);
ChameleonIO.executeChameleonMiniCommand(LiveLoggerActivity.serialPort, "THRESHOLD=" + String.valueOf(nextThreshold), ChameleonIO.TIMEOUT);
ChameleonIO.deviceStatus.updateAllStatusAndPost(false);
}
});
LiveLoggerActivity.setSignalStrengthIndicator(thresholdSeekbar.getProgress());

NumberPicker settingsNumberPicker = (NumberPicker) view.findViewById(R.id.settingsNumberPicker);
settingsNumberPicker.setDividerThickness(1);
Expand Down
Binary file added app/src/main/res/drawable/uidlast24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_live_logger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:background="?deviceStatusBarBackgroundColor"
android:columnCount="4"
android:columnCount="5"
android:paddingLeft="0dp"
android:layout_marginLeft="1dp"
android:rowCount="1">
Expand Down
13 changes: 8 additions & 5 deletions app/src/main/res/layout/tools_menu_tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@
android:onClick="actionButtonCreateNewEvent"
android:text="GETUID" />

<Button
style="@style/GridButtons"
android:drawableLeft="@drawable/uidlast24"
android:onClick="actionButtonModifyUID"
android:tag="LAST_UID"
android:text="LAST UID" />

<Button
style="@style/GridButtons"
android:drawableLeft="@drawable/user24v1"
Expand Down Expand Up @@ -195,10 +202,6 @@
android:tag="SHIFT_LEFT"
android:text="UID >>> 4" />

<Button
style="@style/GridButtons"
android:text="" />

</GridLayout>

<TextView
Expand Down Expand Up @@ -537,7 +540,7 @@
android:background="?colorAccentLog"
android:drawableLeft="@drawable/ellipsisbracket"
android:drawablePadding="11dp"
android:hint="01 23 45 67 89 ab cd ef"
android:hint="01 23 45 67 89 ab cd ef (data field entry)"
android:paddingLeft="5dp" />

<Button
Expand Down

0 comments on commit 162e386

Please sign in to comment.