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

Commit

Permalink
Added help dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxieds committed May 21, 2018
1 parent bebd03a commit cd38ab2
Show file tree
Hide file tree
Showing 7 changed files with 516 additions and 2 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 50
versionName "0.5.0"
versionCode 51
versionName "0.5.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1718,4 +1718,94 @@ else if (signalStrength >= 0.20)
LiveLoggerActivity.runningActivity.setStatusIcon(R.id.signalStrength, R.drawable.signalbars1);
}

public void actionButtonDisplayHelp(View view) {

AlertDialog.Builder adBuilder = new AlertDialog.Builder(this, R.style.SpinnerTheme);
View adView = defaultInflater.inflate(R.layout.help_dialog, null);
final View adViewFinal = adView;

Button cmdRespButton = (Button) adView.findViewById(R.id.cmdRespButton);
cmdRespButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WebView wv = (WebView) adViewFinal.findViewById(R.id.wvDisplayHelpTopic);
String rawHTMLString = getString(R.string.apphtmlheader) + getString(R.string.helpCmdResp) + getString(R.string.apphtmlfooter);
wv.loadData(rawHTMLString, "text/html", "UTF-8");
}
});
Button revECmdsButton = (Button) adView.findViewById(R.id.revECmdsButton);
revECmdsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WebView wv = (WebView) adViewFinal.findViewById(R.id.wvDisplayHelpTopic);
String rawHTMLString = getString(R.string.apphtmlheader) + getString(R.string.helpRevECmds) + getString(R.string.apphtmlfooter);
wv.loadDataWithBaseURL(null, rawHTMLString, "text/html", "UTF-8", "");
}
});
Button revGCmdsButton = (Button) adView.findViewById(R.id.revGCmdsButton);
revGCmdsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WebView wv = (WebView) adViewFinal.findViewById(R.id.wvDisplayHelpTopic);
String rawHTMLString = getString(R.string.apphtmlheader) + getString(R.string.helpRevGCmds) + getString(R.string.apphtmlfooter);
wv.loadData(rawHTMLString, "text/html", "UTF-8");
}
});
Button buttonSettingsButton = (Button) adView.findViewById(R.id.buttonSettingsButton);
buttonSettingsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WebView wv = (WebView) adViewFinal.findViewById(R.id.wvDisplayHelpTopic);
String rawHTMLString = getString(R.string.apphtmlheader) + getString(R.string.helpButtonSettings) + getString(R.string.apphtmlfooter);
wv.loadData(rawHTMLString, "text/html", "UTF-8");
}
});
Button buttonLEDButton = (Button) adView.findViewById(R.id.ledSettingsButton);
buttonLEDButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WebView wv = (WebView) adViewFinal.findViewById(R.id.wvDisplayHelpTopic);
String rawHTMLString = getString(R.string.apphtmlheader) + getString(R.string.helpLEDSettings) + getString(R.string.apphtmlfooter);
wv.loadData(rawHTMLString, "text/html", "UTF-8");
}
});
Button loggingButton = (Button) adView.findViewById(R.id.loggingButton);
loggingButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WebView wv = (WebView) adViewFinal.findViewById(R.id.wvDisplayHelpTopic);
String rawHTMLString = getString(R.string.apphtmlheader) + getString(R.string.helpLogging) + getString(R.string.apphtmlfooter);
wv.loadData(rawHTMLString, "text/html", "UTF-8");
}
});

WebView wv = (WebView) adView.findViewById(R.id.wvDisplayHelpTopic);
wv.getSettings().setJavaScriptEnabled(false);
wv.setBackgroundColor(getThemeColorVariant(R.attr.colorAccentHighlight));
wv.getSettings().setLoadWithOverviewMode(true);
wv.getSettings().setUseWideViewPort(true);
wv.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
wv.setInitialScale(10);

adBuilder.setCancelable(true);
adBuilder.setTitle("Application Help Topics:");
adBuilder.setMessage("This window displays help information for the following topics. Click on each button to display the respective help topic.");
adBuilder.setIcon(R.drawable.help64);
adBuilder.setPositiveButton(
"Done",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
adBuilder.setView(adView);
AlertDialog alertDialog = adBuilder.create();

alertDialog.show();




}

}
Binary file added app/src/main/res/drawable/help24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/help64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions app/src/main/res/layout/activity_live_logger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,19 @@
android:onClick="actionButtonAppSettings"
android:textColor="?deviceStatusBarTextColor" />

<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:background="?deviceStatusBarBackgroundColor"
android:drawableLeft="@drawable/help24"
android:drawablePadding="10dp"
android:gravity="left|center_vertical"
android:onClick="actionButtonDisplayHelp"
android:textColor="?deviceStatusBarTextColor" />

<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="25dp"
Expand Down
70 changes: 70 additions & 0 deletions app/src/main/res/layout/help_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<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="3"
android:padding="2dp"
android:rowCount="2">

<Button
android:id="@+id/cmdRespButton"
style="@style/GridButtons"
android:text="Command Responses" />

<Button
android:id="@+id/revECmdsButton"
style="@style/GridButtons"
android:text="RevE Commands" />

<Button
android:id="@+id/revGCmdsButton"
style="@style/GridButtons"
android:text="RevG Commands" />

<Button
android:id="@+id/buttonSettingsButton"
style="@style/GridButtons"
android:text="Button Settings" />

<Button
android:id="@+id/ledSettingsButton"
style="@style/GridButtons"
android:text="LED Settings" />

<Button
android:id="@+id/loggingButton"
style="@style/GridButtons"
android:text="Logging (RevG)" />

</GridLayout>

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

<WebView
android:id="@+id/wvDisplayHelpTopic"
android:layout_height="450dp"
android:layout_width="fill_parent"
android:layout_margin="10dp"/>

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

</LinearLayout>
Loading

0 comments on commit cd38ab2

Please sign in to comment.