mirror of
https://github.com/m2049r/xmrwallet
synced 2025-09-19 20:40:50 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
849718fdc7 | ||
![]() |
a6372f701d | ||
![]() |
12f135bb14 | ||
![]() |
16870fcbb9 | ||
![]() |
2fbd152fb3 | ||
![]() |
a7b178e024 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,3 +15,4 @@
|
|||||||
/app/alphaStagenet
|
/app/alphaStagenet
|
||||||
/app/prodStagenet
|
/app/prodStagenet
|
||||||
/app/.cxx
|
/app/.cxx
|
||||||
|
/monerujo.id
|
||||||
|
@@ -7,8 +7,8 @@ android {
|
|||||||
applicationId "com.m2049r.xmrwallet"
|
applicationId "com.m2049r.xmrwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 709
|
versionCode 712
|
||||||
versionName "1.17.9 'Druk'"
|
versionName "1.17.12 'Druk'"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
@@ -59,7 +59,7 @@ import com.m2049r.xmrwallet.model.NetworkType;
|
|||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.model.WalletManager;
|
import com.m2049r.xmrwallet.model.WalletManager;
|
||||||
import com.m2049r.xmrwallet.service.WalletService;
|
import com.m2049r.xmrwallet.service.WalletService;
|
||||||
import com.m2049r.xmrwallet.util.ColorHelper;
|
import com.m2049r.xmrwallet.util.ThemeHelper;
|
||||||
import com.m2049r.xmrwallet.util.DayNightMode;
|
import com.m2049r.xmrwallet.util.DayNightMode;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.KeyStoreHelper;
|
import com.m2049r.xmrwallet.util.KeyStoreHelper;
|
||||||
@@ -78,7 +78,6 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -707,11 +706,11 @@ public class LoginActivity extends BaseActivity
|
|||||||
break;
|
break;
|
||||||
case NetworkType_Testnet:
|
case NetworkType_Testnet:
|
||||||
toolbar.setSubtitle(getString(R.string.connect_testnet));
|
toolbar.setSubtitle(getString(R.string.connect_testnet));
|
||||||
toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
toolbar.setBackgroundResource(ThemeHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||||
break;
|
break;
|
||||||
case NetworkType_Stagenet:
|
case NetworkType_Stagenet:
|
||||||
toolbar.setSubtitle(getString(R.string.connect_stagenet));
|
toolbar.setSubtitle(getString(R.string.connect_stagenet));
|
||||||
toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
toolbar.setBackgroundResource(ThemeHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("NetworkType unknown: " + net);
|
throw new IllegalStateException("NetworkType unknown: " + net);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -36,10 +36,12 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.android.material.transition.MaterialContainerTransform;
|
||||||
import com.m2049r.xmrwallet.data.UserNotes;
|
import com.m2049r.xmrwallet.data.UserNotes;
|
||||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||||
import com.m2049r.xmrwallet.model.Transfer;
|
import com.m2049r.xmrwallet.model.Transfer;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
|
import com.m2049r.xmrwallet.util.ThemeHelper;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
@@ -300,7 +302,7 @@ public class TxFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
tvTxXmrToKey.setText(key);
|
tvTxXmrToKey.setText(key);
|
||||||
tvDestinationBtc.setText(userNotes.xmrtoDestination);
|
tvDestinationBtc.setText(userNotes.xmrtoDestination);
|
||||||
tvTxAmountBtc.setText(userNotes.xmrtoAmount + " "+ userNotes.xmrtoCurrency);
|
tvTxAmountBtc.setText(userNotes.xmrtoAmount + " " + userNotes.xmrtoCurrency);
|
||||||
switch (userNotes.xmrtoTag) {
|
switch (userNotes.xmrtoTag) {
|
||||||
case "xmrto":
|
case "xmrto":
|
||||||
tvXmrToSupport.setVisibility(View.GONE);
|
tvXmrToSupport.setVisibility(View.GONE);
|
||||||
@@ -329,6 +331,11 @@ public class TxFragment extends Fragment {
|
|||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
final MaterialContainerTransform transform = new MaterialContainerTransform();
|
||||||
|
transform.setDrawingViewId(R.id.fragment_container);
|
||||||
|
transform.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration));
|
||||||
|
transform.setAllContainerColors(ThemeHelper.getThemedColor(getContext(), R.attr.colorSurface));
|
||||||
|
setSharedElementEnterTransition(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -36,12 +36,14 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.github.brnunes.swipeablerecyclerview.SwipeableRecyclerViewTouchListener;
|
import com.github.brnunes.swipeablerecyclerview.SwipeableRecyclerViewTouchListener;
|
||||||
|
import com.google.android.material.transition.MaterialElevationScale;
|
||||||
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
||||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
@@ -56,13 +58,14 @@ import java.text.NumberFormat;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class WalletFragment extends Fragment
|
public class WalletFragment extends Fragment
|
||||||
implements TransactionInfoAdapter.OnInteractionListener {
|
implements TransactionInfoAdapter.OnInteractionListener {
|
||||||
private TransactionInfoAdapter adapter;
|
private TransactionInfoAdapter adapter;
|
||||||
private NumberFormat formatter = NumberFormat.getInstance();
|
private final NumberFormat formatter = NumberFormat.getInstance();
|
||||||
|
|
||||||
private TextView tvStreetView;
|
private TextView tvStreetView;
|
||||||
private LinearLayout llBalance;
|
private LinearLayout llBalance;
|
||||||
@@ -79,7 +82,7 @@ public class WalletFragment extends Fragment
|
|||||||
|
|
||||||
private Spinner sCurrency;
|
private Spinner sCurrency;
|
||||||
|
|
||||||
private List<String> dismissedTransactions = new ArrayList<>();
|
private final List<String> dismissedTransactions = new ArrayList<>();
|
||||||
|
|
||||||
public void resetDismissedTransactions() {
|
public void resetDismissedTransactions() {
|
||||||
dismissedTransactions.clear();
|
dismissedTransactions.clear();
|
||||||
@@ -92,7 +95,7 @@ public class WalletFragment extends Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||||
if (activityCallback.hasWallet())
|
if (activityCallback.hasWallet())
|
||||||
inflater.inflate(R.menu.wallet_menu, menu);
|
inflater.inflate(R.menu.wallet_menu, menu);
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
@@ -103,6 +106,13 @@ public class WalletFragment extends Fragment
|
|||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.fragment_wallet, container, false);
|
View view = inflater.inflate(R.layout.fragment_wallet, container, false);
|
||||||
|
|
||||||
|
final MaterialElevationScale exitTransition = new MaterialElevationScale(false);
|
||||||
|
exitTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration));
|
||||||
|
setExitTransition(exitTransition);
|
||||||
|
final MaterialElevationScale reenterTransition = new MaterialElevationScale(true);
|
||||||
|
reenterTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration));
|
||||||
|
setReenterTransition(reenterTransition);
|
||||||
|
|
||||||
ivStreetGunther = view.findViewById(R.id.ivStreetGunther);
|
ivStreetGunther = view.findViewById(R.id.ivStreetGunther);
|
||||||
tvStreetView = view.findViewById(R.id.tvStreetView);
|
tvStreetView = view.findViewById(R.id.tvStreetView);
|
||||||
llBalance = view.findViewById(R.id.llBalance);
|
llBalance = view.findViewById(R.id.llBalance);
|
||||||
@@ -123,7 +133,7 @@ public class WalletFragment extends Fragment
|
|||||||
List<String> currencies = new ArrayList<>();
|
List<String> currencies = new ArrayList<>();
|
||||||
currencies.add(Helper.BASE_CRYPTO);
|
currencies.add(Helper.BASE_CRYPTO);
|
||||||
currencies.addAll(Arrays.asList(getResources().getStringArray(R.array.currency)));
|
currencies.addAll(Arrays.asList(getResources().getStringArray(R.array.currency)));
|
||||||
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_balance, currencies);
|
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(Objects.requireNonNull(getContext()), R.layout.item_spinner_balance, currencies);
|
||||||
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
sCurrency.setAdapter(spinnerAdapter);
|
sCurrency.setAdapter(spinnerAdapter);
|
||||||
|
|
||||||
@@ -168,18 +178,8 @@ public class WalletFragment extends Fragment
|
|||||||
recyclerView.addOnItemTouchListener(swipeTouchListener);
|
recyclerView.addOnItemTouchListener(swipeTouchListener);
|
||||||
|
|
||||||
|
|
||||||
bSend.setOnClickListener(new View.OnClickListener() {
|
bSend.setOnClickListener(v -> activityCallback.onSendRequest(v));
|
||||||
@Override
|
bReceive.setOnClickListener(v -> activityCallback.onWalletReceive(v));
|
||||||
public void onClick(View v) {
|
|
||||||
activityCallback.onSendRequest();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bReceive.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
activityCallback.onWalletReceive();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
sCurrency.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
sCurrency.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -202,6 +202,16 @@ public class WalletFragment extends Fragment
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
postponeEnterTransition();
|
||||||
|
view.getViewTreeObserver().addOnPreDrawListener(() -> {
|
||||||
|
startPostponedEnterTransition();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void showBalance(String balance) {
|
void showBalance(String balance) {
|
||||||
tvBalance.setText(balance);
|
tvBalance.setText(balance);
|
||||||
final boolean streetMode = activityCallback.isStreetMode();
|
final boolean streetMode = activityCallback.isStreetMode();
|
||||||
@@ -259,24 +269,14 @@ public class WalletFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(final ExchangeRate exchangeRate) {
|
public void onSuccess(final ExchangeRate exchangeRate) {
|
||||||
if (isAdded())
|
if (isAdded())
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
new Handler(Looper.getMainLooper()).post(() -> exchange(exchangeRate));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
exchange(exchangeRate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(final Exception e) {
|
public void onError(final Exception e) {
|
||||||
Timber.e(e.getLocalizedMessage());
|
Timber.e(e.getLocalizedMessage());
|
||||||
if (isAdded())
|
if (isAdded())
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
new Handler(Looper.getMainLooper()).post(() -> exchangeFailed());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
exchangeFailed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -332,7 +332,13 @@ public class WalletFragment extends Fragment
|
|||||||
// Callbacks from TransactionInfoAdapter
|
// Callbacks from TransactionInfoAdapter
|
||||||
@Override
|
@Override
|
||||||
public void onInteraction(final View view, final TransactionInfo infoItem) {
|
public void onInteraction(final View view, final TransactionInfo infoItem) {
|
||||||
activityCallback.onTxDetailsRequest(infoItem);
|
final MaterialElevationScale exitTransition = new MaterialElevationScale(false);
|
||||||
|
exitTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration));
|
||||||
|
setExitTransition(exitTransition);
|
||||||
|
final MaterialElevationScale reenterTransition = new MaterialElevationScale(true);
|
||||||
|
reenterTransition.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration));
|
||||||
|
setReenterTransition(reenterTransition);
|
||||||
|
activityCallback.onTxDetailsRequest(view, infoItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from activity
|
// called from activity
|
||||||
@@ -411,7 +417,6 @@ public class WalletFragment extends Fragment
|
|||||||
void setActivityTitle(Wallet wallet) {
|
void setActivityTitle(Wallet wallet) {
|
||||||
if (wallet == null) return;
|
if (wallet == null) return;
|
||||||
walletTitle = wallet.getName();
|
walletTitle = wallet.getName();
|
||||||
String watchOnly = (wallet.isWatchOnly() ? getString(R.string.label_watchonly) : "");
|
|
||||||
walletSubtitle = wallet.getAccountLabel();
|
walletSubtitle = wallet.getAccountLabel();
|
||||||
activityCallback.setTitle(walletTitle, walletSubtitle);
|
activityCallback.setTitle(walletTitle, walletSubtitle);
|
||||||
Timber.d("wallet title is %s", walletTitle);
|
Timber.d("wallet title is %s", walletTitle);
|
||||||
@@ -435,7 +440,7 @@ public class WalletFragment extends Fragment
|
|||||||
balance = wallet.getBalance();
|
balance = wallet.getBalance();
|
||||||
unlockedBalance = wallet.getUnlockedBalance();
|
unlockedBalance = wallet.getUnlockedBalance();
|
||||||
refreshBalance();
|
refreshBalance();
|
||||||
String sync = "";
|
String sync;
|
||||||
if (!activityCallback.hasBoundService())
|
if (!activityCallback.hasBoundService())
|
||||||
throw new IllegalStateException("WalletService not bound.");
|
throw new IllegalStateException("WalletService not bound.");
|
||||||
Wallet.ConnectionStatus daemonConnected = activityCallback.getConnectionStatus();
|
Wallet.ConnectionStatus daemonConnected = activityCallback.getConnectionStatus();
|
||||||
@@ -476,9 +481,9 @@ public class WalletFragment extends Fragment
|
|||||||
|
|
||||||
long getDaemonHeight(); //mBoundService.getDaemonHeight();
|
long getDaemonHeight(); //mBoundService.getDaemonHeight();
|
||||||
|
|
||||||
void onSendRequest();
|
void onSendRequest(View view);
|
||||||
|
|
||||||
void onTxDetailsRequest(TransactionInfo info);
|
void onTxDetailsRequest(View view, TransactionInfo info);
|
||||||
|
|
||||||
boolean isSynced();
|
boolean isSynced();
|
||||||
|
|
||||||
@@ -490,7 +495,7 @@ public class WalletFragment extends Fragment
|
|||||||
|
|
||||||
String getTxKey(String txId);
|
String getTxKey(String txId);
|
||||||
|
|
||||||
void onWalletReceive();
|
void onWalletReceive(View view);
|
||||||
|
|
||||||
boolean hasWallet();
|
boolean hasWallet();
|
||||||
|
|
||||||
@@ -504,7 +509,7 @@ public class WalletFragment extends Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
if (context instanceof Listener) {
|
if (context instanceof Listener) {
|
||||||
this.activityCallback = (Listener) context;
|
this.activityCallback = (Listener) context;
|
||||||
@@ -547,7 +552,7 @@ public class WalletFragment extends Fragment
|
|||||||
//TODO figure out why gunther disappears on return from send although he is still set
|
//TODO figure out why gunther disappears on return from send although he is still set
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (streetGunther == null)
|
if (streetGunther == null)
|
||||||
streetGunther = ContextCompat.getDrawable(getContext(), R.drawable.ic_gunther_streetmode);
|
streetGunther = ContextCompat.getDrawable(Objects.requireNonNull(getContext()), R.drawable.ic_gunther_streetmode);
|
||||||
ivStreetGunther.setImageDrawable(streetGunther);
|
ivStreetGunther.setImageDrawable(streetGunther);
|
||||||
} else
|
} else
|
||||||
ivStreetGunther.setImageDrawable(null);
|
ivStreetGunther.setImageDrawable(null);
|
||||||
|
@@ -36,6 +36,7 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.google.android.material.transition.MaterialContainerTransform;
|
||||||
import com.m2049r.xmrwallet.OnBackPressedListener;
|
import com.m2049r.xmrwallet.OnBackPressedListener;
|
||||||
import com.m2049r.xmrwallet.OnUriScannedListener;
|
import com.m2049r.xmrwallet.OnUriScannedListener;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
@@ -49,10 +50,12 @@ import com.m2049r.xmrwallet.layout.SpendViewPager;
|
|||||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.Notice;
|
import com.m2049r.xmrwallet.util.Notice;
|
||||||
|
import com.m2049r.xmrwallet.util.ThemeHelper;
|
||||||
import com.m2049r.xmrwallet.widget.DotBar;
|
import com.m2049r.xmrwallet.widget.DotBar;
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
@@ -309,7 +312,7 @@ public class SendFragment extends Fragment
|
|||||||
SparseArray<WeakReference<SendWizardFragment>> myFragments = new SparseArray<>();
|
SparseArray<WeakReference<SendWizardFragment>> myFragments = new SparseArray<>();
|
||||||
|
|
||||||
public SpendPagerAdapter(FragmentManager fm) {
|
public SpendPagerAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSuccess() {
|
public void addSuccess() {
|
||||||
@@ -538,14 +541,18 @@ public class SendFragment extends Fragment
|
|||||||
enableNavigation();
|
enableNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
final MaterialContainerTransform transform = new MaterialContainerTransform();
|
||||||
|
transform.setDrawingViewId(R.id.fragment_container);
|
||||||
|
transform.setDuration(getResources().getInteger(R.integer.tx_item_transition_duration));
|
||||||
|
transform.setAllContainerColors(ThemeHelper.getThemedColor(Objects.requireNonNull(getContext()), R.attr.colorSurface));
|
||||||
|
setSharedElementEnterTransition(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.send_menu, menu);
|
inflater.inflate(R.menu.send_menu, menu);
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
import com.m2049r.xmrwallet.data.NodeInfo;
|
import com.m2049r.xmrwallet.data.NodeInfo;
|
||||||
import com.m2049r.xmrwallet.util.ColorHelper;
|
import com.m2049r.xmrwallet.util.ThemeHelper;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
@@ -182,7 +182,7 @@ public class NodeInfoAdapter extends RecyclerView.Adapter<NodeInfoAdapter.ViewHo
|
|||||||
Helper.showTimeDifference(tvIp, nodeItem.getTimestamp());
|
Helper.showTimeDifference(tvIp, nodeItem.getTimestamp());
|
||||||
} else {
|
} else {
|
||||||
tvIp.setText(getResponseErrorText(context, nodeItem.getResponseCode()));
|
tvIp.setText(getResponseErrorText(context, nodeItem.getResponseCode()));
|
||||||
tvIp.setTextColor(ColorHelper.getThemedColor(tvIp.getContext(), R.attr.colorError));
|
tvIp.setTextColor(ThemeHelper.getThemedColor(context, R.attr.colorError));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tvIp.setText(context.getResources().getString(R.string.node_testing, nodeItem.getHostAddress()));
|
tvIp.setText(context.getResources().getString(R.string.node_testing, nodeItem.getHostAddress()));
|
||||||
|
@@ -40,6 +40,7 @@ import java.util.Calendar;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
@@ -92,7 +93,8 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
|
|||||||
final TransactionInfo newItem = mNewList.get(newItemPosition);
|
final TransactionInfo newItem = mNewList.get(newItemPosition);
|
||||||
return (oldItem.direction == newItem.direction)
|
return (oldItem.direction == newItem.direction)
|
||||||
&& (oldItem.isPending == newItem.isPending)
|
&& (oldItem.isPending == newItem.isPending)
|
||||||
&& (oldItem.isFailed == newItem.isFailed);
|
&& (oldItem.isFailed == newItem.isFailed)
|
||||||
|
&& (Objects.equals(oldItem.notes, newItem.notes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +167,8 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bind(int position) {
|
void bind(int position) {
|
||||||
this.infoItem = infoItems.get(position);
|
infoItem = infoItems.get(position);
|
||||||
|
itemView.setTransitionName(context.getString(R.string.tx_item_transition_name, infoItem.hash));
|
||||||
|
|
||||||
UserNotes userNotes = new UserNotes(infoItem.notes);
|
UserNotes userNotes = new UserNotes(infoItem.notes);
|
||||||
if (userNotes.xmrtoKey != null) {
|
if (userNotes.xmrtoKey != null) {
|
||||||
|
@@ -656,8 +656,8 @@ public class Helper {
|
|||||||
}
|
}
|
||||||
view.setText(msg);
|
view.setText(msg);
|
||||||
if (hours >= STALE_NODE_HOURS)
|
if (hours >= STALE_NODE_HOURS)
|
||||||
view.setTextColor(ColorHelper.getThemedColor(view.getContext(), R.attr.colorError));
|
view.setTextColor(ThemeHelper.getThemedColor(view.getContext(), R.attr.colorError));
|
||||||
else
|
else
|
||||||
view.setTextColor(ColorHelper.getThemedColor(view.getContext(), android.R.attr.textColorPrimary));
|
view.setTextColor(ThemeHelper.getThemedColor(view.getContext(), android.R.attr.textColorPrimary));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,19 +17,26 @@
|
|||||||
package com.m2049r.xmrwallet.util;
|
package com.m2049r.xmrwallet.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.R;
|
import androidx.annotation.ColorInt;
|
||||||
|
|
||||||
public class ColorHelper {
|
public class ThemeHelper {
|
||||||
static public int getThemedResourceId(Context ctx, int attrId) {
|
static public int getThemedResourceId(Context ctx, int attrId) {
|
||||||
TypedArray styledAttributes = ctx.getTheme().obtainStyledAttributes(R.style.MyMaterialTheme, new int[]{attrId});
|
final TypedValue typedValue = new TypedValue();
|
||||||
return styledAttributes.getResourceId(0, 0);
|
if (ctx.getTheme().resolveAttribute(attrId, typedValue, true))
|
||||||
|
return typedValue.resourceId;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
static public int getThemedColor(Context ctx, int attrId) {
|
static public int getThemedColor(Context ctx, int attrId) {
|
||||||
TypedArray styledAttributes = ctx.getTheme().obtainStyledAttributes(R.style.MyMaterialTheme, new int[]{attrId});
|
final TypedValue typedValue = new TypedValue();
|
||||||
return styledAttributes.getColor(0, Color.BLACK);
|
if (ctx.getTheme().resolveAttribute(attrId, typedValue, true))
|
||||||
|
return typedValue.data;
|
||||||
|
else
|
||||||
|
return Color.BLACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -42,7 +42,7 @@ import com.m2049r.xmrwallet.model.Wallet;
|
|||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
||||||
import com.m2049r.xmrwallet.util.ColorHelper;
|
import com.m2049r.xmrwallet.util.ThemeHelper;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.ServiceHelper;
|
import com.m2049r.xmrwallet.util.ServiceHelper;
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ public class ExchangeView extends LinearLayout {
|
|||||||
|
|
||||||
// make progress circle gray
|
// make progress circle gray
|
||||||
pbExchange.getIndeterminateDrawable().
|
pbExchange.getIndeterminateDrawable().
|
||||||
setColorFilter(ColorHelper.getThemedColor(getContext(), R.attr.colorPrimaryVariant),
|
setColorFilter(ThemeHelper.getThemedColor(getContext(), R.attr.colorPrimaryVariant),
|
||||||
android.graphics.PorterDuff.Mode.MULTIPLY);
|
android.graphics.PorterDuff.Mode.MULTIPLY);
|
||||||
|
|
||||||
sCurrencyA.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
sCurrencyA.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@@ -3,7 +3,8 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:transitionName="@string/receive_transition_name">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etDummy"
|
android:id="@+id/etDummy"
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:transitionName="@string/send_transition_name">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/llNotice"
|
android:id="@+id/llNotice"
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
android:fillViewport="true">
|
android:fillViewport="true"
|
||||||
|
android:transitionName="@string/tx_details_transition_name">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@@ -141,6 +141,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingBottom="80dp"
|
android:paddingBottom="80dp"
|
||||||
|
android:transitionGroup="true"
|
||||||
app:layoutManager="LinearLayoutManager"
|
app:layoutManager="LinearLayoutManager"
|
||||||
tools:listitem="@layout/item_transaction" />
|
tools:listitem="@layout/item_transaction" />
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:text="@string/label_wallet_receive"
|
android:text="@string/label_wallet_receive"
|
||||||
|
android:transitionName="@string/receive_btn_transition_name"
|
||||||
app:icon="@drawable/ic_hand" />
|
app:icon="@drawable/ic_hand" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -175,6 +177,7 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:text="@string/label_wallet_send"
|
android:text="@string/label_wallet_send"
|
||||||
|
android:transitionName="@string/send_btn_transition_name"
|
||||||
app:icon="@drawable/ic_send" />
|
app:icon="@drawable/ic_send" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources></resources>
|
<resources>
|
||||||
|
<integer name="tx_item_transition_duration">300</integer>
|
||||||
|
</resources>
|
||||||
|
@@ -471,4 +471,12 @@
|
|||||||
<item>Ethereum</item>
|
<item>Ethereum</item>
|
||||||
<item>Litecoin</item>
|
<item>Litecoin</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string name="tx_item_transition_name" translatable="false">tx_transition_%1$s</string>
|
||||||
|
<string name="tx_details_transition_name" translatable="false">tx_transition</string>
|
||||||
|
<string name="receive_transition_name" translatable="false">receive_transition</string>
|
||||||
|
<string name="receive_btn_transition_name" translatable="false">receive_btn_transition</string>
|
||||||
|
<string name="send_transition_name" translatable="false">send_transition</string>
|
||||||
|
<string name="send_btn_transition_name" translatable="false">send_btn_transition</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppCard" parent="Widget.MaterialComponents.CardView">
|
<style name="AppCard" parent="Widget.MaterialComponents.CardView">
|
||||||
<item name="cardElevation">8dp</item>
|
<item name="cardElevation">4dp</item>
|
||||||
<item name="cardCornerRadius">1dp</item>
|
<item name="cardCornerRadius">1dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user