Merge branch 'dev' into send-screen-redesign

This commit is contained in:
pokkst 2023-01-30 23:57:10 -06:00
commit 24446d3567
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
15 changed files with 70 additions and 74 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name" translatable="false">MyNero Beta</string> <string name="app_name" translatable="false">Mysu [beta]</string>
</resources> </resources>

View File

@ -84,7 +84,6 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
RecyclerView txHistoryRecyclerView = view.findViewById(R.id.transaction_history_recyclerview); RecyclerView txHistoryRecyclerView = view.findViewById(R.id.transaction_history_recyclerview);
TextView unlockedBalanceTextView = view.findViewById(R.id.balance_unlocked_textview); TextView unlockedBalanceTextView = view.findViewById(R.id.balance_unlocked_textview);
TextView lockedBalanceTextView = view.findViewById(R.id.balance_locked_textview); TextView lockedBalanceTextView = view.findViewById(R.id.balance_locked_textview);
ConstraintLayout noHistoryLayout = view.findViewById(R.id.no_history_layout);
BalanceService balanceService = BalanceService.getInstance(); BalanceService balanceService = BalanceService.getInstance();
HistoryService historyService = HistoryService.getInstance(); HistoryService historyService = HistoryService.getInstance();
@ -132,10 +131,21 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
if (historyService != null) { if (historyService != null) {
historyService.history.observe(getViewLifecycleOwner(), history -> { historyService.history.observe(getViewLifecycleOwner(), history -> {
if (history.isEmpty()) { if (history.isEmpty()) {
txHistoryRecyclerView.setVisibility(View.GONE); // DISPLAYING EMPTY WALLET HISTORY
noHistoryLayout.setVisibility(View.VISIBLE); Wallet wallet = WalletManager.getInstance().getWallet();
displayEmptyHistory(view); int textResId, botImgResId = 0;
if(wallet != null && wallet.isSynchronized()) {
textResId = R.string.no_history_nget_some_monero_in_here;
botImgResId = R.drawable.xmrchan_empty; // img for synchronized
} else { } else {
textResId = R.string.no_history_loading;
botImgResId = R.drawable.xmrchan_loading; // img for loading
}
txHistoryRecyclerView.setVisibility(View.GONE);
displayEmptyHistory(true, view, textResId, botImgResId);
} else {
// POPULATED WALLET HISTORY
Collections.sort(history); Collections.sort(history);
if (history.size() > 100) { if (history.size() > 100) {
adapter.submitList(history.subList(0, 99)); adapter.submitList(history.subList(0, 99));
@ -143,7 +153,7 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
adapter.submitList(history); adapter.submitList(history);
} }
txHistoryRecyclerView.setVisibility(View.VISIBLE); txHistoryRecyclerView.setVisibility(View.VISIBLE);
noHistoryLayout.setVisibility(View.GONE); displayEmptyHistory(false, view, R.string.no_history_nget_some_monero_in_here, R.drawable.xmrchan_loading);
} }
}); });
} }
@ -167,16 +177,24 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
} }
} }
private void displayEmptyHistory(View view) { private void displayEmptyHistory(boolean display, View view, int textResId, int botImgResId) {
TextView mnrjTextView = view.findViewById(R.id.monerochan_empty_tx_textview);
TextView textView = view.findViewById(R.id.empty_tx_textview);
ImageView botImageView = view.findViewById(R.id.monerochan_imageview);
view.findViewById(R.id.no_history_layout).setVisibility(display ? View.VISIBLE : View.GONE);
boolean displayMonerochan = PrefService.getInstance().getBoolean(Constants.PREF_MONEROCHAN, true); boolean displayMonerochan = PrefService.getInstance().getBoolean(Constants.PREF_MONEROCHAN, true);
if(displayMonerochan) { if(displayMonerochan) {
view.findViewById(R.id.monerochan_imageview).setVisibility(View.VISIBLE); botImageView.setVisibility(View.VISIBLE);
view.findViewById(R.id.monerochan_empty_tx_textview).setVisibility(View.VISIBLE); mnrjTextView.setVisibility(View.VISIBLE);
view.findViewById(R.id.empty_tx_textview).setVisibility(View.GONE); textView.setVisibility(View.GONE);
} else { } else {
view.findViewById(R.id.monerochan_imageview).setVisibility(View.GONE); botImageView.setVisibility(View.GONE);
view.findViewById(R.id.monerochan_empty_tx_textview).setVisibility(View.GONE); mnrjTextView.setVisibility(View.GONE);
view.findViewById(R.id.empty_tx_textview).setVisibility(View.VISIBLE); textView.setVisibility(View.VISIBLE);
} }
botImageView.setImageResource(botImgResId);
mnrjTextView.setText(textResId);
textView.setText(textResId);
} }
} }

View File

@ -14,11 +14,13 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.SwitchCompat;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import net.mynero.wallet.MainActivity; import net.mynero.wallet.MainActivity;
@ -131,12 +133,19 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS
} }
private void bindListeners() { private void bindListeners() {
// Disable onBack click
OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) { @Override public void handleOnBackPressed() { } };
FragmentActivity activity = getActivity();
if(activity != null)
activity.getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), onBackPressedCallback);
moreOptionsDropdownTextView.setOnClickListener(view12 -> mViewModel.onMoreOptionsClicked()); moreOptionsDropdownTextView.setOnClickListener(view12 -> mViewModel.onMoreOptionsClicked());
moreOptionsChevronImageView.setOnClickListener(view12 -> mViewModel.onMoreOptionsClicked()); moreOptionsChevronImageView.setOnClickListener(view12 -> mViewModel.onMoreOptionsClicked());
seedOffsetCheckbox.setOnCheckedChangeListener((compoundButton, b) -> useOffset = b); seedOffsetCheckbox.setOnCheckedChangeListener((compoundButton, b) -> useOffset = b);
createWalletButton.setOnClickListener(view1 -> { createWalletButton.setOnClickListener(view1 -> {
prepareDefaultNode(); prepareDefaultNode();
onBackPressedCallback.setEnabled(false);
((MoneroApplication)getActivity().getApplication()).getExecutor().execute(() -> { ((MoneroApplication)getActivity().getApplication()).getExecutor().execute(() -> {
createOrImportWallet( createOrImportWallet(
walletPasswordEditText.getText().toString(), walletPasswordEditText.getText().toString(),

View File

@ -98,9 +98,8 @@ public class ReceiveFragment extends Fragment {
int[] pixels = new int[width * height]; int[] pixels = new int[width * height];
for (int i = 0; i < height; i++) { for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) { for (int j = 0; j < width; j++) {
boolean night = NightmodeHelper.getPreferredNightmode() == DayNightMode.NIGHT;
if (bitMatrix.get(j, i)) { if (bitMatrix.get(j, i)) {
pixels[i * width + j] = night ? 0xffffffff : 0x00000000; pixels[i * width + j] = 0xffffffff;
} else { } else {
pixels[i * height + j] = getResources().getColor(R.color.oled_colorBackground); pixels[i * height + j] = getResources().getColor(R.color.oled_colorBackground);
} }

View File

@ -98,7 +98,6 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
Button displayUtxosButton = view.findViewById(R.id.display_utxos_button); Button displayUtxosButton = view.findViewById(R.id.display_utxos_button);
selectNodeButton = view.findViewById(R.id.select_node_button); selectNodeButton = view.findViewById(R.id.select_node_button);
SwitchCompat nightModeSwitch = view.findViewById(R.id.day_night_switch);
SwitchCompat streetModeSwitch = view.findViewById(R.id.street_mode_switch); SwitchCompat streetModeSwitch = view.findViewById(R.id.street_mode_switch);
SwitchCompat monerochanSwitch = view.findViewById(R.id.monerochan_switch); SwitchCompat monerochanSwitch = view.findViewById(R.id.monerochan_switch);
SwitchCompat donationSwitch = view.findViewById(R.id.donate_per_tx_switch); SwitchCompat donationSwitch = view.findViewById(R.id.donate_per_tx_switch);
@ -107,15 +106,6 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
walletProxyAddressEditText = view.findViewById(R.id.wallet_proxy_address_edittext); walletProxyAddressEditText = view.findViewById(R.id.wallet_proxy_address_edittext);
walletProxyPortEditText = view.findViewById(R.id.wallet_proxy_port_edittext); walletProxyPortEditText = view.findViewById(R.id.wallet_proxy_port_edittext);
nightModeSwitch.setChecked(NightmodeHelper.getPreferredNightmode() == DayNightMode.NIGHT);
nightModeSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
if (b) {
NightmodeHelper.setAndSavePreferredNightmode(DayNightMode.NIGHT);
} else {
NightmodeHelper.setAndSavePreferredNightmode(DayNightMode.DAY);
}
});
streetModeSwitch.setChecked(PrefService.getInstance().getBoolean(Constants.PREF_STREET_MODE, false)); streetModeSwitch.setChecked(PrefService.getInstance().getBoolean(Constants.PREF_STREET_MODE, false));
streetModeSwitch.setOnCheckedChangeListener((compoundButton, b) -> { streetModeSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
PrefService.getInstance().edit().putBoolean(Constants.PREF_STREET_MODE, b).apply(); PrefService.getInstance().edit().putBoolean(Constants.PREF_STREET_MODE, b).apply();

View File

@ -23,17 +23,8 @@ import androidx.appcompat.app.AppCompatDelegate;
import net.mynero.wallet.service.PrefService; import net.mynero.wallet.service.PrefService;
public class NightmodeHelper { public class NightmodeHelper {
public static DayNightMode getPreferredNightmode() {
return DayNightMode.valueOf(PrefService.getInstance().getString(Constants.PREF_NIGHT_MODE, DayNightMode.NIGHT.name()));
}
public static void getAndSetPreferredNightmode() { public static void getAndSetPreferredNightmode() {
setNightMode(getPreferredNightmode()); setNightMode(DayNightMode.NIGHT);
}
public static void setAndSavePreferredNightmode(DayNightMode mode) {
PrefService.getInstance().edit().putString(Constants.PREF_NIGHT_MODE, mode.name()).apply();
setNightMode(mode);
} }
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -64,12 +64,13 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/balance_locked_textview" app:layout_constraintTop_toBottomOf="@id/balance_locked_textview"
android:visibility="gone"> android:visibility="gone"
tools:visibility="visible">
<ImageView <ImageView
android:id="@+id/monerochan_imageview" android:id="@+id/monerochan_imageview"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="400dp" android:layout_height="400dp"
android:src="@drawable/xmrchan_png" android:src="@drawable/xmrchan_empty"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/monerochan_empty_tx_textview"/> app:layout_constraintEnd_toStartOf="@id/monerochan_empty_tx_textview"/>
@ -77,16 +78,18 @@
android:id="@+id/monerochan_empty_tx_textview" android:id="@+id/monerochan_empty_tx_textview"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/no_history_nget_some_monero_in_here" android:text="@string/no_history_nget_some_monero_in_here"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/monerochan_imageview" app:layout_constraintStart_toEndOf="@id/monerochan_imageview"
app:layout_constraintTop_toTopOf="@id/monerochan_imageview" app:layout_constraintTop_toTopOf="@id/monerochan_imageview"/>
app:layout_constraintBottom_toBottomOf="@id/monerochan_imageview"/>
<TextView <TextView
android:id="@+id/empty_tx_textview" android:id="@+id/empty_tx_textview"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center" android:textAlignment="center"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:text="@string/no_history_nget_some_monero_in_here" android:text="@string/no_history_nget_some_monero_in_here"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -4,9 +4,15 @@
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:padding="24dp" android:paddingEnd="24dp"
tools:context="net.mynero.wallet.fragment.settings.SettingsFragment"> android:paddingStart="24dp"
android:paddingTop="24dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:scaleType="fitEnd"
android:src="@drawable/xmrchan_half"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView <TextView
android:id="@+id/create_wallet_textview" android:id="@+id/create_wallet_textview"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -138,28 +138,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/donate_per_tx_desc_textview" /> app:layout_constraintTop_toBottomOf="@id/donate_per_tx_desc_textview" />
<TextView
android:id="@+id/day_night_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/night_mode"
android:textSize="16sp"
android:layout_marginStart="24dp"
app:layout_constraintBottom_toBottomOf="@id/day_night_switch"
app:layout_constraintEnd_toStartOf="@id/day_night_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/day_night_switch" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/day_night_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="24dp"
android:minHeight="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/appearance_settings_textview" />
<TextView <TextView
android:id="@+id/street_mode_label_textview" android:id="@+id/street_mode_label_textview"
android:layout_width="0dp" android:layout_width="0dp"
@ -178,8 +156,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:minHeight="48dp" android:minHeight="48dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/day_night_switch" /> app:layout_constraintTop_toBottomOf="@id/appearance_settings_textview" />
<TextView <TextView
android:id="@+id/monerochan_label_textview" android:id="@+id/monerochan_label_textview"

View File

@ -65,7 +65,12 @@
android:id="@+id/onboarding_fragment" android:id="@+id/onboarding_fragment"
android:name="net.mynero.wallet.fragment.onboarding.OnboardingFragment" android:name="net.mynero.wallet.fragment.onboarding.OnboardingFragment"
android:label="fragment_onboarding" android:label="fragment_onboarding"
tools:layout="@layout/fragment_onboarding" /> tools:layout="@layout/fragment_onboarding">
<action
android:id="@+id/nav_to_home"
app:destination="@id/main_fragment">
</action>
</fragment>
<fragment <fragment
android:id="@+id/transaction_fragment" android:id="@+id/transaction_fragment"
android:name="net.mynero.wallet.fragment.transaction.TransactionFragment" android:name="net.mynero.wallet.fragment.transaction.TransactionFragment"

View File

@ -1,13 +1,8 @@
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE resources [<!ENTITY nbsp "&#160;">]> <?xml version="1.0" encoding="utf-8"?><!DOCTYPE resources [<!ENTITY nbsp "&#160;">]>
<resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en"> <resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en">
<string name="app_name" translatable="false">MyNero</string> <string name="app_name" translatable="false">Mysu</string>
<!--TODO deleteme-->
<!--TODO deleteme-->
<!--TODO deleteme-->
<string name="bad_password">Incorrect password!</string> <string name="bad_password">Incorrect password!</string>
<!--TODO deleteme-->
<string name="send_address_invalid">Not a valid address</string> <string name="send_address_invalid">Not a valid address</string>
@ -43,7 +38,7 @@
<string name="street_mode">Street mode (hide balances)</string> <string name="street_mode">Street mode (hide balances)</string>
<string name="option_hide_xmrchan">Show Monerochan</string> <string name="option_hide_xmrchan">Show Monerochan</string>
<string name="option_donate_per_tx">Add occasional donation</string> <string name="option_donate_per_tx">Add occasional donation</string>
<string name="option_donate_per_tx_desc">Randomly adds a 0.5%-1.5% MyNero donation to Txns. It\'s random so Txns don\'t have a consistently uncommon fingerprint, and the % is random so MyNero doesn\'t know the exact Txn amount.</string> <string name="option_donate_per_tx_desc">Randomly adds a 0.5%-1.5% Mysu donation to Txns. It\'s random so Txns don\'t have a consistently uncommon fingerprint, and the % is random so Mysu doesn\'t know the exact Txn amount.</string>
<string name="display_recovery_phrase">Display wallet keys</string> <string name="display_recovery_phrase">Display wallet keys</string>
<string name="tor_switch_label">Connect to proxy</string> <string name="tor_switch_label">Connect to proxy</string>
<string name="connection_failed">Connection failed</string> <string name="connection_failed">Connection failed</string>
@ -86,7 +81,8 @@
<string name="wallet_proxy_address_hint">127.0.0.1</string> <string name="wallet_proxy_address_hint">127.0.0.1</string>
<string name="wallet_proxy_port_hint">9050</string> <string name="wallet_proxy_port_hint">9050</string>
<string name="no_history_nget_some_monero_in_here">No history!\nGet some Monero in here!</string> <string name="no_history_loading">Loading your wallet…</string>
<string name="no_history_nget_some_monero_in_here">No transactions to display.\nAcquire coins by doing jobs, selling products, mining it, or buying some peer-to-peer.</string>
<string name="node_button_text">Node: %1$s</string> <string name="node_button_text">Node: %1$s</string>
<string name="connected">Connected</string> <string name="connected">Connected</string>
<string name="disconnected">Disconnected</string> <string name="disconnected">Disconnected</string>
@ -124,7 +120,7 @@
<string name="use_password_as_seed_offset">Use password as seed offset</string> <string name="use_password_as_seed_offset">Use password as seed offset</string>
<string name="subbaddress_info_subtitle" translatable="false">#%1$d: %2$s</string> <string name="subbaddress_info_subtitle" translatable="false">#%1$d: %2$s</string>
<string name="previous_addresses">Previous addresses</string> <string name="previous_addresses">Previous addresses</string>
<string name="donate_label">Donate to MyNero</string> <string name="donate_label">Donate to Mysu</string>
<string name="transactions">Transactions</string> <string name="transactions">Transactions</string>
<string name="auth">[ auth ]</string> <string name="auth">[ auth ]</string>
<string name="to">To</string> <string name="to">To</string>