mirror of http://galexander.org/git/simplesshd.git
parent
f74a71fdd4
commit
65d628499b
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<EditText android:id="@+id/authtext"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="start"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:typeface="monospace"
|
||||
android:gravity="top"
|
||||
android:singleLine="false"
|
||||
android:background="#00000000" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android_layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button android:id="@+id/fetch_auth"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Fetch"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:onClick="fetch_clicked" />
|
||||
<Button android:id="@+id/cancel_auth"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Cancel"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:onClick="cancel_clicked" />
|
||||
<Button android:id="@+id/save_auth"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Save"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:onClick="save_clicked" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -0,0 +1,52 @@
|
||||
package org.galexander.sshd;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.EditText;
|
||||
import android.view.View;
|
||||
|
||||
public class AuthKeys extends Activity {
|
||||
private static final Object lock = new Object();
|
||||
private EditText authtext;
|
||||
private String authtext_str;
|
||||
private long authtext_when; /* XXX - type for timestamp?? */
|
||||
private boolean authtext_needs_save;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.authkeys);
|
||||
authtext = (EditText)findViewById(R.id.authtext);
|
||||
authtext_str = null;
|
||||
authtext_needs_save = false;
|
||||
authtext_when = 0;
|
||||
/* XXX - disable R.id.save_auth */
|
||||
}
|
||||
|
||||
/* XXX - on changes to authtext, enable R.id.save_auth, and set authtext_needs_save */
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
/* XXX - start a thread that reads /sdcard/ssh/authorized_keys, updates authtext, iff authorized_keys is newer than authtext_when. sets authtext_when to now if it read anything. otherwise sets authtext from authtext_str */
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
authtext_str = authtext.getText().toString();
|
||||
/* XXX - if unsaved changes, toast notify of them */
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
public void fetch_clicked(View v) {
|
||||
/* XXX - dialog to ask for http...when that dialog is done,
|
||||
* start thread that grabs the http and then appends its
|
||||
* contents to authtext */
|
||||
}
|
||||
|
||||
public void cancel_clicked(View v) {
|
||||
authtext_str = null;
|
||||
authtext_when = 0;
|
||||
}
|
||||
|
||||
public void save_clicked(View v) {
|
||||
/* XXX - start thread that writes to file */
|
||||
}
|
||||
}
|
Loading…
Reference in new issue