From 6aa243a9533793b6005fd1c7780e9656bb847395 Mon Sep 17 00:00:00 2001 From: faketruth Date: Fri, 16 Nov 2012 22:19:12 +0000 Subject: Android: Added an installer class that lets the user select default plugins to install and it will install the example.ini files. Android: Added menu option to retry the MCServer install routine git-svn-id: http://mc-server.googlecode.com/svn/trunk@1050 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- Android/src/com/mcserver/MCServerActivity.java | 41 +++++++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'Android/src/com/mcserver/MCServerActivity.java') diff --git a/Android/src/com/mcserver/MCServerActivity.java b/Android/src/com/mcserver/MCServerActivity.java index 38b566250..8a9846ca1 100644 --- a/Android/src/com/mcserver/MCServerActivity.java +++ b/Android/src/com/mcserver/MCServerActivity.java @@ -16,6 +16,8 @@ import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; @@ -31,13 +33,17 @@ public class MCServerActivity extends Activity { ArrayList mLogList = new ArrayList(); ArrayAdapter mAdapter; + MCServerInstaller mInstaller = null; + + final private int MENU_REINSTALL = 0; + /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); - Log.e("MCServer", "p id: " + android.os.Process.myPid() ); + //Log.e("MCServer", "p id: " + android.os.Process.myPid() ); ((Button)findViewById(R.id.start_server)).setOnClickListener( new View.OnClickListener() { @@ -135,12 +141,14 @@ public class MCServerActivity extends Activity { }); loggerThread.start(); + ((TextView)findViewById(R.id.ip_address)).setText("Connect to: " + getLocalIpAddress()); - - - - ((TextView)findViewById(R.id.ip_address)).setText("Connect to: " + getLocalIpAddress()); + mInstaller = new MCServerInstaller(this); + if( mInstaller.NeedsUpdate() ) + { + mInstaller.ShowFirstRunDialog(); + } } @@ -234,15 +242,32 @@ public class MCServerActivity extends Activity { - public void Testtt() - { - //Log.d("MCServer", "in Testtt"); + @Override + public boolean onCreateOptionsMenu(Menu menu) { + menu.add(0, MENU_REINSTALL, 0, "Reinstall MCServer" ); + return super.onCreateOptionsMenu(menu); } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + switch( item.getItemId() ) + { + case MENU_REINSTALL: + mInstaller.ShowPluginInstallDialog(true); + return true; + } + return false; + } + + + + + static { System.loadLibrary("mcserver"); } -- cgit v1.2.3