Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #56

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open

Dev #56

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9cdd2c7
Initial commit of login layouts (Login, Sign Up, OTP, Reset Password).
Tamkien Mar 8, 2021
3f484ae
Merge pull request #3 from Sprollie/feature/login
minh-hd Mar 8, 2021
7d6c624
Edit the OtpView
Tamkien Mar 8, 2021
890aa48
Added Back icon for Login/Reset Password screen
Tamkien Mar 8, 2021
175ce34
Merge pull request #4 from Sprollie/feature/login
Tamkien Mar 8, 2021
bf55d8d
Create README.md
minh-hd Mar 8, 2021
dc6075b
Added Bottom Navigation.
Tamkien Mar 9, 2021
45be3b8
Merge pull request #8 from Sprollie/feature/bottom_navigation
minh-hd Mar 9, 2021
12d9a93
Renamed duplicated variables.
Tamkien Mar 9, 2021
9808b4c
Disabled Dark mode, Auto-rotate & Split screen.
Tamkien Mar 10, 2021
1861e57
Merge pull request #13 from Sprollie/feature/theme
Tamkien Mar 10, 2021
c704de9
Revert "Disabled Dark mode, Auto-rotate & Split screen."
minh-hd Mar 10, 2021
486779d
Merge pull request #14 from Sprollie/revert-13-feature/theme
minh-hd Mar 10, 2021
f9c00cd
feature/theme
Tamkien Mar 10, 2021
686018f
Merged layout using RecycleView for ProfileFragment
Tamkien Mar 11, 2021
4c598d5
Merged profile pull request #21
Tamkien Mar 12, 2021
840c531
Merged issue #22's resolve
Tamkien Mar 13, 2021
f61923c
Merged new color palette
Tamkien Mar 16, 2021
87a2825
Merge new translation
Tamkien Mar 16, 2021
86605eb
Merge typo resolve
Tamkien Mar 16, 2021
2427eff
Change application name (#29)
minh-hd Mar 18, 2021
5981f34
merge/structure-refactor
minh-hd Mar 23, 2021
b290faa
merge/refactor-firestore-model (#37)
minh-hd Mar 26, 2021
6fcf118
Merged login activity
dauofl Mar 29, 2021
7222892
Feature/firebase (#43)
Tamkien Mar 30, 2021
4c6d8a6
Feature/firebase (#46)
Tamkien Mar 30, 2021
9345b84
minor fix
Tamkien Mar 30, 2021
4db3337
Merge minhhd
minh-hd Mar 30, 2021
081aeee
merge feature cart to dev (#51)
TuesdayTaco71 Apr 1, 2021
b559971
Merge cart feature
TuesdayTaco71 Apr 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/dictionaries/tamkien.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# VinMartAuth
PRM391 Final Project
22 changes: 19 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ plugins {

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.fpt.vinmartauth"
Expand All @@ -34,14 +35,29 @@ android {
dependencies {
//Import the FirebaseBOM
implementation platform('com.google.firebase:firebase-bom:26.6.0')

implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-storage'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:20.0.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
implementation "androidx.core:core-ktx:1.3.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.github.mancj:MaterialSearchBar:0.8.5'
implementation 'com.cepheuen.elegant-number-button:lib:1.0.3'
implementation 'com.squareup.picasso:picasso:2.8'
}
repositories {
mavenCentral()
}
22 changes: 17 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fpt.vinmartauth">
package="com.fpt.vinmartauth"
xmlns:tools="http://schemas.android.com/tools"> <!--This line must be included to use prefix tools-->

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.VinMartAuth">
<activity android:name=".login.SignupActivity" />
<activity android:name=".login.LoginActivity" />
<activity android:name=".MainActivity">
android:theme="@style/Theme.VinMartAuth"
tools:replace="android:theme"> <!-- This line override theme of elegantNumberButton used in Cart -->
<activity android:name=".view.productDetailView.ProductDetailsActivity" />
<activity android:name=".view.productlist.ProductListActivity" />
<activity android:name=".view.by_category.ViewByCategoryActivity" />
<activity android:name=".view.EditProfile"/>
<activity android:name=".view.ResetPasswordActivity" />
<activity android:name=".view.VerificationActivity" />
<activity android:name=".view.SignupActivity" />
<activity android:name=".view.LoginActivity" />
<activity android:name=".view.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 0 additions & 23 deletions app/src/main/java/com/fpt/vinmartauth/MainActivity.java

This file was deleted.

106 changes: 106 additions & 0 deletions app/src/main/java/com/fpt/vinmartauth/adapter/CartAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package com.fpt.vinmartauth.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.cepheuen.elegantnumberbutton.view.ElegantNumberButton;
import com.fpt.vinmartauth.R;
import com.fpt.vinmartauth.entity.CartItem;
import com.fpt.vinmartauth.view.fragment.cartView.CartFragment;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.List;

public class CartAdapter extends RecyclerView.Adapter<CartAdapter.CartHolder>{

private final static List<CartItem> cartItemList = new ArrayList<>();
private static final CartAdapter cartAdapter = new CartAdapter();

private CartAdapter() {}

public static CartAdapter getInstance() {
if (cartAdapter != null) {
return cartAdapter;
} else return new CartAdapter();
}

public void setData(List<CartItem> cartItems) {
cartItemList.clear();
cartItemList.addAll(cartItems);
notifyDataSetChanged();
}

public List<CartItem> getCartItemList() {
return cartItemList;
}

// pass layout to ViewHolder
@NonNull
@Override
public CartHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_row_cart_item, parent, false);
return new CartHolder(view);
}

@Override
public void onBindViewHolder(@NonNull CartHolder holder, int position) {
CartItem item = cartItemList.get(position);
holder.bind(item);
}

@Override
public int getItemCount() {
return cartItemList.size();
}


public static class CartHolder extends RecyclerView.ViewHolder{

public TextView tvProductTitle;
public TextView tvProductPrice;
public ImageView productImage;
public ElegantNumberButton quantityUpDownNumBtn;
private final String TEXT_VIEW_PRICE_LABEL_HEAD = "Giá:\t";
private final String CURRENCY_SYMBOL = " đ";

public CartHolder(@NonNull View itemView) {
super(itemView);
tvProductTitle = itemView.findViewById(R.id.tv_product_title);
tvProductPrice = itemView.findViewById(R.id.tv_product_price);
productImage = itemView.findViewById(R.id.img_product);
quantityUpDownNumBtn = itemView.findViewById(R.id.emb_quantity);
}

private String multipleQuantityWithPrice(String quantity, String price) {
return TEXT_VIEW_PRICE_LABEL_HEAD
.concat(String.valueOf(Integer.parseInt(price)*Integer.parseInt(quantity)))
.concat(CURRENCY_SYMBOL);
}

public void bind(CartItem item) {
tvProductTitle.setText(item.getProductTitle());
tvProductPrice.setText(multipleQuantityWithPrice(item.getQuantity(), item.getProductPrice()));
if (!item.getProductImage().isEmpty()) {
Picasso.get().load(item.getProductImage()).into(productImage);
}
quantityUpDownNumBtn.setNumber(item.getQuantity());
quantityUpDownNumBtn.setOnValueChangeListener((view, oldValue, newValue) -> {
item.setQuantity(String.valueOf(newValue));
cartItemList.get(cartItemList.indexOf(item)).setQuantity(String.valueOf(newValue));
tvProductPrice.setText(multipleQuantityWithPrice(item.getQuantity(), item.getProductPrice()));
// re-calculate and set total price of all items in cart
int cartTotal = cartItemList.stream().
mapToInt(i -> Integer.parseInt(i.getProductPrice()) * Integer.parseInt(i.getQuantity())).sum();
CartFragment.tvCartTotal.setText(String.valueOf(cartTotal).concat(CURRENCY_SYMBOL));
});
}
}
}

49 changes: 49 additions & 0 deletions app/src/main/java/com/fpt/vinmartauth/adapter/CategoryAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.fpt.vinmartauth.adapter

import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.fpt.vinmartauth.R
import com.fpt.vinmartauth.entity.CategoryIcon
import com.fpt.vinmartauth.view.by_category.ViewByCategoryActivity

class CategoryAdapter(private val list: List<CategoryIcon>) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val view =
LayoutInflater.from(parent.context).inflate(R.layout.layout_category, parent, false)
return ViewHolder(view)
}

override fun getItemCount(): Int {
return list.size
}

override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val icon = list[position]
if (holder is ViewHolder) {
holder.bind(icon)
holder.itemView.setOnClickListener { v ->
val intent = Intent(v.context, ViewByCategoryActivity::class.java)
intent.putExtra("CategoryName", icon.catName)
intent.putExtra("CategoryID", icon.catID)
v.context.startActivity(intent)
}
}
}

inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
fun bind(item: CategoryIcon) {
val name: TextView = itemView.findViewById(R.id.tvCatName)
val imgSrc: ImageView = itemView.findViewById(R.id.ivCatIcon)

name.text = item.catName
imgSrc.setImageResource(item.imgSrc)

}
}
}
Loading