mirror of https://github.com/m2049r/xmrwallet.git
cleanup & AppCompatActivity & setTitle
This commit is contained in:
parent
afc45e1cbc
commit
032aa24ab5
|
@ -20,7 +20,6 @@ import android.app.Fragment;
|
|||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -178,8 +177,10 @@ public class GenerateFragment extends Fragment {
|
|||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||
if (etWalletAddress.length() == 0) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
generateWallet();
|
||||
if (bGenerate.getVisibility() == View.VISIBLE) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
generateWallet();
|
||||
}
|
||||
} else if (addressOk()) {
|
||||
etWalletViewKey.requestFocus();
|
||||
} else {
|
||||
|
@ -247,8 +248,10 @@ public class GenerateFragment extends Fragment {
|
|||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||
if (spendKeyOk()) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
generateWallet();
|
||||
if (bGenerate.getVisibility() == View.VISIBLE) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
generateWallet();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.generate_check_key), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
@ -267,8 +270,10 @@ public class GenerateFragment extends Fragment {
|
|||
etWalletRestoreHeight.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
generateWallet();
|
||||
if (bGenerate.getVisibility() == View.VISIBLE) {
|
||||
Helper.hideKeyboard(getActivity());
|
||||
generateWallet();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -324,8 +329,6 @@ public class GenerateFragment extends Fragment {
|
|||
try {
|
||||
height = Long.parseLong(etWalletRestoreHeight.getText().toString());
|
||||
} catch (NumberFormatException ex) {
|
||||
Log.e(TAG, "Cannot parse " + etWalletRestoreHeight.getText().toString());
|
||||
Log.e(TAG, ex.getLocalizedMessage());
|
||||
height = 0; // Keep calm and carry on!
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@ import android.widget.TextView;
|
|||
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
// TODO: somehow show which net we are generating for
|
||||
|
||||
public class GenerateReviewFragment extends Fragment {
|
||||
|
@ -93,7 +91,6 @@ public class GenerateReviewFragment extends Fragment {
|
|||
tvWalletMnemonic.setText(seed);
|
||||
tvWalletViewKey.setText(view);
|
||||
tvWalletSpendKey.setText(spend);
|
||||
NumberFormat formatter = NumberFormat.getInstance();
|
||||
bAccept.setEnabled(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.content.SharedPreferences;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -44,7 +45,7 @@ import com.m2049r.xmrwallet.util.Helper;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
public class LoginActivity extends Activity
|
||||
public class LoginActivity extends AppCompatActivity
|
||||
implements LoginFragment.Listener, GenerateFragment.Listener, GenerateReviewFragment.Listener {
|
||||
static final String TAG = "LoginActivity";
|
||||
|
||||
|
@ -166,6 +167,11 @@ public class LoginActivity extends Activity
|
|||
return Helper.getStorageRoot(getApplicationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(String title) {
|
||||
super.setTitle(title);
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ public class LoginFragment extends Fragment {
|
|||
File getStorageRoot();
|
||||
|
||||
void onWalletSelected(final String wallet);
|
||||
|
||||
void setTitle(String title);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,6 +137,8 @@ public class LoginFragment extends Fragment {
|
|||
} else {
|
||||
setDaemon(daemonTestNet);
|
||||
}
|
||||
activityCallback.setTitle(getString(R.string.app_name) + " " +
|
||||
getString(mainnet ? R.string.connect_mainnet : R.string.connect_testnet));
|
||||
filterList();
|
||||
((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
|
@ -185,6 +189,10 @@ public class LoginFragment extends Fragment {
|
|||
activityCallback.onWalletSelected(wallet);
|
||||
}
|
||||
});
|
||||
|
||||
activityCallback.setTitle(getString(R.string.app_name) + " " +
|
||||
getString(isMainNet() ? R.string.connect_mainnet : R.string.connect_testnet));
|
||||
|
||||
loadList();
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -25,13 +25,14 @@ import android.content.ServiceConnection;
|
|||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.service.WalletService;
|
||||
|
||||
public class WalletActivity extends Activity implements WalletFragment.Listener,
|
||||
public class WalletActivity extends AppCompatActivity implements WalletFragment.Listener,
|
||||
WalletService.Observer {
|
||||
private static final String TAG = "WalletActivity";
|
||||
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fragment_container"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fragment_container"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin">
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
>
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue