mirror of
https://github.com/wownero/wownerujo.git
synced 2026-11-17 22:03:58 +01:00
rework options menus
This commit is contained in:
@@ -345,7 +345,7 @@ public class GenerateFragment extends Fragment {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Log.d(TAG, "onPause()");
|
||||
Log.d(TAG, "onResume()");
|
||||
activityCallback.setTitle(getString(R.string.generate_title));
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,7 @@ public class ReceiveFragment extends Fragment {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO check if we can sensibly cache some of this
|
||||
private Bitmap addLogo(Bitmap qrBitmap) {
|
||||
Bitmap logo = getMoneroLogo();
|
||||
int qrWidth = qrBitmap.getWidth();
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.m2049r.xmrwallet.util.BarcodeData;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.TxData;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -120,11 +121,8 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (!haveWallet) return true;
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.wallet_menu, menu);
|
||||
return true;
|
||||
public boolean hasWallet() {
|
||||
return haveWallet;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,14 +130,16 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_info:
|
||||
onWalletDetails();
|
||||
break;
|
||||
return true;
|
||||
case R.id.action_receive:
|
||||
onWalletReceive();
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.d(TAG, "onCreate()");
|
||||
@@ -585,12 +585,9 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
||||
}
|
||||
|
||||
private void onWalletDetails() {
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||
if (!(fragment instanceof GenerateReviewFragment)) {
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString("type", GenerateReviewFragment.VIEW_WALLET);
|
||||
replaceFragment(new GenerateReviewFragment(), null, extras);
|
||||
}
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString("type", GenerateReviewFragment.VIEW_WALLET);
|
||||
replaceFragment(new GenerateReviewFragment(), null, extras);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -600,11 +597,8 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
||||
|
||||
|
||||
private void startScanFragment() {
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||
if (fragment instanceof SendFragment) {
|
||||
Bundle extras = new Bundle();
|
||||
replaceFragment(new ScannerFragment(), null, extras);
|
||||
}
|
||||
Bundle extras = new Bundle();
|
||||
replaceFragment(new ScannerFragment(), null, extras);
|
||||
}
|
||||
|
||||
/// QR scanner callbacks
|
||||
@@ -703,4 +697,21 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletReceive() {
|
||||
startReceive(getWalletAddress());
|
||||
}
|
||||
|
||||
void startReceive(String address) {
|
||||
Log.d(TAG, "startReceive()");
|
||||
Bundle b = new Bundle();
|
||||
b.putString("address", address);
|
||||
startReceiveFragment(b);
|
||||
}
|
||||
|
||||
void startReceiveFragment(Bundle extras) {
|
||||
replaceFragment(new ReceiveFragment(), null, extras);
|
||||
Log.d(TAG, "ReceiveFragment placed");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,12 +18,16 @@ package com.m2049r.xmrwallet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.constraint.ConstraintLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.DividerItemDecoration;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
@@ -53,6 +57,19 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
||||
ProgressBar pbProgress;
|
||||
Button bSend;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
if (activityCallback.hasWallet())
|
||||
inflater.inflate(R.menu.wallet_menu, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
@@ -236,6 +253,10 @@ public class WalletFragment extends Fragment implements TransactionInfoAdapter.O
|
||||
boolean isWatchOnly();
|
||||
|
||||
String getTxKey(String txId);
|
||||
|
||||
void onWalletReceive();
|
||||
|
||||
boolean hasWallet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user