1
0
mirror of http://galexander.org/git/simplesshd.git synced 2024-12-29 09:28:07 +00:00

separate "Documentation" and "About" choices, and About just displays

version numbers now
This commit is contained in:
Greg Alexander 2015-11-23 09:00:03 -05:00
parent 0062f2794a
commit b35cee186d
2 changed files with 31 additions and 2 deletions

View File

@ -3,7 +3,10 @@
<item android:id="@+id/settings" <item android:id="@+id/settings"
android:icon="@android:drawable/ic_menu_manage" android:icon="@android:drawable/ic_menu_manage"
android:title="Settings" /> android:title="Settings" />
<item android:id="@+id/about" <item android:id="@+id/doc"
android:icon="@android:drawable/ic_menu_help" android:icon="@android:drawable/ic_menu_help"
android:title="Documentation" />
<item android:id="@+id/about"
android:icon="@android:drawable/ic_menu_info_details"
android:title="About" /> android:title="About" />
</menu> </menu>

View File

@ -1,10 +1,12 @@
package org.galexander.sshd; package org.galexander.sshd;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle; import android.os.Bundle;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.Intent; import android.content.Intent;
import android.content.DialogInterface;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
@ -68,11 +70,27 @@ public class SimpleSSHD extends Activity
case R.id.settings: case R.id.settings:
startActivity(new Intent(this, Settings.class)); startActivity(new Intent(this, Settings.class));
return true; return true;
case R.id.about: { case R.id.doc: {
Intent i = new Intent(Intent.ACTION_VIEW); Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://www.galexander.org/software/simplesshd")); i.setData(Uri.parse("http://www.galexander.org/software/simplesshd"));
startActivity(i); startActivity(i);
} return true; } return true;
case R.id.about: {
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setCancelable(true);
b.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface di, int which) { }
});
b.setIcon(android.R.drawable.ic_dialog_info);
b.setTitle("About");
b.setMessage(
"SimpleSSHD version " + my_version() +
"\ndropbear 2014.66" +
"\nscp/sftp from OpenSSH 6.7p1" +
"\nrsync 3.1.1");
b.show();
} return true;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@ -189,4 +207,12 @@ public class SimpleSSHD extends Activity
} catch (Exception ex) { } // for now eat exceptions } catch (Exception ex) { } // for now eat exceptions
return ret; return ret;
} }
public String my_version() {
try {
return getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
} catch (Exception e) {
return "UNKNOWN";
}
}
} }