First professional project I took on as an android developer. The use of paypal library, firebase backend server, internal SQLite database and google maps library.
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
22
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
3
.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
18
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
33
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Mochee.iml" filepath="$PROJECT_DIR$/Mochee.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/runConfigurations.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
40
app/build.gradle
Normal file
@@ -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'
|
||||
55
app/google-services.json
Normal file
@@ -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"
|
||||
}
|
||||
25
app/proguard-rules.pro
vendored
Normal file
@@ -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
|
||||
@@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@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());
|
||||
}
|
||||
}
|
||||
72
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.h_mal.mochee">
|
||||
|
||||
<permission
|
||||
android:name="com.example.googlemap.permission.MAPS_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!-- <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> -->
|
||||
|
||||
|
||||
<!--
|
||||
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
|
||||
Google Maps Android API v2, but you must specify either coarse or fine
|
||||
location permissions for the 'MyLocation' functionality.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/m"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".Splashscreen"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName=".Splashscreen"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="@string/google_maps_key" />
|
||||
|
||||
<activity
|
||||
android:name=".Item_overview"
|
||||
android:parentActivityName=".MainActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.example.h_mal.mochee.MainActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".BasketActivity"
|
||||
android:parentActivityName=".MainActivity">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.example.h_mal.mochee.MainActivity" />
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name=".Data.BasketProvider"
|
||||
android:authorities="com.example.h_mal.mochee"
|
||||
android:exported="false" />
|
||||
|
||||
<activity android:name=".ImageViewer.ImageViewer" />
|
||||
<activity android:name=".DetailsActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
438
app/src/main/java/com/example/h_mal/mochee/BasketActivity.java
Normal file
@@ -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<Cursor>{
|
||||
|
||||
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<String> spinner_countries = new ArrayAdapter<String>(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<Item> basket = new ArrayList<Item>();
|
||||
|
||||
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<Cursor> 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<Cursor> loader, Cursor cursor) {
|
||||
mCursorAdapter.swapCursor(cursor);
|
||||
pb.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
mCursorAdapter.swapCursor(null);
|
||||
pb.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<Blazers> {
|
||||
|
||||
public static final String LOG_TAG = Fragment_Two.class.getName();
|
||||
|
||||
public Blazers_Adapter(Activity context, ArrayList<Blazers> 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;
|
||||
}
|
||||
}
|
||||
@@ -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> 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<Blazers>();
|
||||
|
||||
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(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<Bespoke> {
|
||||
|
||||
public Bespoke_Adapter(Activity context, ArrayList<Bespoke> 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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<InspirationItems> {
|
||||
|
||||
public InspirationItems_Adapter(Activity context, ArrayList<InspirationItems> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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> 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>();
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
110
app/src/main/java/com/example/h_mal/mochee/Fragment_Six.java
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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> bespoke = new ArrayList<Bespoke>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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, Void, Bitmap> {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
267
app/src/main/java/com/example/h_mal/mochee/Item_overview.java
Normal file
@@ -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
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
146
app/src/main/java/com/example/h_mal/mochee/MainActivity.java
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
90
app/src/main/java/com/example/h_mal/mochee/Order.java
Normal file
@@ -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<Item> customerBasket;
|
||||
|
||||
//all parts
|
||||
public Order(String customerName, String customerAddress, String customerCountry, String customerNote, String customerEmail, Payment customerPayment, ArrayList<Item> 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;
|
||||
}
|
||||
}
|
||||
39
app/src/main/java/com/example/h_mal/mochee/Splashscreen.java
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
5
app/src/main/res/anim/fade_in.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
android:duration="500" />
|
||||
6
app/src/main/res/anim/fade_out.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:fromAlpha="1.0" android:toAlpha="0.0"
|
||||
android:fillAfter="true"
|
||||
android:duration="500" />
|
||||
BIN
app/src/main/res/drawable/fragments1.jpg
Normal file
|
After Width: | Height: | Size: 348 KiB |
BIN
app/src/main/res/drawable/frame.jpg
Normal file
|
After Width: | Height: | Size: 131 KiB |
BIN
app/src/main/res/drawable/home_top.jpg
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
app/src/main/res/drawable/inspiration_item.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
app/src/main/res/drawable/m.png
Normal file
|
After Width: | Height: | Size: 867 B |
BIN
app/src/main/res/drawable/sale_icon.png
Normal file
|
After Width: | Height: | Size: 737 B |
BIN
app/src/main/res/drawable/scissor.webp
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
app/src/main/res/drawable/socialmediaicon.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
7
app/src/main/res/font/fonts.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<font
|
||||
android:fontStyle="normal"
|
||||
android:fontWeight="400"
|
||||
android:font="@font/tnrbold" />
|
||||
</font-family>
|
||||
BIN
app/src/main/res/font/tnrbold.otf
Normal file
291
app/src/main/res/layout/activity_basket.xml
Normal file
@@ -0,0 +1,291 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.example.h_mal.mochee.BasketActivity"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/emptyView"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="20dp"
|
||||
android:text="Cart Is Empty"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/emptyCart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="#484950"
|
||||
android:padding="10dp"
|
||||
android:text="Continue Shopping"
|
||||
android:textColor="#ffffff" />
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:id="@+id/progressBar"/>
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/whole_view">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.example.h_mal.mochee.NonScrollListView
|
||||
android:id="@+id/list_item_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_editor_absoluteX="8dp"
|
||||
tools:layout_editor_absoluteY="8dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:text="Subtotal"
|
||||
android:textColor="#303132" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtotalTV"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="£###.##"
|
||||
android:textColor="#303132" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="35dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Insert Shipping Details"
|
||||
android:textColor="#303132"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/detailsName"
|
||||
style="@style/Widget.AppCompat.EditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:ems="10"
|
||||
android:hint="Name"
|
||||
android:inputType="textPersonName"
|
||||
android:minLines="7" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/detailAddress"
|
||||
style="@style/Widget.AppCompat.EditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_margin="6dp"
|
||||
android:ems="10"
|
||||
android:gravity="top|left"
|
||||
android:hint="Address"
|
||||
android:inputType="text" />
|
||||
<EditText
|
||||
android:id="@+id/detailCountry"
|
||||
style="@style/Widget.AppCompat.EditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:ems="10"
|
||||
android:hint="Country"
|
||||
android:focusableInTouchMode="false"
|
||||
android:inputType="textPersonName" />
|
||||
<EditText
|
||||
android:id="@+id/detailEmail"
|
||||
style="@style/Widget.AppCompat.EditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:ems="10"
|
||||
android:hint="Email (Optional)"
|
||||
android:inputType="textEmailAddress" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/deliveryTypeTV"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Delivery"
|
||||
android:textColor="#303132" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/deliveryPriceTV"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="£##.##"
|
||||
android:textColor="#303132" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/addNoteTV"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_margin="6dp"
|
||||
android:text="Add a note"
|
||||
android:textColor="#303132"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_margin="6dp"
|
||||
android:src="@drawable/downarrow" />
|
||||
|
||||
</RelativeLayout>
|
||||
<EditText
|
||||
android:id="@+id/addNoteET"
|
||||
style="@style/Widget.AppCompat.EditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_margin="6dp"
|
||||
android:ems="10"
|
||||
android:gravity="top|left"
|
||||
android:hint="Message"
|
||||
android:inputType="text"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/EnterPromoCode">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_margin="6dp"
|
||||
android:text="Enter A Promo Code"
|
||||
android:textColor="#303132"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_margin="6dp"
|
||||
android:src="@drawable/downarrow" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/promocodeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/promoCodeET"
|
||||
style="@style/Widget.AppCompat.EditText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:hint="Enter A Promo Code here" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/promoCodeBtn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:text="Apply" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/totalPriceTV"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="total"
|
||||
android:textColor="#303132" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sumTotalTV"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="£###.##"
|
||||
android:textColor="#303132" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Button" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</RelativeLayout>
|
||||
41
app/src/main/res/layout/activity_image_viewer.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.example.h_mal.mochee.ImageViewer.ImageViewer">
|
||||
|
||||
|
||||
<com.example.h_mal.mochee.ImageViewer.ZoomableImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/button4"
|
||||
android:scaleType="fitCenter"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="0dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="end"
|
||||
android:layout_margin="20dp"
|
||||
android:background="#484950"
|
||||
android:text="Done"
|
||||
android:textColor="#ffffff"
|
||||
android:onClick="BackFromActivity"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar2"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
134
app/src/main/res/layout/activity_item_overview.xml
Normal file
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.example.h_mal.mochee.Item_overview">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameTV"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="Navy Blue Jacquard Velvet Jacket Tuxedo"
|
||||
android:textColor="#303132"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/priceTV"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="price of blazer"
|
||||
android:textColor="#303132"
|
||||
android:textSize="15sp" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:srcCompat="@android:drawable/ic_menu_zoom" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter" />
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Size"
|
||||
android:textColor="#303132"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/sizes_arrays" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="quantity"
|
||||
android:textColor="#303132"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="+"
|
||||
android:textSize="22sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/quantityTV"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:inputType="number" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/minus"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top|center"
|
||||
android:text="-"
|
||||
android:textSize="28sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:background="#484950"
|
||||
android:onClick="submit"
|
||||
android:text="Submit"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
61
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="com.example.h_mal.mochee.MainActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/appbar_padding_top"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/basket"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/sale_icon">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/backet_quantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="fill_vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:text="0"
|
||||
android:textSize="22sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
14
app/src/main/res/layout/activity_main2.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/splash_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/mocheeloading" />
|
||||
|
||||
</RelativeLayout>
|
||||
13
app/src/main/res/layout/custom_layout.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageSlider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
92
app/src/main/res/layout/fragment1.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:context="com.example.h_mal.mochee.MainActivity">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/home_top" />
|
||||
</FrameLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/at_mochee">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="At MOCHEE, we have made it our mission to provide our customers with luxury Dinner Jackets & Wedding Tuxedo at affordable prices. We also aim to extend these same high standards across all aspects of our business, with particular focus being placed on a truly exceptional and personal level of customer service; to us, this isn’t considered a luxury, it is the fundamental foundation on which our business has been built."
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="18dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
app:srcCompat="@drawable/fragments1" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:background="@color/design_service_background">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:lineSpacingExtra="-10dp"
|
||||
android:text="@string/wedding_topline"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="#ffffff"
|
||||
android:textScaleX="1.1"
|
||||
android:textSize="36dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="@string/wedding_bottomline"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="18dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
82
app/src/main/res/layout/fragment2.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rel_pb_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:padding="10dp" >
|
||||
<ImageView
|
||||
android:id="@+id/imageView5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:srcCompat="@android:drawable/ic_menu_zoom" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/blazer_nameTV"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="Blazer Name"
|
||||
android:textColor="#303132"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/blazer_priceTV"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:text="£###.##"
|
||||
android:textColor="#303132"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<GridView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center|top"
|
||||
android:layout_margin="6dp"
|
||||
android:columnWidth="70dp"
|
||||
android:verticalSpacing="5dp"
|
||||
android:numColumns="auto_fit"
|
||||
android:orientation="vertical"
|
||||
android:stretchMode="spacingWidth" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
19
app/src/main/res/layout/fragment3.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list_bespoke"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:layout_editor_absoluteX="8dp"
|
||||
tools:layout_editor_absoluteY="8dp">
|
||||
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
||||
11
app/src/main/res/layout/fragment4.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent">
|
||||
<ListView
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/insp_list" />
|
||||
|
||||
</RelativeLayout>
|
||||
247
app/src/main/res/layout/fragment6.xml
Normal file
@@ -0,0 +1,247 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="KENT- UNITED KINGDOM"
|
||||
android:textSize="19sp"
|
||||
android:padding="20dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#303132"/>
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="For Help Call Us ON"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="2dp"
|
||||
android:text="Phone"
|
||||
android:textColor="#303132"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="07530918403"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#303132"
|
||||
android:gravity="center"
|
||||
android:textSize="15sp"
|
||||
android:padding="15dp"
|
||||
android:text="Mon-Sun: 10:00am-7:00pm"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_height="2dp"
|
||||
android:background="#303132"/>
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="3dp"
|
||||
android:text="Email"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="sales@mochee.co.uk"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_height="2dp"
|
||||
android:background="#303132"/>
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="3dp"
|
||||
android:text="Company Number"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="09757119"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_height="2dp"
|
||||
android:background="#303132"/>
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="CUSTOMER CARE"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="15dp"
|
||||
android:text="Do we provide International delivery?"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="We can arrange to have your blazer shipped anywhere in Europe for £9,99 and for the rest of the world for a charge of £16.99. Please note delivery dates can vary."
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="15dp"
|
||||
android:text="What is our return policy?"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="All item are non refundable, however we do give credit notes for the value once returned. "
|
||||
android:textSize="15sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="35dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:textColor="#303132"
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Have any questions or concerns? 
 We’re always ready to help!"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/nameET"
|
||||
style="@style/Widget.AppCompat.EditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:ems="10"
|
||||
android:hint="Name"
|
||||
android:inputType="textPersonName"
|
||||
android:minLines="7" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:layout_margin="6dp"
|
||||
android:inputType="textEmailAddress"
|
||||
android:hint="Email"
|
||||
style="@style/Widget.AppCompat.EditText"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:layout_margin="6dp"
|
||||
android:inputType="textPersonName"
|
||||
android:hint="Subject"
|
||||
style="@style/Widget.AppCompat.EditText"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_margin="6dp"
|
||||
android:ems="10"
|
||||
android:hint="Message"
|
||||
android:inputType="text"
|
||||
android:gravity="top|left"
|
||||
style="@style/Widget.AppCompat.EditText" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:background="#484950"
|
||||
android:text="Send"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.gms.maps.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:paddingBottom="52dp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
71
app/src/main/res/layout/list_item_basket.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/basketIV"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="138dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="6dp"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/basketName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_toEndOf="@+id/basketIV"
|
||||
android:layout_toStartOf="@+id/delete_item"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/basketSize"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/basketName"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_toEndOf="@+id/basketIV"
|
||||
android:layout_toStartOf="@+id/delete_item"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/basketPrice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/basketSize"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_toEndOf="@+id/basketIV"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/basketQuantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="6dp"
|
||||
android:layout_toEndOf="@+id/basketIV"
|
||||
android:text="TextView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/basketTotalPrice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/basketIV"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="6dp"
|
||||
android:text="TextView" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/delete_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
app:srcCompat="@android:drawable/ic_delete" />
|
||||
</RelativeLayout>
|
||||
43
app/src/main/res/layout/list_item_bespoke.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="360dp"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/bespoke_layout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bespoke_logo"
|
||||
android:layout_width="85dp"
|
||||
android:layout_height="85dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bespoke_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/bespoke_logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:layout_marginRight="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:text="steps for creating bespoke"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bespoke_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/bespoke_title"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:layout_marginRight="60dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Let our skilled tailors take charge in creating your master piece. Allow two week for a finished arcticle." />
|
||||
</RelativeLayout>
|
||||
8
app/src/main/res/layout/list_item_blazers.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/imageButton"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="fitCenter" />
|
||||
81
app/src/main/res/layout/list_item_insp.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/list_item_inspiration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitXY"
|
||||
app:srcCompat="@drawable/frame" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="50dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/insp_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:gravity="center"
|
||||
android:text="#SOMETHING"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="25dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/insp_title2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:gravity="center"
|
||||
android:text="#SOMETHING"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="6dp"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/insp_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
android:gravity="center"
|
||||
android:text="The two-button jacket features an inner lining decorated with Damask details and a vintage look, to add originality to the winter style. Ideal to pair with a pair of slim fit BLACK trousers and a plain white shirt." />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/insp_image"
|
||||
android:layout_width="272dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
</LinearLayout>
|
||||
33
app/src/main/res/layout/toolbar.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.Toolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/basket"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/sale_icon">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/backet_quantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="fill_vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:text="0"
|
||||
android:textSize="22sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
10
app/src/main/res/menu/menu_main.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="com.example.h_mal.mochee.MainActivity">
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/delete"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
6
app/src/main/res/values-w820dp/dimens.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
||||
18
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#545252</color>
|
||||
<color name="colorPrimaryDark">#3c3c3c</color>
|
||||
<color name="colorAccent">#545252</color>
|
||||
<color name="background_wedding">#e5e5e5</color>
|
||||
<color name="design_service_background">#dbb368</color>
|
||||
<color name="at_mochee">#3c3c3c</color>
|
||||
<color name="itemtext1">#4d4e4f</color>
|
||||
<color name="itemtext2">#a9a9a9</color>
|
||||
<color name="sale_background">#94817e</color>
|
||||
|
||||
<color name="bespoke_bg1">#4cd1a1</color>
|
||||
<color name="bespoke_bg2">#545252</color>
|
||||
<color name="bespoke_bg3">#ededed</color>
|
||||
<color name="bespoke_bg4">#dbb368</color>
|
||||
|
||||
</resources>
|
||||
7
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="appbar_padding_top">8dp</dimen>
|
||||
</resources>
|
||||
231
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,231 @@
|
||||
<resources>
|
||||
<string name="app_name">Mochee</string>
|
||||
<string name="delete">Clear Basket</string>
|
||||
<string name="wedding_topline">DESIGN\nSERVICE</string>
|
||||
<string name="wedding_bottomline">Our highly skilled design team produce concept design to scale from our customers preferred material choice. A great touch to a personalised service. </string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
|
||||
<!--Blazer descriptions-->
|
||||
<string name="product_info">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)</string>
|
||||
|
||||
<string-array name="sizes_arrays">
|
||||
<item>36 Inch Slim Fit (allow 14 days to make)</item>
|
||||
<item>38 Inch Slim Fit (allow 14 days to make)</item>
|
||||
<item>40 Inch Slim Fit (allow 14 days to make)</item>
|
||||
<item>42 Inch Slim Fit (allow 14 days to make)</item>
|
||||
<item>44 Inch Slim Fit (allow 14 days to make)</item>
|
||||
<item>For Bigger Size - Get In Touch</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="countries_array">
|
||||
<item>Albania</item>
|
||||
<item>Algeria</item>
|
||||
<item>American Samoa</item>
|
||||
<item>Andorra</item>
|
||||
<item>Angola</item>
|
||||
<item>Anguilla</item>
|
||||
<item>Antigua</item>
|
||||
<item>Argentina</item>
|
||||
<item>Armenia</item>
|
||||
<item>Aruba</item>
|
||||
<item>Australia</item>
|
||||
<item>Austria</item>
|
||||
<item>Azerbaijan</item>
|
||||
<item>Bahamas</item>
|
||||
<item>Bahrain</item>
|
||||
<item>Bangladesh</item>
|
||||
<item>Barbados</item>
|
||||
<item>Belarus</item>
|
||||
<item>Belgium</item>
|
||||
<item>Belize</item>
|
||||
<item>Benin</item>
|
||||
<item>Bermuda</item>
|
||||
<item>Bhutan</item>
|
||||
<item>Bolivia</item>
|
||||
<item>Botswana</item>
|
||||
<item>Brazil</item>
|
||||
<item>British Virgin Is.</item>
|
||||
<item>Brunei</item>
|
||||
<item>Bulgaria</item>
|
||||
<item>Burkino Faso</item>
|
||||
<item>Burma</item>
|
||||
<item>Burundi</item>
|
||||
<item>Cambodia</item>
|
||||
<item>Cameroon</item>
|
||||
<item>Canada</item>
|
||||
<item>Cape Verde</item>
|
||||
<item>Cayman Islands</item>
|
||||
<item>Central African</item>
|
||||
<item>Chad</item>
|
||||
<item>Chile</item>
|
||||
<item>China</item>
|
||||
<item>Colombia</item>
|
||||
<item>Congo</item>
|
||||
<item>Congo, The Republic of</item>
|
||||
<item>Cook Islands</item>
|
||||
<item>Costa Rica</item>
|
||||
<item>Cote D'Ivoire</item>
|
||||
<item>Croatia</item>
|
||||
<item>Cyprus</item>
|
||||
<item>Czech Republic</item>
|
||||
<item>Denmark</item>
|
||||
<item>Djibouti</item>
|
||||
<item>Dominica</item>
|
||||
<item>Dominican Republic</item>
|
||||
<item>Ecuador</item>
|
||||
<item>Egypt</item>
|
||||
<item>El Salvador</item>
|
||||
<item>Equatorial Guinea</item>
|
||||
<item>Eritrea</item>
|
||||
<item>Estonia</item>
|
||||
<item>Ethiopia</item>
|
||||
<item>Faeroe Islands</item>
|
||||
<item>Fiji</item>
|
||||
<item>Finland</item>
|
||||
<item>France</item>
|
||||
<item>French Guiana</item>
|
||||
<item>French Polynesia</item>
|
||||
<item>Gabon</item>
|
||||
<item>Gambia</item>
|
||||
<item>Georgia, Republic of</item>
|
||||
<item>Germany</item>
|
||||
<item>Ghana</item>
|
||||
<item>Gibraltar</item>
|
||||
<item>Greece</item>
|
||||
<item>Greenland</item>
|
||||
<item>Grenada</item>
|
||||
<item>Guadeloupe</item>
|
||||
<item>Guam</item>
|
||||
<item>Guatemala</item>
|
||||
<item>Guinea</item>
|
||||
<item>Guinea-Bissau</item>
|
||||
<item>Guyana</item>
|
||||
<item>Haiti</item>
|
||||
<item>Honduras</item>
|
||||
<item>Hong Kong</item>
|
||||
<item>Hungary</item>
|
||||
<item>Iceland</item>
|
||||
<item>India</item>
|
||||
<item>Indonesia</item>
|
||||
<item>Ireland</item>
|
||||
<item>Israel</item>
|
||||
<item>Italy</item>
|
||||
<item>Ivory Coast</item>
|
||||
<item>Jamaica</item>
|
||||
<item>Japan</item>
|
||||
<item>Jordan</item>
|
||||
<item>Kazakhstan</item>
|
||||
<item>Kenya</item>
|
||||
<item>Kuwait</item>
|
||||
<item>Kyrgyzstan</item>
|
||||
<item>Latvia</item>
|
||||
<item>Lebanon</item>
|
||||
<item>Lesotho</item>
|
||||
<item>Liechtenstein</item>
|
||||
<item>Lithuania</item>
|
||||
<item>Luxembourg</item>
|
||||
<item>Macau</item>
|
||||
<item>Macedonia</item>
|
||||
<item>Madagascar</item>
|
||||
<item>Malawi</item>
|
||||
<item>Malaysia</item>
|
||||
<item>Maldives</item>
|
||||
<item>Mali</item>
|
||||
<item>Malta</item>
|
||||
<item>Marshall Islands</item>
|
||||
<item>Martinique</item>
|
||||
<item>Mauritania</item>
|
||||
<item>Mauritius</item>
|
||||
<item>Mexico</item>
|
||||
<item>Micronesia</item>
|
||||
<item>Moldova</item>
|
||||
<item>Monaco</item>
|
||||
<item>Mongolia</item>
|
||||
<item>Montserrat</item>
|
||||
<item>Morocco</item>
|
||||
<item>Mozambique</item>
|
||||
<item>Myanmar</item>
|
||||
<item>Namibia</item>
|
||||
<item>Nepal</item>
|
||||
<item>Netherlands</item>
|
||||
<item>Netherlands Antilles</item>
|
||||
<item>New Caledonia</item>
|
||||
<item>New Zealand</item>
|
||||
<item>Nicaragua</item>
|
||||
<item>Niger</item>
|
||||
<item>Nigeria</item>
|
||||
<item>Norway</item>
|
||||
<item>Oman</item>
|
||||
<item>Pakistan</item>
|
||||
<item>Palau</item>
|
||||
<item>Panama</item>
|
||||
<item>Papua New Guinea</item>
|
||||
<item>Paraguay</item>
|
||||
<item>Peru</item>
|
||||
<item>Philippines</item>
|
||||
<item>Poland</item>
|
||||
<item>Portugal</item>
|
||||
<item>Puerto Rico</item>
|
||||
<item>Qatar</item>
|
||||
<item>Reunion Island</item>
|
||||
<item>Romania</item>
|
||||
<item>Russia</item>
|
||||
<item>Rwanda</item>
|
||||
<item>Saipan</item>
|
||||
<item>San Marino</item>
|
||||
<item>Saudi Arabia</item>
|
||||
<item>Senegal</item>
|
||||
<item>Seychelles</item>
|
||||
<item>Sierra Leone</item>
|
||||
<item>Singapore</item>
|
||||
<item>Slovak Republic</item>
|
||||
<item>Slovenia</item>
|
||||
<item>South Africa</item>
|
||||
<item>South Korea</item>
|
||||
<item>Spain</item>
|
||||
<item>Sri Lanka</item>
|
||||
<item>St. Kitts & Nevis</item>
|
||||
<item>St. Lucia</item>
|
||||
<item>St. Vincent</item>
|
||||
<item>Suriname</item>
|
||||
<item>Swaziland</item>
|
||||
<item>Sweden</item>
|
||||
<item>Switzerland</item>
|
||||
<item>Syria</item>
|
||||
<item>Taiwan</item>
|
||||
<item>Tanzania</item>
|
||||
<item>Thailand</item>
|
||||
<item>Togo</item>
|
||||
<item>Trinidad & Tobago</item>
|
||||
<item>Tunisia</item>
|
||||
<item>Turkey</item>
|
||||
<item>Turkmenistan, Republic of</item>
|
||||
<item>Turks & Caicos Is.</item>
|
||||
<item>U.A.E.</item>
|
||||
<item>U.S. Virgin Islands</item>
|
||||
<item>U.S.A.</item>
|
||||
<item>Uganda</item>
|
||||
<item>Ukraine</item>
|
||||
<item>United Kingdom</item>
|
||||
<item>Uruguay</item>
|
||||
<item>Uzbekistan</item>
|
||||
<item>Vanuatu</item>
|
||||
<item>Vatican City</item>
|
||||
<item>Venezuela</item>
|
||||
<item>Vietnam</item>
|
||||
<item>Wallis & Futuna Islands</item>
|
||||
<item>Yemen</item>
|
||||
<item>Zambia</item>
|
||||
<item>Zimbabwe</item>
|
||||
|
||||
</string-array>
|
||||
|
||||
<string-array name="delivery_array">
|
||||
<item>Yes</item>
|
||||
<item>No</item>
|
||||
</string-array>
|
||||
<string name="title_activity_maps">Map</string>
|
||||
|
||||
</resources>
|
||||
20
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
26
build.gradle
Normal file
@@ -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
|
||||
}
|
||||
17
gradle.properties
Normal file
@@ -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
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -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
|
||||
160
gradlew
vendored
Normal file
@@ -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 "$@"
|
||||
90
gradlew.bat
vendored
Normal file
@@ -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
|
||||
1
settings.gradle
Normal file
@@ -0,0 +1 @@
|
||||
include ':app'
|
||||