From 66115394919135ac616eb77219aeb2c1eadf4054 Mon Sep 17 00:00:00 2001
From: m2049r <30435443+m2049r@users.noreply.github.com>
Date: Tue, 15 Aug 2017 12:04:25 +0200
Subject: [PATCH] some cleaning up
---
.../com/m2049r/xmrwallet/LoginActivity.java | 21 ++---------
.../com/m2049r/xmrwallet/LoginFragment.java | 2 --
.../com/m2049r/xmrwallet/WalletActivity.java | 36 ++++---------------
app/src/main/res/values/strings.xml | 2 +-
4 files changed, 9 insertions(+), 52 deletions(-)
diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
index 3a65cffd..9079c038 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
@@ -24,9 +24,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
-import android.os.AsyncTask;
import android.os.Bundle;
-import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.KeyEvent;
@@ -34,23 +32,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
-import android.widget.BaseAdapter;
import android.widget.EditText;
-import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
-import android.widget.ToggleButton;
import com.m2049r.xmrwallet.model.WalletManager;
import com.m2049r.xmrwallet.util.Helper;
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 {
static final String TAG = "LoginActivity";
@@ -189,7 +178,8 @@ public class LoginActivity extends Activity implements LoginFragment.LoginFragme
} else {
String msg = getString(R.string.message_strorage_not_permitted);
Log.e(TAG, msg);
- throw new IllegalStateException(msg);
+ Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
+ //throw new IllegalStateException(msg);
}
break;
default:
@@ -197,14 +187,7 @@ public class LoginActivity extends Activity implements LoginFragment.LoginFragme
}
void startLoginFragment() {
- // Create a new Fragment to be placed in the activity layout
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()
.add(R.id.fragment_container, fragment).commit();
Log.d(TAG, "fragment added");
diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java
index 5dc08f1f..f925d08a 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java
@@ -19,7 +19,6 @@ package com.m2049r.xmrwallet;
import android.app.Fragment;
import android.content.Context;
import android.content.SharedPreferences;
-import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.Log;
@@ -40,7 +39,6 @@ import android.widget.Toast;
import android.widget.ToggleButton;
import com.m2049r.xmrwallet.model.WalletManager;
-import com.m2049r.xmrwallet.util.Helper;
import java.io.File;
import java.io.IOException;
diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java
index 22bc86f7..40ef7122 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java
@@ -66,9 +66,6 @@ public class WalletActivity extends Activity implements WalletFragment.WalletFra
disconnectWalletService();
}
-// private String title = null;
-
-
@Override
protected void onStop() {
Log.d(TAG, "onStop()");
@@ -88,39 +85,18 @@ public class WalletActivity extends Activity implements WalletFragment.WalletFra
super.onCreate(savedInstanceState);
setContentView(R.layout.wallet_activity);
- // Check that the activity is using the layout version with
- // the fragment_container FrameLayout
- if (findViewById(R.id.fragment_container) != null) {
- Log.d(TAG, "fragment_container not null");
- // 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;
- }
+ Fragment walletFragment = new WalletFragment();
+ getFragmentManager().beginTransaction()
+ .add(R.id.fragment_container, walletFragment).commit();
+ Log.d(TAG, "fragment added");
- // 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) {
return;
}
- //Log.d(TAG, "no savedInstanceState");
startWalletService();
- //Log.d(TAG, "onCreate() done.");
+ Log.d(TAG, "onCreate() done.");
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 11c77b79..f2c64603 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -41,6 +41,6 @@
Problems
External Storage is not writable! Panic!
- External Storage permission not granted! Panic!
+ We really need those External Storage permissions!