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

Commit

Permalink
Preparing to add more scripting functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
maxieds committed Apr 29, 2021
1 parent 0af76a9 commit 9eec3d4
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 6 deletions.
17 changes: 17 additions & 0 deletions app/src/main/SampleScripts/example-syntax2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* example-syntax2.sh */

Printf("Example Script V2:\n > Loops and slices\n")

// Iterate through a loop (subtract off two each time):
$ctri = 10;
while($ctri <= 0) {
Printf("LOOP I = %02d\n", $ctri)
$ctri--
$ctri += -1
}

// Examples of slices with arrays:
Printf("TODO ...\n")

// Finally, conclude the script normally:
Exit(0)
6 changes: 6 additions & 0 deletions app/src/main/SampleScripts/string-handling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* string-handling.sh */

Printf("TODO ... Test the string handling functions ...\n")


Exit(0)
Original file line number Diff line number Diff line change
Expand Up @@ -945,4 +945,9 @@ public void actionButtonScriptingGUIHandlePerformTaskClick(View view) {
ScriptingGUIMain.scriptGUIHandlePerformTaskClick((Button) view, view.getTag().toString());
}

public void copyButtonTagToClipboard(View btn) {
String clipBoardText = ((Button) btn).getTag().toString();
Utils.copyTextToClipboard(this, clipBoardText, true);
}

}
12 changes: 12 additions & 0 deletions app/src/main/java/com/maxieds/chameleonminilivedebugger/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This program (The Chameleon Mini Live Debugger) is free software written by

package com.maxieds.chameleonminilivedebugger;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
Expand Down Expand Up @@ -545,4 +547,14 @@ public static void dismissAndroidKeyboard(ChameleonMiniLiveDebuggerActivity acti
}
}

public static void copyTextToClipboard(ChameleonMiniLiveDebuggerActivity activityCtx, String textToCopy, boolean showToastStatus) {
ClipboardManager clipboard = (ClipboardManager) activityCtx.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText("CMLD Find Scripts URL", textToCopy);
clipboard.setPrimaryClip(clipData);
if(showToastStatus) {
String toastMsg = "Copied URL to Clipboard:\n" + textToCopy;
Utils.displayToastMessage(activityCtx, toastMsg, Toast.LENGTH_SHORT);
}
}

}
Binary file added app/src/main/res/drawable/locate_scripts24.webp
Binary file not shown.
1 change: 0 additions & 1 deletion app/src/main/res/layout/apdu_search_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ https://github.com/maxieds/ChameleonMiniLiveDebugger
android:textAllCaps="true"
android:textSize="12.5sp"
android:textStyle="normal"
android:onClick="actionButtonAPDUCopyCmd"
android:text="COPY" />

</RelativeLayout>
Expand Down
54 changes: 54 additions & 0 deletions app/src/main/res/layout/scripting_tab_load_import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,60 @@ https://github.com/maxieds/ChameleonMiniLiveDebugger

</GridLayout>

<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="?colorPrimaryDark" />

<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="?colorPrimaryDark" />

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?colorPrimaryDarkLog"
android:drawableLeft="@drawable/locate_scripts24"
android:drawablePadding="5dp"
android:paddingLeft="10dp"
android:gravity="center_vertical"
android:singleLine="true"
android:text="Find Sample Scripts:"
android:textAllCaps="true"
android:textSize="18sp"
android:textStyle="bold|italic" />

<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="?colorPrimaryDark" />

<GridLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:background="?colorAccentLog"
android:columnCount="1"
android:padding="0dp">

<Button
style="@style/GridButtonsNoWidth"
android:layout_columnWeight="1.0"
android:layout_weight="1.0"
android:gravity="center_vertical|center_horizontal"
android:layout_gravity="center_vertical|left"
android:drawableLeft="@drawable/copy24"
android:drawablePadding="8dp"
android:paddingLeft="10dp"
android:text="Copy link to sample scripts "
android:tag="https://github.com/maxieds/ChameleonMiniLiveDebugger/tree/master/app/src/main/SampleScripts"
android:onClick="copyButtonTagToClipboard" />

</GridLayout>

<View
android:layout_width="match_parent"
android:layout_height="2dp"
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ https://github.com/maxieds/ChameleonMiniLiveDebugger
\nin the subtab are still under active development. They
\nare not yet considered production ready. However,
\ntesters and early adopters are welcome to try things
\nout at any rate. A list of prospective test scripts
\nis here:
\nhttps://github.com/maxieds/ChameleonMiniLiveDebugger/tree/master/app/src/main/SampleScripts
\n\nStay safe out there!
\nout at any rate.
\n\nF*ck Trump (#26), and stay safe out there!
</string>
<string name="appInitialUserGreetingMsgPaid">
Thank you for your contribution in purchasing the paid
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ https://github.com/maxieds/ChameleonMiniLiveDebugger
<item name="android:background">?colorAccentLog</item>
<item name="android:maxButtonHeight">8dp</item>
<item name="android:maxHeight">40dp</item>
<item name="android:layout_weight">0.29</item>
<item name="android:textSize">11sp</item>
<item name="android:textStyle">normal|bold</item>
</style>
Expand Down

0 comments on commit 9eec3d4

Please sign in to comment.