diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..39fb081
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+.externalNativeBuild
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..7ac24c7
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..ba7052b
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..45894e9
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..cfa8223
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,40 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 27
+ defaultConfig {
+ applicationId "com.example.h_mal.mochee"
+ minSdkVersion 26
+ targetSdkVersion 27
+ versionCode 1
+ versionName "1.0"
+ multiDexEnabled true
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.google.firebase:firebase-database:11.8.0'
+ implementation 'com.squareup.picasso:picasso:2.5.2'
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ implementation 'com.android.support:appcompat-v7:27.0.2'
+ implementation 'com.android.support:design:27.0.2'
+ implementation 'com.android.support.constraint:constraint-layout:1.0.2'
+ implementation 'com.google.android.gms:play-services-maps:11.8.0'
+ implementation 'com.paypal.sdk:paypal-android-sdk:2.15.3'
+ implementation 'com.android.support:support-v4:27.0.2'
+ testCompile 'junit:junit:4.12'
+}
+
+
+
+apply plugin: 'com.google.gms.google-services'
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 0000000..4450bdc
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,55 @@
+{
+ "project_info": {
+ "project_number": "712408456970",
+ "firebase_url": "https://mochee-e5228.firebaseio.com",
+ "project_id": "mochee-e5228",
+ "storage_bucket": "mochee-e5228.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:712408456970:android:55dcd0e2fd995128",
+ "android_client_info": {
+ "package_name": "com.example.h_mal.mochee"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "712408456970-2rns9os1deb54mna58k52lapu6e8tiq2.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.example.h_mal.mochee",
+ "certificate_hash": "00c68d18dc2957e8e4fbff21bd137e9f1bda9700"
+ }
+ },
+ {
+ "client_id": "712408456970-bhfd269l6bos5anr510tfjjrj2p0fsig.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyCyQ9hzkRvCpfF8KJ0wL6rplC4H9VuPOXI"
+ }
+ ],
+ "services": {
+ "analytics_service": {
+ "status": 1
+ },
+ "appinvite_service": {
+ "status": 2,
+ "other_platform_oauth_client": [
+ {
+ "client_id": "712408456970-bhfd269l6bos5anr510tfjjrj2p0fsig.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ },
+ "ads_service": {
+ "status": 2
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..5543844
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\h_mal\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# 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/app/src/androidTest/java/com/example/h_mal/mochee/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/h_mal/mochee/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..61efbc6
--- /dev/null
+++ b/app/src/androidTest/java/com/example/h_mal/mochee/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.example.h_mal.mochee;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.example.h_mal.mochee", appContext.getPackageName());
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..b26ce5d
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/h_mal/mochee/BasketActivity.java b/app/src/main/java/com/example/h_mal/mochee/BasketActivity.java
new file mode 100644
index 0000000..0befedf
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/BasketActivity.java
@@ -0,0 +1,438 @@
+package com.example.h_mal.mochee;
+
+import android.app.Activity;
+import android.app.LoaderManager;
+import android.content.CursorLoader;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.Loader;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v4.widget.NestedScrollView;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatActivity;
+import android.text.InputType;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.h_mal.mochee.Data.BasketContract.ItemEntry;
+import com.example.h_mal.mochee.Data.BasketCursorAdapter;
+import com.example.h_mal.mochee.Data.BasketDbHelper;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.paypal.android.sdk.payments.PayPalConfiguration;
+import com.paypal.android.sdk.payments.PayPalPayment;
+import com.paypal.android.sdk.payments.PayPalService;
+import com.paypal.android.sdk.payments.PaymentActivity;
+import com.paypal.android.sdk.payments.PaymentConfirmation;
+
+import org.json.JSONException;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+
+public class BasketActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks{
+
+ private static final int BASKET_LOADER = 0;
+ BasketCursorAdapter mCursorAdapter;
+
+ BasketDbHelper mDbHelper;
+ CursorLoader cursor;
+ Double subtotalPrice;
+ Double deliveryPrice;
+ Double totalPrice;
+ Double subTotalVal;
+
+ TextView sum;
+ TextView subTotalTV;
+ TextView deliveryType;
+ TextView deliveryPriceTV;
+
+ EditText promoCodeET;
+ EditText customerName;
+ EditText customerAddress;
+ EditText customerCountry;
+ EditText customerEmail;
+ EditText addNoteET;
+ ProgressBar pb;
+ NestedScrollView wholeView;
+ LinearLayout newView;
+
+ private DatabaseReference mDatabase;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_basket);
+
+ mDatabase = FirebaseDatabase.getInstance().getReference();
+
+ wholeView = (NestedScrollView) findViewById(R.id.whole_view);
+ newView = (LinearLayout) findViewById(R.id.emptyView) ;
+ NonScrollListView productListView = (NonScrollListView) findViewById(R.id.list_item_view);
+ LinearLayout promoCodeTV = (LinearLayout) findViewById(R.id.EnterPromoCode);
+ final LinearLayout promoCodeLayout = (LinearLayout) findViewById(R.id.promocodeLayout);
+ promoCodeET = (EditText) findViewById(R.id.promoCodeET);
+ Button promoCodeBtn = (Button) findViewById(R.id.promoCodeBtn);
+ final LinearLayout addNoteTV = (LinearLayout) findViewById(R.id.addNoteTV);
+ addNoteET = (EditText) findViewById(R.id.addNoteET);
+ subTotalTV = (TextView) findViewById(R.id.subtotalTV);
+ sum = (TextView) findViewById(R.id.sumTotalTV);
+ Button button = (Button) findViewById(R.id.button3);
+ Button emptyCart = (Button) findViewById(R.id.emptyCart);
+
+ pb = (ProgressBar) findViewById(R.id.progressBar);
+ pb.setVisibility(View.GONE);
+
+ customerName = (EditText) findViewById(R.id.detailsName);
+ customerAddress = (EditText) findViewById(R.id.detailAddress);
+ customerCountry = (EditText) findViewById(R.id.detailCountry);
+ customerEmail = (EditText) findViewById(R.id.detailEmail);
+
+ customerCountry.setInputType(InputType.TYPE_NULL);
+
+ final ArrayAdapter spinner_countries = new ArrayAdapter(this,android.R.layout.simple_spinner_dropdown_item,getResources().getStringArray(R.array.countries_array));
+
+ customerCountry.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View v) {
+ new AlertDialog.Builder(BasketActivity.this)
+ .setTitle("Select Countries")
+ .setAdapter(spinner_countries, new DialogInterface.OnClickListener() {
+
+ public void onClick(DialogInterface dialog, int which) {
+ customerCountry.setText(getResources().getStringArray(R.array.countries_array)[which].toString());
+ setDeliveryPrice();
+ dialog.dismiss();
+ }
+ }).create().show();
+ }
+ });
+
+ deliveryType = (TextView) findViewById(R.id.deliveryTypeTV);
+ deliveryPriceTV = (TextView) findViewById(R.id.deliveryPriceTV);
+ deliveryType.setText("");
+ deliveryPriceTV.setText("");
+ deliveryPrice = 0.00d;
+
+ emptyCart.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Intent intent = new Intent(BasketActivity.this, MainActivity.class);
+ startActivity(intent);
+ finish();
+ }
+ });
+
+ SetTitle();
+
+ mCursorAdapter = new BasketCursorAdapter(this, null);
+ productListView.setAdapter(mCursorAdapter);
+
+ getLoaderManager().initLoader(BASKET_LOADER, null, this);
+
+ promoCodeTV.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ if(promoCodeLayout.getVisibility()==View.GONE) {
+ promoCodeLayout.setVisibility(View.VISIBLE);
+ }else{
+ promoCodeLayout.setVisibility(View.GONE);
+ }
+ }
+ });
+
+ promoCodeBtn.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ promoCodeET.setText("");
+ Toast.makeText(BasketActivity.this, "Invalid Promotion Code", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ addNoteTV.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ if(addNoteET.getVisibility()==View.GONE) {
+ addNoteET.setVisibility(View.VISIBLE);
+ }else{
+ addNoteET.setVisibility(View.GONE);
+ }
+ }
+ });
+
+ button.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+
+ if(TextUtils.isEmpty(customerName.getText()) || TextUtils.isEmpty(customerAddress.getText()) || TextUtils.isEmpty(customerCountry.getText()) || TextUtils.isEmpty(customerCountry.getText()) ){
+ Toast.makeText(BasketActivity.this, "Insert All Mandatory Fields", Toast.LENGTH_SHORT).show();
+ if(TextUtils.isEmpty(customerName.getText())){
+ customerName.setHintTextColor(Color.parseColor("#ff0000"));
+ }
+ if(TextUtils.isEmpty(customerAddress.getText())){
+ customerAddress.setHintTextColor(Color.parseColor("#ff0000"));
+ }
+ if(TextUtils.isEmpty(customerCountry.getText())){
+ customerCountry.setHintTextColor(Color.parseColor("#ff0000"));
+ }
+ return;
+ }
+
+
+ PayPalPayment payment = new PayPalPayment(new BigDecimal(sum.getText().toString()), "GBP", "Mochee",
+ PayPalPayment.PAYMENT_INTENT_SALE);
+
+ Intent intent = new Intent(BasketActivity.this, PaymentActivity.class);
+
+ // send the same configuration for restart resiliency
+ intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
+
+ intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);
+
+ startActivityForResult(intent, 0);
+
+ }
+ });
+ setSubTotal();
+ setTotal();
+
+ if(Basket_Counter.setBasketQuantity(this) == 0){
+ newView.setVisibility(View.VISIBLE);
+ wholeView.setVisibility(View.GONE);
+
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu_main, menu); //your file name
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+
+ case R.id.action_settings:
+ deleteAllProducts();
+ SetTitle();
+ newView.setVisibility(View.VISIBLE);
+ wholeView.setVisibility(View.GONE);
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ private void setDeliveryPrice(){
+ if(customerCountry.getText().toString().equals("United Kingdom")){
+ deliveryPrice = 5.99d;
+ deliveryPriceTV.setText("£"+deliveryPrice);
+ deliveryType.setText("UK Delivery");
+ setTotal();
+ }else{
+ deliveryPrice = 19.99d;
+ deliveryPriceTV.setText("£"+deliveryPrice);
+ deliveryType.setText("International Delivery");
+ setTotal();
+ }
+ }
+
+ private void SetTitle(){
+ getSupportActionBar().setDisplayShowTitleEnabled(true);
+ getSupportActionBar().setTitle("Basket(" + (Basket_Counter.setBasketQuantity(this)+"") + ")");
+ }
+
+ private void deleteAllProducts() {
+ int rowsDeleted = getContentResolver().delete(ItemEntry.CONTENT_URI, null, null);
+ Log.v("MainActivity", rowsDeleted + " rows deleted");
+ }
+
+ private void setSubTotal(){
+ try {
+ File dbFile = this.getDatabasePath("items.db");
+
+ SQLiteDatabase db = SQLiteDatabase.openDatabase(dbFile.getAbsolutePath(), null, SQLiteDatabase.CREATE_IF_NECESSARY);
+
+ Cursor cursor = db.rawQuery("SELECT SUM(" + ItemEntry.COLUMN_ITEM_TOTALPRICE + ") AS Total FROM " + ItemEntry.TABLE_NAME + ";", null);
+
+ subTotalVal = 0.0d;
+ if (cursor.moveToFirst()) {
+ subTotalVal = cursor.getDouble(cursor.getColumnIndex("Total"));// get final subTotalVal
+ }
+
+ subTotalTV.setText("£"+ subTotalVal);
+ setTotal();
+ cursor.close();
+ }
+ catch (Exception e){
+ subTotalTV.setText("0.00");
+ }
+ }
+
+ private void setTotal(){
+ try{
+// if(deliveryPriceTV != null) {
+// deliveryPrice = Double.parseDouble(deliveryPriceTV.getText().toString());
+// }else{
+// deliveryPrice = 0.0d;
+// }
+ totalPrice = subTotalVal + deliveryPrice;
+
+ sum.setText(totalPrice+"");
+
+ }catch(Exception e){
+ sum.setText("0");
+ }
+ }
+
+ private Order createOrder(String transactionID, String transactionDate, String transactionState){
+ ArrayList- basket = new ArrayList
- ();
+
+ Cursor newCurso = getContentResolver().query(ItemEntry.CONTENT_URI,cursor.getProjection(),null,null,null);
+ if (newCurso != null && newCurso.moveToFirst()) {
+ //add row to list
+ do {
+ Integer id = newCurso.getInt(newCurso.getColumnIndex(ItemEntry._ID));
+ String thisTitle = newCurso.getString(newCurso.getColumnIndex(ItemEntry.COLUMN_ITEM_NAME));
+ String thisArtist = newCurso.getString(newCurso.getColumnIndex(ItemEntry.COLUMN_ITEM_SIZE));
+ Integer thisAlbum = newCurso.getInt(newCurso.getColumnIndex(ItemEntry.COLUMN_ITEM_QUANTITY));
+ basket.add(new Item(id, thisTitle, thisArtist, thisAlbum));
+ }
+ while (newCurso.moveToNext());
+ newCurso.close();
+ }
+
+ Price price = new Price(deliveryPrice,
+ subtotalPrice,
+ totalPrice);
+ PaypalInfo paypalInfo = new PaypalInfo(transactionID,transactionDate,transactionState);
+ Payment payment = new Payment(price,paypalInfo);
+
+ Order order = null;
+ try {
+ String email = "";
+ if(!TextUtils.isEmpty(customerEmail.getText())) {
+ email = customerEmail.getText().toString();
+ }
+ String note = "";
+ if(!TextUtils.isEmpty(addNoteET.getText())){
+ note = addNoteET.getText().toString();
+ }
+ order = new Order(customerName.getText().toString(),
+ customerAddress.getText().toString(),
+ customerCountry.getText().toString(),
+ email,
+ note,
+ payment,
+ basket);
+
+ }catch (Exception e){
+ Toast.makeText(this, "missing info", Toast.LENGTH_SHORT).show();
+ }
+ return order;
+
+ }
+
+ private static PayPalConfiguration config = new PayPalConfiguration()
+
+ // Start with mock environment. When ready, switch to sandbox (ENVIRONMENT_SANDBOX)
+ // or live (ENVIRONMENT_PRODUCTION)
+ .environment(PayPalConfiguration.ENVIRONMENT_SANDBOX)
+
+ .clientId(Config.PAYPAL_CLIENT_ID);
+
+ @Override
+ protected void onActivityResult (int requestCode, int resultCode, Intent data) {
+ if (resultCode == Activity.RESULT_OK) {
+ PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
+ if (confirm != null) {
+ try {
+ //this log contains the paypal details
+ confirm.getProofOfPayment().getPaymentId();
+ Log.i("paymentExample", confirm.toJSONObject().toString(4));
+
+ mDatabase.child("Order").push().setValue(createOrder(confirm.getProofOfPayment().getTransactionId(),confirm.getProofOfPayment().getCreateTime(),confirm.getProofOfPayment().getState()));
+
+ Config.clearForm((ViewGroup) findViewById(R.id.whole_view));
+ deleteAllProducts();
+ Toast.makeText(this, "Successful payment", Toast.LENGTH_SHORT).show();
+ Intent intent = new Intent(BasketActivity.this, MainActivity.class);
+ startActivity(intent);
+ // see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
+ // for more details.
+
+ } catch (JSONException e) {
+ Log.e("paymentExample", "an extremely unlikely failure occurred: ", e);
+ }
+ }
+ }
+ else if (resultCode == Activity.RESULT_CANCELED) {
+ Log.i("paymentExample", "The user canceled.");
+ }
+ else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
+ Log.i("paymentExample", "An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
+ }
+ }
+
+ @Override
+ public void onBackPressed() {
+ new AlertDialog.Builder(this)
+ .setTitle("Exit Basket?")
+ .setNegativeButton(android.R.string.no, null)
+ .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
+
+ public void onClick(DialogInterface arg0, int arg1) {
+ BasketActivity.super.onBackPressed();
+ }
+ }).create().show();
+ }
+
+ @Override
+ public Loader onCreateLoader(int i, Bundle bundle) {
+ String[] projection = {
+ ItemEntry._ID,
+ ItemEntry.COLUMN_ITEM_IMAGE,
+ ItemEntry.COLUMN_ITEM_NAME,
+ ItemEntry.COLUMN_ITEM_PRICE,
+ ItemEntry.COLUMN_ITEM_SIZE,
+ ItemEntry.COLUMN_ITEM_QUANTITY,
+ ItemEntry.COLUMN_ITEM_TOTALPRICE};
+
+ cursor = new CursorLoader(this,
+ ItemEntry.CONTENT_URI,
+ projection,
+ null,
+ null,
+ null);
+
+ pb.setVisibility(View.VISIBLE);
+
+ return cursor;
+ }
+
+ @Override
+ public void onLoadFinished(Loader loader, Cursor cursor) {
+ mCursorAdapter.swapCursor(cursor);
+ pb.setVisibility(View.GONE);
+ }
+
+ @Override
+ public void onLoaderReset(Loader loader) {
+ mCursorAdapter.swapCursor(null);
+ pb.setVisibility(View.VISIBLE);
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Basket_Counter.java b/app/src/main/java/com/example/h_mal/mochee/Basket_Counter.java
new file mode 100644
index 0000000..c9893fb
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Basket_Counter.java
@@ -0,0 +1,41 @@
+package com.example.h_mal.mochee;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+
+import com.example.h_mal.mochee.Data.BasketContract;
+
+import java.io.File;
+
+/**
+ * Created by h_mal on 19/01/2018.
+ */
+
+public class Basket_Counter {
+
+ private static int total;
+
+ private Basket_Counter(){}
+
+ public static int setBasketQuantity(Context context){
+ total = 0;
+ try {
+ File dbFile = context.getDatabasePath("items.db");
+
+ SQLiteDatabase db = SQLiteDatabase.openDatabase(dbFile.getAbsolutePath(), null, SQLiteDatabase.CREATE_IF_NECESSARY);
+ Cursor cursor = db.rawQuery("SELECT SUM(" + BasketContract.ItemEntry.COLUMN_ITEM_QUANTITY + ") AS Total FROM " + BasketContract.ItemEntry.TABLE_NAME + ";", null);
+
+
+ if (cursor.moveToFirst()) {
+ total = cursor.getInt(cursor.getColumnIndex("Total"));// get final subTotalVal
+ }
+ cursor.close();
+
+ }catch(Exception e){
+ total = 0;
+ }
+
+ return total;
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Data/BasketContract.java b/app/src/main/java/com/example/h_mal/mochee/Data/BasketContract.java
new file mode 100644
index 0000000..387e57c
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Data/BasketContract.java
@@ -0,0 +1,49 @@
+package com.example.h_mal.mochee.Data;
+
+import android.content.ContentResolver;
+import android.net.Uri;
+import android.provider.BaseColumns;
+
+/**
+ * Created by h_mal on 12/01/2018.
+ */
+
+public class BasketContract {
+
+ private BasketContract() {}
+
+ public static final String CONTENT_AUTHORITY = "com.example.h_mal.mochee";
+
+ public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
+
+ public static final String PATH_ITEMS = "items";
+
+ public static final class ItemEntry implements BaseColumns {
+
+ public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, PATH_ITEMS);
+
+ public static final String CONTENT_LIST_TYPE =
+ ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_ITEMS;
+
+
+ public static final String CONTENT_ITEM_TYPE =
+ ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_ITEMS;
+
+
+ public final static String TABLE_NAME = "basket";
+
+ public final static String _ID = BaseColumns._ID;
+
+ public final static String COLUMN_ITEM_IMAGE = "image";
+
+ public final static String COLUMN_ITEM_NAME = "name";
+
+ public final static String COLUMN_ITEM_PRICE = "price";
+
+ public final static String COLUMN_ITEM_SIZE = "size";
+
+ public final static String COLUMN_ITEM_QUANTITY = "quantity";
+
+ public final static String COLUMN_ITEM_TOTALPRICE = "totalprice";
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Data/BasketCursorAdapter.java b/app/src/main/java/com/example/h_mal/mochee/Data/BasketCursorAdapter.java
new file mode 100644
index 0000000..82fbd0b
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Data/BasketCursorAdapter.java
@@ -0,0 +1,105 @@
+package com.example.h_mal.mochee.Data;
+
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.database.Cursor;
+import android.support.v7.app.AlertDialog;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.CursorAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.example.h_mal.mochee.BasketActivity;
+import com.example.h_mal.mochee.Basket_Counter;
+import com.example.h_mal.mochee.Data.BasketContract.ItemEntry;
+import com.example.h_mal.mochee.Item_overview;
+import com.example.h_mal.mochee.MainActivity;
+import com.example.h_mal.mochee.R;
+import com.squareup.picasso.Picasso;
+
+/**
+ * Created by h_mal on 13/01/2018.
+ */
+
+public class BasketCursorAdapter extends CursorAdapter {
+
+ private final BasketActivity activity;
+
+ private Context mContext;
+
+ public BasketCursorAdapter(BasketActivity context, Cursor c) {
+ super(context, c, 0);
+ this.activity = context;
+ }
+
+ @Override
+ public View newView(Context context, Cursor cursor, ViewGroup parent) {
+ return LayoutInflater.from(context).inflate(R.layout.list_item_basket, parent, false);
+ }
+
+ @Override
+ public void bindView(View view, Context context, Cursor cursor) {
+ mContext = context;
+
+ ImageView imageView = (ImageView) view.findViewById(R.id.basketIV);
+ TextView nameTV = (TextView) view.findViewById(R.id.basketName);
+ TextView priceTV = (TextView) view.findViewById(R.id.basketPrice);
+ TextView quantityTV = (TextView) view.findViewById(R.id.basketQuantity);
+ TextView sizeTV = (TextView) view.findViewById(R.id.basketSize);
+ TextView totalPriceTV = (TextView) view.findViewById(R.id.basketTotalPrice);
+ ImageView delete = (ImageView) view.findViewById(R.id.delete_item);
+
+ final String imageColumnIndex = cursor.getString(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_IMAGE));
+ final String nameColumnIndex = cursor.getString(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_NAME));
+ final Float priceColumnIndex = cursor.getFloat(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_PRICE));
+ final String quantityInColumnIndex = cursor.getString(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_QUANTITY));
+ final String sizeOutColumnIndex = cursor.getString(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_SIZE));
+ final Float totalpriceColumnIndex = cursor.getFloat(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_TOTALPRICE));
+
+ Picasso.with(mContext)
+ .load(imageColumnIndex)
+ .placeholder(R.drawable.mocheeloading)
+ .into(imageView);
+
+ nameTV.setText(nameColumnIndex);
+ priceTV.setText("£"+String.format("%.2f", priceColumnIndex));
+ quantityTV.setText("Quantity : " + quantityInColumnIndex);
+ sizeTV.setText(sizeOutColumnIndex);
+ totalPriceTV.setText("£"+String.format("%.2f", totalpriceColumnIndex));
+
+ final long id = cursor.getLong(cursor.getColumnIndexOrThrow(ItemEntry._ID));
+
+ view.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View v) {
+ final Intent newIntent = new Intent(mContext, Item_overview.class);
+ newIntent.putExtra("name",nameColumnIndex);
+ newIntent.putExtra("price",priceColumnIndex);
+ newIntent.putExtra("image",imageColumnIndex);
+ mContext.startActivity(newIntent);
+ }
+ });
+
+ delete.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View v) {
+ mContext.getContentResolver().delete(ItemEntry.CONTENT_URI, ItemEntry._ID + " = " + id , null);
+ if(Basket_Counter.setBasketQuantity(mContext) == 0){
+ final Intent intent = new Intent(mContext, MainActivity.class);
+ new AlertDialog.Builder(mContext)
+ .setTitle("Cart Is Empty")
+ .setCancelable(false)
+ .setNegativeButton("Return to Items", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface arg0, int arg1) {
+ mContext.startActivity(intent);
+ }
+ })
+ .create().show();
+ }
+ }
+ });
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/h_mal/mochee/Data/BasketDbHelper.java b/app/src/main/java/com/example/h_mal/mochee/Data/BasketDbHelper.java
new file mode 100644
index 0000000..4a71d21
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Data/BasketDbHelper.java
@@ -0,0 +1,47 @@
+package com.example.h_mal.mochee.Data;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+
+import com.example.h_mal.mochee.Data.BasketContract.ItemEntry;
+
+/**
+ * Created by h_mal on 12/01/2018.
+ */
+
+public class BasketDbHelper extends SQLiteOpenHelper {
+
+ public static final String LOG_TAG = BasketDbHelper.class.getSimpleName();
+
+ private static final String DATABASE_NAME = "items.db";
+
+ private static final int DATABASE_VERSION = 1;
+
+
+ public BasketDbHelper(Context context) {
+ super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+
+ String SQL_CREATE_PRODUCTS_TABLE = "CREATE TABLE " + ItemEntry.TABLE_NAME + " ("
+ + ItemEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ + ItemEntry.COLUMN_ITEM_IMAGE + " TEXT NOT NULL, "
+ + ItemEntry.COLUMN_ITEM_NAME + " TEXT NOT NULL, "
+ + ItemEntry.COLUMN_ITEM_PRICE + " FLOAT NOT NULL, "
+ + ItemEntry.COLUMN_ITEM_QUANTITY + " INTEGER NOT NULL, "
+ + ItemEntry.COLUMN_ITEM_SIZE + " TEXT NOT NULL, "
+ + ItemEntry.COLUMN_ITEM_TOTALPRICE + " FLOAT NOT NULL DEFAULT 0)";
+
+ db.execSQL(SQL_CREATE_PRODUCTS_TABLE);
+ }
+
+
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Data/BasketProvider.java b/app/src/main/java/com/example/h_mal/mochee/Data/BasketProvider.java
new file mode 100644
index 0000000..ee2d93e
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Data/BasketProvider.java
@@ -0,0 +1,242 @@
+package com.example.h_mal.mochee.Data;
+
+import android.content.ContentProvider;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.UriMatcher;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.net.Uri;
+import android.util.Log;
+
+import com.example.h_mal.mochee.Data.BasketContract.ItemEntry;
+
+/**
+ * Created by h_mal on 12/01/2018.
+ */
+
+public class BasketProvider extends ContentProvider {
+
+
+ public static final String LOG_TAG = BasketProvider.class.getSimpleName();
+
+ private static final int BASKET = 100;
+ private static final int BASKET_ID = 101;
+
+ private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
+
+
+ static {
+
+ sUriMatcher.addURI(BasketContract.CONTENT_AUTHORITY, BasketContract.PATH_ITEMS, BASKET);
+
+ sUriMatcher.addURI(BasketContract.CONTENT_AUTHORITY, BasketContract.PATH_ITEMS + "/#", BASKET_ID);
+ }
+
+ BasketDbHelper mDbHelper;
+
+ @Override
+ public boolean onCreate() {
+ mDbHelper = new BasketDbHelper(getContext());
+ return true;
+ }
+
+ @Override
+ public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
+ String sortOrder) {
+
+ SQLiteDatabase database = mDbHelper.getReadableDatabase();
+
+ Cursor cursor;
+
+ int match = sUriMatcher.match(uri);
+ switch (match) {
+ case BASKET:
+
+ cursor = database.query(ItemEntry.TABLE_NAME, projection, selection, selectionArgs,
+ null, null, sortOrder);
+ break;
+ case BASKET_ID:
+
+ selection = ItemEntry._ID + "=?";
+ selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) };
+ cursor = database.query(ItemEntry.TABLE_NAME, projection, selection, selectionArgs,
+ null, null, sortOrder);
+ break;
+ default:
+ throw new IllegalArgumentException("Cannot query " + uri);
+ }
+
+ cursor.setNotificationUri(getContext().getContentResolver(), uri);
+
+ return cursor;
+ }
+
+ @Override
+ public Uri insert(Uri uri, ContentValues contentValues) {
+ final int match = sUriMatcher.match(uri);
+ switch (match) {
+ case BASKET:
+ return insertItem(uri, contentValues);
+ default:
+ throw new IllegalArgumentException("Insertion is not supported for " + uri);
+ }
+ }
+
+ private Uri insertItem(Uri uri, ContentValues values) {
+
+ String image = values.getAsString(ItemEntry.COLUMN_ITEM_IMAGE);
+ if (image == null) {
+ throw new IllegalArgumentException("Image required");
+ }
+
+ String name = values.getAsString(ItemEntry.COLUMN_ITEM_NAME);
+ if (name == null) {
+ throw new IllegalArgumentException("Name required");
+ }
+
+ Float price = values.getAsFloat(ItemEntry.COLUMN_ITEM_PRICE);
+ if (price == null) {
+ throw new IllegalArgumentException("Price required");
+ }
+
+ String size = values.getAsString(ItemEntry.COLUMN_ITEM_SIZE);
+ if (size == null) {
+ throw new IllegalArgumentException("Size In required");
+ }
+
+ Integer quantity = values.getAsInteger(ItemEntry.COLUMN_ITEM_QUANTITY);
+ if (quantity == null) {
+ throw new IllegalArgumentException("Time Out required");
+ }
+
+ values.getAsFloat(ItemEntry.COLUMN_ITEM_TOTALPRICE);
+
+ SQLiteDatabase database = mDbHelper.getWritableDatabase();
+
+ long id = database.insert(ItemEntry.TABLE_NAME, null, values);
+ if (id == -1) {
+ Log.e(LOG_TAG, "row failed " + uri);
+ return null;
+ }
+
+ getContext().getContentResolver().notifyChange(uri, null);
+
+ return ContentUris.withAppendedId(uri, id);
+ }
+
+ @Override
+ public int update(Uri uri, ContentValues contentValues, String selection,
+ String[] selectionArgs) {
+ final int match = sUriMatcher.match(uri);
+ switch (match) {
+ case BASKET:
+ return updateItem(uri, contentValues, selection, selectionArgs);
+ case BASKET_ID:
+
+ selection = ItemEntry._ID + "=?";
+ selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) };
+ return updateItem(uri, contentValues, selection, selectionArgs);
+ default:
+ throw new IllegalArgumentException("Update is not supported for " + uri);
+ }
+ }
+
+
+ private int updateItem(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+
+ if (values.containsKey(ItemEntry.COLUMN_ITEM_IMAGE)) {
+ String image = values.getAsString(ItemEntry.COLUMN_ITEM_IMAGE);
+ if (image == null) {
+ throw new IllegalArgumentException("image required");
+ }
+ }
+
+ if (values.containsKey(ItemEntry.COLUMN_ITEM_NAME)) {
+ String name = values.getAsString(ItemEntry.COLUMN_ITEM_NAME);
+ if (name == null) {
+ throw new IllegalArgumentException("name required");
+ }
+ }
+
+ if (values.containsKey(ItemEntry.COLUMN_ITEM_PRICE)) {
+ Float price = values.getAsFloat(ItemEntry.COLUMN_ITEM_PRICE);
+ if (price == null) {
+ throw new IllegalArgumentException("price required");
+ }
+ }
+
+ if (values.containsKey(ItemEntry.COLUMN_ITEM_SIZE)) {
+ String size = values.getAsString(ItemEntry.COLUMN_ITEM_SIZE);
+ if (size == null) {
+ throw new IllegalArgumentException("size required");
+ }
+ }
+
+ if (values.containsKey(ItemEntry.COLUMN_ITEM_QUANTITY)) {
+ Integer quantity = values.getAsInteger(ItemEntry.COLUMN_ITEM_QUANTITY);
+ if (quantity == null) {
+ throw new IllegalArgumentException("quantity required");
+ }
+ }
+
+ if (values.containsKey(ItemEntry.COLUMN_ITEM_TOTALPRICE)) {
+ Float totalprice = values.getAsFloat(ItemEntry.COLUMN_ITEM_TOTALPRICE);
+ if (totalprice == null) {
+ throw new IllegalArgumentException("break required");
+ }
+ }
+
+ if (values.size() == 0) {
+ return 0;
+ }
+
+ SQLiteDatabase database = mDbHelper.getWritableDatabase();
+ int rowsUpdated = database.update(ItemEntry.TABLE_NAME, values, selection, selectionArgs);
+ if (rowsUpdated != 0) {
+ getContext().getContentResolver().notifyChange(uri, null);
+ }
+
+ return rowsUpdated;
+ }
+
+ @Override
+ public int delete(Uri uri, String selection, String[] selectionArgs) {
+ SQLiteDatabase database = mDbHelper.getWritableDatabase();
+
+ int rowsDeleted;
+
+ final int match = sUriMatcher.match(uri);
+ switch (match) {
+ case BASKET:
+ rowsDeleted = database.delete(ItemEntry.TABLE_NAME, selection, selectionArgs);
+ break;
+ case BASKET_ID:
+ selection = ItemEntry._ID + "=?";
+ selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) };
+ rowsDeleted = database.delete(ItemEntry.TABLE_NAME, selection, selectionArgs);
+ break;
+ default:
+ throw new IllegalArgumentException("Deletion is not supported for " + uri);
+ }
+
+ if (rowsDeleted != 0) {
+ getContext().getContentResolver().notifyChange(uri, null);
+ }
+
+ return rowsDeleted;
+ }
+
+ @Override
+ public String getType(Uri uri) {
+ final int match = sUriMatcher.match(uri);
+ switch (match) {
+ case BASKET:
+ return ItemEntry.CONTENT_LIST_TYPE;
+ case BASKET_ID:
+ return ItemEntry.CONTENT_ITEM_TYPE;
+ default:
+ throw new IllegalStateException("Unknown URI " + uri + " with match " + match);
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Blazers.java b/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Blazers.java
new file mode 100644
index 0000000..747e6be
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Blazers.java
@@ -0,0 +1,32 @@
+package com.example.h_mal.mochee.Fragment2_Parts;
+
+/**
+ * Created by h_mal on 04/01/2018.
+ */
+
+public class Blazers {
+
+ private String Name;
+
+ private String Price;
+
+ private String imageURL;
+
+ private String IconURL;
+
+ public String getName() {
+ return Name;
+ }
+
+ public String getPrice() {
+ return Price;
+ }
+
+ public String getImageURL() {
+ return imageURL;
+ }
+
+ public String getIconURL() {
+ return IconURL;
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Blazers_Adapter.java b/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Blazers_Adapter.java
new file mode 100644
index 0000000..ac4baee
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Blazers_Adapter.java
@@ -0,0 +1,44 @@
+package com.example.h_mal.mochee.Fragment2_Parts;
+
+import android.app.Activity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+
+import com.example.h_mal.mochee.R;
+import com.squareup.picasso.Picasso;
+
+import java.util.ArrayList;
+
+/**
+ * Created by h_mal on 04/01/2018.
+ */
+
+public class Blazers_Adapter extends ArrayAdapter {
+
+ public static final String LOG_TAG = Fragment_Two.class.getName();
+
+ public Blazers_Adapter(Activity context, ArrayList books) {
+ super(context, 0, books);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View listItemView = convertView;
+ if (listItemView == null) {
+ listItemView = LayoutInflater.from(getContext()).inflate(
+ R.layout.list_item_blazers, parent, false);
+ }
+ Blazers currentBlazers = getItem(position);
+
+ ImageView blazerImageView = (ImageView) listItemView.findViewById(R.id.imageButton);
+ Picasso.with(getContext())
+ .load(currentBlazers.getIconURL())
+ .placeholder(R.drawable.m)
+ .into(blazerImageView);
+
+ return listItemView;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Fragment_Two.java b/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Fragment_Two.java
new file mode 100644
index 0000000..a7709ad
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment2_Parts/Fragment_Two.java
@@ -0,0 +1,140 @@
+package com.example.h_mal.mochee.Fragment2_Parts;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.GridView;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.example.h_mal.mochee.ImageViewer.ImageViewer;
+import com.example.h_mal.mochee.Item_overview;
+import com.example.h_mal.mochee.R;
+import com.google.firebase.FirebaseApp;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+import com.squareup.picasso.Picasso;
+
+import java.util.ArrayList;
+
+/**
+ * Created by h_mal on 07/10/2017.
+ */
+
+public class Fragment_Two extends Fragment{
+
+ private Blazers currentBlazer;
+ ArrayList blazers;
+ DatabaseReference stockDB;
+
+ ImageView mainIV;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment2, container, false);
+
+ FirebaseApp.initializeApp(getContext());
+
+ mainIV = (ImageView) rootView.findViewById(R.id.imageView5);
+ ImageView zoom = rootView.findViewById(R.id.imageView4);
+ final TextView nameTV = (TextView) rootView.findViewById(R.id.blazer_nameTV);
+ final TextView priceTV = (TextView) rootView.findViewById(R.id.blazer_priceTV);
+ final GridView listView = (GridView) rootView.findViewById(R.id.list);
+
+ blazers = new ArrayList();
+
+ stockDB = FirebaseDatabase.getInstance().getReference("Stock");
+
+ stockDB.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot) {
+
+ //clearing the previous artist list
+ blazers.clear();
+
+ //iterating through all the nodes
+ for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
+ //getting artist
+ Blazers artist = postSnapshot.getValue(Blazers.class);
+ //adding artist to the list
+ blazers.add(artist);
+ }
+ currentBlazer = blazers.get(0);
+
+ Picasso.with(getContext())
+ .load(currentBlazer.getImageURL())
+ .placeholder(R.drawable.mocheeloading)
+ .into(mainIV);
+
+ nameTV.setText(currentBlazer.getName());
+ priceTV.setText(currentBlazer.getPrice());
+ //creating adapter
+ Blazers_Adapter adapter = new Blazers_Adapter(getActivity(),blazers);
+ //attaching adapter to the listview
+ listView.setAdapter(adapter);
+
+ }
+
+ @Override
+ public void onCancelled(DatabaseError databaseError) {
+
+ }
+ });
+
+ zoom.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Intent intent = new Intent(getActivity(), ImageViewer.class);
+ intent.putExtra("image",currentBlazer.getImageURL());
+ startActivity(intent);
+ }
+ });
+
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ currentBlazer = (Blazers) parent.getItemAtPosition(position);
+ Picasso.with(getContext())
+ .load(currentBlazer.getImageURL())
+ .placeholder(R.drawable.mocheeloading)
+ .into(mainIV);
+
+ nameTV.setText(currentBlazer.getName());
+ priceTV.setText(currentBlazer.getPrice());
+ }
+ });
+
+
+ mainIV.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ OpenWindow();
+ }
+ });
+
+ return rootView;
+ }
+
+ private void OpenWindow(){
+ Intent intent = new Intent(Fragment_Two.this.getActivity(), Item_overview.class);
+
+ intent.putExtra("image",currentBlazer.getImageURL());
+ intent.putExtra("name",currentBlazer.getName());
+ intent.putExtra("price",currentBlazer.getPrice());
+ startActivity(intent);
+ }
+
+ private void addItemsFromFireBase(){
+
+
+ }
+
+
+
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment3_Parts/Bespoke.java b/app/src/main/java/com/example/h_mal/mochee/Fragment3_Parts/Bespoke.java
new file mode 100644
index 0000000..b5ee529
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment3_Parts/Bespoke.java
@@ -0,0 +1,54 @@
+package com.example.h_mal.mochee.Fragment3_Parts;
+
+/**
+ * Created by h_mal on 04/01/2018.
+ */
+
+public class Bespoke {
+
+ private Integer logo;
+
+ private Integer BackgroundColour;
+
+ private String title;
+
+ private Integer titleTextColour;
+
+ private String description;
+
+ private Integer descriptionTextColour;
+
+ public Bespoke(Integer logo, Integer backgroundColour, String title, Integer titleTextColour,
+ String description, Integer descriptionTextColour) {
+ this.logo = logo;
+ this.BackgroundColour = backgroundColour;
+ this.title = title;
+ this.titleTextColour = titleTextColour;
+ this.description = description;
+ this.descriptionTextColour = descriptionTextColour;
+ }
+
+ public Integer getLogo() {
+ return logo;
+ }
+
+ public Integer getBackgroundColour() {
+ return BackgroundColour;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public Integer getTitleTextColour() {
+ return titleTextColour;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Integer getDescriptionTextColour() {
+ return descriptionTextColour;
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment3_Parts/Bespoke_Adapter.java b/app/src/main/java/com/example/h_mal/mochee/Fragment3_Parts/Bespoke_Adapter.java
new file mode 100644
index 0000000..7331829
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment3_Parts/Bespoke_Adapter.java
@@ -0,0 +1,51 @@
+package com.example.h_mal.mochee.Fragment3_Parts;
+
+import android.app.Activity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.example.h_mal.mochee.R;
+
+import java.util.ArrayList;
+
+/**
+ * Created by h_mal on 04/01/2018.
+ */
+
+public class Bespoke_Adapter extends ArrayAdapter {
+
+ public Bespoke_Adapter(Activity context, ArrayList bespoke) {
+ super(context, 0, bespoke);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View listItemView = convertView;
+ if (listItemView == null) {
+ listItemView = LayoutInflater.from(getContext()).inflate(
+ R.layout.list_item_bespoke, parent, false);
+ }
+ Bespoke currentItem = getItem(position);
+
+ ImageView itemImageView = (ImageView) listItemView.findViewById(R.id.bespoke_logo);
+ itemImageView.setImageResource(currentItem.getLogo());
+
+ RelativeLayout relativeLayout = listItemView.findViewById(R.id.bespoke_layout);
+ relativeLayout.setBackgroundResource(currentItem.getBackgroundColour());
+
+ TextView titleTextView = (TextView) listItemView.findViewById(R.id.bespoke_title);
+ titleTextView.setText(currentItem.getTitle());
+ titleTextView.setTextColor(currentItem.getTitleTextColour());
+
+ TextView descTextView = (TextView) listItemView.findViewById(R.id.bespoke_description);
+ descTextView.setText(currentItem.getDescription());
+ descTextView.setTextColor(currentItem.getDescriptionTextColour());
+
+ return listItemView;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment4_Parts/InspirationItems.java b/app/src/main/java/com/example/h_mal/mochee/Fragment4_Parts/InspirationItems.java
new file mode 100644
index 0000000..84e76c0
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment4_Parts/InspirationItems.java
@@ -0,0 +1,42 @@
+package com.example.h_mal.mochee.Fragment4_Parts;
+
+import com.google.firebase.database.IgnoreExtraProperties;
+
+/**
+ * Created by h_mal on 04/01/2018.
+ */
+
+@IgnoreExtraProperties
+public class InspirationItems {
+
+ private String description;
+ private String imageURL;
+ private String name;
+ private String subname;
+
+ public InspirationItems() {
+ }
+
+ public InspirationItems(String description, String imageURL, String name, String subname) {
+ this.description = description;
+ this.imageURL = imageURL;
+ this.name = name;
+ this.subname = subname;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getImageURL() {
+ return imageURL;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSubname() {
+ return subname;
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment4_Parts/InspirationItems_Adapter.java b/app/src/main/java/com/example/h_mal/mochee/Fragment4_Parts/InspirationItems_Adapter.java
new file mode 100644
index 0000000..15c9943
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment4_Parts/InspirationItems_Adapter.java
@@ -0,0 +1,55 @@
+package com.example.h_mal.mochee.Fragment4_Parts;
+
+import android.app.Activity;
+import android.support.annotation.NonNull;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.example.h_mal.mochee.R;
+import com.squareup.picasso.Picasso;
+
+import java.util.ArrayList;
+
+/**
+ * Created by h_mal on 04/01/2018.
+ */
+
+public class InspirationItems_Adapter extends ArrayAdapter {
+
+ public InspirationItems_Adapter(Activity context, ArrayList objects) {
+ super(context, 0, objects);
+ }
+
+ @NonNull
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View listItemView = convertView;
+ if (listItemView == null) {
+ listItemView = LayoutInflater.from(getContext()).inflate(
+ R.layout.list_item_insp, parent, false);
+ }
+ InspirationItems currentItem = getItem(position);
+
+ TextView descriptionTextView = (TextView) listItemView.findViewById(R.id.insp_desc);
+ descriptionTextView.setText(currentItem.getDescription());
+
+ ImageView imageView = (ImageView) listItemView.findViewById(R.id.insp_image);
+ Picasso.with(getContext())
+ .load(currentItem.getImageURL())
+ .placeholder(R.drawable.mocheeloading)
+ .into(imageView);
+
+ TextView titleView = (TextView) listItemView.findViewById(R.id.insp_title);
+ titleView.setText(currentItem.getName());
+
+ TextView subtitletv = (TextView) listItemView.findViewById(R.id.insp_title2);
+ subtitletv.setText(currentItem.getSubname());
+
+ return listItemView;
+ }
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment6_parts/Enquiry.java b/app/src/main/java/com/example/h_mal/mochee/Fragment6_parts/Enquiry.java
new file mode 100644
index 0000000..df1ccf5
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment6_parts/Enquiry.java
@@ -0,0 +1,36 @@
+package com.example.h_mal.mochee.Fragment6_parts;
+
+/**
+ * Created by h_mal on 06/02/2018.
+ */
+
+public class Enquiry {
+
+ private String enqName;
+ private String enqEmail;
+ private String enqSubject;
+ private String enqMessage;
+
+ public Enquiry(String enqName, String enqEmail, String enqSubject, String enqMessage) {
+ this.enqName = enqName;
+ this.enqEmail = enqEmail;
+ this.enqSubject = enqSubject;
+ this.enqMessage = enqMessage;
+ }
+
+ public String getEnqName() {
+ return enqName;
+ }
+
+ public String getEnqEmail() {
+ return enqEmail;
+ }
+
+ public String getEnqSubject() {
+ return enqSubject;
+ }
+
+ public String getEnqMessage() {
+ return enqMessage;
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment_Four.java b/app/src/main/java/com/example/h_mal/mochee/Fragment_Four.java
new file mode 100644
index 0000000..5ec77df
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment_Four.java
@@ -0,0 +1,81 @@
+package com.example.h_mal.mochee;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ListView;
+
+import com.example.h_mal.mochee.Fragment4_Parts.InspirationItems;
+import com.example.h_mal.mochee.Fragment4_Parts.InspirationItems_Adapter;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+
+import java.util.ArrayList;
+
+/**
+ * Created by h_mal on 07/10/2017.
+ */
+
+public class Fragment_Four extends Fragment {
+
+ DatabaseReference inspDb;
+ ListView listView;
+ ArrayList inspirationItems;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment4, container, false);
+
+ inspDb = FirebaseDatabase.getInstance().getReference("inspirationItems");
+
+ inspirationItems = new ArrayList();
+
+ InspirationItems_Adapter adapter = new InspirationItems_Adapter(getActivity(),inspirationItems);
+ listView = (ListView) rootView.findViewById(R.id.insp_list);
+
+ listView.setAdapter(adapter);
+
+ inspDb.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot) {
+
+
+ //clearing the previous artist list
+ inspirationItems.clear();
+
+ //iterating through all the nodes
+ for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
+ //getting artist
+ InspirationItems artist = postSnapshot.getValue(InspirationItems.class);
+ //adding artist to the list
+ inspirationItems.add(artist);
+ }
+
+ //creating adapter
+ InspirationItems_Adapter adapter = new InspirationItems_Adapter(getActivity(),inspirationItems);
+ //attaching adapter to the listview
+ listView.setAdapter(adapter);
+ }
+
+ @Override
+ public void onCancelled(DatabaseError databaseError) {
+
+ }
+ });
+ return rootView;
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ //attaching value event listener
+
+ }
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment_Six.java b/app/src/main/java/com/example/h_mal/mochee/Fragment_Six.java
new file mode 100644
index 0000000..ac66930
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment_Six.java
@@ -0,0 +1,110 @@
+package com.example.h_mal.mochee;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.example.h_mal.mochee.Fragment6_parts.Enquiry;
+import com.google.android.gms.maps.CameraUpdateFactory;
+import com.google.android.gms.maps.GoogleMap;
+import com.google.android.gms.maps.MapView;
+import com.google.android.gms.maps.MapsInitializer;
+import com.google.android.gms.maps.OnMapReadyCallback;
+import com.google.android.gms.maps.model.CameraPosition;
+import com.google.android.gms.maps.model.LatLng;
+import com.google.android.gms.maps.model.MarkerOptions;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+
+/**
+ * Created by h_mal on 07/10/2017.
+ */
+
+public class Fragment_Six extends Fragment{
+
+ MapView mapView;
+ GoogleMap map;
+ private DatabaseReference mDatabase;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment6, container, false);
+
+ final EditText name = (EditText) rootView.findViewById(R.id.nameET);
+ final EditText email = (EditText) rootView.findViewById(R.id.editText2);
+ final EditText subject = (EditText) rootView.findViewById(R.id.editText);
+ final EditText message = (EditText) rootView.findViewById(R.id.editText4);
+
+ mDatabase = FirebaseDatabase.getInstance().getReference();
+
+ Button button = (Button) rootView.findViewById(R.id.button);
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ final Enquiry enquiry = new Enquiry(name.getText().toString(),email.getText().toString(),subject.getText().toString(),message.getText().toString());
+ mDatabase.child("Enquiry").push().setValue(enquiry);
+ }
+ });
+
+ mapView = (MapView) rootView.findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+
+ mapView.onResume(); // needed to get the map to display immediately
+
+ try {
+ MapsInitializer.initialize(getActivity().getApplicationContext());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ mapView.getMapAsync(new OnMapReadyCallback() {
+ @Override
+ public void onMapReady(GoogleMap mMap) {
+ map = mMap;
+
+ // For showing a move to my location button
+// map.setMyLocationEnabled(true);
+
+ // For dropping a marker at a point on the Map
+ LatLng sydney = new LatLng(51.2704, 0.5227);
+ map.addMarker(new MarkerOptions().position(sydney).title("Mochee Kent")).showInfoWindow();
+
+ // For zooming automatically to the location of the marker
+ CameraPosition cameraPosition = new CameraPosition.Builder().target(sydney).zoom(12).build();
+ map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
+ }
+ });
+
+ return rootView;
+
+ }
+
+ @Override
+ public void onResume() {
+ mapView.onResume();
+ super.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ mapView.onPause();
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ mapView.onDestroy();
+ }
+
+ @Override
+ public void onLowMemory() {
+ super.onLowMemory();
+ mapView.onLowMemory();
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment_Three.java b/app/src/main/java/com/example/h_mal/mochee/Fragment_Three.java
new file mode 100644
index 0000000..b6ce465
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment_Three.java
@@ -0,0 +1,44 @@
+package com.example.h_mal.mochee;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.ListView;
+
+import com.example.h_mal.mochee.Fragment3_Parts.Bespoke;
+import com.example.h_mal.mochee.Fragment3_Parts.Bespoke_Adapter;
+
+import java.util.ArrayList;
+
+/**
+ * Created by h_mal on 07/10/2017.
+ */
+
+public class Fragment_Three extends Fragment{
+
+ ImageView imMain;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment3, container, false);
+
+ final ArrayList bespoke = new ArrayList();
+ bespoke.add(new Bespoke(R.drawable.cloth,R.color.bespoke_bg1,"CHOOSE YOUR\nFABRIC", Color.WHITE,"Choose from our material library. A mixture of velvet, jamawar and jacquard patterns.", Color.BLACK));
+ bespoke.add(new Bespoke(R.drawable.pen,R.color.bespoke_bg2,"DESIGN", R.color.bespoke_bg1,"Let our design team take charge to mock up a concept which you can personalise from the lapels to the cuff buttons. ", Color.WHITE));
+ bespoke.add(new Bespoke(R.drawable.tailor,R.color.bespoke_bg3,"TAILOR\nMADE", R.color.bespoke_bg1,"Let our skilled tailors take charge in creating your master piece. Allow two week for a finished arcticle.", Color.BLACK));
+ bespoke.add(new Bespoke(R.drawable.world,R.color.bespoke_bg4,"UK & WORLDWIDE DELIVERY", Color.BLACK,"We deliver to all UK destinations free of charge. To all other worldwide destinations we charge a small fee.", Color.BLACK));
+
+ Bespoke_Adapter adapter = new Bespoke_Adapter(getActivity(),bespoke);
+ ListView listView = (ListView) rootView.findViewById(R.id.list_bespoke);
+
+ listView.setAdapter(adapter);
+
+ return rootView;
+ }
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Fragment_home.java b/app/src/main/java/com/example/h_mal/mochee/Fragment_home.java
new file mode 100644
index 0000000..6bbdaac
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Fragment_home.java
@@ -0,0 +1,23 @@
+package com.example.h_mal.mochee;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Created by h_mal on 07/10/2017.
+ */
+
+public class Fragment_home extends Fragment{
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment1, container, false);
+
+ return rootView;
+ }
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/ImageViewer/ImageViewer.java b/app/src/main/java/com/example/h_mal/mochee/ImageViewer/ImageViewer.java
new file mode 100644
index 0000000..6e4f7e8
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/ImageViewer/ImageViewer.java
@@ -0,0 +1,91 @@
+package com.example.h_mal.mochee.ImageViewer;
+
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+
+import com.example.h_mal.mochee.R;
+
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class ImageViewer extends AppCompatActivity {
+
+ Integer imageInt;
+ ProgressBar pb;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ setContentView(R.layout.activity_image_viewer);
+
+ pb = (ProgressBar) findViewById(R.id.progressBar2);
+
+ ZoomableImageView im = (ZoomableImageView) findViewById(R.id.imageView);
+
+ Intent intent = getIntent();
+
+ String url = intent.getStringExtra("image");
+
+ im.setTag(url);
+
+ DownloadImagesTask retrieve = new DownloadImagesTask();
+ retrieve.execute(im);
+
+ }
+
+ public void BackFromActivity(View view) {
+ finish();
+ }
+
+ public class DownloadImagesTask extends AsyncTask {
+
+ ImageView imageView = null;
+
+ @Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ pb.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ protected Bitmap doInBackground(ImageView... imageViews) {
+ this.imageView = imageViews[0];
+ return download_Image((String)imageView.getTag());
+ }
+
+ @Override
+ protected void onPostExecute(Bitmap result) {
+ imageView.setImageBitmap(result);
+ pb.setVisibility(View.GONE);
+ }
+
+ private Bitmap download_Image(String url) {
+
+ Bitmap bmp =null;
+ try{
+ URL ulrn = new URL(url);
+ HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
+ InputStream is = con.getInputStream();
+ bmp = BitmapFactory.decodeStream(is);
+ if (null != bmp)
+ return bmp;
+
+ }catch(Exception e){}
+ return bmp;
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/ImageViewer/ZoomableImageView.java b/app/src/main/java/com/example/h_mal/mochee/ImageViewer/ZoomableImageView.java
new file mode 100644
index 0000000..6edde3e
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/ImageViewer/ZoomableImageView.java
@@ -0,0 +1,272 @@
+package com.example.h_mal.mochee.ImageViewer;
+
+/**
+ * Created by h_mal on 03/02/2018.
+ */
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Matrix;
+import android.graphics.PointF;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.ScaleGestureDetector;
+import android.view.View;
+
+public class ZoomableImageView extends android.support.v7.widget.AppCompatImageView
+{
+ Matrix matrix = new Matrix();
+
+ static final int NONE = 0;
+ static final int DRAG = 1;
+ static final int ZOOM = 2;
+ static final int CLICK = 3;
+ int mode = NONE;
+
+ PointF last = new PointF();
+ PointF start = new PointF();
+ float minScale = 1f;
+ float maxScale = 4f;
+ float[] m;
+
+ float redundantXSpace, redundantYSpace;
+ float width, height;
+ float saveScale = 1f;
+ float right, bottom, origWidth, origHeight, bmWidth, bmHeight;
+
+ ScaleGestureDetector mScaleDetector;
+ Context context;
+
+ public ZoomableImageView(Context context, AttributeSet attr)
+ {
+ super(context, attr);
+ super.setClickable(true);
+ this.context = context;
+ mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
+ matrix.setTranslate(1f, 1f);
+ m = new float[9];
+ setImageMatrix(matrix);
+ setScaleType(ScaleType.MATRIX);
+
+ setOnTouchListener(new OnTouchListener()
+ {
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event)
+ {
+ mScaleDetector.onTouchEvent(event);
+
+ matrix.getValues(m);
+ float x = m[Matrix.MTRANS_X];
+ float y = m[Matrix.MTRANS_Y];
+ PointF curr = new PointF(event.getX(), event.getY());
+
+ switch (event.getAction())
+ {
+ //when one finger is touching
+ //set the mode to DRAG
+ case MotionEvent.ACTION_DOWN:
+ last.set(event.getX(), event.getY());
+ start.set(last);
+ mode = DRAG;
+ break;
+ //when two fingers are touching
+ //set the mode to ZOOM
+ case MotionEvent.ACTION_POINTER_DOWN:
+ last.set(event.getX(), event.getY());
+ start.set(last);
+ mode = ZOOM;
+ break;
+ //when a finger moves
+ //If mode is applicable move image
+ case MotionEvent.ACTION_MOVE:
+ //if the mode is ZOOM or
+ //if the mode is DRAG and already zoomed
+ if (mode == ZOOM || (mode == DRAG && saveScale > minScale))
+ {
+ float deltaX = curr.x - last.x;// x difference
+ float deltaY = curr.y - last.y;// y difference
+ float scaleWidth = Math.round(origWidth * saveScale);// width after applying current scale
+ float scaleHeight = Math.round(origHeight * saveScale);// height after applying current scale
+ //if scaleWidth is smaller than the views width
+ //in other words if the image width fits in the view
+ //limit left and right movement
+ if (scaleWidth < width)
+ {
+ deltaX = 0;
+ if (y + deltaY > 0)
+ deltaY = -y;
+ else if (y + deltaY < -bottom)
+ deltaY = -(y + bottom);
+ }
+ //if scaleHeight is smaller than the views height
+ //in other words if the image height fits in the view
+ //limit up and down movement
+ else if (scaleHeight < height)
+ {
+ deltaY = 0;
+ if (x + deltaX > 0)
+ deltaX = -x;
+ else if (x + deltaX < -right)
+ deltaX = -(x + right);
+ }
+ //if the image doesnt fit in the width or height
+ //limit both up and down and left and right
+ else
+ {
+ if (x + deltaX > 0)
+ deltaX = -x;
+ else if (x + deltaX < -right)
+ deltaX = -(x + right);
+
+ if (y + deltaY > 0)
+ deltaY = -y;
+ else if (y + deltaY < -bottom)
+ deltaY = -(y + bottom);
+ }
+ //move the image with the matrix
+ matrix.postTranslate(deltaX, deltaY);
+ //set the last touch location to the current
+ last.set(curr.x, curr.y);
+ }
+ break;
+ //first finger is lifted
+ case MotionEvent.ACTION_UP:
+ mode = NONE;
+ int xDiff = (int) Math.abs(curr.x - start.x);
+ int yDiff = (int) Math.abs(curr.y - start.y);
+ if (xDiff < CLICK && yDiff < CLICK)
+ performClick();
+ break;
+ // second finger is lifted
+ case MotionEvent.ACTION_POINTER_UP:
+ mode = NONE;
+ break;
+ }
+ setImageMatrix(matrix);
+ invalidate();
+ return true;
+ }
+
+ });
+ }
+
+ @Override
+ public void setImageBitmap(Bitmap bm)
+ {
+ super.setImageBitmap(bm);
+ bmWidth = bm.getWidth();
+ bmHeight = bm.getHeight();
+ }
+
+ public void setMaxZoom(float x)
+ {
+ maxScale = x;
+ }
+
+ private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener
+ {
+
+ @Override
+ public boolean onScaleBegin(ScaleGestureDetector detector)
+ {
+ mode = ZOOM;
+ return true;
+ }
+
+ @Override
+ public boolean onScale(ScaleGestureDetector detector)
+ {
+ float mScaleFactor = detector.getScaleFactor();
+ float origScale = saveScale;
+ saveScale *= mScaleFactor;
+ if (saveScale > maxScale)
+ {
+ saveScale = maxScale;
+ mScaleFactor = maxScale / origScale;
+ }
+ else if (saveScale < minScale)
+ {
+ saveScale = minScale;
+ mScaleFactor = minScale / origScale;
+ }
+ right = width * saveScale - width - (2 * redundantXSpace * saveScale);
+ bottom = height * saveScale - height - (2 * redundantYSpace * saveScale);
+ if (origWidth * saveScale <= width || origHeight * saveScale <= height)
+ {
+ matrix.postScale(mScaleFactor, mScaleFactor, width / 2, height / 2);
+ if (mScaleFactor < 1)
+ {
+ matrix.getValues(m);
+ float x = m[Matrix.MTRANS_X];
+ float y = m[Matrix.MTRANS_Y];
+ if (mScaleFactor < 1)
+ {
+ if (Math.round(origWidth * saveScale) < width)
+ {
+ if (y < -bottom)
+ matrix.postTranslate(0, -(y + bottom));
+ else if (y > 0)
+ matrix.postTranslate(0, -y);
+ }
+ else
+ {
+ if (x < -right)
+ matrix.postTranslate(-(x + right), 0);
+ else if (x > 0)
+ matrix.postTranslate(-x, 0);
+ }
+ }
+ }
+ }
+ else
+ {
+ matrix.postScale(mScaleFactor, mScaleFactor, detector.getFocusX(), detector.getFocusY());
+ matrix.getValues(m);
+ float x = m[Matrix.MTRANS_X];
+ float y = m[Matrix.MTRANS_Y];
+ if (mScaleFactor < 1) {
+ if (x < -right)
+ matrix.postTranslate(-(x + right), 0);
+ else if (x > 0)
+ matrix.postTranslate(-x, 0);
+ if (y < -bottom)
+ matrix.postTranslate(0, -(y + bottom));
+ else if (y > 0)
+ matrix.postTranslate(0, -y);
+ }
+ }
+ return true;
+ }
+ }
+
+ @Override
+ protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
+ {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ width = MeasureSpec.getSize(widthMeasureSpec);
+ height = MeasureSpec.getSize(heightMeasureSpec);
+ //Fit to screen.
+ float scale;
+ float scaleX = width / bmWidth;
+ float scaleY = height / bmHeight;
+ scale = Math.min(scaleX, scaleY);
+ matrix.setScale(scale, scale);
+ setImageMatrix(matrix);
+ saveScale = 1f;
+
+ // Center the image
+ redundantYSpace = height - (scale * bmHeight) ;
+ redundantXSpace = width - (scale * bmWidth);
+ redundantYSpace /= 2;
+ redundantXSpace /= 2;
+
+ matrix.postTranslate(redundantXSpace, redundantYSpace);
+
+ origWidth = width - 2 * redundantXSpace;
+ origHeight = height - 2 * redundantYSpace;
+ right = width * saveScale - width - (2 * redundantXSpace * saveScale);
+ bottom = height * saveScale - height - (2 * redundantYSpace * saveScale);
+ setImageMatrix(matrix);
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Item_overview.java b/app/src/main/java/com/example/h_mal/mochee/Item_overview.java
new file mode 100644
index 0000000..96f0029
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Item_overview.java
@@ -0,0 +1,267 @@
+package com.example.h_mal.mochee;
+
+import android.content.ContentValues;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatActivity;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.h_mal.mochee.Data.BasketContract.ItemEntry;
+import com.example.h_mal.mochee.Data.BasketDbHelper;
+import com.example.h_mal.mochee.ImageViewer.ImageViewer;
+import com.squareup.picasso.Picasso;
+
+import static java.lang.Float.parseFloat;
+import static java.lang.Integer.parseInt;
+
+public class Item_overview extends AppCompatActivity {
+
+ EditText quantityET;
+ TextView name;
+ TextView price;
+ String size;
+ Spinner sizeSpinner;
+ Integer quantity = 1;
+ String imageURL;
+ String strBase64;
+
+ static ImageView iV;
+
+ byte[] b;
+
+ BasketDbHelper basketDbHelper;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_item_overview);
+
+ name = (TextView) findViewById(R.id.nameTV);
+ price = (TextView) findViewById(R.id.priceTV);
+ iV = (ImageView) findViewById(R.id.imageView2);
+ sizeSpinner = (Spinner) findViewById(R.id.spinner);
+ quantityET = (EditText) findViewById(R.id.quantityTV);
+ TextView increaseTV = (TextView) findViewById(R.id.plus);
+ TextView decreaseTV = (TextView) findViewById(R.id.minus);
+
+ quantityET.setText("1");
+
+ Intent intent = getIntent();
+
+ imageURL = intent.getStringExtra("image");
+ Picasso.with(this)
+ .load(imageURL)
+ .placeholder(R.drawable.mocheeloading)
+ .into(iV);
+
+ name.setText(intent.getStringExtra("name"));
+
+ iV.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if( imageURL != null) {
+ Intent intent = new Intent(Item_overview.this, ImageViewer.class);
+ intent.putExtra("image", imageURL);
+ startActivity(intent);
+ }
+ }
+ });
+
+ price.setText(intent.getStringExtra("price"));
+
+ addListenerOnSpinnerItemSelection();
+
+ increaseTV.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ increaseQuantity();
+ }
+ });
+
+ decreaseTV.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ decreaseQuantity();
+ }
+ });
+
+ quantityET.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void afterTextChanged(Editable editable) {
+ if (quantityET.getText().toString().equals("")){
+ return;
+ }
+ if (parseInt(quantityET.getText().toString()) <= 0){
+ quantityET.setText("1");
+ }
+ }
+ });
+
+ }
+
+ public void submit(View view) {
+ if (quantityET.getText().toString().equals("")) {
+ Toast.makeText(this, "No quantity selected", Toast.LENGTH_SHORT).show();
+ }
+
+ if(CheckIsDataAlreadyInDBorNot()){
+ updateProduct();
+ }else{
+ insertProduct();
+ }
+
+ new AlertDialog.Builder(this)
+ .setTitle("Item added to cart?")
+ .setMessage("Open cart?")
+ .setNegativeButton("Return to Items", new DialogInterface.OnClickListener() {
+
+ public void onClick(DialogInterface arg0, int arg1) {
+ Item_overview.super.onBackPressed();
+ finish();
+ getFragmentManager().popBackStackImmediate();
+ }
+ })
+ .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
+
+ public void onClick(DialogInterface arg0, int arg1) {
+ Intent intent = new Intent(Item_overview.this, BasketActivity.class);
+ startActivity(intent);
+ finish();
+ }
+ }).create().show();
+
+ }
+
+ private void increaseQuantity(){
+ quantity = parseInt(quantityET.getText().toString());
+ quantity = quantity + 1;
+ quantityET.setText(quantity.toString());
+ }
+
+ private void decreaseQuantity(){
+ quantity = parseInt(quantityET.getText().toString());
+ if (quantity == 1){
+
+ }else{
+ quantity = quantity - 1;
+ quantityET.setText(quantity.toString());
+// (""+quantity);
+ }
+ }
+
+ private void insertProduct(){
+
+ ContentValues values = new ContentValues();
+
+// iV.buildDrawingCache();
+// Bitmap bmap = iV.getDrawingCache();
+// ByteArrayOutputStream baos = new ByteArrayOutputStream();
+// bmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object
+// b = baos.toByteArray();
+// strBase64= Base64.encodeToString(b, 0);
+
+ values.put(ItemEntry.COLUMN_ITEM_IMAGE, imageURL);
+ values.put(ItemEntry.COLUMN_ITEM_NAME, name.getText().toString());
+ values.put(ItemEntry.COLUMN_ITEM_PRICE, parseFloat((price.getText().toString()).substring((price.getText().toString()).length() - 6)));
+ values.put(ItemEntry.COLUMN_ITEM_SIZE, size);
+ values.put(ItemEntry.COLUMN_ITEM_QUANTITY, quantity);
+ values.put(ItemEntry.COLUMN_ITEM_TOTALPRICE, (quantity * (parseFloat((price.getText().toString()).substring((price.getText().toString()).length() - 6)))));
+
+ getContentResolver().insert(ItemEntry.CONTENT_URI, values);
+
+ }
+
+ public boolean CheckIsDataAlreadyInDBorNot() {
+
+ String[] columns = { ItemEntry.COLUMN_ITEM_NAME , ItemEntry.COLUMN_ITEM_SIZE , ItemEntry.COLUMN_ITEM_QUANTITY};
+ String selection = ItemEntry.COLUMN_ITEM_NAME + " =? AND " + ItemEntry.COLUMN_ITEM_SIZE + " =?";
+ String[] selectionArgs = { name.getText().toString(), size};
+
+ Cursor cursor = getContentResolver().query(ItemEntry.CONTENT_URI,columns,selection,selectionArgs,null);
+
+ int quan = 0;
+ if (!cursor.moveToFirst()){
+ cursor.moveToFirst();
+ }
+ try {
+ quan = cursor.getInt(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_QUANTITY));
+ }catch (Exception e){
+ System.out.println("error");
+ }
+ boolean exists = (cursor.getCount() > 0);
+
+ cursor.close();
+
+ return exists;
+
+ }
+
+ private void updateProduct(){
+
+ String[] columns = { ItemEntry.COLUMN_ITEM_NAME , ItemEntry.COLUMN_ITEM_SIZE , ItemEntry.COLUMN_ITEM_QUANTITY, ItemEntry._ID, ItemEntry.COLUMN_ITEM_TOTALPRICE};
+ String selection = ItemEntry.COLUMN_ITEM_NAME + " =? AND " + ItemEntry.COLUMN_ITEM_SIZE + " =?";
+ String[] selectionArgs = { name.getText().toString(), size};
+
+ Cursor cursor = getContentResolver().query(ItemEntry.CONTENT_URI,columns,selection,selectionArgs,null);
+
+ if (!cursor.moveToFirst()){
+ cursor.moveToFirst();
+ }
+
+ String ID = cursor.getString(cursor.getColumnIndexOrThrow(ItemEntry._ID));
+
+ quantity = quantity + cursor.getInt(cursor.getColumnIndexOrThrow(ItemEntry.COLUMN_ITEM_QUANTITY));
+
+ ContentValues values = new ContentValues();
+
+
+// values.put(ItemEntry.COLUMN_ITEM_IMAGE, strBase64);
+// values.put(ItemEntry.COLUMN_ITEM_NAME, name.getText().toString());
+// values.put(ItemEntry.COLUMN_ITEM_PRICE, parseFloat((price.getText().toString()).substring((price.getText().toString()).length() - 6)));
+// values.put(ItemEntry.COLUMN_ITEM_SIZE, size);
+ values.put(ItemEntry.COLUMN_ITEM_QUANTITY, quantity);
+ values.put(ItemEntry.COLUMN_ITEM_TOTALPRICE, (quantity * (parseFloat((price.getText().toString()).substring((price.getText().toString()).length() - 6)))));
+
+ getContentResolver().update(ItemEntry.CONTENT_URI,values,ItemEntry._ID + " =? ", new String[]{ID});
+ cursor.close();
+ }
+
+ public void addListenerOnSpinnerItemSelection() {
+ sizeSpinner = (Spinner) findViewById(R.id.spinner);
+ sizeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> parentView, View selectedItemView, int pos, long id) {
+ size = parentView.getItemAtPosition(pos).toString();
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parentView) {
+ // your code here
+ }
+
+ });
+
+ }
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/MainActivity.java b/app/src/main/java/com/example/h_mal/mochee/MainActivity.java
new file mode 100644
index 0000000..1787879
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/MainActivity.java
@@ -0,0 +1,146 @@
+package com.example.h_mal.mochee;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.example.h_mal.mochee.Fragment2_Parts.Fragment_Two;
+
+public class MainActivity extends AppCompatActivity {
+
+ /**
+ * The {@link android.support.v4.view.PagerAdapter} that will provide
+ * fragments for each of the sections. We use a
+ * {@link FragmentPagerAdapter} derivative, which will keep every
+ * loaded fragment in memory. If this becomes too memory intensive, it
+ * may be best to switch to a
+ * {@link android.support.v4.app.FragmentStatePagerAdapter}.
+ */
+
+ private SectionsPagerAdapter mSectionsPagerAdapter;
+
+ private TabLayout tabLayout;
+
+ /**
+ * The {@link ViewPager} that will host the section contents.
+ */
+ private ViewPager mViewPager;
+
+ TextView basketQuantity;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+
+
+ // Create the adapter that will return a fragment for each of the three
+ // primary sections of the activity.
+ mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
+
+ // Set up the ViewPager with the sections adapter.
+ mViewPager = (ViewPager) findViewById(R.id.container);
+ mViewPager.setAdapter(mSectionsPagerAdapter);
+
+ tabLayout = (TabLayout) findViewById(R.id.tabs);
+ tabLayout.setupWithViewPager(mViewPager);
+ tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
+
+ basketQuantity = (TextView) findViewById(R.id.backet_quantity);
+
+ RelativeLayout basket = (RelativeLayout) findViewById(R.id.basket);
+
+ basket.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View v) {
+ if(basketQuantity.equals("0")){
+ Intent intent = new Intent(MainActivity.this, BasketActivity.class);
+ startActivity(intent);
+ }else {
+ Intent intent = new Intent(MainActivity.this, BasketActivity.class);
+ startActivity(intent);
+ }
+ }
+ });
+
+ basketQuantity.setText(Basket_Counter.setBasketQuantity(this)+"");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ basketQuantity.setText(Basket_Counter.setBasketQuantity(this)+"");
+ }
+
+
+ /**
+ * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
+ * one of the sections/tabs/pages.
+ */
+ public class SectionsPagerAdapter extends FragmentPagerAdapter {
+
+ public SectionsPagerAdapter(FragmentManager fm) {
+ super(fm);
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ switch (position){
+ case 0:
+ Fragment_home tab1 = new Fragment_home();
+ return tab1;
+ case 1:
+ Fragment_Two tab2 = new Fragment_Two();
+ return tab2;
+ case 2:
+ Fragment_Three tab3 = new Fragment_Three();
+ return tab3;
+ case 3:
+ Fragment_Four tab4 = new Fragment_Four();
+ return tab4;
+ case 4:
+ Fragment_Six tab6 = new Fragment_Six();
+ return tab6;
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public int getCount() {
+ // Show 3 total pages.
+ return 5;
+ }
+
+ @Override
+ public CharSequence getPageTitle(int position) {
+ switch (position) {
+ case 0:
+ return "Home";
+ case 1:
+ return "Shop";
+ case 2:
+ return "Tailor Made";
+ case 3:
+ return "Inspiration";
+ case 4:
+ return "Contact";
+ }
+ return null;
+ }
+
+
+ }
+
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/NonScrollListView.java b/app/src/main/java/com/example/h_mal/mochee/NonScrollListView.java
new file mode 100644
index 0000000..070c00e
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/NonScrollListView.java
@@ -0,0 +1,31 @@
+package com.example.h_mal.mochee;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.ViewGroup;
+import android.widget.ListView;
+
+/**
+ * Created by h_mal on 18/01/2018.
+ */
+
+public class NonScrollListView extends ListView {
+
+ public NonScrollListView(Context context) {
+ super(context);
+ }
+ public NonScrollListView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+ public NonScrollListView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+ @Override
+ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
+ Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
+ ViewGroup.LayoutParams params = getLayoutParams();
+ params.height = getMeasuredHeight();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/h_mal/mochee/Order.java b/app/src/main/java/com/example/h_mal/mochee/Order.java
new file mode 100644
index 0000000..86e808a
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Order.java
@@ -0,0 +1,90 @@
+package com.example.h_mal.mochee;
+
+import java.util.ArrayList;
+
+/**
+ * Created by h_mal on 08/02/2018.
+ */
+
+public class Order {
+
+ public String customerName;
+ public String customerAddress;
+ public String customerCountry;
+ public String customerNote;
+ public String customerEmail;
+ public Payment customerPayment;
+ public ArrayList
- customerBasket;
+
+ //all parts
+ public Order(String customerName, String customerAddress, String customerCountry, String customerNote, String customerEmail, Payment customerPayment, ArrayList
- customerBasket) {
+ this.customerName = customerName;
+ this.customerAddress = customerAddress;
+ this.customerCountry = customerCountry;
+ this.customerNote = customerNote;
+ this.customerEmail = customerEmail;
+ this.customerPayment = customerPayment;
+ this.customerBasket = customerBasket;
+ }
+}
+
+ class Payment{
+
+ public Price customerPriceBreakdown;
+ public PaypalInfo customerPaypalInfo;
+
+ public Payment(Price customerPriceBreakdown, PaypalInfo customerPaypalInfo) {
+ this.customerPriceBreakdown = customerPriceBreakdown;
+ this.customerPaypalInfo = customerPaypalInfo;
+ }
+}
+
+class Price{
+
+ public Double deliveryPrice;
+ public Double subtotalPrice;
+ public Double totalPrice;
+
+ public Price(Double deliveryPrice, Double subtotalPrice, Double totalPrice) {
+ this.deliveryPrice = deliveryPrice;
+ this.subtotalPrice = subtotalPrice;
+ this.totalPrice = totalPrice;
+ }
+}
+
+class PaypalInfo{
+
+ public String transactionID;
+ public String date;
+ public String state;
+
+ public PaypalInfo(String transactionID, String date, String state) {
+ this.transactionID = transactionID;
+ this.date = date;
+ this.state = state;
+ }
+}
+
+class Basket{
+
+ public Item items;
+
+ public Basket(Item items) {
+ this.items = items;
+ }
+}
+
+class Item{
+
+ public Integer itemNumber;
+ public String itemName;
+ public String itemSize;
+ public Integer itemQuantity;
+
+ public Item(Integer itemNumber, String itemName, String itemSize, Integer itemQuantity) {
+ this.itemNumber = itemNumber;
+ this.itemName = itemName;
+ this.itemSize = itemSize;
+ this.itemQuantity = itemQuantity;
+ }
+}
diff --git a/app/src/main/java/com/example/h_mal/mochee/Splashscreen.java b/app/src/main/java/com/example/h_mal/mochee/Splashscreen.java
new file mode 100644
index 0000000..cad1807
--- /dev/null
+++ b/app/src/main/java/com/example/h_mal/mochee/Splashscreen.java
@@ -0,0 +1,39 @@
+package com.example.h_mal.mochee;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+
+public class Splashscreen extends Activity {
+
+ // Splash screen timer
+ private static int SPLASH_TIME_OUT = 2000;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main2);
+
+ new Handler().postDelayed(new Runnable() {
+
+ /*
+ * Showing splash screen with a timer. This will be useful when you
+ * want to show case your app logo / company
+ */
+
+ @Override
+ public void run() {
+ // This method will be executed once the timer is over
+ // Start your app main activity
+ Intent i = new Intent(Splashscreen.this, MainActivity.class);
+ startActivity(i);
+ overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
+ // close this activity
+ finish();
+
+
+ }
+ }, SPLASH_TIME_OUT);
+ }
+}
diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml
new file mode 100644
index 0000000..3102990
--- /dev/null
+++ b/app/src/main/res/anim/fade_in.xml
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/fade_out.xml b/app/src/main/res/anim/fade_out.xml
new file mode 100644
index 0000000..9e2d22a
--- /dev/null
+++ b/app/src/main/res/anim/fade_out.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/fragments1.jpg b/app/src/main/res/drawable/fragments1.jpg
new file mode 100644
index 0000000..f80ddf3
Binary files /dev/null and b/app/src/main/res/drawable/fragments1.jpg differ
diff --git a/app/src/main/res/drawable/frame.jpg b/app/src/main/res/drawable/frame.jpg
new file mode 100644
index 0000000..47f8e50
Binary files /dev/null and b/app/src/main/res/drawable/frame.jpg differ
diff --git a/app/src/main/res/drawable/home_top.jpg b/app/src/main/res/drawable/home_top.jpg
new file mode 100644
index 0000000..95c8229
Binary files /dev/null and b/app/src/main/res/drawable/home_top.jpg differ
diff --git a/app/src/main/res/drawable/inspiration_item.webp b/app/src/main/res/drawable/inspiration_item.webp
new file mode 100644
index 0000000..303b650
Binary files /dev/null and b/app/src/main/res/drawable/inspiration_item.webp differ
diff --git a/app/src/main/res/drawable/m.png b/app/src/main/res/drawable/m.png
new file mode 100644
index 0000000..18cfa62
Binary files /dev/null and b/app/src/main/res/drawable/m.png differ
diff --git a/app/src/main/res/drawable/sale_icon.png b/app/src/main/res/drawable/sale_icon.png
new file mode 100644
index 0000000..deb1ee2
Binary files /dev/null and b/app/src/main/res/drawable/sale_icon.png differ
diff --git a/app/src/main/res/drawable/scissor.webp b/app/src/main/res/drawable/scissor.webp
new file mode 100644
index 0000000..73e071b
Binary files /dev/null and b/app/src/main/res/drawable/scissor.webp differ
diff --git a/app/src/main/res/drawable/socialmediaicon.png b/app/src/main/res/drawable/socialmediaicon.png
new file mode 100644
index 0000000..a035afb
Binary files /dev/null and b/app/src/main/res/drawable/socialmediaicon.png differ
diff --git a/app/src/main/res/font/fonts.xml b/app/src/main/res/font/fonts.xml
new file mode 100644
index 0000000..0115a46
--- /dev/null
+++ b/app/src/main/res/font/fonts.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/font/tnrbold.otf b/app/src/main/res/font/tnrbold.otf
new file mode 100644
index 0000000..45c190e
Binary files /dev/null and b/app/src/main/res/font/tnrbold.otf differ
diff --git a/app/src/main/res/layout/activity_basket.xml b/app/src/main/res/layout/activity_basket.xml
new file mode 100644
index 0000000..c892dd2
--- /dev/null
+++ b/app/src/main/res/layout/activity_basket.xml
@@ -0,0 +1,291 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_image_viewer.xml b/app/src/main/res/layout/activity_image_viewer.xml
new file mode 100644
index 0000000..a5c5a70
--- /dev/null
+++ b/app/src/main/res/layout/activity_image_viewer.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_item_overview.xml b/app/src/main/res/layout/activity_item_overview.xml
new file mode 100644
index 0000000..f310990
--- /dev/null
+++ b/app/src/main/res/layout/activity_item_overview.xml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..a643a96
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main2.xml b/app/src/main/res/layout/activity_main2.xml
new file mode 100644
index 0000000..44694f0
--- /dev/null
+++ b/app/src/main/res/layout/activity_main2.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/custom_layout.xml b/app/src/main/res/layout/custom_layout.xml
new file mode 100644
index 0000000..6d1d003
--- /dev/null
+++ b/app/src/main/res/layout/custom_layout.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment1.xml b/app/src/main/res/layout/fragment1.xml
new file mode 100644
index 0000000..30aefa0
--- /dev/null
+++ b/app/src/main/res/layout/fragment1.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment2.xml b/app/src/main/res/layout/fragment2.xml
new file mode 100644
index 0000000..d69ed4d
--- /dev/null
+++ b/app/src/main/res/layout/fragment2.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment3.xml b/app/src/main/res/layout/fragment3.xml
new file mode 100644
index 0000000..4091190
--- /dev/null
+++ b/app/src/main/res/layout/fragment3.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment4.xml b/app/src/main/res/layout/fragment4.xml
new file mode 100644
index 0000000..a5d9495
--- /dev/null
+++ b/app/src/main/res/layout/fragment4.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment6.xml b/app/src/main/res/layout/fragment6.xml
new file mode 100644
index 0000000..2c4f768
--- /dev/null
+++ b/app/src/main/res/layout/fragment6.xml
@@ -0,0 +1,247 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_basket.xml b/app/src/main/res/layout/list_item_basket.xml
new file mode 100644
index 0000000..e145b11
--- /dev/null
+++ b/app/src/main/res/layout/list_item_basket.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_bespoke.xml b/app/src/main/res/layout/list_item_bespoke.xml
new file mode 100644
index 0000000..b230160
--- /dev/null
+++ b/app/src/main/res/layout/list_item_bespoke.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_blazers.xml b/app/src/main/res/layout/list_item_blazers.xml
new file mode 100644
index 0000000..12b119c
--- /dev/null
+++ b/app/src/main/res/layout/list_item_blazers.xml
@@ -0,0 +1,8 @@
+
+
diff --git a/app/src/main/res/layout/list_item_insp.xml b/app/src/main/res/layout/list_item_insp.xml
new file mode 100644
index 0000000..61f0ee2
--- /dev/null
+++ b/app/src/main/res/layout/list_item_insp.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/toolbar.xml b/app/src/main/res/layout/toolbar.xml
new file mode 100644
index 0000000..0559e4c
--- /dev/null
+++ b/app/src/main/res/layout/toolbar.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..a820548
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,10 @@
+
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..4850bdd
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,18 @@
+
+
+ #545252
+ #3c3c3c
+ #545252
+ #e5e5e5
+ #dbb368
+ #3c3c3c
+ #4d4e4f
+ #a9a9a9
+ #94817e
+
+ #4cd1a1
+ #545252
+ #ededed
+ #dbb368
+
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..cef3abc
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+ 16dp
+ 16dp
+ 16dp
+ 8dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..2dfc4c6
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,231 @@
+
+ Mochee
+ Clear Basket
+ DESIGN\nSERVICE
+ Our highly skilled design team produce concept design to scale from our customers preferred material choice. A great touch to a personalised service.
+
+
+ Hello blank fragment
+
+
+ Our Limited Edition velvet jacket, creating a contemporary floral impact. Ideal to team with a pair of black trousers to add a dandy touch to the total look.(Please allow 10 days to manufacture)
+
+
+
- 36 Inch Slim Fit (allow 14 days to make)
+ - 38 Inch Slim Fit (allow 14 days to make)
+ - 40 Inch Slim Fit (allow 14 days to make)
+ - 42 Inch Slim Fit (allow 14 days to make)
+ - 44 Inch Slim Fit (allow 14 days to make)
+ - For Bigger Size - Get In Touch
+
+
+
+ - Albania
+ - Algeria
+ - American Samoa
+ - Andorra
+ - Angola
+ - Anguilla
+ - Antigua
+ - Argentina
+ - Armenia
+ - Aruba
+ - Australia
+ - Austria
+ - Azerbaijan
+ - Bahamas
+ - Bahrain
+ - Bangladesh
+ - Barbados
+ - Belarus
+ - Belgium
+ - Belize
+ - Benin
+ - Bermuda
+ - Bhutan
+ - Bolivia
+ - Botswana
+ - Brazil
+ - British Virgin Is.
+ - Brunei
+ - Bulgaria
+ - Burkino Faso
+ - Burma
+ - Burundi
+ - Cambodia
+ - Cameroon
+ - Canada
+ - Cape Verde
+ - Cayman Islands
+ - Central African
+ - Chad
+ - Chile
+ - China
+ - Colombia
+ - Congo
+ - Congo, The Republic of
+ - Cook Islands
+ - Costa Rica
+ - Cote D'Ivoire
+ - Croatia
+ - Cyprus
+ - Czech Republic
+ - Denmark
+ - Djibouti
+ - Dominica
+ - Dominican Republic
+ - Ecuador
+ - Egypt
+ - El Salvador
+ - Equatorial Guinea
+ - Eritrea
+ - Estonia
+ - Ethiopia
+ - Faeroe Islands
+ - Fiji
+ - Finland
+ - France
+ - French Guiana
+ - French Polynesia
+ - Gabon
+ - Gambia
+ - Georgia, Republic of
+ - Germany
+ - Ghana
+ - Gibraltar
+ - Greece
+ - Greenland
+ - Grenada
+ - Guadeloupe
+ - Guam
+ - Guatemala
+ - Guinea
+ - Guinea-Bissau
+ - Guyana
+ - Haiti
+ - Honduras
+ - Hong Kong
+ - Hungary
+ - Iceland
+ - India
+ - Indonesia
+ - Ireland
+ - Israel
+ - Italy
+ - Ivory Coast
+ - Jamaica
+ - Japan
+ - Jordan
+ - Kazakhstan
+ - Kenya
+ - Kuwait
+ - Kyrgyzstan
+ - Latvia
+ - Lebanon
+ - Lesotho
+ - Liechtenstein
+ - Lithuania
+ - Luxembourg
+ - Macau
+ - Macedonia
+ - Madagascar
+ - Malawi
+ - Malaysia
+ - Maldives
+ - Mali
+ - Malta
+ - Marshall Islands
+ - Martinique
+ - Mauritania
+ - Mauritius
+ - Mexico
+ - Micronesia
+ - Moldova
+ - Monaco
+ - Mongolia
+ - Montserrat
+ - Morocco
+ - Mozambique
+ - Myanmar
+ - Namibia
+ - Nepal
+ - Netherlands
+ - Netherlands Antilles
+ - New Caledonia
+ - New Zealand
+ - Nicaragua
+ - Niger
+ - Nigeria
+ - Norway
+ - Oman
+ - Pakistan
+ - Palau
+ - Panama
+ - Papua New Guinea
+ - Paraguay
+ - Peru
+ - Philippines
+ - Poland
+ - Portugal
+ - Puerto Rico
+ - Qatar
+ - Reunion Island
+ - Romania
+ - Russia
+ - Rwanda
+ - Saipan
+ - San Marino
+ - Saudi Arabia
+ - Senegal
+ - Seychelles
+ - Sierra Leone
+ - Singapore
+ - Slovak Republic
+ - Slovenia
+ - South Africa
+ - South Korea
+ - Spain
+ - Sri Lanka
+ - St. Kitts & Nevis
+ - St. Lucia
+ - St. Vincent
+ - Suriname
+ - Swaziland
+ - Sweden
+ - Switzerland
+ - Syria
+ - Taiwan
+ - Tanzania
+ - Thailand
+ - Togo
+ - Trinidad & Tobago
+ - Tunisia
+ - Turkey
+ - Turkmenistan, Republic of
+ - Turks & Caicos Is.
+ - U.A.E.
+ - U.S. Virgin Islands
+ - U.S.A.
+ - Uganda
+ - Ukraine
+ - United Kingdom
+ - Uruguay
+ - Uzbekistan
+ - Vanuatu
+ - Vatican City
+ - Venezuela
+ - Vietnam
+ - Wallis & Futuna Islands
+ - Yemen
+ - Zambia
+ - Zimbabwe
+
+
+
+
+ - Yes
+ - No
+
+ Map
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..11806a7
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/com/example/h_mal/mochee/ExampleUnitTest.java b/app/src/test/java/com/example/h_mal/mochee/ExampleUnitTest.java
new file mode 100644
index 0000000..a77a3dd
--- /dev/null
+++ b/app/src/test/java/com/example/h_mal/mochee/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.example.h_mal.mochee;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..8138d02
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,26 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ google()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.0.1'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ classpath 'com.google.gms:google-services:3.1.0'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ google()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..aac7c9b
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,17 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..a8f0823
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Jan 16 22:43:33 AEDT 2018
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'