Commit 729224b1 by eqy Committed by Tianqi Chen

check in (#1629)

parent 16d3c1f6
......@@ -39,11 +39,9 @@ import android.app.NotificationManager;
public class MainActivity extends AppCompatActivity {
private boolean skipRelaunch = true;
// wait time before automatic restart of RPC Activity
public static final int HANDLER_RESTART_DELAY = 5000;
private void showDialog(String title, String msg) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(title);
......@@ -91,7 +89,7 @@ public class MainActivity extends AppCompatActivity {
final Runnable rPCStarter = new Runnable() {
public void run() {
if (switchPersistent.isChecked()) {
System.err.println("relaunching RPC activity in 5s...");
System.err.println("relaunching RPC activity...");
Intent intent = ((MainActivity) context).updateRPCPrefs();
startActivity(intent);
}
......@@ -116,6 +114,7 @@ public class MainActivity extends AppCompatActivity {
if (isChecked) {
System.err.println("automatic RPC restart enabled...");
updateRPCPrefs();
setupRelaunch();
} else {
System.err.println("automatic RPC restart disabled...");
updateRPCPrefs();
......@@ -123,29 +122,14 @@ public class MainActivity extends AppCompatActivity {
}
});
Button startRPC = findViewById(R.id.button_start_rpc);
startRPC.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = ((MainActivity) context).updateRPCPrefs();
startActivity(intent);
}
});
enableInputView(true);
}
@Override
protected void onResume() {
System.err.println("MainActivity onResume...");
System.err.println("skipRelaunch: " + skipRelaunch);
// if this is the first time onResume is called, do nothing, otherwise we
// may double launch
if (!skipRelaunch) {
enableInputView(true);
setupRelaunch();
} else {
skipRelaunch = false;
}
super.onResume();
}
......
......@@ -78,15 +78,4 @@
android:textOn="@string/switch_on" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/button_start_rpc"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/start_rpc" />
</LinearLayout>
</LinearLayout>
......@@ -9,11 +9,10 @@
<string name="label_address">Address</string>
<string name="label_port">Port</string>
<string name="label_key">Key</string>
<string name="label_persistent">Keep RPC Alive</string>
<string name="label_persistent">Enable RPC</string>
<string name="switch_on">Enabled</string>
<string name="switch_off">Disabled</string>
<string name="start_rpc">Start RPC</string>
<string name="stop_rpc">Stop RPC</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment