mirror of https://github.com/m2049r/xmrwallet.git
rework options menus
This commit is contained in:
parent
93025c5e1b
commit
fe84bae9ed
|
@ -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,13 +130,15 @@ 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) {
|
||||
|
@ -585,13 +585,10 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisposeRequest() {
|
||||
|
@ -600,12 +597,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// QR scanner callbacks
|
||||
@Override
|
||||
|
@ -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
|
||||
|
|
|
@ -3,12 +3,6 @@
|
|||
android:height="32dp"
|
||||
android:viewportHeight="75.0"
|
||||
android:viewportWidth="75.0">
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData=" M 37.3, 37.3
|
||||
m -36.9, 0
|
||||
a 36.9,36.9 0 1,0 73.8,0
|
||||
a 36.9,36.9 0 1,0 -73.8,0" />
|
||||
|
||||
<path
|
||||
android:fillColor="#ff6600"
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="230.0"
|
||||
android:viewportWidth="230.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M0 0L0 230L230 230L230 0L0 0z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10 10L10 80L80 80L80 10L10 10M110 10L110 20L120 20L120 10L110 10M130 10L130 30L140 30L140 10L130 10M150 10L150 80L220 80L220 10L150 10z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M20 20L20 70L70 70L70 20L20 20M160 20L160 70L210 70L210 20L160 20z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M30 30L30 60L60 60L60 30L30 30M90 30L90 40L100 40L100 30L90 30M110 30L110 40L120 40L120 30L110 30M170 30L170 60L200 60L200 30L170 30M130 40L130 50L120 50L120 60L110 60L110 50L100 50L100 70L90 70L90 90L50 90L50 120L60 120L60 130L50 130L50 140L60 140L60 130L70 130L70 140L90 140L90 180L100 180L100 170L110 170L110 180L120 180L120 190L90 190L90 220L100 220L100 210L110 210L110 220L130 220L130 210L140 210L140 220L160 220L160 210L170 210L170 220L190 220L190 210L180 210L180 200L200 200L200 220L220 220L220 210L210 210L210 200L220 200L220 190L210 190L210 180L200 180L200 190L180 190L180 170L160 170L160 160L180 160L180 140L160 140L160 130L180 130L180 120L190 120L190 110L200 110L200 120L220 120L220 100L200 100L200 90L190 90L190 110L180 110L180 100L160 100L160 90L130 90L130 100L120 100L120 70L130 70L130 80L140 80L140 70L130 70L130 60L140 60L140 40L130 40z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M100 70L100 100L90 100L90 110L80 110L80 100L70 100L70 110L60 110L60 120L70 120L70 130L90 130L90 140L100 140L100 150L110 150L110 140L120 140L120 160L110 160L110 170L120 170L120 180L130 180L130 200L140 200L140 180L150 180L150 190L170 190L170 180L150 180L150 160L160 160L160 150L150 150L150 130L160 130L160 110L150 110L150 100L130 100L130 120L140 120L140 110L150 110L150 130L130 130L130 140L120 140L120 120L110 120L110 130L100 130L100 120L90 120L90 110L100 110L100 100L110 100L110 110L120 110L120 100L110 100L110 70L100 70z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10 90L10 120L30 120L30 130L10 130L10 140L30 140L30 130L40 130L40 120L30 120L30 110L20 110L20 100L40 100L40 90L10 90M70 110L70 120L80 120L80 110L70 110M200 130L200 140L190 140L190 150L200 150L200 170L210 170L210 160L220 160L220 150L210 150L210 130L200 130M10 150L10 220L80 220L80 150L10 150M130 150L130 160L140 160L140 150L130 150z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M20 160L20 210L70 210L70 160L20 160z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M30 170L30 200L60 200L60 170L30 170M130 170L130 180L140 180L140 170L130 170z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M200 190L200 200L210 200L210 190L200 190M110 200L110 210L120 210L120 200L110 200M150 200L150 210L160 210L160 200L150 200z" />
|
||||
</vector>
|
|
@ -27,9 +27,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8sp"
|
||||
android:layout_weight="3"
|
||||
android:text="@string/receive_paymentid_hint"
|
||||
android:text="@string/receive_paymentid_label"
|
||||
android:textAlignment="textEnd"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
|
@ -37,7 +36,7 @@
|
|||
android:layout_width="0sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:hint="@string/send_paymentid_hint"
|
||||
android:hint="@string/receive_paymentid_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textMultiLine"
|
||||
android:textAlignment="textStart"
|
||||
|
@ -71,14 +70,13 @@
|
|||
android:layout_weight="3"
|
||||
android:text="@string/send_amount_label"
|
||||
android:textAlignment="textEnd"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etAmount"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/send_amount_hint"
|
||||
android:hint="@string/receive_amount_hint"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="numberDecimal"
|
||||
android:layout_weight="7"
|
||||
|
|
|
@ -9,4 +9,11 @@
|
|||
android:title="@string/menu_info"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_receive"
|
||||
android:icon="@drawable/ic_monero_qr_24dp"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/menu_receive"
|
||||
app:showAsAction="always" />
|
||||
|
||||
</menu>
|
|
@ -154,7 +154,10 @@
|
|||
|
||||
<string name="receive_generate_hint">Generate QR Code</string>
|
||||
<string name="receive_paymentid_button">Generate</string>
|
||||
<string name="receive_paymentid_hint">PaymentID</string>
|
||||
<string name="receive_paymentid_label">PaymentID</string>
|
||||
<string name="receive_paymentid_hint">(optional)</string>
|
||||
<string name="receive_amount_label">Amount</string>
|
||||
<string name="receive_amount_hint">(optional)</string>
|
||||
|
||||
<string name="big_amount">999999.999999999999</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue