mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-09 20:53:47 +01:00
Add "no history" layout when wallet has no history
This commit is contained in:
parent
822128c4c6
commit
1e4a91d046
@ -13,6 +13,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@ -85,6 +86,7 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
|
||||
RecyclerView txHistoryRecyclerView = view.findViewById(R.id.transaction_history_recyclerview);
|
||||
TextView unlockedBalanceTextView = view.findViewById(R.id.balance_unlocked_textview);
|
||||
TextView lockedBalanceTextView = view.findViewById(R.id.balance_locked_textview);
|
||||
ConstraintLayout noHistoryLayout = view.findViewById(R.id.no_history_layout);
|
||||
|
||||
BalanceService balanceService = BalanceService.getInstance();
|
||||
HistoryService historyService = HistoryService.getInstance();
|
||||
@ -133,6 +135,7 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
|
||||
historyService.history.observe(getViewLifecycleOwner(), history -> {
|
||||
if (history.isEmpty()) {
|
||||
txHistoryRecyclerView.setVisibility(View.GONE);
|
||||
noHistoryLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Collections.sort(history);
|
||||
if (history.size() > 100) {
|
||||
@ -141,6 +144,7 @@ public class HomeFragment extends Fragment implements TransactionInfoAdapter.TxI
|
||||
adapter.submitList(history);
|
||||
}
|
||||
txHistoryRecyclerView.setVisibility(View.VISIBLE);
|
||||
noHistoryLayout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable/xmrchan_png.png
Normal file
BIN
app/src/main/res/drawable/xmrchan_png.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
@ -58,6 +58,34 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/balance_locked_textview"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/no_history_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/balance_locked_textview"
|
||||
android:visibility="gone">
|
||||
<ImageView
|
||||
android:id="@+id/monerochan_imageview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="400dp"
|
||||
android:src="@drawable/xmrchan_png"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/empty_tx_textview"/>
|
||||
<TextView
|
||||
android:id="@+id/empty_tx_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_history_nget_some_monero_in_here"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/monerochan_imageview"
|
||||
app:layout_constraintTop_toTopOf="@id/monerochan_imageview"
|
||||
app:layout_constraintBottom_toBottomOf="@id/monerochan_imageview"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
|
@ -80,4 +80,5 @@
|
||||
<string name="wallet_proxy_address_hint">127.0.0.1</string>
|
||||
<string name="wallet_proxy_port_hint">9050</string>
|
||||
<string name="invalid_ip">Invalid IP address</string>
|
||||
<string name="no_history_nget_some_monero_in_here">No history!\nGet some Monero in here!</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user