set wallet adapter and listView
This commit is contained in:
parent
389886f3c6
commit
d4d3eaf5ed
|
@ -36,7 +36,8 @@ public class SelectWalletActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
Log.i("SelectWalletActivity", "userWallets : "+userWallets);
|
||||
ArrayAdapter<Wallet> adapter = new ArrayAdapter<Wallet>(this, R.layout.activity_select_wallet, userWallets);
|
||||
WalletAdapter adapter = new WalletAdapter(this,userWallets);
|
||||
//ArrayAdapter<Wallet> adapter = new ArrayAdapter<Wallet>(this, R.layout.activity_select_wallet, userWallets);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
//TODO
|
||||
|
|
41
app/src/main/java/monnethic/mobile/wallet/WalletAdapter.java
Normal file
41
app/src/main/java/monnethic/mobile/wallet/WalletAdapter.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WalletAdapter extends ArrayAdapter<Wallet> {
|
||||
public WalletAdapter(Context context, ArrayList<Wallet> wallets){
|
||||
super(context,0,wallets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent){
|
||||
Wallet wallet = getItem(position);
|
||||
|
||||
if(convertView == null){
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.wallet_view_template, parent, false);
|
||||
}
|
||||
|
||||
TextView wallet_hash = (TextView) convertView.findViewById(R.id.wallet_hash);
|
||||
TextView wallet_type = (TextView) convertView.findViewById(R.id.wallet_type);
|
||||
TextView wallet_balance = (TextView) convertView.findViewById(R.id.wallet_balance);
|
||||
|
||||
ViewGroup.LayoutParams params = convertView.getLayoutParams();
|
||||
params.height = 300;
|
||||
convertView.setLayoutParams(params);
|
||||
|
||||
wallet_hash.setText(wallet.getWallet_hash());
|
||||
wallet_type.setText(wallet.getType());
|
||||
wallet_balance.setText(String.valueOf(wallet.getBalance()));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
|
@ -1,40 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.wallet.CreateWalletActivity">
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:fillViewport="true"
|
||||
>
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextWalletType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="168dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:ems="10"
|
||||
android:gravity="center"
|
||||
android:hint="Wallet name"
|
||||
android:inputType="text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.6"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:inputType="text" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_marginBottom="188dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonValidate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:text="Validate" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonCancel"
|
||||
|
@ -42,19 +48,11 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="86dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Cancel" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonOk"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/buttonCancel"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="86dp"
|
||||
android:text="OK" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_marginTop="220dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:text="CREATE WALLET"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -24,7 +24,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginBottom="200dp"
|
||||
android:layout_marginBottom="220dp"
|
||||
android:text="SELECT WALLET"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<ListView
|
||||
android:id="@+id/listViewWallet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:dividerHeight="5dp" />
|
||||
</ScrollView>
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
77
app/src/main/res/layout/wallet_view_template.xml
Normal file
77
app/src/main/res/layout/wallet_view_template.xml
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_hash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="Wallet Hash"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/wallet_hash"
|
||||
android:layout_alignStart="@+id/wallet_balance"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:text="Wallet Type"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/wallet_balance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="112dp"
|
||||
android:layout_marginTop="52dp"
|
||||
android:text="Wallet Balance"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/wallet_type"
|
||||
android:layout_marginEnd="-85dp"
|
||||
android:layout_toStartOf="@+id/wallet_balance"
|
||||
android:text="Wallet :"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignStart="@+id/textView2"
|
||||
android:layout_alignTop="@+id/wallet_balance"
|
||||
android:text="Balance :"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
Loading…
Reference in a new issue