Merge branch 'feature/churning'

# Conflicts:
#	app/src/main/res/layout/fragment_home.xml
#	app/src/main/res/layout/fragment_utxos.xml
#	app/src/main/res/values/strings.xml
This commit is contained in:
pokkst 2022-10-07 23:46:27 -05:00
commit 9d8bc28fdc
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
4 changed files with 50 additions and 12 deletions

View file

@ -55,6 +55,7 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
});
public LiveData<PendingTransaction> pendingTransaction = _pendingTransaction;
public UriData uriData = null;
public boolean isChurning = false;
public PendingTransaction.Priority priority;
private EditText addressEditText;
private EditText amountEditText;
@ -118,7 +119,11 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
String valueString = Wallet.getDisplayAmount(selectedValue);
selectedUtxosValueTextView.setVisibility(View.VISIBLE);
if(isChurning) {
selectedUtxosValueTextView.setText(getResources().getString(R.string.selected_utxos_value_churning, valueString));
} else {
selectedUtxosValueTextView.setText(getResources().getString(R.string.selected_utxos_value, valueString));
}
} else {
selectedUtxosValueTextView.setVisibility(View.GONE);
}

View file

@ -17,7 +17,9 @@ import net.mynero.wallet.R;
import net.mynero.wallet.adapter.CoinsInfoAdapter;
import net.mynero.wallet.fragment.dialog.SendBottomSheetDialog;
import net.mynero.wallet.model.CoinsInfo;
import net.mynero.wallet.service.AddressService;
import net.mynero.wallet.service.UTXOService;
import net.mynero.wallet.util.UriData;
import java.util.ArrayList;
import java.util.Collections;
@ -28,6 +30,7 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
private final ArrayList<String> selectedUtxos = new ArrayList<>();
private final CoinsInfoAdapter adapter = new CoinsInfoAdapter(this);
private Button sendUtxosButton;
private Button churnUtxosButton;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@ -45,12 +48,21 @@ public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInf
private void bindListeners(View view) {
sendUtxosButton = view.findViewById(R.id.send_utxos_button);
churnUtxosButton = view.findViewById(R.id.churn_utxos_button);
sendUtxosButton.setVisibility(View.GONE);
churnUtxosButton.setVisibility(View.GONE);
sendUtxosButton.setOnClickListener(view1 -> {
SendBottomSheetDialog sendDialog = new SendBottomSheetDialog();
sendDialog.selectedUtxos = selectedUtxos;
sendDialog.show(getActivity().getSupportFragmentManager(), null);
});
churnUtxosButton.setOnClickListener(view1 -> {
SendBottomSheetDialog sendDialog = new SendBottomSheetDialog();
sendDialog.isChurning = true;
sendDialog.uriData = UriData.parse(AddressService.getInstance().getLatestSubaddress().getAddress());
sendDialog.selectedUtxos = selectedUtxos;
sendDialog.show(getActivity().getSupportFragmentManager(), null);
});
}
private void bindObservers(View view) {

View file

@ -25,26 +25,45 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:clipToPadding="false"
android:paddingBottom="128dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_utxos_textview"
app:layout_constraintVertical_bias="0.0" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/utxos_options_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="@+id/churn_utxos_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_bg_left"
android:text="@string/churn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/send_utxos_button"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/send_utxos_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/button_bg"
android:visibility="gone"
android:layout_marginBottom="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/button_bg_right"
android:text="@string/send"
tools:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/churn_utxos_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -94,9 +94,11 @@
<string name="high">High</string>
<string name="view_utxos">View UTXOs</string>
<string name="selected_utxos_value">Selected value: %1$s XMR</string>
<string name="selected_utxos_value_churning">Selected value: %1$s XMR\n\nThe anonymity benefits of churning are still being researched. Only proceed if you know what you are doing.</string>
<string name="global_index_text">Global Idx: %1$d</string>
<string name="outpoint_text">Outpoint: %1$s</string>
<string name="create_wallet_failed">Create wallet failed: %1$s</string>
<string name="churn">Churn</string>
<string name="wallet_keys_label">Wallet Keys</string>
<string name="max_subaddresses_warning">Max subaddresses. Please receive funds first.</string>
<string name="done">Done</string>