Skip to content
Snippets Groups Projects
Commit 05ae4656 authored by Filip Stanicak's avatar Filip Stanicak
Browse files

Added Transaction items with different types

parent e28983f3
No related branches found
No related tags found
No related merge requests found
Showing
with 267 additions and 98 deletions
......@@ -28,6 +28,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.recyclerview:recyclerview:1.1.0"
......
......@@ -3,6 +3,7 @@ package com.example.mobileapp;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
......@@ -16,10 +17,12 @@ class Recycler_View_Adapter_Transaction extends RecyclerView.Adapter<Recycler_Vi
private ArrayList <String> mTitles = new ArrayList<>();
private ArrayList <Boolean> mGiveOrGet = new ArrayList<>();
private ArrayList <String> mAmount = new ArrayList<>();
private ArrayList <String> mAmount_Converted = new ArrayList<>();
private ArrayList <String> mCurrency_Converted = new ArrayList<>();
private ArrayList <String> mCurrency = new ArrayList<>();
private TransactionFragment mContext;
public Recycler_View_Adapter_Transaction(TransactionFragment mContext, ArrayList<String> mUserNamesOne, ArrayList<String> mUserNamesTwo, ArrayList<String> mTitles, ArrayList<Boolean> mGiveOrGet, ArrayList<String> mAmount, ArrayList<String> mCurrency) {
public Recycler_View_Adapter_Transaction(TransactionFragment mContext, ArrayList<String> mUserNamesOne, ArrayList<String> mUserNamesTwo, ArrayList<String> mTitles, ArrayList<Boolean> mGiveOrGet, ArrayList<String> mAmount, ArrayList<String> mCurrency, ArrayList<String> mAmount_Converted, ArrayList<String> mCurrency_Converted) {
this.mUserNamesOne = mUserNamesOne;
this.mUserNamesTwo = mUserNamesTwo;
this.mTitles = mTitles;
......@@ -27,12 +30,15 @@ class Recycler_View_Adapter_Transaction extends RecyclerView.Adapter<Recycler_Vi
this.mAmount = mAmount;
this.mCurrency = mCurrency;
this.mContext = mContext;
this.mAmount_Converted = mAmount_Converted;
this.mCurrency_Converted = mCurrency_Converted;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_transaction, parent, false);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_transaction_receive, parent, false);
ViewHolder holder = new ViewHolder(view);
return holder;
}
......@@ -44,6 +50,18 @@ class Recycler_View_Adapter_Transaction extends RecyclerView.Adapter<Recycler_Vi
holder.title.setText(mTitles.get(position));
holder.amount.setText(mAmount.get(position));
holder.currency.setText(mCurrency.get(position));
if (!mCurrency.get(position).equals(mCurrency_Converted.get(position))) {
holder.currency_converted.setText(mCurrency_Converted.get(position));
holder.amount_converted.setText(mAmount_Converted.get(position));
}
if (mGiveOrGet.get(position)) {
holder.giveOrGet.setImageResource(R.drawable.get_symbol);
} else {
holder.giveOrGet.setImageResource(R.drawable.give_symbol);
}
}
@Override
......@@ -56,16 +74,22 @@ class Recycler_View_Adapter_Transaction extends RecyclerView.Adapter<Recycler_Vi
TextView userName;
TextView title;
TextView amount;
ImageView giveOrGet;
TextView amount_converted;
TextView currency_converted;
TextView currency;
LinearLayout transactionLayout;
public ViewHolder(@NonNull View itemView) {
super(itemView);
giveOrGet = itemView.findViewById(R.id.give_or_get);
userName = itemView.findViewById(R.id.person_two);
title = itemView.findViewById(R.id.transaction_title);
amount = itemView.findViewById(R.id.transaction_amount);
currency = itemView.findViewById(R.id.transaction_currency);
amount_converted = itemView.findViewById(R.id.transaction_amount_converted);
currency_converted = itemView.findViewById(R.id.transaction_currency);
currency = itemView.findViewById(R.id.transaction_currency_basis);
transactionLayout = itemView.findViewById(R.id.transaction_layout);
}
}
......
package com.example.mobileapp;
import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -7,6 +9,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
......@@ -26,6 +29,8 @@ public class Recycler_View_Adapter_User extends RecyclerView.Adapter<Recycler_Vi
this.mContext = mContext;
}
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_user_group, parent, false);
......@@ -47,6 +52,28 @@ public class Recycler_View_Adapter_User extends RecyclerView.Adapter<Recycler_Vi
holder.userAdmin.setImageResource(R.drawable.no_admin_crown);
}
holder.userAdmin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(changeAdminStatus(position)) {
mUserAdmin.set(position,true);
Recycler_View_Adapter_User.this.notifyItemChanged(position);
} else {
mUserAdmin.set(position,false);
Recycler_View_Adapter_User.this.notifyItemChanged(position);
}
}
});
}
public boolean changeAdminStatus(int position) {
if (mUserAdmin.get(position)) {
return false;
} else {
return true;
}
}
@Override
......
......@@ -8,6 +8,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
......
......@@ -11,18 +11,39 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class TransactionFragment extends Fragment {
private static final String TAG = "Debug";
//First User participating in the transaction, its the Accountuser himself, name is needed for admin
private ArrayList <String> mUserNamesOne = new ArrayList<>();
//Second User participating in the transaction
private ArrayList <String> mUserNamesTwo = new ArrayList<>();
//Title of the transaction
private ArrayList <String> mTitles = new ArrayList<>();
//Decider if money is received or has to be given
private ArrayList <Boolean> mGiveOrGet = new ArrayList<>();
private ArrayList <String> mAmount = new ArrayList<>();
//Displaying the amount in the groups currency
private ArrayList <String> mAmount_Converted = new ArrayList<>();
private ArrayList <String> mCurrency = new ArrayList<>();
private ArrayList <String> mAmount = new ArrayList<>();
private ArrayList <String> mCurrency_Converted = new ArrayList<>();
//private RequestQueue mQueue;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -37,7 +58,7 @@ public class TransactionFragment extends Fragment {
View rootView = inflater.inflate(R.layout.fragment_transaction_fragement, container, false);
RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_transaction_view);
Recycler_View_Adapter_Transaction adapter = new Recycler_View_Adapter_Transaction(this,mUserNamesOne,mUserNamesTwo,mTitles,mGiveOrGet,mAmount,mCurrency);
Recycler_View_Adapter_Transaction adapter = new Recycler_View_Adapter_Transaction(this,mUserNamesOne,mUserNamesTwo,mTitles,mGiveOrGet,mAmount,mCurrency,mAmount_Converted,mCurrency_Converted);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
......@@ -48,21 +69,26 @@ public class TransactionFragment extends Fragment {
private void initImageBitmaps() {
//mQueue = Volley.newRequestQueue(getActivity());
//jsonParse();
mUserNamesOne.add("Filip");
mUserNamesTwo.add("Bruno");
mTitles.add("Restaurant");
mGiveOrGet.add(true);
mAmount.add("50.00");
mCurrency.add("€");
mAmount_Converted.add("2.00");
mCurrency_Converted.add("€");
mUserNamesOne.add("Dennis");
mUserNamesTwo.add("Jan");
mTitles.add("Themenpark");
mGiveOrGet.add(false);
mAmount.add("120.00");
mCurrency.add("$");
mCurrency.add("€");
mAmount_Converted.add("2.00");
mCurrency_Converted.add("$");
......@@ -71,7 +97,9 @@ public class TransactionFragment extends Fragment {
mTitles.add("Einkaufen");
mGiveOrGet.add(false);
mAmount.add("1680.00");
mCurrency.add("¥");
mCurrency.add("€");
mAmount_Converted.add("2.00");
mCurrency_Converted.add("¥");
mUserNamesOne.add("Dennis");
......@@ -79,7 +107,40 @@ public class TransactionFragment extends Fragment {
mTitles.add("Bar");
mGiveOrGet.add(true);
mAmount.add("20.00");
mCurrency.add("£");
mCurrency.add("€");
mAmount_Converted.add("2.00");
mCurrency_Converted.add("£");
}
/*
private void jsonParse() {
String url = "https://api.exchangeratesapi.io/latest";
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject rates = response.getJSONObject("rates");
int canada = rates.getInt("CAD");
int hongkong = rates.getInt("HKD");
int island = rates.getInt("ISK");
int denmark = rates.getInt("DKK");
int hungary = rates.getInt("HUF");
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
});
mQueue.add(request);
} */
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="19.2"
android:viewportHeight="19.2"
android:tint="#136A10"
android:alpha="0.8">
<group android:translateX="-2.4"
android:translateY="-2.4">
<path
android:fillColor="#136A10"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</group>
</vector>
Frontend/app/src/main/res/drawable-hdpi/get_symbol.png

179 B | W: | H:

Frontend/app/src/main/res/drawable-hdpi/get_symbol.png

169 B | W: | H:

Frontend/app/src/main/res/drawable-hdpi/get_symbol.png
Frontend/app/src/main/res/drawable-hdpi/get_symbol.png
Frontend/app/src/main/res/drawable-hdpi/get_symbol.png
Frontend/app/src/main/res/drawable-hdpi/get_symbol.png
  • 2-up
  • Swipe
  • Onion skin
Frontend/app/src/main/res/drawable-mdpi/get_symbol.png

159 B | W: | H:

Frontend/app/src/main/res/drawable-mdpi/get_symbol.png

147 B | W: | H:

Frontend/app/src/main/res/drawable-mdpi/get_symbol.png
Frontend/app/src/main/res/drawable-mdpi/get_symbol.png
Frontend/app/src/main/res/drawable-mdpi/get_symbol.png
Frontend/app/src/main/res/drawable-mdpi/get_symbol.png
  • 2-up
  • Swipe
  • Onion skin
Frontend/app/src/main/res/drawable-xhdpi/get_symbol.png

227 B | W: | H:

Frontend/app/src/main/res/drawable-xhdpi/get_symbol.png

178 B | W: | H:

Frontend/app/src/main/res/drawable-xhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xhdpi/get_symbol.png
  • 2-up
  • Swipe
  • Onion skin
Frontend/app/src/main/res/drawable-xxhdpi/get_symbol.png

244 B | W: | H:

Frontend/app/src/main/res/drawable-xxhdpi/get_symbol.png

231 B | W: | H:

Frontend/app/src/main/res/drawable-xxhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xxhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xxhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xxhdpi/get_symbol.png
  • 2-up
  • Swipe
  • Onion skin
Frontend/app/src/main/res/drawable-xxxhdpi/get_symbol.png

273 B | W: | H:

Frontend/app/src/main/res/drawable-xxxhdpi/get_symbol.png

323 B | W: | H:

Frontend/app/src/main/res/drawable-xxxhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xxxhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xxxhdpi/get_symbol.png
Frontend/app/src/main/res/drawable-xxxhdpi/get_symbol.png
  • 2-up
  • Swipe
  • Onion skin
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="4dp"
android:color="#B81313"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/transaction_layout"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="+"
android:layout_marginTop="-10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textSize="60dp"
android:textColor="#136A10" />
<View
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#C5B358" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/person_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:textSize="24dp"
android:text="Placeholder"
android:textColor="#C5B358"/>
<TextView
android:id="@+id/transaction_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:textSize="18dp"
android:text="Placeholder"
android:textColor="#716528"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="20dp"
android:gravity="right|center">
<TextView
android:id="@+id/transaction_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00,00"
android:textColor="#C5B358"
android:textSize="30dp" />
<TextView
android:id="@+id/transaction_currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="$"
android:textColor="#C5B358"
android:textSize="30dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/transaction_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/give_or_get"
android:layout_width="34dp"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:gravity="center"
android:src="@drawable/get_symbol"/>
<View
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#C5B358" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:id="@+id/person_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="Placeholder"
android:textColor="#C5B358"
android:textSize="24dp" />
<TextView
android:id="@+id/transaction_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="Placeholder"
android:textColor="#716528"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="20dp"
android:gravity="right|center">
<TextView
android:id="@+id/transaction_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00,00"
android:textColor="#C5B358"
android:textSize="24dp" />
<TextView
android:id="@+id/transaction_currency_basis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="$"
android:textColor="#C5B358"
android:textSize="24dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="20dp"
android:gravity="right|center">
<TextView
android:id="@+id/transaction_amount_converted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#716528"
android:textSize="18dp" />
<TextView
android:id="@+id/transaction_currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textColor="#716528"
android:textSize="18dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:src="@drawable/rnd_button"
android:layout_marginLeft="69dp"/>
</LinearLayout>
\ No newline at end of file
......@@ -39,7 +39,7 @@
android:layout_height="35dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="-50dp"
android:src="@drawable/admin_crown" />
/>
</LinearLayout>
......
......@@ -21,6 +21,8 @@
android:clickable="true"
android:onClick="backButton"/>
<LinearLayout
android:layout_width="match_parent"
android:gravity="center_horizontal"
......
Images/+.png

347 B

Images/drawable-hdpi/+.png

1.98 KiB | W: | H:

Images/drawable-hdpi/+.png

317 B | W: | H:

Images/drawable-hdpi/+.png
Images/drawable-hdpi/+.png
Images/drawable-hdpi/+.png
Images/drawable-hdpi/+.png
  • 2-up
  • Swipe
  • Onion skin
Images/drawable-ldpi/+.png

502 B | W: | H:

Images/drawable-ldpi/+.png

226 B | W: | H:

Images/drawable-ldpi/+.png
Images/drawable-ldpi/+.png
Images/drawable-ldpi/+.png
Images/drawable-ldpi/+.png
  • 2-up
  • Swipe
  • Onion skin
Images/drawable-mdpi/+.png

1008 B | W: | H:

Images/drawable-mdpi/+.png

215 B | W: | H:

Images/drawable-mdpi/+.png
Images/drawable-mdpi/+.png
Images/drawable-mdpi/+.png
Images/drawable-mdpi/+.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment