mirror of https://github.com/m2049r/xmrwallet.git
Tweaking UI & some bugfixing on the way (#729)
This commit is contained in:
parent
c5a035437b
commit
a7b178e024
|
@ -15,3 +15,4 @@
|
|||
/app/alphaStagenet
|
||||
/app/prodStagenet
|
||||
/app/.cxx
|
||||
/monerujo.id
|
||||
|
|
|
@ -59,7 +59,7 @@ import com.m2049r.xmrwallet.model.NetworkType;
|
|||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
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.Helper;
|
||||
import com.m2049r.xmrwallet.util.KeyStoreHelper;
|
||||
|
@ -78,7 +78,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -707,11 +706,11 @@ public class LoginActivity extends BaseActivity
|
|||
break;
|
||||
case NetworkType_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;
|
||||
case NetworkType_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;
|
||||
default:
|
||||
throw new IllegalStateException("NetworkType unknown: " + net);
|
||||
|
|
|
@ -36,10 +36,12 @@ import androidx.annotation.Nullable;
|
|||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.transition.MaterialContainerTransform;
|
||||
import com.m2049r.xmrwallet.data.UserNotes;
|
||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||
import com.m2049r.xmrwallet.model.Transfer;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.util.ThemeHelper;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
||||
|
@ -329,6 +331,11 @@ public class TxFragment extends Fragment {
|
|||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
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
|
||||
|
|
|
@ -60,7 +60,7 @@ import com.m2049r.xmrwallet.model.TransactionInfo;
|
|||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
import com.m2049r.xmrwallet.model.WalletManager;
|
||||
import com.m2049r.xmrwallet.service.WalletService;
|
||||
import com.m2049r.xmrwallet.util.ColorHelper;
|
||||
import com.m2049r.xmrwallet.util.ThemeHelper;
|
||||
import com.m2049r.xmrwallet.util.Helper;
|
||||
import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
|
||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||
|
@ -424,10 +424,10 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||
toolbar.setBackgroundResource(R.drawable.backgound_toolbar_mainnet);
|
||||
break;
|
||||
case NetworkType_Testnet:
|
||||
toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||
toolbar.setBackgroundResource(ThemeHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||
break;
|
||||
case NetworkType_Stagenet:
|
||||
toolbar.setBackgroundResource(ColorHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||
toolbar.setBackgroundResource(ThemeHelper.getThemedResourceId(this, R.attr.colorPrimaryDark));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unsupported Network: " + WalletManager.getInstance().getNetworkType());
|
||||
|
@ -548,10 +548,10 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onTxDetailsRequest(TransactionInfo info) {
|
||||
public void onTxDetailsRequest(View view, TransactionInfo info) {
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(TxFragment.ARG_INFO, info);
|
||||
replaceFragment(new TxFragment(), null, args);
|
||||
replaceFragmentWithTransition(view, new TxFragment(), null, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -828,6 +828,17 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||
}
|
||||
}
|
||||
|
||||
void replaceFragmentWithTransition(View view, Fragment newFragment, String stackName, Bundle extras) {
|
||||
if (extras != null) {
|
||||
newFragment.setArguments(extras);
|
||||
}
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.addSharedElement(view, getString(R.string.tx_details_transition_name))
|
||||
.replace(R.id.fragment_container, newFragment)
|
||||
.addToBackStack(stackName)
|
||||
.commit();
|
||||
}
|
||||
|
||||
void replaceFragment(Fragment newFragment, String stackName, Bundle extras) {
|
||||
if (extras != null) {
|
||||
newFragment.setArguments(extras);
|
||||
|
|
|
@ -42,6 +42,7 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.github.brnunes.swipeablerecyclerview.SwipeableRecyclerViewTouchListener;
|
||||
import com.google.android.material.transition.MaterialElevationScale;
|
||||
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||
import com.m2049r.xmrwallet.model.Wallet;
|
||||
|
@ -332,7 +333,13 @@ public class WalletFragment extends Fragment
|
|||
// Callbacks from TransactionInfoAdapter
|
||||
@Override
|
||||
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
|
||||
|
@ -478,7 +485,7 @@ public class WalletFragment extends Fragment
|
|||
|
||||
void onSendRequest();
|
||||
|
||||
void onTxDetailsRequest(TransactionInfo info);
|
||||
void onTxDetailsRequest(View view, TransactionInfo info);
|
||||
|
||||
boolean isSynced();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import com.m2049r.xmrwallet.R;
|
||||
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 java.net.HttpURLConnection;
|
||||
|
@ -182,7 +182,7 @@ public class NodeInfoAdapter extends RecyclerView.Adapter<NodeInfoAdapter.ViewHo
|
|||
Helper.showTimeDifference(tvIp, nodeItem.getTimestamp());
|
||||
} else {
|
||||
tvIp.setText(getResponseErrorText(context, nodeItem.getResponseCode()));
|
||||
tvIp.setTextColor(ColorHelper.getThemedColor(tvIp.getContext(), R.attr.colorError));
|
||||
tvIp.setTextColor(ThemeHelper.getThemedColor(context, R.attr.colorError));
|
||||
}
|
||||
} else {
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
@ -92,7 +93,8 @@ public class TransactionInfoAdapter extends RecyclerView.Adapter<TransactionInfo
|
|||
final TransactionInfo newItem = mNewList.get(newItemPosition);
|
||||
return (oldItem.direction == newItem.direction)
|
||||
&& (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) {
|
||||
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);
|
||||
if (userNotes.xmrtoKey != null) {
|
||||
|
|
|
@ -656,8 +656,8 @@ public class Helper {
|
|||
}
|
||||
view.setText(msg);
|
||||
if (hours >= STALE_NODE_HOURS)
|
||||
view.setTextColor(ColorHelper.getThemedColor(view.getContext(), R.attr.colorError));
|
||||
view.setTextColor(ThemeHelper.getThemedColor(view.getContext(), R.attr.colorError));
|
||||
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;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
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) {
|
||||
TypedArray styledAttributes = ctx.getTheme().obtainStyledAttributes(R.style.MyMaterialTheme, new int[]{attrId});
|
||||
return styledAttributes.getResourceId(0, 0);
|
||||
final TypedValue typedValue = new TypedValue();
|
||||
if (ctx.getTheme().resolveAttribute(attrId, typedValue, true))
|
||||
return typedValue.resourceId;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
static public int getThemedColor(Context ctx, int attrId) {
|
||||
TypedArray styledAttributes = ctx.getTheme().obtainStyledAttributes(R.style.MyMaterialTheme, new int[]{attrId});
|
||||
return styledAttributes.getColor(0, Color.BLACK);
|
||||
final TypedValue typedValue = new TypedValue();
|
||||
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.ExchangeCallback;
|
||||
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.ServiceHelper;
|
||||
|
||||
|
@ -180,7 +180,7 @@ public class ExchangeView extends LinearLayout {
|
|||
|
||||
// make progress circle gray
|
||||
pbExchange.getIndeterminateDrawable().
|
||||
setColorFilter(ColorHelper.getThemedColor(getContext(), R.attr.colorPrimaryVariant),
|
||||
setColorFilter(ThemeHelper.getThemedColor(getContext(), R.attr.colorPrimaryVariant),
|
||||
android.graphics.PorterDuff.Mode.MULTIPLY);
|
||||
|
||||
sCurrencyA.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:fillViewport="true">
|
||||
android:fillViewport="true"
|
||||
android:transitionName="@string/tx_details_transition_name">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -141,6 +141,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="80dp"
|
||||
android:transitionGroup="true"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
tools:listitem="@layout/item_transaction" />
|
||||
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
<integer name="tx_item_transition_duration">300</integer>
|
||||
</resources>
|
||||
|
|
|
@ -471,4 +471,8 @@
|
|||
<item>Ethereum</item>
|
||||
<item>Litecoin</item>
|
||||
</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>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</style>
|
||||
|
||||
<style name="AppCard" parent="Widget.MaterialComponents.CardView">
|
||||
<item name="cardElevation">8dp</item>
|
||||
<item name="cardElevation">4dp</item>
|
||||
<item name="cardCornerRadius">1dp</item>
|
||||
</style>
|
||||
|
||||
|
|
Loading…
Reference in New Issue