- Adding send and receive buttons to the balances views
- Now the transactions view appears as the second Page of the Board Activity
This commit is contained in:
parent
131a5c5ea8
commit
2590bb42ed
4 changed files with 67 additions and 7 deletions
|
@ -25,6 +25,8 @@
|
|||
</activity>
|
||||
<activity android:name=".activities.ImportSeedActivity" >
|
||||
</activity>
|
||||
<activity android:name=".activities.SendTransactionActivity" >
|
||||
</activity>
|
||||
<service android:name=".service.CrystalWalletService"
|
||||
android:exported="false"/>
|
||||
</application>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package cy.agorise.crystalwallet.views;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.arch.lifecycle.LifecycleOwner;
|
||||
import android.arch.lifecycle.LiveData;
|
||||
|
@ -9,12 +11,17 @@ import android.arch.lifecycle.ViewModelProviders;
|
|||
import android.arch.paging.PagedList;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.activities.SendTransactionActivity;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinBalance;
|
||||
import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
||||
import cy.agorise.crystalwallet.models.CryptoNetBalance;
|
||||
|
@ -25,28 +32,68 @@ import cy.agorise.crystalwallet.viewmodels.CryptoCoinBalanceListViewModel;
|
|||
*/
|
||||
|
||||
public class CryptoNetBalanceViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView cryptoNetIcon;
|
||||
private TextView cryptoNetName;
|
||||
private CryptoCoinBalanceListView cryptoCoinBalanceListView;
|
||||
//@BindView(R.id.ivCryptoNetIcon)
|
||||
ImageView cryptoNetIcon;
|
||||
|
||||
//@BindView(R.id.tvCryptoNetName)
|
||||
TextView cryptoNetName;
|
||||
|
||||
//@BindView(R.id.cryptoCoinBalancesListView)
|
||||
CryptoCoinBalanceListView cryptoCoinBalanceListView;
|
||||
|
||||
@BindView(R.id.btnSendFromThisAccount)
|
||||
Button btnSendFromThisAccount;
|
||||
|
||||
Context context;
|
||||
|
||||
long cryptoNetAccountId;
|
||||
|
||||
private Fragment fragment;
|
||||
|
||||
public CryptoNetBalanceViewHolder(View itemView, Fragment fragment) {
|
||||
super(itemView);
|
||||
this.cryptoNetAccountId = -1;
|
||||
|
||||
cryptoNetIcon = (ImageView) itemView.findViewById(R.id.ivCryptoNetIcon);
|
||||
cryptoNetName = (TextView) itemView.findViewById(R.id.tvCryptoNetName);
|
||||
cryptoCoinBalanceListView = (CryptoCoinBalanceListView) itemView.findViewById(R.id.cryptoCoinBalancesListView);
|
||||
btnSendFromThisAccount = (Button) itemView.findViewById(R.id.btnSendFromThisAccount);
|
||||
btnSendFromThisAccount.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
sendFromThisAccount();
|
||||
}
|
||||
});
|
||||
this.fragment = fragment;
|
||||
this.context = itemView.getContext();
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
cryptoNetName.setText("loading...");
|
||||
}
|
||||
|
||||
//@OnClick(R.id.btnSendFromThisAccount)
|
||||
public void sendFromThisAccount(){
|
||||
if (this.cryptoNetAccountId >= 0) {
|
||||
//Intent intent = new Intent(this.context, SendTransactionActivity.class);
|
||||
//this.context.startActivity(intent);
|
||||
|
||||
Intent startActivity = new Intent();
|
||||
startActivity.setClass(context, SendTransactionActivity.class);
|
||||
startActivity.setAction(SendTransactionActivity.class.getName());
|
||||
startActivity.putExtra("CRYPTO_NET_ACCOUNT_ID", this.cryptoNetAccountId);
|
||||
startActivity.setFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
context.startActivity(startActivity);
|
||||
}
|
||||
}
|
||||
|
||||
public void bindTo(final CryptoNetBalance balance) {
|
||||
if (balance == null){
|
||||
cryptoNetName.setText("loading...");
|
||||
} else {
|
||||
this.cryptoNetAccountId = balance.getAccountId();
|
||||
cryptoNetName.setText(balance.getCryptoNet().getLabel());
|
||||
|
||||
CryptoCoinBalanceListViewModel cryptoCoinBalanceListViewModel = ViewModelProviders.of(this.fragment).get(CryptoCoinBalanceListViewModel.class);
|
||||
|
|
|
@ -32,6 +32,18 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:text="unknown coin" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSendFromThisAccount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="send"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnReceiveWithThisAccount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="receive"/>
|
||||
</LinearLayout>
|
||||
|
||||
<cy.agorise.crystalwallet.views.CryptoCoinBalanceListView
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context="cy.agorise.crystalwallet.fragments.TransactionsFragment">
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<TextView
|
||||
<cy.agorise.crystalwallet.views.TransactionListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Transactions Fragment" />
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/vTransactionListView" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
Loading…
Reference in a new issue