diff --git a/Android/Android Apps/MyMall/.gitignore b/Android/Android Apps/MyMall/.gitignore new file mode 100644 index 00000000..603b1407 --- /dev/null +++ b/Android/Android Apps/MyMall/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git a/Android/Android Apps/MyMall/.idea/.name b/Android/Android Apps/MyMall/.idea/.name new file mode 100644 index 00000000..2280c951 --- /dev/null +++ b/Android/Android Apps/MyMall/.idea/.name @@ -0,0 +1 @@ +Mei Mall \ No newline at end of file diff --git a/Android/Android Apps/MyMall/.idea/codeStyles/Project.xml b/Android/Android Apps/MyMall/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..681f41ae --- /dev/null +++ b/Android/Android Apps/MyMall/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/Android/Android Apps/MyMall/.idea/gradle.xml b/Android/Android Apps/MyMall/.idea/gradle.xml new file mode 100644 index 00000000..5cd135a0 --- /dev/null +++ b/Android/Android Apps/MyMall/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/Android/Android Apps/MyMall/.idea/jarRepositories.xml b/Android/Android Apps/MyMall/.idea/jarRepositories.xml new file mode 100644 index 00000000..0380d8d3 --- /dev/null +++ b/Android/Android Apps/MyMall/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Android/Android Apps/MyMall/.idea/misc.xml b/Android/Android Apps/MyMall/.idea/misc.xml new file mode 100644 index 00000000..7bfef59d --- /dev/null +++ b/Android/Android Apps/MyMall/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/Android/Android Apps/MyMall/.idea/runConfigurations.xml b/Android/Android Apps/MyMall/.idea/runConfigurations.xml new file mode 100644 index 00000000..7f68460d --- /dev/null +++ b/Android/Android Apps/MyMall/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/Android/Android Apps/MyMall/README.md b/Android/Android Apps/MyMall/README.md new file mode 100644 index 00000000..f4f16ed4 --- /dev/null +++ b/Android/Android Apps/MyMall/README.md @@ -0,0 +1,18 @@ +# My Mall Android Application +This App have feature of add product to cart, Give review and payment screen.
+This is a E-commerce Android application Application
+ +## Screensort + + + + +## Concepts Used +- Text View +- Material Design +- Relative Layouts +- Glide: An image loading and caching library for Android focused on smooth scrolling +- Image View +- ViewBinding +- RecyclerView +- pl.droidsonroids.gif Libraray diff --git a/Android/Android Apps/MyMall/app/.gitignore b/Android/Android Apps/MyMall/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/Android/Android Apps/MyMall/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/Android/Android Apps/MyMall/app/build.gradle b/Android/Android Apps/MyMall/app/build.gradle new file mode 100644 index 00000000..bfb8eaae --- /dev/null +++ b/Android/Android Apps/MyMall/app/build.gradle @@ -0,0 +1,63 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.2" + + defaultConfig { + applicationId "org.meicode.meimall" + minSdkVersion 19 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + //Material + implementation 'com.google.android.material:material:1.1.0' + + //Glide + implementation 'com.github.bumptech.glide:glide:4.11.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' + + //Gson + implementation 'com.google.code.gson:gson:2.8.6' + + //RecyclerView + implementation "androidx.recyclerview:recyclerview:1.1.0" + + //Retrofit + implementation 'com.squareup.retrofit2:retrofit:2.8.1' + + //Gson Converter Factory + implementation 'com.squareup.retrofit2:converter-gson:2.8.1' + + //Logging interceptor + implementation("com.squareup.okhttp3:logging-interceptor:4.5.0") + + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + + implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' +} diff --git a/Android/Android Apps/MyMall/app/proguard-rules.pro b/Android/Android Apps/MyMall/app/proguard-rules.pro new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ b/Android/Android Apps/MyMall/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/Android/Android Apps/MyMall/app/src/androidTest/java/org/meicode/meimall/ExampleInstrumentedTest.java b/Android/Android Apps/MyMall/app/src/androidTest/java/org/meicode/meimall/ExampleInstrumentedTest.java new file mode 100644 index 00000000..ff2556ea --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/androidTest/java/org/meicode/meimall/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package org.meicode.meimall; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("org.meicode.meimall", appContext.getPackageName()); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/AndroidManifest.xml b/Android/Android Apps/MyMall/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..7ca298c0 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/AddReviewDialog.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/AddReviewDialog.java new file mode 100644 index 00000000..e9db8f8d --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/AddReviewDialog.java @@ -0,0 +1,87 @@ +package org.meicode.meimall; + +import android.app.Dialog; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; + +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import static org.meicode.meimall.GroceryItemActivity.GROCERY_ITEM_KEY; + +public class AddReviewDialog extends DialogFragment { + + public interface AddReview { + void onAddReviewResult(Review review); + } + + private AddReview addReview; + + private TextView txtItemName, txtWarning; + private EditText edtTxtUserName; + private EditText edtTxtReview; + private Button btnAddReview; + + @NonNull + @Override + public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { + View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_add_review, null); + initViews(view); + + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) + .setView(view); + + Bundle bundle = getArguments(); + if (null != bundle) { + final GroceryItem item = bundle.getParcelable(GROCERY_ITEM_KEY); + if (null != item) { + txtItemName.setText(item.getName()); + btnAddReview.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String userName = edtTxtUserName.getText().toString(); + String review = edtTxtReview.getText().toString(); + String date = getCurrentDate(); + if (userName.equals("") || review.equals("")) { + txtWarning.setText("Fill all the blanks"); + txtWarning.setVisibility(View.VISIBLE); + }else { + txtWarning.setVisibility(View.GONE); + try { + addReview = (AddReview) getActivity(); + addReview.onAddReviewResult(new Review(item.getId(), userName, review, date)); + dismiss(); + }catch (ClassCastException e) { + e.printStackTrace(); + } + } + } + }); + } + } + + return builder.create(); + } + + private String getCurrentDate() { + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-YYYY"); + return sdf.format(calendar.getTime()); + } + + private void initViews(View view) { + txtItemName = view.findViewById(R.id.txtItemName); + txtWarning = view.findViewById(R.id.txtWarning); + edtTxtUserName = view.findViewById(R.id.edtTxtUserName); + edtTxtReview = view.findViewById(R.id.edtTxtReview); + btnAddReview = view.findViewById(R.id.btnAddReview); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/AllCategoriesDialog.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/AllCategoriesDialog.java new file mode 100644 index 00000000..fd72d082 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/AllCategoriesDialog.java @@ -0,0 +1,76 @@ +package org.meicode.meimall; + +import android.app.Dialog; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; + +import java.util.ArrayList; + +public class AllCategoriesDialog extends DialogFragment { + + public interface GetCategory{ + void onGetCategoryResult(String category); + } + + private GetCategory getCategory; + + public static final String ALL_CATEGORIES = "categories"; + public static final String CALLING_ACTIVITY = "activity"; + + @NonNull + @Override + public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { + View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_all_categories, null); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) + .setView(view); + + Bundle bundle = getArguments(); + if (null != bundle) { + final String callingActivity = bundle.getString(CALLING_ACTIVITY); + final ArrayList categories = bundle.getStringArrayList(ALL_CATEGORIES); + if (null != categories) { + ListView listView = view.findViewById(R.id.listView); + ArrayAdapter adapter = new ArrayAdapter(getActivity(), + android.R.layout.simple_list_item_1, + categories); + listView.setAdapter(adapter); + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (callingActivity) { + case "main_activity": + Intent intent = new Intent(getActivity(), SearchActivity.class); + intent.putExtra("category", categories.get(position)); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + getActivity().startActivity(intent); + dismiss(); + break; + case "search_activity": + try { + getCategory = (GetCategory) getActivity(); + getCategory.onGetCategoryResult(categories.get(position)); + dismiss(); + }catch (ClassCastException e) { + e.printStackTrace(); + } + break; + default: + break; + } + } + }); + } + } + + return builder.create(); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/CartActivity.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/CartActivity.java new file mode 100644 index 00000000..e8d05b38 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/CartActivity.java @@ -0,0 +1,63 @@ +package org.meicode.meimall; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.FragmentTransaction; + +import android.content.Intent; +import android.os.Bundle; +import android.view.MenuItem; + +import com.google.android.material.appbar.MaterialToolbar; +import com.google.android.material.bottomnavigation.BottomNavigationView; + +public class CartActivity extends AppCompatActivity { + + private MaterialToolbar toolbar; + private BottomNavigationView bottomNavigationView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_cart); + + initViews(); + initBottomNavView(); + setSupportActionBar(toolbar); + + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, new FirstCartFragment()); + transaction.commit(); + } + + private void initBottomNavView() { + bottomNavigationView.setSelectedItemId(R.id.cart); + bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()) { + case R.id.search: + Intent searchIntent = new Intent(CartActivity.this,SearchActivity.class); + searchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(searchIntent); + break; + case R.id.home: + Intent homeIntent = new Intent(CartActivity.this, MainActivity.class); + homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(homeIntent); + break; + case R.id.cart: + break; + default: + break; + } + return false; + } + }); + } + + private void initViews() { + bottomNavigationView = findViewById(R.id.bottomNavView); + toolbar = findViewById(R.id.toolbar); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/CartAdapter.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/CartAdapter.java new file mode 100644 index 00000000..950c7527 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/CartAdapter.java @@ -0,0 +1,118 @@ +package org.meicode.meimall; + +import android.content.Context; +import android.content.DialogInterface; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.ArrayList; + +public class CartAdapter extends RecyclerView.Adapter { + + public interface TotalPrice{ + void getTotalPrice(double price); + } + + public interface DeleteItem{ + void onDeleteResult(GroceryItem item); + } + + private DeleteItem deleteItem; + + private TotalPrice totalPrice; + + private ArrayList items = new ArrayList<>(); + + private Context context; + private Fragment fragment; + + public CartAdapter(Context context, Fragment fragment) { + this.context = context; + this.fragment = fragment; + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.cart_item, parent, false); + return new ViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, final int position) { + holder.txtName.setText(items.get(position).getName()); + holder.txtPrice.setText(items.get(position).getPrice() + "$"); + holder.txtDelete.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + AlertDialog.Builder builder = new AlertDialog.Builder(context) + .setTitle("Deleting...") + .setMessage("Are you sure you want to delete this item?") + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + try { + deleteItem = (DeleteItem) fragment; + deleteItem.onDeleteResult(items.get(position)); + }catch (ClassCastException e) { + e.printStackTrace(); + } + } + }); + builder.create().show(); + } + }); + } + + @Override + public int getItemCount() { + return items.size(); + } + + public void setItems(ArrayList items) { + this.items = items; + calculateTotalPrice(); + notifyDataSetChanged(); + } + + private void calculateTotalPrice() { + double price =0; + for (GroceryItem item: items) { + price += item.getPrice(); + } + + price = Math.round(price*100.0)/100.0; + + try{ + totalPrice = (TotalPrice) fragment; + totalPrice.getTotalPrice(price); + }catch (ClassCastException e) { + e.printStackTrace(); + } + } + + public class ViewHolder extends RecyclerView.ViewHolder { + + private TextView txtName, txtPrice, txtDelete; + + public ViewHolder(@NonNull View itemView) { + super(itemView); + + txtName = itemView.findViewById(R.id.txtName); + txtPrice = itemView.findViewById(R.id.txtPrice); + txtDelete = itemView.findViewById(R.id.txtDelete); + } + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/FirstCartFragment.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/FirstCartFragment.java new file mode 100644 index 00000000..4e53dc90 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/FirstCartFragment.java @@ -0,0 +1,98 @@ +package org.meicode.meimall; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.ArrayList; + +public class FirstCartFragment extends Fragment implements CartAdapter.DeleteItem, CartAdapter.TotalPrice { + + @Override + public void getTotalPrice(double price) { + txtSum.setText(String.valueOf(price) + "$"); + } + + @Override + public void onDeleteResult(GroceryItem item) { + Utils.deleteItemFromCart(getActivity(), item); + ArrayList cartItems = Utils.getCartItems(getActivity()); + if (null != cartItems) { + if (cartItems.size()>0) { + txtNoItems.setVisibility(View.GONE); + itemsRelLayout.setVisibility(View.VISIBLE); + adapter.setItems(cartItems); + }else { + txtNoItems.setVisibility(View.VISIBLE); + itemsRelLayout.setVisibility(View.GONE); + } + }else { + txtNoItems.setVisibility(View.VISIBLE); + itemsRelLayout.setVisibility(View.GONE); + } + } + + private RecyclerView recyclerView; + private TextView txtSum, txtNoItems; + private Button btnNext; + private RelativeLayout itemsRelLayout; + + private CartAdapter adapter; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_cart_first, container, false); + + initViews(view); + + adapter = new CartAdapter(getActivity(), this); + recyclerView.setAdapter(adapter); + recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); + + ArrayList cartItems = Utils.getCartItems(getActivity()); + if (null != cartItems) { + if (cartItems.size()>0) { + txtNoItems.setVisibility(View.GONE); + itemsRelLayout.setVisibility(View.VISIBLE); + adapter.setItems(cartItems); + }else { + txtNoItems.setVisibility(View.VISIBLE); + itemsRelLayout.setVisibility(View.GONE); + } + }else { + txtNoItems.setVisibility(View.VISIBLE); + itemsRelLayout.setVisibility(View.GONE); + } + + btnNext.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, new SecondCartFragment()); + transaction.commit(); + } + }); + + return view; + } + + private void initViews(View view) { + recyclerView = view.findViewById(R.id.recyclerView); + txtSum = view.findViewById(R.id.txtTotalPrice); + txtNoItems = view.findViewById(R.id.txtNoItem); + btnNext = view.findViewById(R.id.btnNext); + itemsRelLayout = view.findViewById(R.id.itemsRelLayout); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItem.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItem.java new file mode 100644 index 00000000..998fd681 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItem.java @@ -0,0 +1,183 @@ +package org.meicode.meimall; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.ArrayList; + +public class GroceryItem implements Parcelable { + private int id; + private String name; + private String description; + private String imageUrl; + private String category; + private double price; + private int availableAmount; + private int rate; + private int userPoint; + private int popularityPoint; + private ArrayList reviews; + + public GroceryItem(String name, String description, String imageUrl, String category, double price, int availableAmount) { + this.id = Utils.getID(); + this.name = name; + this.description = description; + this.imageUrl = imageUrl; + this.category = category; + this.price = price; + this.availableAmount = availableAmount; + this.rate = 0; + this.userPoint = 0; + this.popularityPoint = 0; + reviews = new ArrayList<>(); + } + + protected GroceryItem(Parcel in) { + id = in.readInt(); + name = in.readString(); + description = in.readString(); + imageUrl = in.readString(); + category = in.readString(); + price = in.readDouble(); + availableAmount = in.readInt(); + rate = in.readInt(); + userPoint = in.readInt(); + popularityPoint = in.readInt(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public GroceryItem createFromParcel(Parcel in) { + return new GroceryItem(in); + } + + @Override + public GroceryItem[] newArray(int size) { + return new GroceryItem[size]; + } + }; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + public int getAvailableAmount() { + return availableAmount; + } + + public void setAvailableAmount(int availableAmount) { + this.availableAmount = availableAmount; + } + + public int getRate() { + return rate; + } + + public void setRate(int rate) { + this.rate = rate; + } + + public int getUserPoint() { + return userPoint; + } + + public void setUserPoint(int userPoint) { + this.userPoint = userPoint; + } + + public int getPopularityPoint() { + return popularityPoint; + } + + public void setPopularityPoint(int popularityPoint) { + this.popularityPoint = popularityPoint; + } + + public ArrayList getReviews() { + return reviews; + } + + public void setReviews(ArrayList reviews) { + this.reviews = reviews; + } + + @Override + public String toString() { + return "GroceryItem{" + + "id=" + id + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", category='" + category + '\'' + + ", price=" + price + + ", availableAmount=" + availableAmount + + ", rate=" + rate + + ", userPoint=" + userPoint + + ", popularityPoint=" + popularityPoint + + ", reviews=" + reviews + + '}'; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(id); + dest.writeString(name); + dest.writeString(description); + dest.writeString(imageUrl); + dest.writeString(category); + dest.writeDouble(price); + dest.writeInt(availableAmount); + dest.writeInt(rate); + dest.writeInt(userPoint); + dest.writeInt(popularityPoint); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItemActivity.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItemActivity.java new file mode 100644 index 00000000..e7955088 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItemActivity.java @@ -0,0 +1,240 @@ +package org.meicode.meimall; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.content.ComponentName; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Bundle; +import android.os.IBinder; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.google.android.material.appbar.MaterialToolbar; + +import java.util.ArrayList; + +public class GroceryItemActivity extends AppCompatActivity implements AddReviewDialog.AddReview { + private static final String TAG = "GroceryItemActivity"; + + private boolean isBound; + private TrackUserTime mService; + + private ServiceConnection connection = new ServiceConnection() { + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + TrackUserTime.LocalBinder binder = (TrackUserTime.LocalBinder) service; + mService = binder.getService(); + isBound = true; + mService.setItem(incomingItem); + } + + @Override + public void onServiceDisconnected(ComponentName name) { + isBound = false; + } + }; + + @Override + public void onAddReviewResult(Review review) { + Log.d(TAG, "onAddReviewResult: new review: " + review); + Utils.addReview(this, review); + Utils.changeUserPoint(this, incomingItem, 3); + ArrayList reviews = Utils.getReviewById(this, review.getGroceryItemId()); + if (null != reviews) { + adapter.setReviews(reviews); + } + } + + public static final String GROCERY_ITEM_KEY = "incoming_item"; + + private RecyclerView reviewsRecView; + private TextView txtName, txtPrice, txtDescription, txtAddReview; + private ImageView itemImage, firstEmptyStar, firstFilledStar, secondEmptyStar, secondFilledStar, + thirdEmptyStar, thirdFilledStar; + private Button btnAddToCart; + private RelativeLayout firstStarRelLayout, secondStarRelLayout, thirdStarRelLayout; + private MaterialToolbar toolbar; + + private GroceryItem incomingItem; + + private ReviewsAdapter adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_grocery_item); + initViews(); + + setSupportActionBar(toolbar); + + adapter = new ReviewsAdapter(); + + final Intent intent = getIntent(); + if (null != intent) { + incomingItem = intent.getParcelableExtra(GROCERY_ITEM_KEY); + if (null != incomingItem) { + Utils.changeUserPoint(this, incomingItem, 1); + txtName.setText(incomingItem.getName()); + txtDescription.setText(incomingItem.getDescription()); + txtPrice.setText(String.valueOf(incomingItem.getPrice()) + "$"); + Glide.with(this) + .asBitmap() + .load(incomingItem.getImageUrl()) + .into(itemImage); + ArrayList reviews = Utils.getReviewById(this, incomingItem.getId()); + reviewsRecView.setAdapter(adapter); + reviewsRecView.setLayoutManager(new LinearLayoutManager(this)); + if (null != reviews) { + if (reviews.size()>0) { + adapter.setReviews(reviews); + } + } + + btnAddToCart.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Utils.addItemToCart(GroceryItemActivity.this, incomingItem); + Intent cartIntent = new Intent(GroceryItemActivity.this, CartActivity.class); + cartIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(cartIntent); + } + }); + + txtAddReview.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + AddReviewDialog dialog = new AddReviewDialog(); + Bundle bundle = new Bundle(); + bundle.putParcelable(GROCERY_ITEM_KEY, incomingItem); + dialog.setArguments(bundle); + dialog.show(getSupportFragmentManager(), "add review"); + } + }); + + handleRating(); + } + } + } + + private void handleRating() { + switch (incomingItem.getRate()) { + case 0: + firstEmptyStar.setVisibility(View.VISIBLE); + firstFilledStar.setVisibility(View.GONE); + secondEmptyStar.setVisibility(View.VISIBLE); + secondFilledStar.setVisibility(View.GONE); + thirdEmptyStar.setVisibility(View.VISIBLE); + thirdFilledStar.setVisibility(View.GONE); + break; + case 1: + firstEmptyStar.setVisibility(View.GONE); + firstFilledStar.setVisibility(View.VISIBLE); + secondEmptyStar.setVisibility(View.VISIBLE); + secondFilledStar.setVisibility(View.GONE); + thirdEmptyStar.setVisibility(View.VISIBLE); + thirdFilledStar.setVisibility(View.GONE); + break; + case 2: + firstEmptyStar.setVisibility(View.GONE); + firstFilledStar.setVisibility(View.VISIBLE); + secondEmptyStar.setVisibility(View.GONE); + secondFilledStar.setVisibility(View.VISIBLE); + thirdEmptyStar.setVisibility(View.VISIBLE); + thirdFilledStar.setVisibility(View.GONE); + break; + case 3: + firstEmptyStar.setVisibility(View.GONE); + firstFilledStar.setVisibility(View.VISIBLE); + secondEmptyStar.setVisibility(View.GONE); + secondFilledStar.setVisibility(View.VISIBLE); + thirdEmptyStar.setVisibility(View.GONE); + thirdFilledStar.setVisibility(View.VISIBLE); + break; + default: + break; + } + + firstStarRelLayout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (incomingItem.getRate() != 1) { + Utils.changeRate(GroceryItemActivity.this, incomingItem.getId(), 1); + + Utils.changeUserPoint(GroceryItemActivity.this, incomingItem, (1-incomingItem.getRate())*2); + + incomingItem.setRate(1); + handleRating(); + } + } + }); + + secondStarRelLayout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (incomingItem.getRate() != 2) { + Utils.changeRate(GroceryItemActivity.this, incomingItem.getId(), 2); + Utils.changeUserPoint(GroceryItemActivity.this, incomingItem, (2-incomingItem.getRate())*2); + incomingItem.setRate(2); + handleRating(); + } + } + }); + + thirdStarRelLayout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (incomingItem.getRate() != 3) { + Utils.changeRate(GroceryItemActivity.this, incomingItem.getId(), 3); + Utils.changeUserPoint(GroceryItemActivity.this, incomingItem, (3-incomingItem.getRate())*2); + incomingItem.setRate(3); + handleRating(); + } + } + }); + } + + private void initViews() { + txtName = findViewById(R.id.txtName); + txtDescription = findViewById(R.id.txtDescription); + txtPrice = findViewById(R.id.txtPrice); + txtAddReview = findViewById(R.id.txtAddReview); + itemImage = findViewById(R.id.itemImage); + firstEmptyStar = findViewById(R.id.firstEmptyStar); + firstFilledStar = findViewById(R.id.firstFilledStar); + secondEmptyStar = findViewById(R.id.secondEmptyStar); + secondFilledStar = findViewById(R.id.secondFilledStar); + thirdEmptyStar = findViewById(R.id.thirdEmptyStar); + thirdFilledStar = findViewById(R.id.thirdFilledStar); + btnAddToCart = findViewById(R.id.btnAddToCart); + reviewsRecView = findViewById(R.id.reviewsRecView); + firstStarRelLayout = findViewById(R.id.firstStarRelLayout); + secondStarRelLayout = findViewById(R.id.secondStarRelLayout); + thirdStarRelLayout = findViewById(R.id.thirdStarRelLayout); + toolbar = findViewById(R.id.toolbar); + } + + @Override + protected void onStart() { + super.onStart(); + + Intent intent = new Intent(this, TrackUserTime.class); + bindService(intent, connection, BIND_AUTO_CREATE); + } + + @Override + protected void onStop() { + super.onStop(); + + if (isBound) { + unbindService(connection); + } + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItemAdapter.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItemAdapter.java new file mode 100644 index 00000000..48f00c60 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/GroceryItemAdapter.java @@ -0,0 +1,79 @@ +package org.meicode.meimall; + +import android.content.Context; +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.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.bumptech.glide.Glide; +import com.google.android.material.card.MaterialCardView; + +import java.util.ArrayList; + +import static org.meicode.meimall.GroceryItemActivity.GROCERY_ITEM_KEY; + +public class GroceryItemAdapter extends RecyclerView.Adapter{ + + private ArrayList items = new ArrayList<>(); + private Context context; + + public GroceryItemAdapter(Context context) { + this.context = context; + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.grocery_item, parent, false); + return new ViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, final int position) { + holder.txtName.setText(items.get(position).getName()); + holder.txtPrice.setText(String.valueOf(items.get(position).getPrice()) + "$"); + Glide.with(context) + .asBitmap() + .load(items.get(position).getImageUrl()) + .into(holder.image); + holder.parent.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(context, GroceryItemActivity.class); + intent.putExtra(GROCERY_ITEM_KEY, items.get(position)); + context.startActivity(intent); + } + }); + } + + @Override + public int getItemCount() { + return items.size(); + } + + public void setItems(ArrayList items) { + this.items = items; + notifyDataSetChanged(); + } + + public class ViewHolder extends RecyclerView.ViewHolder { + + private TextView txtName, txtPrice; + private ImageView image; + private MaterialCardView parent; + + public ViewHolder(@NonNull View itemView) { + super(itemView); + txtName = itemView.findViewById(R.id.txtName); + txtPrice = itemView.findViewById(R.id.txtPrice); + image = itemView.findViewById(R.id.image); + parent = itemView.findViewById(R.id.parent); + } + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/LicencesDialog.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/LicencesDialog.java new file mode 100644 index 00000000..4682c806 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/LicencesDialog.java @@ -0,0 +1,36 @@ +package org.meicode.meimall; + +import android.app.Dialog; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; + +public class LicencesDialog extends DialogFragment { + + @NonNull + @Override + public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { + View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_licences, null); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) + .setView(view); + + TextView textView = view.findViewById(R.id.txtLicences); + Button btnDismiss = view.findViewById(R.id.btnDismiss); + + textView.setText(Utils.getLicenses()); + btnDismiss.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + return builder.create(); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/MainActivity.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/MainActivity.java new file mode 100644 index 00000000..18545ecb --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/MainActivity.java @@ -0,0 +1,104 @@ +package org.meicode.meimall; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.fragment.app.FragmentTransaction; + +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.view.MenuItem; +import android.widget.Toast; + +import com.google.android.material.appbar.MaterialToolbar; +import com.google.android.material.navigation.NavigationView; + +import static org.meicode.meimall.AllCategoriesDialog.ALL_CATEGORIES; +import static org.meicode.meimall.AllCategoriesDialog.CALLING_ACTIVITY; + +public class MainActivity extends AppCompatActivity { + + private DrawerLayout drawer; + private NavigationView navigationView; + private MaterialToolbar toolbar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + initViews(); + Utils.initSharedPreferences(this); + + setSupportActionBar(toolbar); + ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, + R.string.drawer_open, R.string.drawer_close); + drawer.addDrawerListener(toggle); + toggle.syncState(); + + navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()) { + case R.id.cart: + Intent cartIntent = new Intent(MainActivity.this, CartActivity.class); + cartIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(cartIntent); + break; + case R.id.categories: + AllCategoriesDialog dialog = new AllCategoriesDialog(); + Bundle bundle = new Bundle(); + bundle.putStringArrayList(ALL_CATEGORIES, Utils.getCategories(MainActivity.this)); + bundle.putString(CALLING_ACTIVITY, "main_activity"); + dialog.setArguments(bundle); + dialog.show(getSupportFragmentManager(), "all categories dialog"); + break; + case R.id.about: + new AlertDialog.Builder(MainActivity.this) + .setTitle("About Us") + .setMessage("Designed and Developed by Gagandeep kumar\n" + + "Visit for more") + .setPositiveButton("Visit", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Intent websiteIntent = new Intent(MainActivity.this, WebsiteActivity.class); + startActivity(websiteIntent); + } + }).create().show(); + break; + case R.id.terms: + new AlertDialog.Builder(MainActivity.this) + .setTitle("Terms") + .setMessage("There are no terms, Enjoy using the application :)") + .setPositiveButton("Dismiss", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + + } + }).create().show(); + break; + case R.id.licences: + LicencesDialog licencesDialog = new LicencesDialog(); + licencesDialog.show(getSupportFragmentManager(), "licences"); + break; + default: + break; + } + return false; + } + }); + + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, new MainFragment()); + transaction.commit(); + } + + private void initViews() { + drawer = findViewById(R.id.drawer); + navigationView = findViewById(R.id.navigationView); + toolbar = findViewById(R.id.toolbar); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/MainFragment.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/MainFragment.java new file mode 100644 index 00000000..c3c3a384 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/MainFragment.java @@ -0,0 +1,135 @@ +package org.meicode.meimall; + +import android.content.Intent; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.bottomnavigation.BottomNavigationView; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; + +public class MainFragment extends Fragment { + + private BottomNavigationView bottomNavigationView; + + private RecyclerView newItemsRecView, popularItemsRecView, suggestedItemsRecView; + + private GroceryItemAdapter newItemsAdapter, popularItemsAdapter, suggestedItemsAdapter; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_main, container, false); + + initView(view); + initBottomNavView(); + +// Utils.clearSharedPreferences(getActivity()); + + return view; + } + + @Override + public void onResume() { + super.onResume(); + initRecViews(); + } + + private void initRecViews() { + newItemsAdapter = new GroceryItemAdapter(getActivity()); + newItemsRecView.setAdapter(newItemsAdapter); + newItemsRecView.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.HORIZONTAL, false)); + + popularItemsAdapter = new GroceryItemAdapter(getActivity()); + popularItemsRecView.setAdapter(popularItemsAdapter); + popularItemsRecView.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.HORIZONTAL, false)); + + suggestedItemsAdapter = new GroceryItemAdapter(getActivity()); + suggestedItemsRecView.setAdapter(suggestedItemsAdapter); + suggestedItemsRecView.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.HORIZONTAL, false)); + + ArrayList newItems = Utils.getAllItems(getActivity()); + if (null != newItems) { + Comparator newItemsComparator = new Comparator() { + @Override + public int compare(GroceryItem o1, GroceryItem o2) { + return o1.getId() - o2.getId(); + } + }; + + Comparator reverseComparator = Collections.reverseOrder(newItemsComparator); + Collections.sort(newItems, reverseComparator); + newItemsAdapter.setItems(newItems); + } + + ArrayList popularItems = Utils.getAllItems(getActivity()); + if (null != popularItems) { + Comparator popularItemsComparator = new Comparator() { + @Override + public int compare(GroceryItem o1, GroceryItem o2) { + return o1.getPopularityPoint() - o2.getPopularityPoint(); + } + }; + Collections.sort(popularItems, Collections.reverseOrder(popularItemsComparator)); + popularItemsAdapter.setItems(popularItems); + } + + ArrayList suggestedItems = Utils.getAllItems(getActivity()); + if (null != suggestedItems) { + Comparator suggestedItemsComparator = new Comparator() { + @Override + public int compare(GroceryItem o1, GroceryItem o2) { + return o1.getUserPoint() - o2.getUserPoint(); + } + }; + Collections.sort(suggestedItems, Collections.reverseOrder(suggestedItemsComparator)); + suggestedItemsAdapter.setItems(suggestedItems); + } + } + + private void initBottomNavView() { + bottomNavigationView.setSelectedItemId(R.id.home); + // TODO: Finish this + bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()) { + case R.id.home: + break; + case R.id.search: + Intent intent = new Intent(getActivity(), SearchActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + break; + case R.id.cart: + Intent cartIntent = new Intent(getActivity(), CartActivity.class); + cartIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(cartIntent); + break; + default: + break; + } + return false; + } + }); + } + + private void initView(View view) { + bottomNavigationView = view.findViewById(R.id.bottomNavView); + newItemsRecView = view.findViewById(R.id.newItemsRecView); + popularItemsRecView = view.findViewById(R.id.popularItemRecView); + suggestedItemsRecView = view.findViewById(R.id.suggestedItemsRecView); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Order.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Order.java new file mode 100644 index 00000000..1da87754 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Order.java @@ -0,0 +1,117 @@ +package org.meicode.meimall; + +import java.util.ArrayList; + +public class Order { + private int id; + private ArrayList items; + private String address; + private String zipCode; + private String phoneNumber; + private String email; + private double totalPrice; + private String paymentMethod; + private boolean success; + + public Order(ArrayList items, String address, String zipCode, String phoneNumber, String email, double totalPrice, String paymentMethod, boolean success) { + this.id = Utils.getOrderId(); + this.items = items; + this.address = address; + this.zipCode = zipCode; + this.phoneNumber = phoneNumber; + this.email = email; + this.totalPrice = totalPrice; + this.paymentMethod = paymentMethod; + this.success = success; + } + + public Order() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public ArrayList getItems() { + return items; + } + + public void setItems(ArrayList items) { + this.items = items; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getZipCode() { + return zipCode; + } + + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public double getTotalPrice() { + return totalPrice; + } + + public void setTotalPrice(double totalPrice) { + this.totalPrice = totalPrice; + } + + public String getPaymentMethod() { + return paymentMethod; + } + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + @Override + public String toString() { + return "Order{" + + "id=" + id + + ", items=" + items + + ", address='" + address + '\'' + + ", zipCode='" + zipCode + '\'' + + ", phoneNumber='" + phoneNumber + '\'' + + ", email='" + email + '\'' + + ", totalPrice=" + totalPrice + + ", paymentMethod='" + paymentMethod + '\'' + + ", success=" + success + + '}'; + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/OrderEndPoint.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/OrderEndPoint.java new file mode 100644 index 00000000..49d56815 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/OrderEndPoint.java @@ -0,0 +1,11 @@ +package org.meicode.meimall; + +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.POST; + +public interface OrderEndPoint { + + @POST("posts") + Call newOrder(@Body Order order); +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/PaymentResultFragment.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/PaymentResultFragment.java new file mode 100644 index 00000000..f476377d --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/PaymentResultFragment.java @@ -0,0 +1,75 @@ +package org.meicode.meimall; + +import android.content.Intent; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; + +import static org.meicode.meimall.SecondCartFragment.ORDER_KEY; + +public class PaymentResultFragment extends Fragment { + + private TextView txtMessage; + private Button btnHome; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_payment_result, container, false); + + initViews(view); + + Bundle bundle = getArguments(); + if (null != bundle) { + String jsonOrder = bundle.getString(ORDER_KEY); + if (null != jsonOrder) { + Gson gson = new Gson(); + Type type = new TypeToken(){}.getType(); + Order order = gson.fromJson(jsonOrder, type); + if (null != order) { + if (order.isSuccess()) { + txtMessage.setText("Payment was successful\nYour Order will arrive in 3 days"); + Utils.clearCartItems(getActivity()); + for (GroceryItem item: order.getItems()) { + Utils.increasePopularityPoint(getActivity(), item, 1); + Utils.changeUserPoint(getActivity(), item, 4); + } + }else { + txtMessage.setText("Payment failed,\nPlease try another payment method"); + } + } + }else { + txtMessage.setText("Payment failed,\nPlease try another payment method"); + } + } + + btnHome.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(getActivity(), MainActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + }); + + return view; + } + + private void initViews(View view) { + txtMessage = view.findViewById(R.id.txtMessage); + btnHome = view.findViewById(R.id.btnHome); + + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Review.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Review.java new file mode 100644 index 00000000..900161ad --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Review.java @@ -0,0 +1,57 @@ +package org.meicode.meimall; + +public class Review { + private int groceryItemId; + private String userName; + private String text; + private String date; + + public Review(int groceryItemId, String userName, String text, String date) { + this.groceryItemId = groceryItemId; + this.userName = userName; + this.text = text; + this.date = date; + } + + public int getGroceryItemId() { + return groceryItemId; + } + + public void setGroceryItemId(int groceryItemId) { + this.groceryItemId = groceryItemId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + @Override + public String toString() { + return "Review{" + + "groceryItemId=" + groceryItemId + + ", userName='" + userName + '\'' + + ", text='" + text + '\'' + + ", date='" + date + '\'' + + '}'; + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/ReviewsAdapter.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/ReviewsAdapter.java new file mode 100644 index 00000000..26007341 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/ReviewsAdapter.java @@ -0,0 +1,56 @@ +package org.meicode.meimall; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.ArrayList; + +public class ReviewsAdapter extends RecyclerView.Adapter { + + private ArrayList reviews = new ArrayList<>(); + + public ReviewsAdapter() { + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.reviews_item, parent, false); + return new ViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + holder.txtReview.setText(reviews.get(position).getText()); + holder.txtDate.setText(reviews.get(position).getDate()); + holder.txtUserName.setText(reviews.get(position).getUserName()); + } + + @Override + public int getItemCount() { + return reviews.size(); + } + + public void setReviews(ArrayList reviews) { + this.reviews = reviews; + notifyDataSetChanged(); + } + + public class ViewHolder extends RecyclerView.ViewHolder { + + private TextView txtUserName, txtReview, txtDate; + + public ViewHolder(@NonNull View itemView) { + super(itemView); + + txtReview = itemView.findViewById(R.id.txtReview); + txtUserName = itemView.findViewById(R.id.txtUserName); + txtDate = itemView.findViewById(R.id.txtDate); + } + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SearchActivity.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SearchActivity.java new file mode 100644 index 00000000..89d3b6cf --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SearchActivity.java @@ -0,0 +1,271 @@ +package org.meicode.meimall; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.content.Intent; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.MenuItem; +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.android.material.appbar.MaterialToolbar; +import com.google.android.material.bottomnavigation.BottomNavigationView; + +import java.util.ArrayList; + +import static org.meicode.meimall.AllCategoriesDialog.ALL_CATEGORIES; +import static org.meicode.meimall.AllCategoriesDialog.CALLING_ACTIVITY; + +public class SearchActivity extends AppCompatActivity implements AllCategoriesDialog.GetCategory { + private static final String TAG = "SearchActivity"; + + @Override + public void onGetCategoryResult(String category) { + ArrayList items = Utils.getItemsByCategory(this, category); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + + private MaterialToolbar toolbar; + private EditText searchBox; + private ImageView btnSearch; + private TextView firstCat, secondCat, thirdCat, txtAllCategories; + private BottomNavigationView bottomNavigationView; + private RecyclerView recyclerView; + + private GroceryItemAdapter adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_search); + + initViews(); + initBottomNavView(); + + setSupportActionBar(toolbar); + + adapter = new GroceryItemAdapter(this); + recyclerView.setAdapter(adapter); + recyclerView.setLayoutManager(new GridLayoutManager(this, 2)); + + Intent intent = getIntent(); + if (null != intent) { + String category = intent.getStringExtra("category"); + if (null != category) { + ArrayList items = Utils.getItemsByCategory(this, category); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + } + + btnSearch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + initSearch(); + } + }); + + searchBox.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + initSearch(); + } + + @Override + public void afterTextChanged(Editable s) { + + } + }); + + ArrayList categories = Utils.getCategories(this); + if (null != categories) { + if (categories.size()>0) { + if (categories.size() == 1) { + showCategories(categories, 1); + }else if (categories.size() == 2) { + showCategories(categories, 2); + }else { + showCategories(categories, 3); + } + } + } + + txtAllCategories.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + AllCategoriesDialog dialog = new AllCategoriesDialog(); + Bundle bundle = new Bundle(); + bundle.putStringArrayList(ALL_CATEGORIES, Utils.getCategories(SearchActivity.this)); + bundle.putString(CALLING_ACTIVITY, "search_activity"); + dialog.setArguments(bundle); + dialog.show(getSupportFragmentManager(), "all categories dialog"); + } + }); + } + + private void increaseUserPoint(ArrayList items) { + for (GroceryItem i: items) { + Utils.changeUserPoint(this, i, 1); + } + } + + private void showCategories(final ArrayList categories, int i) { + switch (i) { + case 1: + firstCat.setVisibility(View.VISIBLE); + firstCat.setText(categories.get(0)); + secondCat.setVisibility(View.GONE); + thirdCat.setVisibility(View.GONE); + firstCat.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ArrayList items = Utils.getItemsByCategory(SearchActivity.this, categories.get(0)); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + }); + break; + case 2: + firstCat.setVisibility(View.VISIBLE); + firstCat.setText(categories.get(0)); + secondCat.setVisibility(View.VISIBLE); + secondCat.setText(categories.get(1)); + thirdCat.setVisibility(View.GONE); + firstCat.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ArrayList items = Utils.getItemsByCategory(SearchActivity.this, categories.get(0)); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + }); + secondCat.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ArrayList items = Utils.getItemsByCategory(SearchActivity.this, categories.get(1)); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + }); + break; + case 3: + firstCat.setVisibility(View.VISIBLE); + firstCat.setText(categories.get(0)); + secondCat.setVisibility(View.VISIBLE); + secondCat.setText(categories.get(1)); + thirdCat.setVisibility(View.VISIBLE); + thirdCat.setText(categories.get(2)); + firstCat.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ArrayList items = Utils.getItemsByCategory(SearchActivity.this, categories.get(0)); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + }); + secondCat.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ArrayList items = Utils.getItemsByCategory(SearchActivity.this, categories.get(1)); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + }); + thirdCat.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ArrayList items = Utils.getItemsByCategory(SearchActivity.this, categories.get(2)); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + }); + break; + default: + firstCat.setVisibility(View.GONE); + secondCat.setVisibility(View.GONE); + thirdCat.setVisibility(View.GONE); + break; + } + } + + private void initSearch() { + if (!searchBox.getText().toString().equals("")) { + // TODO: get items + String name = searchBox.getText().toString(); + ArrayList items = Utils.searchForItems(this, name); + if (null != items) { + adapter.setItems(items); + increaseUserPoint(items); + } + } + } + + private void initBottomNavView() { + bottomNavigationView.setSelectedItemId(R.id.search); + // TODO: Finish this + bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()) { + case R.id.home: + Intent intent = new Intent(SearchActivity.this, MainActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + break; + case R.id.search: + break; + case R.id.cart: + Intent cartIntent = new Intent(SearchActivity.this, CartActivity.class); + cartIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(cartIntent); + break; + default: + break; + } + return false; + } + }); + } + + private void initViews() { + toolbar = findViewById(R.id.toolbar); + searchBox = findViewById(R.id.searchBox); + btnSearch = findViewById(R.id.btnSearch); + firstCat = findViewById(R.id.txtFirstCat); + secondCat = findViewById(R.id.txtSecondCat); + thirdCat = findViewById(R.id.txtThirdCat); + txtAllCategories = findViewById(R.id.txtAllCategories); + bottomNavigationView = findViewById(R.id.bottomNavView); + recyclerView = findViewById(R.id.recyclerView); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SecondCartFragment.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SecondCartFragment.java new file mode 100644 index 00000000..a16d7362 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SecondCartFragment.java @@ -0,0 +1,129 @@ +package org.meicode.meimall; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.ArrayList; + +public class SecondCartFragment extends Fragment { + + public static final String ORDER_KEY = "order"; + + private EditText edtTxtAddress, edtTxtZipCode, edtTxtPhoneNumber, edtTxtEmail; + private Button btnNext, btnBack; + private TextView txtWarning; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_cart_second, container, false); + + initViews(view); + + Bundle bundle = getArguments(); + if (null != bundle) { + String jsonOrder = bundle.getString(ORDER_KEY); + if (null != jsonOrder) { + Gson gson = new Gson(); + Type type = new TypeToken() {}.getType(); + Order order = gson.fromJson(jsonOrder, type); + if (null != order) { + edtTxtAddress.setText(order.getAddress()); + edtTxtPhoneNumber.setText(order.getPhoneNumber()); + edtTxtZipCode.setText(order.getZipCode()); + edtTxtEmail.setText(order.getEmail()); + } + } + } + + btnBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, new FirstCartFragment()); + transaction.commit(); + } + }); + + btnNext.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (validateData()) { + txtWarning.setVisibility(View.GONE); + + ArrayList cartItems = Utils.getCartItems(getActivity()); + if (null != cartItems) { + Order order = new Order(); + order.setItems(cartItems); + order.setAddress(edtTxtAddress.getText().toString()); + order.setPhoneNumber(edtTxtPhoneNumber.getText().toString()); + order.setZipCode(edtTxtZipCode.getText().toString()); + order.setEmail(edtTxtEmail.getText().toString()); + order.setTotalPrice(calculateTotalPrice(cartItems)); + + Gson gson = new Gson(); + String jsonOrder = gson.toJson(order); + Bundle bundle = new Bundle(); + bundle.putString(ORDER_KEY, jsonOrder); + + ThirdCartFragment thirdCartFragment = new ThirdCartFragment(); + thirdCartFragment.setArguments(bundle); + FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, thirdCartFragment); + transaction.commit(); + } + + }else { + txtWarning.setVisibility(View.VISIBLE); + txtWarning.setText("Please Fill All The Blanks"); + } + } + }); + + return view; + } + + private double calculateTotalPrice(ArrayList items) { + double price =0; + for (GroceryItem item: items) { + price += item.getPrice(); + } + + price = Math.round(price*100.0)/100.0; + + return price; + } + + private boolean validateData() { + if (edtTxtAddress.getText().toString().equals("") || edtTxtPhoneNumber.getText().toString().equals("") || + edtTxtZipCode.getText().toString().equals("") || edtTxtEmail.getText().toString().equals("")) { + return false; + } + + return true; + } + + private void initViews(View view) { + edtTxtAddress = view.findViewById(R.id.edtTxtAddress); + edtTxtZipCode = view.findViewById(R.id.edtTxtZipCode); + edtTxtPhoneNumber = view.findViewById(R.id.edtTxtPhoneNumber); + edtTxtEmail = view.findViewById(R.id.edtTxtEmail); + btnNext = view.findViewById(R.id.btnNext); + btnBack = view.findViewById(R.id.btnBack); + txtWarning = view.findViewById(R.id.txtWarning); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SplashScreen.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SplashScreen.java new file mode 100644 index 00000000..044b1c1e --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/SplashScreen.java @@ -0,0 +1,42 @@ +package org.meicode.meimall; + +import androidx.appcompat.app.AppCompatActivity; +import pl.droidsonroids.gif.GifImageView; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.TextView; + +public class SplashScreen extends AppCompatActivity { + + private static int SPLASH_TIMER = 5000; + + //variables + GifImageView background; + TextView powerdBy; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + setContentView(R.layout.activity_splash_screen); + + //Hooks + background = (GifImageView) findViewById(R.id.welcome); + powerdBy = (TextView) findViewById(R.id.textView); + + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + Intent intent = new Intent(getApplicationContext(), MainActivity.class); + startActivity(intent); + finish(); + } + },SPLASH_TIMER); + + } +} \ No newline at end of file diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/ThirdCartFragment.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/ThirdCartFragment.java new file mode 100644 index 00000000..b6bff650 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/ThirdCartFragment.java @@ -0,0 +1,154 @@ +package org.meicode.meimall; + +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.RadioGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; + +import okhttp3.OkHttpClient; +import okhttp3.logging.HttpLoggingInterceptor; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +import static org.meicode.meimall.SecondCartFragment.ORDER_KEY; + +public class ThirdCartFragment extends Fragment { + private static final String TAG = "ThirdCartFragment"; + + private Button btnBack, btnCheckout; + private TextView txtItems, txtAddress, txtPhoneNumber, txtTotalPrice; + private RadioGroup rgPayment; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_cart_third, container, false); + + initViews(view); + + Bundle bundle = getArguments(); + if (null != bundle) { + final String jsonOrder = bundle.getString(ORDER_KEY); + if (null != jsonOrder) { + Gson gson = new Gson(); + Type type = new TypeToken() {}.getType(); + final Order order = gson.fromJson(jsonOrder, type); + if (null != order) { + String items = ""; + for (GroceryItem i: order.getItems()) { + items += "\n\t" + i.getName(); + } + + txtItems.setText(items); + txtAddress.setText(order.getAddress()); + txtPhoneNumber.setText(order.getPhoneNumber()); + txtTotalPrice.setText(String.valueOf(order.getTotalPrice())); + + + btnBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Bundle backBundle = new Bundle(); + backBundle.putString(ORDER_KEY, jsonOrder); + SecondCartFragment secondCartFragment = new SecondCartFragment(); + secondCartFragment.setArguments(backBundle); + FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, secondCartFragment); + transaction.commit(); + } + }); + + btnCheckout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + switch (rgPayment.getCheckedRadioButtonId()) { + case R.id.rbPayPal: + order.setPaymentMethod("PayPal"); + break; + case R.id.rbCreditCard: + order.setPaymentMethod("Credit Card"); + break; + default: + order.setPaymentMethod("Unknown"); + break; + } + + order.setSuccess(true); + + // TODO: 4/27/2020 Send Your Request with Retrofit + + HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor() + .setLevel(HttpLoggingInterceptor.Level.BODY); + + OkHttpClient client = new OkHttpClient.Builder() + .addInterceptor(interceptor) + .build(); + + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://jsonplaceholder.typicode.com/") + .addConverterFactory(GsonConverterFactory.create()) + .client(client) + .build(); + + OrderEndPoint endPoint = retrofit.create(OrderEndPoint.class); + Call call = endPoint.newOrder(order); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + Log.d(TAG, "onResponse: code: " + response.code()); + if (response.isSuccessful()) { + Bundle resultBundle = new Bundle(); + resultBundle.putString(ORDER_KEY, gson.toJson(response.body())); + PaymentResultFragment paymentResultFragment = new PaymentResultFragment(); + paymentResultFragment.setArguments(resultBundle); + FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, paymentResultFragment); + transaction.commit(); + }else { + FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.container, new PaymentResultFragment()); + transaction.commit(); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + t.printStackTrace(); + } + }); + } + }); + } + } + } + + return view; + } + + private void initViews(View view) { + rgPayment = view.findViewById(R.id.rgPaymentMethod); + txtAddress = view.findViewById(R.id.txtAddress); + txtPhoneNumber = view.findViewById(R.id.txtPhoneNumber); + txtItems = view.findViewById(R.id.txtItems); + txtTotalPrice = view.findViewById(R.id.txtPrice); + btnBack = view.findViewById(R.id.btnBack); + btnCheckout = view.findViewById(R.id.btnCheckout); + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/TrackUserTime.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/TrackUserTime.java new file mode 100644 index 00000000..5ddd02e9 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/TrackUserTime.java @@ -0,0 +1,64 @@ +package org.meicode.meimall; + +import android.app.Service; +import android.content.Intent; +import android.os.Binder; +import android.os.IBinder; + +import androidx.annotation.Nullable; + +public class TrackUserTime extends Service { + + private int seconds = 0; + private boolean shouldFinish; + private GroceryItem item; + + private IBinder binder = new LocalBinder(); + + @Nullable + @Override + public IBinder onBind(Intent intent) { + trackTime(); + return binder; + } + + public class LocalBinder extends Binder { + TrackUserTime getService() { + return TrackUserTime.this; + } + } + + private void trackTime () { + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + while (!shouldFinish) { + try { + Thread.sleep(1000); + seconds++; + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }); + thread.start(); + } + + public void setItem(GroceryItem item) { + this.item = item; + } + + @Override + public void onDestroy() { + super.onDestroy(); + + shouldFinish = true; + int minutes = seconds/60; + if (minutes>0) { + if (null != item) { + Utils.changeUserPoint(this, item, minutes); + } + } + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Utils.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Utils.java new file mode 100644 index 00000000..1b2b716f --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/Utils.java @@ -0,0 +1,462 @@ +package org.meicode.meimall; + +import android.content.Context; +import android.content.SharedPreferences; +import android.util.Log; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.ArrayList; + +public class Utils { + private static final String TAG = "Utils"; + + private static int ID = 0; + private static int ORDER_ID = 0; + + private static final String ALL_ITEMS_KEY = "all_items"; + private static final String DB_NAME = "fake_database"; + private static final String CART_ITEMS_KEY = "cart_items"; + private static Gson gson = new Gson(); + private static Type groceryListType = new TypeToken>(){}.getType(); + + public static void initSharedPreferences(Context context) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + ArrayList allItems = gson.fromJson(sharedPreferences.getString(ALL_ITEMS_KEY, null), groceryListType); + if (null == allItems) { + initAllItems(context); + } + } + + public static void clearSharedPreferences(Context context) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.clear(); + editor.commit(); + } + + private static void initAllItems(Context context) { + ArrayList allItems = new ArrayList<>(); + allItems.add(new GroceryItem("Ice Cream", "Ice cream (derived from earlier iced cream or cream ice) is a sweetened frozen food typically eaten as a snack or dessert. It may be made from dairy milk or cream and is flavoured with a sweetener, either sugar or an alternative, and any spice, such as cocoa or vanilla.", + "https://anycustombox.com/images/ice-cream-box-02.jpg", + "Food", 5.4, 10)); + + GroceryItem milk = new GroceryItem("Milk", "Milk is a nutrient-rich, white liquid food produced by the mammary glands of mammals. It is the primary source of nutrition for infant mammals before they are able to digest other types of food.", + "https://www.psdmockups.com/wp-content/uploads/2019/06/1L-Tetra-Pak-Carton-Boxes-PSD-Mockup.jpg", + "Drink", 2.3, 8); + allItems.add(milk); + + GroceryItem soda = new GroceryItem("Soda", "A soft drink is a drink that usually contains carbonated water, a sweetener, and a natural or artificial flavoring. The sweetener may be a sugar, high-fructose corn syrup, fruit juice, a sugar substitute, or some combination of these", + "https://cdn.diffords.com/contrib/bws/2019/05/5cc9b8261f976.jpg", + "Drink", 0.99, 15); + allItems.add(soda); + + GroceryItem shampoo = new GroceryItem("Shampoo", "Shampoo is a hair care product, typically in the form of a viscous liquid, that is used for cleaning hair. Less commonly, shampoo is available in bar form, like a bar of soap. Shampoo is used by applying it to wet hair, massaging the product into the scalp, and then rinsing it out. Some users may follow a shampooing with the use of hair conditioner.", + "https://res.cloudinary.com/mtree/image/upload/q_auto,f_auto/HeadandShoulders_PH_MW/9Gq7gblVJdM5RfPkfdp5H/6302bb00431710a9b9abf450a31b73e3/HS_PH_Menthol_Large.jpg", + "Cleanser", 14.5, 9); + allItems.add(shampoo); + + GroceryItem spaghetti = new GroceryItem("Spaghetti", + "Spaghetti is a long, thin, solid, cylindrical pasta. It is a staple food of traditional Italian cuisine. Like other pasta, spaghetti is made of milled wheat and water and sometimes enriched with vitamins and minerals. Italian spaghetti is typically made from durum wheat semolina.", + "https://sc01.alicdn.com/kf/UTB8AoDnIJoSdeJk43Owq6ya4XXak.jpg_350x350.jpg", + "Food", 3.85, 6); + + allItems.add(spaghetti); + + GroceryItem soap = new GroceryItem("Soap", "Soap is a salt of a fatty acid[1] used in a variety of cleansing and lubricating products. In a domestic setting, soaps are surfactants usually used for washing, bathing, and other types of housekeeping. In industrial settings, soaps are used as thickeners, components of some lubricants, and precursors to catalysts.", + "https://www.londondrugs.com/on/demandware.static/-/Sites-londondrugs-master/default/dwfcbde309/products/L9276163/large/L9276163.JPG", + "Cleanser", 2.65, 14); + allItems.add(soap); + + GroceryItem juice = new GroceryItem("Juice", "Juice is a drink made from the extraction or pressing of the natural liquid contained in fruit and vegetables. It can also refer to liquids that are flavored with concentrate or other biological food sources, such as meat or seafood, such as clam juice. Juice is commonly consumed as a beverage or used as an ingredient or flavoring in foods or other beverages, as for smoothies. Juice emerged as a popular beverage choice after the development of pasteurization methods enabled its preservation without using fermentation (which is used in wine production)", + "https://dg6qn11ynnp6a.cloudfront.net/wp-content/uploads/2015/04/199373.jpg", + "Drink", 3.45, 25); + allItems.add(juice); + + GroceryItem walnut = new GroceryItem("Walnut", "A walnut is the nut of any tree of the genus Juglans (Family Juglandaceae), particularly the Persian or English walnut, Juglans regia. A walnut is the edible seed of a drupe, and thus not a true botanical nut. It is commonly consumed as a nut.", + "https://sc01.alicdn.com/kf/Uc583c440540142d89b55cc6fbde774106/969734566/Uc583c440540142d89b55cc6fbde774106.jpg", + "Nuts", 5.6, 4); + allItems.add(walnut); + + GroceryItem pistachio = new GroceryItem("Pistachio", "The pistachio (/pɪˈstɑːʃiˌoʊ, -ˈstæ-/, Pistacia vera), a member of the cashew family, is a small tree originating from Central Asia and the Middle East. The tree produces seeds that are widely consumed as food. Pistacia vera often is confused with other species in the genus Pistacia that are also known as pistachio.", + "https://sc01.alicdn.com/kf/UTB8kYzuIlahduJk43Jaq6zM8FXaz.jpg", + "Nuts", 9.85, 15); + allItems.add(pistachio); + + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.putString(ALL_ITEMS_KEY, gson.toJson(allItems)); + editor.commit(); + } + + public static ArrayList getAllItems(Context context) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + ArrayList allItems = gson.fromJson(sharedPreferences.getString(ALL_ITEMS_KEY, null), groceryListType); + return allItems; + } + + public static void changeRate(Context context, int itemId, int newRate) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + ArrayList allItems = gson.fromJson(sharedPreferences.getString(ALL_ITEMS_KEY, null), groceryListType); + if (null != allItems) { + ArrayList newItems = new ArrayList<>(); + for (GroceryItem i: allItems) { + if (i.getId() == itemId) { + i.setRate(newRate); + newItems.add(i); + }else { + newItems.add(i); + } + } + + editor.remove(ALL_ITEMS_KEY); + editor.putString(ALL_ITEMS_KEY, gson.toJson(newItems)); + editor.commit(); + } + } + + public static void addReview(Context context, Review review) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + ArrayList allItems = getAllItems(context); + if (null != allItems) { + ArrayList newItems = new ArrayList<>(); + for (GroceryItem i: allItems) { + if (i.getId() == review.getGroceryItemId()) { + ArrayList reviews = i.getReviews(); + reviews.add(review); + i.setReviews(reviews); + newItems.add(i); + }else { + newItems.add(i); + } + } + + editor.remove(ALL_ITEMS_KEY); + editor.putString(ALL_ITEMS_KEY, gson.toJson(newItems)); + editor.commit(); + } + } + + public static ArrayList getReviewById(Context context, int itemId) { + ArrayList allItems = getAllItems(context); + if (null != allItems) { + for (GroceryItem i: allItems) { + if (i.getId() == itemId) { + ArrayList reviews = i.getReviews(); + return reviews; + } + } + } + + return null; + } + + public static void addItemToCart (Context context, GroceryItem item) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + ArrayList cartItems = gson.fromJson(sharedPreferences.getString(CART_ITEMS_KEY, null), groceryListType); + if (cartItems == null) { + cartItems = new ArrayList<>(); + } + + cartItems.add(item); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.remove(CART_ITEMS_KEY); + editor.putString(CART_ITEMS_KEY, gson.toJson(cartItems)); + editor.commit(); + } + + public static ArrayList getCartItems(Context context) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + ArrayList cartItems = gson.fromJson(sharedPreferences.getString(CART_ITEMS_KEY, null), groceryListType); + return cartItems; + } + + public static ArrayList searchForItems(Context context, String text) { + ArrayList allItems = getAllItems(context); + if (null != allItems) { + ArrayList items = new ArrayList<>(); + for (GroceryItem item: allItems) { + if (item.getName().equalsIgnoreCase(text)) { + items.add(item); + } + + String[] names = item.getName().split(" "); + for (int i=0; i getCategories(Context context) { + ArrayList allItems = getAllItems(context); + if (null != allItems) { + ArrayList categories = new ArrayList<>(); + for (GroceryItem item: allItems) { + boolean doesExist = false; + for (String s: categories) { + if (item.getCategory().equals(s)) { + doesExist = true; + } + } + + if (!doesExist) { + categories.add(item.getCategory()); + } + } + + return categories; + } + + return null; + } + + public static ArrayList getItemsByCategory (Context context, String category) { + ArrayList allItems = getAllItems(context); + if (null != allItems) { + ArrayList items = new ArrayList<>(); + for (GroceryItem item: allItems) { + if (item.getCategory().equals(category)) { + items.add(item); + } + } + + return items; + } + + return null; + } + + public static void deleteItemFromCart(Context context, GroceryItem item) { + ArrayList cartItems = getCartItems(context); + if (null != cartItems) { + ArrayList newItems = new ArrayList<>(); + for (GroceryItem i: cartItems) { + if (i.getId() != item.getId()) { + newItems.add(i); + } + } + + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.remove(CART_ITEMS_KEY); + editor.putString(CART_ITEMS_KEY, gson.toJson(newItems)); + editor.commit(); + } + } + + public static void clearCartItems(Context context) { + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.remove(CART_ITEMS_KEY); + editor.commit(); + } + + public static void increasePopularityPoint(Context context, GroceryItem item, int points) { + ArrayList allItems = getAllItems(context); + if (null != allItems) { + ArrayList newItems = new ArrayList<>(); + for (GroceryItem i: allItems) { + if (i.getId() == item.getId()) { + i.setPopularityPoint(i.getPopularityPoint() + points); + newItems.add(i); + }else { + newItems.add(i); + } + } + + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.remove(ALL_ITEMS_KEY); + Gson gson =new Gson(); + editor.putString(ALL_ITEMS_KEY, gson.toJson(newItems)); + editor.commit(); + } + } + + public static void changeUserPoint (Context context, GroceryItem item, int points) { + Log.d(TAG, "changeUserPoint: Attempting to add " + points + " to " + item.getName()); + ArrayList allItems = getAllItems(context); + if (null != allItems) { + ArrayList newItems = new ArrayList<>(); + for (GroceryItem i: allItems) { + if (i.getId() == item.getId()) { + i.setUserPoint(i.getUserPoint() + points); + } + + newItems.add(i); + } + + SharedPreferences sharedPreferences = context.getSharedPreferences(DB_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.remove(ALL_ITEMS_KEY); + editor.putString(ALL_ITEMS_KEY, gson.toJson(newItems)); + editor.commit(); + } + } + + public static int getID() { + ID++; + return ID; + } + + public static int getOrderId() { + ORDER_ID++; + return ORDER_ID; + } + + public static String getLicenses() { + String licenses = ""; + + //Gson + licenses += "Gson\n"; + licenses += "Copyright 2008 Google Inc.\n" + + "\n" + + "Licensed under the Apache License, Version 2.0 (the \"License\");\n" + + "you may not use this file except in compliance with the License.\n" + + "You may obtain a copy of the License at\n" + + "\n" + + " http://www.apache.org/licenses/LICENSE-2.0\n" + + "\n" + + "Unless required by applicable law or agreed to in writing, software\n" + + "distributed under the License is distributed on an \"AS IS\" BASIS,\n" + + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + + "See the License for the specific language governing permissions and\n\n" + + "limitations under the License.\n\n"; + + //Glide + licenses += "Glide\n"; + licenses += "License for everything not in third_party and not otherwise marked:\n" + + "\n" + + "Copyright 2014 Google, Inc. All rights reserved.\n" + + "\n" + + "Redistribution and use in source and binary forms, with or without modification, are\n" + + "permitted provided that the following conditions are met:\n" + + "\n" + + " 1. Redistributions of source code must retain the above copyright notice, this list of\n" + + " conditions and the following disclaimer.\n" + + "\n" + + " 2. Redistributions in binary form must reproduce the above copyright notice, this list\n" + + " of conditions and the following disclaimer in the documentation and/or other materials\n" + + " provided with the distribution.\n" + + "\n" + + "THIS SOFTWARE IS PROVIDED BY GOOGLE, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED\n" + + "WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n" + + "FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE, INC. OR\n" + + "CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n" + + "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n" + + "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n" + + "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n" + + "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n" + + "ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + + "\n" + + "The views and conclusions contained in the software and documentation are those of the\n" + + "authors and should not be interpreted as representing official policies, either expressed\n" + + "or implied, of Google, Inc.\n" + + "---------------------------------------------------------------------------------------------\n" + + "License for third_party/disklrucache:\n" + + "\n" + + "Copyright 2012 Jake Wharton\n" + + "Copyright 2011 The Android Open Source Project\n" + + "\n" + + "Licensed under the Apache License, Version 2.0 (the \"License\");\n" + + "you may not use this file except in compliance with the License.\n" + + "You may obtain a copy of the License at\n" + + "\n" + + " http://www.apache.org/licenses/LICENSE-2.0\n" + + "\n" + + "Unless required by applicable law or agreed to in writing, software\n" + + "distributed under the License is distributed on an \"AS IS\" BASIS,\n" + + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + + "See the License for the specific language governing permissions and\n" + + "limitations under the License.\n" + + "---------------------------------------------------------------------------------------------\n" + + "License for third_party/gif_decoder:\n" + + "\n" + + "Copyright (c) 2013 Xcellent Creations, Inc.\n" + + "\n" + + "Permission is hereby granted, free of charge, to any person obtaining\n" + + "a copy of this software and associated documentation files (the\n" + + "\"Software\"), to deal in the Software without restriction, including\n" + + "without limitation the rights to use, copy, modify, merge, publish,\n" + + "distribute, sublicense, and/or sell copies of the Software, and to\n" + + "permit persons to whom the Software is furnished to do so, subject to\n" + + "the following conditions:\n" + + "\n" + + "The above copyright notice and this permission notice shall be\n" + + "included in all copies or substantial portions of the Software.\n" + + "\n" + + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" + + "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" + + "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" + + "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" + + "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" + + "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" + + "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" + + "---------------------------------------------------------------------------------------------\n" + + "License for third_party/gif_encoder/AnimatedGifEncoder.java and\n" + + "third_party/gif_encoder/LZWEncoder.java:\n" + + "\n" + + "No copyright asserted on the source code of this class. May be used for any\n" + + "purpose, however, refer to the Unisys LZW patent for restrictions on use of\n" + + "the associated LZWEncoder class. Please forward any corrections to\n" + + "kweiner@fmsware.com.\n" + + "\n" + + "-----------------------------------------------------------------------------\n" + + "License for third_party/gif_encoder/NeuQuant.java\n" + + "\n" + + "Copyright (c) 1994 Anthony Dekker\n" + + "\n" + + "NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See\n" + + "\"Kohonen neural networks for optimal colour quantization\" in \"Network:\n" + + "Computation in Neural Systems\" Vol. 5 (1994) pp 351-367. for a discussion of\n" + + "the algorithm.\n" + + "\n" + + "Any party obtaining a copy of these files from the author, directly or\n" + + "indirectly, is granted, free of charge, a full and unrestricted irrevocable,\n" + + "world-wide, paid up, royalty-free, nonexclusive right and license to deal in\n" + + "this software and documentation files (the \"Software\"), including without\n" + + "limitation the rights to use, copy, modify, merge, publish, distribute,\n" + + "sublicense, and/or sell copies of the Software, and to permit persons who\n" + + "receive copies from any such party to do so, with the only requirement being\n" + + "that this copyright notice remain intact.\n\n"; + + //Retrofit + licenses += "Retrofit\n"; + licenses += "Copyright 2013 Square, Inc.\n" + + "\n" + + "Licensed under the Apache License, Version 2.0 (the \"License\");\n" + + "you may not use this file except in compliance with the License.\n" + + "You may obtain a copy of the License at\n" + + "\n" + + " http://www.apache.org/licenses/LICENSE-2.0\n" + + "\n" + + "Unless required by applicable law or agreed to in writing, software\n" + + "distributed under the License is distributed on an \"AS IS\" BASIS,\n" + + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + + "See the License for the specific language governing permissions and\n" + + "limitations under the License.\n\n"; + + return licenses; + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/WebsiteActivity.java b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/WebsiteActivity.java new file mode 100644 index 00000000..f46d9198 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/java/org/meicode/meimall/WebsiteActivity.java @@ -0,0 +1,33 @@ +package org.meicode.meimall; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +public class WebsiteActivity extends AppCompatActivity { + + private WebView webView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_website); + + webView = findViewById(R.id.webView); + + webView.setWebViewClient(new WebViewClient()); + webView.getSettings().setJavaScriptEnabled(true); + webView.loadUrl("www.linkedin.com/in/gagandeep-kumar-b36657170"); + } + + @Override + public void onBackPressed() { + if (webView.canGoBack()) { + webView.goBack(); + }else { + super.onBackPressed(); + } + } +} diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_about.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_about.xml new file mode 100644 index 00000000..f9d66a3e --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_about.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_cart.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_cart.xml new file mode 100644 index 00000000..8c5f73ee --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_cart.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_categories.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_categories.xml new file mode 100644 index 00000000..f55196af --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_categories.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_empty_star.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_empty_star.xml new file mode 100644 index 00000000..1e2951e8 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_empty_star.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_filled_star.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_filled_star.xml new file mode 100644 index 00000000..f6babfe2 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_filled_star.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_home.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_home.xml new file mode 100644 index 00000000..4c950c41 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_home.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_licences.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_licences.xml new file mode 100644 index 00000000..f8150658 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_licences.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_money.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_money.xml new file mode 100644 index 00000000..2ae6e4e2 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_money.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_search.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_search.xml new file mode 100644 index 00000000..171cf501 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_search.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_terms.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_terms.xml new file mode 100644 index 00000000..8186d70d --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-anydpi/ic_terms.xml @@ -0,0 +1,11 @@ + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_about.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_about.png new file mode 100644 index 00000000..1f599f8d Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_about.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_cart.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_cart.png new file mode 100644 index 00000000..1d030416 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_cart.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_categories.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_categories.png new file mode 100644 index 00000000..074ba94e Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_categories.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_empty_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_empty_star.png new file mode 100644 index 00000000..e46ae2f9 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_empty_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_filled_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_filled_star.png new file mode 100644 index 00000000..23d0bbbb Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_filled_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_home.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_home.png new file mode 100644 index 00000000..8fb84073 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_home.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_licences.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_licences.png new file mode 100644 index 00000000..41b328f2 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_licences.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_money.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_money.png new file mode 100644 index 00000000..c1c1d407 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_money.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_search.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_search.png new file mode 100644 index 00000000..6b12d42a Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_search.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_terms.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_terms.png new file mode 100644 index 00000000..1e577705 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-hdpi/ic_terms.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_about.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_about.png new file mode 100644 index 00000000..75778e2c Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_about.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_cart.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_cart.png new file mode 100644 index 00000000..a621fad5 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_cart.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_categories.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_categories.png new file mode 100644 index 00000000..c909ec29 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_categories.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_empty_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_empty_star.png new file mode 100644 index 00000000..64e291f0 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_empty_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_filled_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_filled_star.png new file mode 100644 index 00000000..c528a135 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_filled_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_home.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_home.png new file mode 100644 index 00000000..ea153710 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_home.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_licences.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_licences.png new file mode 100644 index 00000000..33ead9a8 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_licences.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_money.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_money.png new file mode 100644 index 00000000..38597d4f Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_money.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_search.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_search.png new file mode 100644 index 00000000..2a798671 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_search.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_terms.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_terms.png new file mode 100644 index 00000000..e82435a3 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-mdpi/ic_terms.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_about.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_about.png new file mode 100644 index 00000000..80d918d7 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_about.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_cart.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_cart.png new file mode 100644 index 00000000..e3d5aed8 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_cart.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_categories.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_categories.png new file mode 100644 index 00000000..787a57e8 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_categories.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_empty_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_empty_star.png new file mode 100644 index 00000000..312217d6 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_empty_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_filled_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_filled_star.png new file mode 100644 index 00000000..ca57a8f2 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_filled_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_home.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_home.png new file mode 100644 index 00000000..c5f757ae Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_home.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_licences.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_licences.png new file mode 100644 index 00000000..e6eb9355 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_licences.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_money.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_money.png new file mode 100644 index 00000000..6ac0bf38 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_money.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_search.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_search.png new file mode 100644 index 00000000..ef1859e5 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_search.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_terms.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_terms.png new file mode 100644 index 00000000..ebb74a0a Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xhdpi/ic_terms.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_about.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_about.png new file mode 100644 index 00000000..12203f79 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_about.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_cart.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_cart.png new file mode 100644 index 00000000..cea649aa Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_cart.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_categories.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_categories.png new file mode 100644 index 00000000..10455296 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_categories.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_empty_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_empty_star.png new file mode 100644 index 00000000..9c128679 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_empty_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_filled_star.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_filled_star.png new file mode 100644 index 00000000..51957028 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_filled_star.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_home.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_home.png new file mode 100644 index 00000000..3c9f10dc Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_home.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_licences.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_licences.png new file mode 100644 index 00000000..6637297b Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_licences.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_money.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_money.png new file mode 100644 index 00000000..110d4ac9 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_money.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_search.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_search.png new file mode 100644 index 00000000..e2108c2c Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_search.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_terms.png b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_terms.png new file mode 100644 index 00000000..497b7245 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable-xxhdpi/ic_terms.png differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable/animation.gif b/Android/Android Apps/MyMall/app/src/main/res/drawable/animation.gif new file mode 100644 index 00000000..eaca4064 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable/animation.gif differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable/ic_launcher_background.xml b/Android/Android Apps/MyMall/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable/mall.gif b/Android/Android Apps/MyMall/app/src/main/res/drawable/mall.gif new file mode 100644 index 00000000..ef095c16 Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable/mall.gif differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/drawable/welcome.gif b/Android/Android Apps/MyMall/app/src/main/res/drawable/welcome.gif new file mode 100644 index 00000000..9e91616b Binary files /dev/null and b/Android/Android Apps/MyMall/app/src/main/res/drawable/welcome.gif differ diff --git a/Android/Android Apps/MyMall/app/src/main/res/layout/activity_cart.xml b/Android/Android Apps/MyMall/app/src/main/res/layout/activity_cart.xml new file mode 100644 index 00000000..ad7f0336 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/layout/activity_cart.xml @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Android/Android Apps/MyMall/app/src/main/res/layout/activity_grocery_item.xml b/Android/Android Apps/MyMall/app/src/main/res/layout/activity_grocery_item.xml new file mode 100644 index 00000000..4284b5f4 --- /dev/null +++ b/Android/Android Apps/MyMall/app/src/main/res/layout/activity_grocery_item.xml @@ -0,0 +1,189 @@ + + + + + +