mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-30 01:23:16 +00:00
Add option to hide Monerochan
This commit is contained in:
parent
3f0c213b47
commit
4059e28d3f
7 changed files with 61 additions and 4 deletions
|
@ -31,6 +31,7 @@ import net.mynero.wallet.model.WalletManager;
|
||||||
import net.mynero.wallet.service.BalanceService;
|
import net.mynero.wallet.service.BalanceService;
|
||||||
import net.mynero.wallet.service.BlockchainService;
|
import net.mynero.wallet.service.BlockchainService;
|
||||||
import net.mynero.wallet.service.HistoryService;
|
import net.mynero.wallet.service.HistoryService;
|
||||||
|
import net.mynero.wallet.service.PrefService;
|
||||||
import net.mynero.wallet.util.Constants;
|
import net.mynero.wallet.util.Constants;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -133,6 +134,7 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
|
||||||
if (history.isEmpty()) {
|
if (history.isEmpty()) {
|
||||||
txHistoryRecyclerView.setVisibility(View.GONE);
|
txHistoryRecyclerView.setVisibility(View.GONE);
|
||||||
noHistoryLayout.setVisibility(View.VISIBLE);
|
noHistoryLayout.setVisibility(View.VISIBLE);
|
||||||
|
displayEmptyHistory(view);
|
||||||
} else {
|
} else {
|
||||||
Collections.sort(history);
|
Collections.sort(history);
|
||||||
if (history.size() > 100) {
|
if (history.size() > 100) {
|
||||||
|
@ -164,4 +166,17 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void displayEmptyHistory(View view) {
|
||||||
|
boolean displayMonerochan = PrefService.getInstance().getBoolean(Constants.PREF_MONEROCHAN, true);
|
||||||
|
if(displayMonerochan) {
|
||||||
|
view.findViewById(R.id.monerochan_imageview).setVisibility(View.VISIBLE);
|
||||||
|
view.findViewById(R.id.monerochan_empty_tx_textview).setVisibility(View.VISIBLE);
|
||||||
|
view.findViewById(R.id.empty_tx_textview).setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
view.findViewById(R.id.monerochan_imageview).setVisibility(View.GONE);
|
||||||
|
view.findViewById(R.id.monerochan_empty_tx_textview).setVisibility(View.GONE);
|
||||||
|
view.findViewById(R.id.empty_tx_textview).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -35,6 +35,7 @@ import net.mynero.wallet.model.Wallet;
|
||||||
import net.mynero.wallet.model.WalletManager;
|
import net.mynero.wallet.model.WalletManager;
|
||||||
import net.mynero.wallet.service.BalanceService;
|
import net.mynero.wallet.service.BalanceService;
|
||||||
import net.mynero.wallet.service.BlockchainService;
|
import net.mynero.wallet.service.BlockchainService;
|
||||||
|
import net.mynero.wallet.service.HistoryService;
|
||||||
import net.mynero.wallet.service.PrefService;
|
import net.mynero.wallet.service.PrefService;
|
||||||
import net.mynero.wallet.util.Constants;
|
import net.mynero.wallet.util.Constants;
|
||||||
import net.mynero.wallet.util.DayNightMode;
|
import net.mynero.wallet.util.DayNightMode;
|
||||||
|
@ -99,6 +100,7 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
|
||||||
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 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 torSwitch = view.findViewById(R.id.tor_switch);
|
SwitchCompat torSwitch = view.findViewById(R.id.tor_switch);
|
||||||
ConstraintLayout proxySettingsLayout = view.findViewById(R.id.wallet_proxy_settings_layout);
|
ConstraintLayout proxySettingsLayout = view.findViewById(R.id.wallet_proxy_settings_layout);
|
||||||
walletProxyAddressEditText = view.findViewById(R.id.wallet_proxy_address_edittext);
|
walletProxyAddressEditText = view.findViewById(R.id.wallet_proxy_address_edittext);
|
||||||
|
@ -119,6 +121,12 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
|
||||||
BalanceService.getInstance().refreshBalance();
|
BalanceService.getInstance().refreshBalance();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
monerochanSwitch.setChecked(PrefService.getInstance().getBoolean(Constants.PREF_MONEROCHAN, true));
|
||||||
|
monerochanSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
|
||||||
|
PrefService.getInstance().edit().putBoolean(Constants.PREF_MONEROCHAN, b).apply();
|
||||||
|
HistoryService.getInstance().refreshHistory();
|
||||||
|
});
|
||||||
|
|
||||||
boolean usesProxy = PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false);
|
boolean usesProxy = PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false);
|
||||||
String proxy = PrefService.getInstance().getString(Constants.PREF_PROXY, "");
|
String proxy = PrefService.getInstance().getString(Constants.PREF_PROXY, "");
|
||||||
if (proxy.contains(":")) {
|
if (proxy.contains(":")) {
|
||||||
|
|
|
@ -98,8 +98,9 @@ public class PrefService extends ServiceBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getBoolean(String key, boolean defaultValue) {
|
public boolean getBoolean(String key, boolean defaultValue) {
|
||||||
|
boolean containsKey = preferences.contains(key);
|
||||||
boolean value = preferences.getBoolean(key, false);
|
boolean value = preferences.getBoolean(key, false);
|
||||||
if(!value && defaultValue) {
|
if(!value && defaultValue && !containsKey) {
|
||||||
edit().putBoolean(key, true).apply();
|
edit().putBoolean(key, true).apply();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ public class Constants {
|
||||||
public static final String PREF_CUSTOM_NODES = "pref_custom_nodes";
|
public static final String PREF_CUSTOM_NODES = "pref_custom_nodes";
|
||||||
public static final String PREF_USES_OFFSET = "pref_uses_offset";
|
public static final String PREF_USES_OFFSET = "pref_uses_offset";
|
||||||
public static final String PREF_STREET_MODE = "pref_street_mode";
|
public static final String PREF_STREET_MODE = "pref_street_mode";
|
||||||
|
public static final String PREF_MONEROCHAN = "pref_monerochan";
|
||||||
|
|
||||||
public static final String URI_PREFIX = "monero:";
|
public static final String URI_PREFIX = "monero:";
|
||||||
public static final String URI_ARG_AMOUNT = "tx_amount";
|
public static final String URI_ARG_AMOUNT = "tx_amount";
|
||||||
|
|
|
@ -72,9 +72,9 @@
|
||||||
android:src="@drawable/xmrchan_png"
|
android:src="@drawable/xmrchan_png"
|
||||||
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/empty_tx_textview"/>
|
app:layout_constraintEnd_toStartOf="@id/monerochan_empty_tx_textview"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/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:text="@string/no_history_nget_some_monero_in_here"
|
android:text="@string/no_history_nget_some_monero_in_here"
|
||||||
|
@ -82,6 +82,16 @@
|
||||||
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"/>
|
app:layout_constraintBottom_toBottomOf="@id/monerochan_imageview"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/empty_tx_textview"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:text="@string/no_history_nget_some_monero_in_here"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
|
@ -133,6 +133,27 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/day_night_switch" />
|
app:layout_constraintTop_toBottomOf="@id/day_night_switch" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/monerochan_label_textview"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/option_hide_xmrchan"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/monerochan_switch"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/monerochan_switch"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/monerochan_switch" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/monerochan_switch"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:minHeight="48dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/street_mode_switch" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/network_settings_textview"
|
android:id="@+id/network_settings_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -145,7 +166,7 @@
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
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/street_mode_switch" />
|
app:layout_constraintTop_toBottomOf="@id/monerochan_switch" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/select_node_button"
|
android:id="@+id/select_node_button"
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||||
<string name="night_mode">Night mode</string>
|
<string name="night_mode">Night mode</string>
|
||||||
<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="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>
|
||||||
|
|
Loading…
Reference in a new issue