set details
This commit is contained in:
parent
c4ec808cd3
commit
a78a8ee4c3
Binary file not shown.
|
@ -42,7 +42,8 @@
|
|||
<activity android:name="monnethic.mobile.wallet.SelectWalletActivity" />
|
||||
<activity android:name="monnethic.mobile.search.SearchUser" />
|
||||
<activity android:name="monnethic.mobile.search.DisplayWalletSearch" />
|
||||
<activity android:name="monnethic.mobile.history.HistoryActivity"></activity>
|
||||
<activity android:name="monnethic.mobile.history.HistoryActivity" />
|
||||
<activity android:name="monnethic.mobile.history.HistoryDetailsActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,6 +1,8 @@
|
|||
package monnethic.mobile.database;
|
||||
|
||||
public class Transaction {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Transaction implements Serializable {
|
||||
private int transactionId;
|
||||
private long transactionDate;
|
||||
private String transactionFrom;
|
||||
|
|
|
@ -202,19 +202,18 @@ public class HistoryActivity extends AppCompatActivity {
|
|||
ArrayList<Transaction> transactions = new ArrayList<>();
|
||||
//function, wallet_hash, size, start_date, end_date
|
||||
try{
|
||||
String myFormat = "dd-MM-yyyy";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
Date start_d = sdf.parse(fromDate.getText().toString());
|
||||
String start_date = String.valueOf(start_d.getTime());
|
||||
Date end_d = sdf.parse(toDate.getText().toString());
|
||||
String end_date = String.valueOf(end_d.getTime());
|
||||
|
||||
String size = inputSize.getText().toString();
|
||||
if(Integer.parseInt(function)==0){
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash).get();
|
||||
} else if(Integer.parseInt(function)==1 || Integer.parseInt(function)==2 || Integer.parseInt(function)==3){
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash,size).get();
|
||||
} else {
|
||||
String myFormat = "dd-MM-yyyy";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
Date start_d = sdf.parse(fromDate.getText().toString());
|
||||
String start_date = String.valueOf(start_d.getTime());
|
||||
Date end_d = sdf.parse(toDate.getText().toString());
|
||||
String end_date = String.valueOf(end_d.getTime());
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash,size,start_date,end_date).get();
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
@ -228,7 +227,13 @@ public class HistoryActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Transaction t = (Transaction) listView.getItemAtPosition(i);
|
||||
Toast.makeText(HistoryActivity.this,"TxID: "+t.getTransactionHash(),Toast.LENGTH_SHORT).show();
|
||||
Intent transactionDetailsIntent = new Intent(HistoryActivity.this, HistoryDetailsActivity.class);
|
||||
transactionDetailsIntent.putExtra("USER_HASH",user_hash);
|
||||
transactionDetailsIntent.putExtra("USER_PWD",user_password);
|
||||
transactionDetailsIntent.putExtra("SESSION_ID",session_id);
|
||||
transactionDetailsIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
transactionDetailsIntent.putExtra("TRANSACTION",t);
|
||||
HistoryActivity.this.startActivity(transactionDetailsIntent);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
package monnethic.mobile.history;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import monnethic.mobile.database.Transaction;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
|
||||
public class HistoryDetailsActivity extends AppCompatActivity {
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
private Transaction transaction;
|
||||
|
||||
private TextView txID;
|
||||
private TextView txDate;
|
||||
private TextView txFrom;
|
||||
private TextView txTo;
|
||||
private TextView txAmount;
|
||||
private TextView txUnit;
|
||||
private Button goToExplorer;
|
||||
private Button closeActivity;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_history_details);
|
||||
getIntentValue();
|
||||
initView();
|
||||
}
|
||||
|
||||
private void getIntentValue(){
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
transaction = (Transaction) intent.getSerializableExtra("TRANSACTION");
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
txID = findViewById(R.id.displayTxID);
|
||||
txID.setText(transaction.getTransactionHash());
|
||||
|
||||
Log.i("HistoryDetails","transaction : "+transaction.toString());
|
||||
Log.i("HistoryDetails","transaction Date : "+transaction.getTransactionDate());
|
||||
|
||||
txDate = findViewById(R.id.dateDisplay);
|
||||
String myFormat = "dd-MM-yyyy HH:mm:ss";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
Date dateTransaction = new Date(transaction.getTransactionDate());
|
||||
txDate.setText(sdf.format(dateTransaction));
|
||||
|
||||
txFrom = findViewById(R.id.fromDisplay);
|
||||
txFrom.setText(transaction.getTransactionFrom());
|
||||
|
||||
txTo = findViewById(R.id.toDisplay);
|
||||
txTo.setText(transaction.getTransactionTo());
|
||||
|
||||
txAmount = findViewById(R.id.amountDisplay);
|
||||
String amountDisplay = String.valueOf(transaction.getTransactionAmount())+" "+transaction.getTransactionUnit();
|
||||
txAmount.setText(amountDisplay);
|
||||
|
||||
goToExplorer = findViewById(R.id.btnGoToExplorer);
|
||||
closeActivity = findViewById(R.id.btnCloseDetails);
|
||||
|
||||
setButtonListener();
|
||||
}
|
||||
|
||||
private void setButtonListener(){
|
||||
goToExplorer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String url = "http://monitor.monnethic.fr:8080/#/transactions";
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse(url));
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
closeActivity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
new EndSessionTask().execute(session_id);
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
try{
|
||||
SessionApiHandler sessionApiHandler = new SessionApiHandler();
|
||||
sessionApiHandler.endSession(strings[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
165
app/src/main/res/layout/activity_history_details.xml
Normal file
165
app/src/main/res/layout/activity_history_details.xml
Normal file
|
@ -0,0 +1,165 @@
|
|||
<?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.history.HistoryDetailsActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="TxID: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayTxID"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:textIsSelectable="true"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="Date: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dateDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView14"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="From: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fromDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView16"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.05"
|
||||
android:text="To: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toDisplay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView18"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.02"
|
||||
android:text="Amount: " />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amountDisplay"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.7" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGoToExplorer"
|
||||
android:layout_marginLeft="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Go to explorer" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCloseDetails"
|
||||
android:layout_marginLeft="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Close" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -55,6 +55,7 @@
|
|||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="83dp"
|
||||
android:layout_marginTop="0dp"
|
||||
|
||||
android:clickable="true"
|
||||
android:onClick="onClickForgetPassword"
|
||||
android:text="forget password?"
|
||||
|
|
|
@ -51,13 +51,13 @@
|
|||
<TextView
|
||||
android:id="@+id/balanceView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textBalance"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="15dp"
|
||||
android:inputType="none"
|
||||
android:textAlignment="center"
|
||||
android:textSize="18sp" />
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textBalance"
|
||||
|
@ -89,7 +89,7 @@
|
|||
android:layout_height="45dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="55dp"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:text="History" />
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue