some cleaning up

merge-requests/3/head
m2049r 7 years ago
parent 69729e5257
commit 6611539491

@ -24,9 +24,7 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.StrictMode;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -34,23 +32,14 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.BaseAdapter;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton;
import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.model.WalletManager;
import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.Helper;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class LoginActivity extends Activity implements LoginFragment.LoginFragmentListener { public class LoginActivity extends Activity implements LoginFragment.LoginFragmentListener {
static final String TAG = "LoginActivity"; static final String TAG = "LoginActivity";
@ -189,7 +178,8 @@ public class LoginActivity extends Activity implements LoginFragment.LoginFragme
} else { } else {
String msg = getString(R.string.message_strorage_not_permitted); String msg = getString(R.string.message_strorage_not_permitted);
Log.e(TAG, msg); Log.e(TAG, msg);
throw new IllegalStateException(msg); Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
//throw new IllegalStateException(msg);
} }
break; break;
default: default:
@ -197,14 +187,7 @@ public class LoginActivity extends Activity implements LoginFragment.LoginFragme
} }
void startLoginFragment() { void startLoginFragment() {
// Create a new Fragment to be placed in the activity layout
Fragment fragment = new LoginFragment(); Fragment fragment = new LoginFragment();
// In case this activity was started with special instructions from an
// Intent, pass the Intent's extras to the fragment as arguments
//firstFragment.setArguments(getIntent().getExtras());
// Add the fragment to the 'fragment_container' FrameLayout
getFragmentManager().beginTransaction() getFragmentManager().beginTransaction()
.add(R.id.fragment_container, fragment).commit(); .add(R.id.fragment_container, fragment).commit();
Log.d(TAG, "fragment added"); Log.d(TAG, "fragment added");

@ -19,7 +19,6 @@ package com.m2049r.xmrwallet;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.StrictMode; import android.os.StrictMode;
import android.util.Log; import android.util.Log;
@ -40,7 +39,6 @@ import android.widget.Toast;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.model.WalletManager;
import com.m2049r.xmrwallet.util.Helper;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

@ -66,9 +66,6 @@ public class WalletActivity extends Activity implements WalletFragment.WalletFra
disconnectWalletService(); disconnectWalletService();
} }
// private String title = null;
@Override @Override
protected void onStop() { protected void onStop() {
Log.d(TAG, "onStop()"); Log.d(TAG, "onStop()");
@ -88,39 +85,18 @@ public class WalletActivity extends Activity implements WalletFragment.WalletFra
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.wallet_activity); setContentView(R.layout.wallet_activity);
// Check that the activity is using the layout version with Fragment walletFragment = new WalletFragment();
// the fragment_container FrameLayout getFragmentManager().beginTransaction()
if (findViewById(R.id.fragment_container) != null) { .add(R.id.fragment_container, walletFragment).commit();
Log.d(TAG, "fragment_container not null"); Log.d(TAG, "fragment added");
// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.
if (savedInstanceState != null) {
return;
}
// Create a new Fragment to be placed in the activity layout
Fragment firstFragment = new WalletFragment();
// In case this activity was started with special instructions from an
// Intent, pass the Intent's extras to the fragment as arguments
firstFragment.setArguments(getIntent().getExtras());
// Add the fragment to the 'fragment_container' FrameLayout
getFragmentManager().beginTransaction()
.add(R.id.fragment_container, firstFragment).commit();
Log.d(TAG, "fragment added");
}
// TODO do stuff with savedInstanceState // TODO do stuff with savedInstanceState ?
if (savedInstanceState != null) { if (savedInstanceState != null) {
return; return;
} }
//Log.d(TAG, "no savedInstanceState");
startWalletService(); startWalletService();
//Log.d(TAG, "onCreate() done."); Log.d(TAG, "onCreate() done.");
} }

@ -41,6 +41,6 @@
<string name="prompt_problems">Problems</string> <string name="prompt_problems">Problems</string>
<string name="message_strorage_not_writable">External Storage is not writable! Panic!</string> <string name="message_strorage_not_writable">External Storage is not writable! Panic!</string>
<string name="message_strorage_not_permitted">External Storage permission not granted! Panic!</string> <string name="message_strorage_not_permitted">We really need those External Storage permissions!</string>
</resources> </resources>

Loading…
Cancel
Save