APPENDIX. Application Store Admin. build.gradle. app/build.gradle

Similar documents
EMBEDDED SYSTEMS PROGRAMMING Application Basics

android-espresso #androidespresso

EMBEDDED SYSTEMS PROGRAMMING Android NDK

EMBEDDED SYSTEMS PROGRAMMING Android NDK

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

Fragment Example Create the following files and test the application on emulator or device.

APPENDIX. Application User. MainActivity.java. RegistrationActivity.java

Tabel mysql. Kode di PHP. Config.php. Service.php

ANDROID PROGRAMS DAY 3

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar


CITIZEN COP PRESENTED BY :- A CLOUD BASED CRIME REPORT APPLICATION. SOUVIK ROY - IT2014/066 AWSAF AMBAR - IT2014/067 SAYANI DUTTA - IT2014/089

<uses-permission android:name="android.permission.internet" />

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server.

Developing For Android

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

TUTOR FINDER APP REPORT OF MAJOR PROJECT SUBMITTED FOR PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE OF MASTERS OF COMPUTER APPLICATION

The Definitive Guide to Firebase

Basic GUI elements - exercises

Mobile Application Development

android:layout_margintop="5dp" > <EditText android:layout_width="210dp"

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126

05. RecyclerView and Styles

Practical 1.ListView example

@Bind(R.id.input_ ) EditText EditText Button _loginbutton;

Intents. Your first app assignment

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

SMART VEHICLE TRACKING APPLICATION

Android UI Development

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

<uses-permission android:name="android.permission.internet"/>

Manifest.xml. Activity.java

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Android Beginners Workshop

Android Workshop: Model View Controller ( MVC):

Android - JSON Parser Tutorial

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

LAMPIRAN PROGRAM. public class Listdata_adiktif extends ArrayAdapter<ModelData_adiktif> {

Android tips. which simplify your life

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { }

Mobile Software Development for Android - I397

API Guide for Gesture Recognition Engine. Version 2.0

Android Programs Day 5

StoppUhr. <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="start1"

Serious Gaming. Technical manual. This document is a collection of the code and installation process

Tip Calculator. xmlns:tools=" android:layout_width="match_parent"

LAMPIRAN PROGRAM. public class ListArrayAdapterPost extends ArrayAdapter<ModelDataPost> {


PROGRAMMING APPLICATIONS DECLARATIVE GUIS

Create Parent Activity and pass its information to Child Activity using Intents.

Dynamically Create Admob Banner and Interstitial Ads

Arrays of Buttons. Inside Android

M.A.D Assignment # 1

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

VMware AirWatch Android SDK Technical Implementation Guide Empowering your enterprise applications with MDM capabilities using

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches

Android CardView Tutorial

LifeStreet Media Android Publisher SDK Integration Guide

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

EMBEDDED SYSTEMS PROGRAMMING Android Services

COMP61242: Task /04/18

Topics of Discussion

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="com.example.root.

Android HelloWorld - Example. Tushar B. Kute,

Android Layout Types

Software Practice 3 Before we start Today s lecture Today s Task Team organization

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences

Getting Started With Android Feature Flags

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)

Open Lecture Mobile Programming. Firebase Tools

Android JSON Parsing Tutorial

1.1 Why Foxit MobilePDF SDK is your choice Foxit MobilePDF SDK Key Features Evaluation License...

Press project on the left toolbar if it doesn t show an overview of the app yet.

// MainActivity.java ; Noah Spenser; Senior Design; Diabetic Breathalyzer

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

Android Application Development. By : Shibaji Debnath

Introduction to Android Development

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Data Persistence. Chapter 10

Android Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9)

API Guide for Gesture Recognition Engine. Version 1.1

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

1.1 Why Foxit MobilePDF SDK is your choice Foxit MobilePDF SDK Key Features Evaluation License...

else if(rb2.ischecked()) {

Android DP SDK Integration Guide

Android - Widgets Tutorial

1. Simple List. 1.1 Simple List using simple_list_item_1

LAMPIRAN. byte bcdtodec(byte val) { return( (val/16*10) + (val%16) ); } void setup() {

Learn about Android Content Providers and SQLite

Simple Currency Converter

SDK Android Studio. 2. build.gradle. SDK moxie-client-xxx.aar libs 2.1. build.gradle. 2.4 repositories. app proguard-rules.pro

Q.1 Explain the dialog and also explain the Demonstrate working dialog in android.

Our First Android Application

Transcription:

Application Store Admin build.gradle APPENDIX // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() dependencies { classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files allprojects { repositories { jcenter() task clean(type: Delete) { delete rootproject.builddir app/build.gradle apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.3" defaultconfig { applicationid "com.example.root.projectku" minsdkversion 17 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguardandroid.txt'), 'proguard-rules.pro' dependencies { A

compile filetree(dir: 'libs', include: ['*.jar']) androidtestcompile('com.android.support.test.espresso:espressocore:2.2.2', { exclude group: 'com.android.support', module: 'supportannotations' ) compile files('libs/android-async-http-1.4.6.jar') compile files('libs/http-core-4.1.jar') compile files('libs/httpclient-4.0.3.jar') compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.firebase:firebase-auth:9.4.0' compile 'com.google.firebase:firebase-database:9.4.0' compile 'com.google.android.gms:play-services-maps:9.4.0' compile 'com.android.support:design:25.3.0' compile 'com.google.firebase:firebase-storage:9.4.0' compile 'com.github.bumptech.glide:glide:3.7.0' testcompile 'junit:junit:4.12' apply plugin: 'com.google.gms.google-services' AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.root.projectku"> <!-- 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.internet" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gse RVICES" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.write_settings" /> <uses-permission android:name="android.permission.send_sms" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" B

android:label="@string/app_name" android:roundicon="@mipmap/ic_launcher_round" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity"></activity> <activity android:name=".loginactivity" android:label="login" /> <activity android:name=".lokasitokoactivity" android:label="@string/title_activity_toko" /> <meta-data android:name="com.google.android.geo.api_key" android:value="@string/google_maps_key" /> <activity android:name=".listorderactivity" /> <activity android:name=".homeactivity" android:nohistory="true"/> <activity android:name=".launcheractivity" android:nohistory="true"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".historyorderactivity"></activity> </application> </manifest> LoginActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.text.textutils; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; import com.google.firebase.auth.firebaseuser; C

public class LoginActivity extends AppCompatActivity implements View.OnClickListener { private Button btsignin; private EditText etemail; private EditText etpasword; private FirebaseAuth firebaseauth; private ProgressDialog progressdialog; private FirebaseUser firebaseuser; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); etemail = (EditText) findviewbyid(r.id.etemail); etpassword = (EditText) findviewbyid(r.id.etpassword); btsignin = (Button) findviewbyid(r.id.btsignin); progressdialog = new ProgressDialog(this); btsignin.setonclicklistener(this); private void userlogin(){ final String email = etemail.gettext().tostring().trim(); String password = etpassword.gettext().tostring().trim(); if (TextUtils.isEmpty(email)) { Toast.makeText(this, "enter email please", Toast.LENGTH_LONG).show(); return; if (TextUtils.isEmpty(password)) { Toast.makeText(this, "enter password please", Toast.LENGTH_LONG).show(); return; progressdialog.setmessage("wait.."); progressdialog.show(); firebaseauth.signinwithemailandpassword(email, password).addoncompletelistener(this, new OnCompleteListener<AuthResult>() { public void oncomplete(@nonnull Task<AuthResult> task) { progressdialog.dismiss(); if (task.issuccessful()) { finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); D

); public void onclick(view view) { if(view == buttonsignin){ userlogin(); activity_login.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout 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_height="match_parent" tools:context="com.example.root.projectku.loginactivity"> <LinearLayout android:layout_centervertical="true" android:layout_width="368dp" android:orientation="vertical" tools:layout_editor_absolutey="0dp" tools:layout_editor_absolutex="8dp"> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="user Login" android:id="@+id/textview" android:layout_gravity="center_horizontal" /> <EditText android:id="@+id/etemail" android:layout_margin="15dp" android:hint="enter email" android:inputtype="textemailaddress" /> <EditText android:id="@+id/etpassword" android:layout_margin="15dp" android:hint="enter password" android:inputtype="textpassword" /> <Button android:id="@+id/btsignin" android:layout_margin="15dp" android:text="login" /> E

</LinearLayout> </android.support.constraint.constraintlayout> LauncherActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.os.handler; import android.support.v7.app.appcompatactivity; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; public class LauncherActivity extends AppCompatActivity { private FirebaseAuth firebaseauth; private static final int SPLASH_TIME = 2 * 1000; private DatabaseReference firebasetable,firebasesubtable; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_launcher); try { new Handler().postDelayed(new Runnable() { public void run() { firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ Intent intent = new Intent(LauncherActivity.this, HomeActivity.class); startactivity(intent); LauncherActivity.this.finish(); else { Intent intent = new Intent(LauncherActivity.this, MainActivity.class); startactivity(intent); LauncherActivity.this.finish();, SPLASH_TIME); catch(exception e){ public void onbackpressed() { this.finish(); super.onbackpressed(); activity_launcher.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android" F

xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent" tools:context="com.example.root.projectku.launcheractivity"> android:layout_width="wrap_content" android:text="welcome..."/> </android.support.constraint.constraintlayout> HomeActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import com.google.firebase.auth.firebaseauth; 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; public class HomeActivity extends AppCompatActivity { Button btlist; Button btbarang; Button bthistory; Button btlogout; private FirebaseAuth firebaseauth; private DatabaseReference firebasetable,firebasesubtable; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); firebaseauth = FirebaseAuth.getInstance(); btbarang = (Button) findviewbyid(r.id.btbarang); btlist = (Button) findviewbyid(r.id.btlist); bthistory = (Button) findviewbyid(r.id.bthistory); btlogout = (Button) findviewbyid(r.id.btlogout); btbarang.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), LokasiTokoActivity.class)); ); btlist.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { firebasetable = FirebaseDatabase.getInstance().getReference().child("BarangToko"); G

firebasetable.addvalueeventlistener(new ValueEventListener() { public void ondatachange(datasnapshot snapshot) { for(datasnapshot singlesnapshot : snapshot.getchildren()) { if(singlesnapshot.child("admin").getvalue( ).tostring().equals(firebaseauth.getcurrentus er().getemail().replace('.',','))) { ListOrderActivity.KEY_NAMA_TOKO=singl esnapshot.getkey().tostring(); finish(); startactivity(new Intent(getApplicationContext(), ListOrderActivity.class)); public void oncancelled(databaseerror databaseerror) { ); ); bthistory.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { firebasetable = FirebaseDatabase.getInstance().getReference().child("BarangToko"); firebasetable.addvalueeventlistener(new ValueEventListener() {//Membaca dan mendengarkan perubahan untuk seluruh konten jalur. public void ondatachange(datasnapshot snapshot) { for(datasnapshot singlesnapshot : snapshot.getchildren()) { if(singlesnapshot.child("admin").getvalue( ).tostring().equals(firebaseauth.getcurrentuser().getemail().replace('.', ','))) { HistoryOrderActivity.KEY_NAMA_TOKO=si nglesnapshot.getkey().tostring(); finish(); startactivity(new Intent(getApplicationContext(), HistoryOrderActivity.class)); public void oncancelled(databaseerror databaseerror) { ); ); H

btlogout.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { firebaseauth.signout(); finish(); startactivity(new Intent(getApplicationContext(), LoginActivity.class)); ); activity_home.xml <?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_height="match_parent" tools:context="com.example.root.projectku.homeactivity"> <Button android:id="@+id/btlist" android:layout_width="wrap_content" android:layout_weight="1" android:text="list Order" android:layout_margintop="24dp" android:layout_below="@+id/btbarang" android:layout_centerhorizontal="true" /> <Button android:id="@+id/btbarang" android:layout_width="wrap_content" android:layout_weight="1" android:text="update Barang" android:layout_margintop="21dp" android:layout_alignparenttop="true" android:layout_alignstart="@+id/bthistory" /> <Button android:id="@+id/bthistory" android:layout_width="wrap_content" android:layout_weight="1" android:text="delivery Order" android:layout_below="@+id/btlist" android:layout_margintop="21dp" android:layout_centerhorizontal="true" /> <Button android:id="@+id/btlogout" android:layout_width="wrap_content" I

android:layout_weight="1" android:text="logout" android:layout_margintop="21dp" android:layout_below="@+id/bthistory" android:layout_centerhorizontal="true" /> </RelativeLayout> LokasiTokoActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.toast; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import java.util.hashmap; import java.util.map; public class LokasiTokoActivity extends AppCompatActivity { private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase=firebasedatabase.getinstance().getreference().getroot(), firebasetable, firebasesubtable, firebasesubsubtable, firebaserecord; String temp_key_id_toko,temp_key_toko,temp_key_barang; Map<String, Object> map_toko,map_barang; Button btnmenu; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_lokasi_toko); btnmenu = (Button) findviewbyid(r.id.btmenu); firebasetable = firebasedatabase.child("barangtoko"); firebasesubtable=firebasetable.child("alfamart Krakatau"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","1@gmail,com"); map_toko.put("latitude", "-6.987331"); map_toko.put("longitude", "110.437260"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("aqua Botol 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "4500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("bango Kecap Manis 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "26000"); J

map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("indomilk Susu Kental Manis 370gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "9500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("aqua Botol 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "4500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("filma Minyak Goreng 2L"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "2500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","2@gmail,com"); map_toko.put("latitude", "-6.988187"); map_toko.put("longitude", "110.436879"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("tango Wafer 300gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "21000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("sariwangi Teh Celup Asli 25sachet"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "6900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); K

firebaserecord=firebasesubsubtable.child("rejoice Shampoo Rich 320ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "30500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("sariwangi Teh Celup Asli 25sachet"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "6900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("nice Facial Tissue Non Perfumed 2Ply 700gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "18900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","3@gmail,com"); map_toko.put("latitude", "-6.989611"); map_toko.put("longitude", "110.434986"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("detol Body Wash Anti Bakteri 450ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "30900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("nature E Handbody Lotion 245ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("formula Pasta Gigi Strong Protector 2x100gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "17900"); L

map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("rinso Anti Noda Deterjen 1kg"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "27800"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","4@gmail,com"); map_toko.put("latitude", "-7.025296"); map_toko.put("longitude", "110.404211"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("indomie Mie Goreng"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "2000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("lifeboy Shampoo Anti Dandruff 170ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "15900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("close Up Pasta Gigi Menthol"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "15000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("so Klin Softergent Powder 800gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "14300"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); map_toko = new HashMap<String, Object>(); M

map_toko.put("admin","5@gmail,com"); map_toko.put("latitude", "-7.024602"); map_toko.put("longitude", "110.403863"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("mie Sedap Kari Spesial"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "3500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("pantene Shampo Anti Dandruff 170ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "20800"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("kraft Oreo Selection Biscuit 352gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "40900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("garnier Men Acno Fight Wasabi 100ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","28900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","6@gmail,com"); map_toko.put("latitude", "-7.029462"); map_toko.put("longitude", "110.408694"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("listerine Mouthwash Antiseptic 250ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "19500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); N

firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("nivea Deo Roll On Extra Whitening"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","16400"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("minute Maid Juice Pulpy 350ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","5500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("indomaret Beras Ramos Super 5kg"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","59900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","7@gmail,com"); map_toko.put("latitude", "-7.767377"); map_toko.put("longitude", "110.448636"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("minyak Goreng Sania Refil 2L"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("sunligh Pencuci Piring 800ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","14500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); O

firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("vixal Botol Blue 800ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","14500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("hit Insektisida Spray Orange 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","25900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Kadirojo"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","8@gmail,com"); map_toko.put("latitude", "-7.764747"); map_toko.put("longitude", "110.448845"); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("minyak Goreng Filma Refil 2L"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("pantene Shampo Anti Dandruff 170ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "20800"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("alfamart Beras Ramos Super 5kg"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","59900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Maluku"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","9@gmail,com"); map_toko.put("latitude", "-6.991882"); map_toko.put("longitude", "110.436643"); P

firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("force Magic Lemon 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Maluku"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("marjan Boudoin 500ml All Varian"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "18900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Maluku"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("selamat Wafer Kaleng 200g"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","15900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); Toast.makeText(getApplicationContext(), "BarangToko Sukses ditambahkan", Toast.LENGTH_LONG).show(); btnmenu.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ); activity_lokasi_toko.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout 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_height="match_parent" tools:context="com.example.root.projectku.lokasitokoactivity"> <RelativeLayout android:layout_width="wrap_content" tools:layout_editor_absolutey="4dp" tools:layout_editor_absolutex="113dp"> Q

<Button android:id="@+id/btmenu" android:layout_width="wrap_content" android:layout_centerhorizontal="true" android:text="back to Menu" tools:layout_editor_absolutex="130dp" tools:layout_editor_absolutey="0dp" /> </RelativeLayout> </android.support.constraint.constraintlayout> ListOrderActivity.java package com.example.root.projectku; import android.app.alertdialog; import android.content.dialoginterface; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.adapterview; import android.widget.button; import android.widget.listview; import android.widget.textview; import android.widget.toast; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.childeventlistener; 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.query; import com.google.firebase.database.valueeventlistener; import java.util.arraylist; import java.util.hashmap; import java.util.iterator; public class ListOrderActivity extends AppCompatActivity { public static String KEY_NAMA_TOKO="1"; public static String KEY_ID_ORDER="2"; public static String KEY_STATUS="3"; public static String KEY_TANGGAL="4"; public static String KEY_TOTAL="5"; public static String KEY_USERNAME="6"; public static String KEY_ORDER_DETAIL="7"; private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase= FirebaseDatabase.getInstance().getReference().getRoot(),firebaseTable, firebasesubtable, firebasesubsubtable, firebaserecord, firebaserecorddetail; String tabel = "Order"; String NamaBarang = "", Qty = "", Stok="0"; int StokInt; Button btnmenu; ListView listp, mlistdata; R

ListOrderAdapter adapter; ArrayList<HashMap<String, String>> listrow = new ArrayList<HashMap<String, String>>(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_list_order); listp = (ListView) findviewbyid(r.id.listorder); btnmenu = (Button) findviewbyid(r.id.btmenu); firebasetable = firebasedatabase.child(tabel); firebasesubtable = firebasetable.child(key_nama_toko); Query query = firebasesubtable.orderbykey(); query.addlistenerforsinglevalueevent(new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { String namatoko = ""; String idorder = ""; String status = ""; String tanggal = ""; String total = ""; String username = ""; for (DataSnapshot singlesnapshot : datasnapshot.getchildren()) { HashMap<String, String> map = new HashMap<String, String>(); idorder = singlesnapshot.getkey().tostring(); status = singlesnapshot.child("status").getvalue().tostring(); tanggal = singlesnapshot.child("tanggal").getvalue().tostring(); total = singlesnapshot.child("total").getvalue().tostring(); username = singlesnapshot.child("username").getvalue().tostring().replace(",","."); String orderdetail = ""; for (DataSnapshot singlesnapshot2 : singlesnapshot.child("orderdetail").getchildren()) { orderdetail = orderdetail + singlesnapshot2.child("namabarang").getvalue().tostring() +"-"+singlesnapshot2.child("harga").getvalue().tostring() +"-"+singlesnapshot2.child("qty").getvalue().tostring()+"\r\n"; if(status.equals("pending")) { map.put(key_id_order, idorder); map.put(key_status, status); map.put(key_tanggal, tanggal); map.put(key_total, total); map.put(key_username, username); map.put(key_order_detail, orderdetail); listrow.add(map); adapter = new ListOrderAdapter(ListOrderActivity.this, listrow); listp.setadapter(adapter); S

public void oncancelled(databaseerror databaseerror) { ); listp.setonitemlongclicklistener(new AdapterView.OnItemLongClickListener() { public boolean onitemlongclick(adapterview<?> parent, final View view, final int position, long id) { new AlertDialog.Builder(ListOrderActivity.this).setTitle(getResources().getString(R.string.st atus)).setmessage(getresources().getstring(r.string. status_message)).setpositivebutton(getresources().getstring(r. string.send), new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int which) { TextView idordernya = (TextView) view.findviewbyid(r.id.tvidorder); firebaserecord=firebasesubtable.child (idordernya.gettext().tostring()); firebaserecord.child("status").setval ue("terkirim"); firebaserecorddetail= firebaserecord.child("orderdetail"); firebaserecorddetail.addchildeventlis tener(new ChildEventListener() { public void onchildadded(datasnapshot datasnapshot, String s) { Iterator i = datasnapshot.getchildren().iterator(); while (i.hasnext()) { i.next(); NamaBarang = (String) ((DataSnapshot) i.next()).getvalue(); Qty = (String) ((DataSnapshot) i.next()).getvalue(); DatabaseReference firebaserecordupdateqty = firebasedatabase.child("barangtoko").child(key_nama_toko).child("barang").child(namabarang); firebaserecordupdateqty. child("stokmutasi").setvalue(qty); public void onchildchanged(datasnapshot datasnapshot, String s) { T

public void onchildremoved(datasnapshot datasnapshot) { public void onchildmoved(datasnapshot datasnapshot, String s) { public void oncancelled(databaseerror databaseerror) { ); DatabaseReference fbstok = firebasedatabase.child("barangtoko").child(key_nama_toko).child("barang") ; fbstok.addlistenerforsinglevalueevent (new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { DatabaseReference fbstok2 = firebasedatabase.child("barangtoko").child(key_nama_toko).child("barang").child(datasnapshot.getkey()); for(datasnapshot singlesnapshot1 : datasnapshot.getchildren()) { String stok = singlesnapshot1.child("stok").getvalue().tostring(); String stokmutasi= singlesnapshot1.child("stokmutasi").getvalue().tostring(); int stokbaru=integer.parseint(stok)-integer.parseint(stokmutasi); public void oncancelled(databaseerror databaseerror) { ); Toast.makeText(getApplicationContext( ), "Data "+idordernya.gettext().tostring()+" Sukses disimpan", Toast.LENGTH_LONG).show(); finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ).setnegativebutton(getresources().getstring(r. string.cancel), new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int which) { TextView idordernya = (TextView) view.findviewbyid(r.id.tvidorder); U

firebaserecord=firebasesubtable.child (idordernya.gettext().tostring()); firebaserecord.child("status").setval ue("dibatalkan"); Toast.makeText(getApplicationContext( ), "Data "+idordernya.gettext().tostring()+" Sukses dicancel (batalkan)", Toast.LENGTH_LONG).show(); finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ).show(); return false; ); btnmenu.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ); public void onbackpressed() { this.finish(); super.onbackpressed(); ListOrderAdapter.java package com.example.root.projectku; import android.app.activity; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.textview; import java.util.arraylist; import java.util.hashmap; public class ListOrderAdapter extends BaseAdapter { private Activity activity; private ArrayList<HashMap<String, String>> data; private static LayoutInflater inflater = null; public ListOrderAdapter(Activity a, ArrayList<HashMap<String, String>> d) { activity = a; data = d; inflater = (LayoutInflater) activity.getsystemservice(context.layout_inflater_service); V

public int getcount() { return data.size(); public Object getitem(int position) { return position; public long getitemid(int position) { return position; public View getview(int position, View convertview, ViewGroup parent) { View vi = convertview; if (convertview == null) vi = inflater.inflate(r.layout.list_order, null); TextView tvidorder= (TextView) vi.findviewbyid(r.id.tvidorder); TextView tvstatus= (TextView) vi.findviewbyid(r.id.tvstatus); TextView tvtanggal= (TextView) vi.findviewbyid(r.id.tvtanggal); TextView tvtotal= (TextView) vi.findviewbyid(r.id.tvtotal); TextView tvusername= (TextView) vi.findviewbyid(r.id.tvusername); TextView tvorderdetail= (TextView) vi.findviewbyid(r.id.tvorderdetail); HashMap<String, String> hasil = new HashMap<String, String>(); hasil = data.get(position); tvidorder.settext(hasil.get(listorderactivity.key_id_order)); tvstatus.settext(hasil.get(listorderactivity.key_status)); tvtanggal.settext(hasil.get(listorderactivity.key_tanggal)); tvtotal.settext(hasil.get(listorderactivity.key_total)); tvusername.settext(hasil.get(listorderactivity.key_username)); tvorderdetail.settext(hasil.get(listorderactivity.key_order_deta IL)); return vi; activity_list_order.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout 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="368dp" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:orientation="vertical" tools:layout_editor_absolutex="8dp" tools:layout_editor_absolutey="29dp" tools:context="com.example.root.projectku.listorderactivity"> <RelativeLayout android:layout_width="wrap_content" > <ListView W

android:id="@+id/listorder" android:layout_width="wrap_content" android:layout_height="445dp" android:layout_alignparentstart="true" /> <Button android:layout_width="wrap_content" android:id="@+id/btmenu" android:text="back to Menu" android:layout_below="@+id/listorder" android:layout_centerhorizontal="true" /> </RelativeLayout> </android.support.constraint.constraintlayout> list_order.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:id="@+id/textview" android:layout_width="wrap_content" android:text="id Order: " /> android:id="@+id/tvidorder" android:layout_width="wrap_content" android:text="large Text" android:textappearance="?android:attr/textappearancemedium" /> </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:id="@+id/textview4" android:layout_width="wrap_content" android:text="user: " /> android:layout_width="wrap_content" X

android:textappearance="?android:attr/textappearancemedium" android:text="large Text" android:id="@+id/tvusername"/> </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:id="@+id/textview2" android:layout_width="wrap_content" android:text="tanggal: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="large Text" android:id="@+id/tvtanggal"/> </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:id="@+id/textview3" android:layout_width="wrap_content" android:text="total: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="large Text" android:id="@+id/tvtotal"/> </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:id="@+id/textview1" android:layout_width="wrap_content" android:text="status: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="large Text" android:id="@+id/tvstatus"/> </LinearLayout> <LinearLayout Y

android:layout_height="match_parent" android:orientation="horizontal"> android:id="@+id/textview5" android:layout_width="wrap_content" android:text="barang: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancesmall" android:text="large Text" android:id="@+id/tvorderdetail"/> </LinearLayout> </LinearLayout> HistoryOrderActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.listview; import com.google.firebase.auth.firebaseauth; 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.query; import com.google.firebase.database.valueeventlistener; import java.util.arraylist; import java.util.hashmap; public class HistoryOrderActivity extends AppCompatActivity { public static String KEY_NAMA_TOKO="1"; public static String KEY_ID_ORDER="2"; public static String KEY_STATUS="3"; public static String KEY_TANGGAL="4"; public static String KEY_TOTAL="5"; public static String KEY_USERNAME="6"; public static String KEY_ORDER_DETAIL="7"; private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase= FirebaseDatabase.getInstance().getReference().getRoot(),firebaseTable, firebasesubtable, firebasesubsubtable, firebaserecord, firebaserecorddetail; String tabel = "Order"; String NamaBarang = "", Qty = "", Stok="0"; int StokInt; Button btnmenu; ListView listp, mlistdata; ListOrderAdapter adapter; Z

ArrayList<HashMap<String, String>> listrow = new ArrayList<HashMap<String, String>>(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_history_order); listp = (ListView) findviewbyid(r.id.listorder); btnmenu = (Button) findviewbyid(r.id.btmenu); firebasetable = firebasedatabase.child(tabel);// firebasesubtable = firebasetable.child(key_nama_toko);// Query query = firebasesubtable.orderbykey(); query.addlistenerforsinglevalueevent(new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { String namatoko = ""; String idorder = ""; String status = ""; String tanggal = ""; String total = ""; String username = ""; for (DataSnapshot singlesnapshot : datasnapshot.getchildren()) { HashMap<String, String> map = new HashMap<String, String>(); idorder = singlesnapshot.getkey().tostring(); status = singlesnapshot.child("status").getvalue().tostring(); tanggal = singlesnapshot.child("tanggal").getvalue().tostring(); total = singlesnapshot.child("total").getvalue().tostring(); username = singlesnapshot.child("username").getvalue().tostring().replace(",","."); String orderdetail = ""; for (DataSnapshot singlesnapshot2 : singlesnapshot.child("orderdetail").getchildren()) { orderdetail = orderdetail + singlesnapshot2.child("namabarang").getvalue().tostring() +"-"+singlesnapshot2.child("harga").getvalue().tostring() +"-"+singlesnapshot2.child("qty").getvalue().tostring()+"\r\n"; if(status.equals("terkirim")) { map.put(key_id_order, idorder); map.put(key_status, status); map.put(key_tanggal, tanggal); map.put(key_total, total); map.put(key_username, username); map.put(key_order_detail, orderdetail); listrow.add(map); adapter = new ListOrderAdapter(HistoryOrderActivity.this, listrow); listp.setadapter(adapter); AA

public void oncancelled(databaseerror databaseerror) { ); btnmenu.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ); public void onbackpressed() { this.finish(); super.onbackpressed(); activity_history_order.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout 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_height="match_parent" tools:context="com.example.root.projectku.historyorderactivity"> <RelativeLayout android:layout_width="wrap_content" > <ListView android:id="@+id/listorder" android:layout_width="wrap_content" android:layout_height="445dp" android:layout_alignparentstart="true" /> <Button android:layout_width="wrap_content" android:id="@+id/btmenu" android:text="back to Menu" android:layout_below="@+id/listorder" android:layout_centerhorizontal="true" /> </RelativeLayout> </android.support.constraint.constraintlayout> AB

Application Customer AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.root.client"> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gse RVICES" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.write_settings" /> <uses-permission android:name="android.permission.send_sms" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundicon="@mipmap/ic_launcher_round" android:supportsrtl="true" android:theme="@style/apptheme"> <!-- The API key for Google Maps-based APIs is defined as a string resource. (See the file "res/values/google_maps_api.xml"). Note that the API key is linked to the encryption key used to sign the APK. You need a different API key for each encryption key, including the release key that is used to sign the APK for publishing. You can define the keys for the debug and release targets in src/debug/ and src/release/. --> <meta-data android:name="com.google.android.geo.api_key" android:value="@string/google_maps_key" /> <activity android:name=".mainactivity" android:label="@string/register"> </activity> <activity AC

android:name=".loginactivity" android:label="@string/login"> <intent-filter> android:name="android.intent.action.main" /> <action <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".menuactivity" android:label="@string/title_activity_menu" android:theme="@style/apptheme.noactionbar" /> <activity android:name=".orderactivity" /> <activity android:name=".productactivity" /> <activity android:name=".shoppingcartactivity" /> </application> </manifest> build.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() dependencies { classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files allprojects { repositories { jcenter() task clean(type: Delete) { delete rootproject.builddir app/build.gradle apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.3" defaultconfig { AD

applicationid "com.example.root.client" minsdkversion 17 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguardandroid.txt'), 'proguard-rules.pro' dependencies { compile filetree(dir: 'libs', include: ['*.jar']) androidtestcompile('com.android.support.test.espresso:espressocore:2.2.2', { exclude group: 'com.android.support', module: 'supportannotations' ) compile files('libs/android-async-http-1.4.6.jar') compile files('libs/http-core-4.1.jar') compile files('libs/httpclient-4.0.3.jar') compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.firebase:firebase-auth:9.4.0' compile 'com.google.firebase:firebase-database:9.4.0' compile 'com.google.android.gms:play-services-maps:9.4.0' compile 'com.android.support:design:25.3.0' compile 'com.google.firebase:firebase-storage:9.4.0' compile 'com.github.bumptech.glide:glide:3.7.0' testcompile 'junit:junit:4.12' apply plugin: 'com.google.gms.google-services' adapter/cartitemadapter.java package com.example.root.projectku.adapter; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.textview; import com.example.root.projectku.r; import com.example.root.projectku.constant.constant; import com.example.root.projectku.model.cart; import com.example.root.projectku.model.cartitem; import com.example.root.projectku.util.carthelper; import java.math.bigdecimal; import java.text.decimalformat; AE

import java.text.decimalformatsymbols; import java.util.collections; import java.util.list; import java.util.locale; public class CartItemAdapter extends BaseAdapter { private static final String TAG = "CartItemAdapter"; private List<CartItem> cartitems = Collections.emptyList(); private final Context context; public CartItemAdapter(Context context) { this.context = context; public void updatecartitems(list<cartitem> cartitems) { this.cartitems = cartitems; notifydatasetchanged(); public int getcount() { return cartitems.size(); public CartItem getitem(int position) { return cartitems.get(position); public long getitemid(int position) { return position; public View getview(final int position, View convertview, ViewGroup parent) { TextView tvname; TextView tvunitprice; TextView tvquantity; TextView tvprice; if (convertview == null) { convertview = LayoutInflater.from(context).inflate(R.layout.adapter_cart_item, parent, false); tvname = (TextView) convertview.findviewbyid(r.id.tvcartitemname); tvunitprice = (TextView) convertview.findviewbyid(r.id.tvcartitemunitprice); tvquantity = (TextView) convertview.findviewbyid(r.id.tvcartitemquantity); tvprice = (TextView) convertview.findviewbyid(r.id.tvcartitemprice); convertview.settag(new ViewHolder(tvName, tvunitprice, tvquantity, tvprice)); else { ViewHolder viewholder = (ViewHolder) convertview.gettag(); tvname = viewholder.tvcartitemname; tvunitprice = viewholder.tvcartitemunitprice; tvquantity = viewholder.tvcartitemquantity; tvprice = viewholder.tvcartitemprice; AF

final Cart cart = CartHelper.getCart(); final CartItem cartitem = getitem(position); tvname.settext(cartitem.getproduct().getname()); DecimalFormat df = new DecimalFormat("#,##0", DecimalFormatSymbols.getInstance(Locale.ITALY)); tvunitprice.settext(constant.currency+string.valueof(df.format(c artitem.getproduct().getprice().setscale(0, BigDecimal.ROUND_HALF_UP)))); tvquantity.settext(string.valueof(cartitem.getquantity())); tvprice.settext(constant.currency+string.valueof(df.format(cart. getcost(cartitem.getproduct()).setscale(0, BigDecimal.ROUND_HALF_UP)))); return convertview; private static class ViewHolder { public final TextView tvcartitemname; public final TextView tvcartitemunitprice; public final TextView tvcartitemquantity; public final TextView tvcartitemprice; public ViewHolder(TextView tvcartitemname, TextView tvcartitemunitprice, TextView tvcartitemquantity, TextView tvcartitemprice) { this.tvcartitemname = tvcartitemname; this.tvcartitemunitprice = tvcartitemunitprice; this.tvcartitemquantity = tvcartitemquantity; this.tvcartitemprice = tvcartitemprice; adapter_cart_item.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_margin="5dp" android:minheight="50dp" android:orientation="horizontal" android:weightsum="1"> android:id="@+id/tvcartitemname" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.4" android:gravity="center" android:text=""/> android:id="@+id/tvcartitemunitprice" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.2" AG

android:gravity="center" android:text=""/> android:id="@+id/tvcartitemquantity" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.15" android:gravity="center"/> android:id="@+id/tvcartitemprice" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.25" android:gravity="center" android:text=""/> </LinearLayout> adapter/productadapter.java package com.example.root.projectku.adapter; import android.content.context; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.imageview; import android.widget.textview; import com.example.root.projectku.r; import com.example.root.projectku.constant.constant; import com.example.root.projectku.model.product; import java.math.bigdecimal; import java.util.arraylist; import java.util.list; public class ProductAdapter extends BaseAdapter { private static final String TAG = "ProductAdapter"; private List<Product> products = new ArrayList<Product>(); private final Context context; public ProductAdapter(Context context) { this.context = context; public void updateproducts(list<product> products) { this.products.addall(products); notifydatasetchanged(); public int getcount() { return products.size(); public Product getitem(int position) { return products.get(position); AH

public long getitemid(int position) { return position; public View getview(int position, View convertview, ViewGroup parent) { TextView tvname; TextView tvprice; ImageView ivimage; if (convertview == null) { convertview = LayoutInflater.from(context).inflate(R.layout.adapter_product, parent, false); tvname = (TextView) convertview.findviewbyid(r.id.tvproductname); tvprice = (TextView) convertview.findviewbyid(r.id.tvproductprice); ivimage = (ImageView) convertview.findviewbyid(r.id.ivproductimage); convertview.settag(new ViewHolder(tvName, tvprice, ivimage)); else { ViewHolder viewholder = (ViewHolder) convertview.gettag(); tvname = viewholder.tvproductname; tvprice = viewholder.tvproductprice; ivimage = viewholder.ivproductimage; final Product product = getitem(position); tvname.settext(product.getname()); tvprice.settext(constant.currency+string.valueof(product.getpric e().setscale(2, BigDecimal.ROUND_HALF_UP))); Log.d(TAG, "Context package name: " + context.getpackagename()); ivimage.setimageresource(context.getresources().getidentifier( product.getimagename(), "drawable", context.getpackagename())); return convertview; private static class ViewHolder { public final TextView tvproductname; public final TextView tvproductprice; public final ImageView ivproductimage; public ViewHolder(TextView tvproductname, TextView tvproductprice, ImageView ivproductimage) { this.tvproductname = tvproductname; this.tvproductprice = tvproductprice; this.ivproductimage = ivproductimage; AI

adapter_product.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_margin="5dp" android:minheight="50dp" android:orientation="horizontal" android:weightsum="1"> android:id="@+id/tvproductname" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.50" android:textcolor="@color/black" android:gravity="center" android:text=""/> <ImageView android:id="@+id/ivproductimage" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.25" android:gravity="center"/> android:id="@+id/tvproductprice" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.25" android:textcolor="@color/black" android:gravity="center" android:text=""/> </LinearLayout> constant/constant.java package com.example.root.projectku.constant; import java.util.arraylist; import java.util.list; public class Constant { public static final List<Integer> QUANTITY_LIST = new ArrayList<Integer>(); public static final String CURRENCY = "Rp. "; model/cart.java package com.example.root.projectku.model; import java.io.serializable; import java.math.bigdecimal; import java.util.hashmap; import java.util.map; AJ

import java.util.map.entry; import java.util.set; /** * A representation of shopping cart. * <p/> * A shopping cart has a map of {@link Saleable products to their corresponding quantities. */ public class Cart implements Serializable { private static final long serialversionuid = 42L; private Map<Saleable, Integer> cartitemmap = new HashMap<Saleable, Integer>(); private BigDecimal totalprice = BigDecimal.ZERO; private int totalquantity = 0; /** * Add a quantity of a certain {@link Saleable product to this shopping cart * * @param sellable the product will be added to this shopping cart * @param quantity the amount to be added */ public void add(final Saleable sellable, int quantity) { if (cartitemmap.containskey(sellable)) { cartitemmap.put(sellable, cartitemmap.get(sellable) + quantity); else { cartitemmap.put(sellable, quantity); totalprice = totalprice.add(sellable.getprice().multiply(bigdecimal.valueof(quantity)) ); totalquantity += quantity; /** * Set new quantity for a {@link Saleable product in this shopping cart * * @param sellable the product which quantity will be updated * @param quantity the new quantity will be assigned for the product * @throws ProductNotFoundException if the product is not found in this shopping cart. * @throws QuantityOutOfRangeException if the quantity is negative */ //throws memberitahu bahwa method yang bersangkutan dapat melempar eksepsi dengan tipe yang dideklarasikan public void update(final Saleable sellable, int quantity) throws ProductNotFoundException, QuantityOutOfRangeException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); if (quantity < 0) throw new QuantityOutOfRangeException(quantity + " is not a valid quantity. It must be non-negative."); int productquantity = cartitemmap.get(sellable); BigDecimal productprice = sellable.getprice().multiply(bigdecimal.valueof(productquantity)); AK

cartitemmap.put(sellable, quantity); totalquantity = totalquantity - productquantity + quantity; totalprice = totalprice.subtract(productprice).add(sellable.getprice().multiply(bigdec imal.valueof(quantity))); /** * Remove a certain quantity of a {@link Saleable product from this shopping cart * * @param sellable the product which will be removed * @param quantity the quantity of product which will be removed * @throws ProductNotFoundException if the product is not found in this shopping cart * @throws QuantityOutOfRangeException if the quantity is negative or more than the existing quantity of the product in this shopping cart */ public void remove(final Saleable sellable, int quantity) throws ProductNotFoundException, QuantityOutOfRangeException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); int productquantity = cartitemmap.get(sellable); if (quantity < 0 quantity > productquantity) throw new QuantityOutOfRangeException(quantity + " is not a valid quantity. It must be non-negative and less than the current quantity of the product in the shopping cart."); if (productquantity == quantity) { cartitemmap.remove(sellable); else { cartitemmap.put(sellable, productquantity - quantity); totalprice = totalprice.subtract(sellable.getprice().multiply(bigdecimal.valueof(quant ity))); totalquantity -= quantity; /** * Remove a {@link Saleable product from this shopping cart totally * * @param sellable the product to be removed * @throws ProductNotFoundException if the product is not found in this shopping cart */ public void remove(final Saleable sellable) throws ProductNotFoundException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); int quantity = cartitemmap.get(sellable); cartitemmap.remove(sellable); totalprice = totalprice.subtract(sellable.getprice().multiply(bigdecimal.valueof(quant ity))); totalquantity -= quantity; /** AL

* Remove all products from this shopping cart */ public void clear() { cartitemmap.clear(); totalprice = BigDecimal.ZERO; totalquantity = 0; /** * Get quantity of a {@link Saleable product in this shopping cart * * @param sellable the product of interest which this method will return the quantity * @return The product quantity in this shopping cart * @throws ProductNotFoundException if the product is not found in this shopping cart */ public int getquantity(final Saleable sellable) throws ProductNotFoundException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); return cartitemmap.get(sellable); /** * Get total cost of a {@link Saleable product in this shopping cart * * @param sellable the product of interest which this method will return the total cost * @return Total cost of the product * @throws ProductNotFoundException if the product is not found in this shopping cart */ public BigDecimal getcost(final Saleable sellable) throws ProductNotFoundException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); return sellable.getprice().multiply(bigdecimal.valueof(cartitemmap.get(sellable) )); /** * Get total price of all products in this shopping cart * * @return Total price of all products in this shopping cart */ public BigDecimal gettotalprice() { return totalprice; /** * Get total quantity of all products in this shopping cart * * @return Total quantity of all products in this shopping cart */ public int gettotalquantity() { return totalquantity; AM

/** * Get set of products in this shopping cart * * @return Set of {@link Saleable products in this shopping cart */ public Set<Saleable> getproducts() { return cartitemmap.keyset(); /** * Get a map of products to their quantities in the shopping cart * * @return A map from product to its quantity in this shopping cart */ public Map<Saleable, Integer> getitemwithquantity() { Map<Saleable, Integer> cartitemmap = new HashMap<Saleable, Integer>(); cartitemmap.putall(this.cartitemmap); return cartitemmap; public String tostring() { StringBuilder strbuilder = new StringBuilder(); for (Entry<Saleable, Integer> entry : cartitemmap.entryset()) { strbuilder.append(string.format("product: %s, Unit Price: %f, Quantity: %d%n", entry.getkey().getname(), entry.getkey().getprice(), entry.getvalue())); strbuilder.append(string.format("total Quantity: %d, Total Price: %f", totalquantity, totalprice)); return strbuilder.tostring(); public class ProductNotFoundException extends RuntimeException { private static final long serialversionuid = 43L; private static final String DEFAULT_MESSAGE = "Product is not found in the shopping cart."; public ProductNotFoundException() { super(default_message); public ProductNotFoundException(String message) { super(message); public class QuantityOutOfRangeException extends RuntimeException { private static final long serialversionuid = 44L; private static final String DEFAULT_MESSAGE = "Quantity is out of range"; public QuantityOutOfRangeException() { super(default_message); public QuantityOutOfRangeException(String message) { super(message); AN

model/cartitem.java package com.example.root.projectku.model; public class CartItem { private Product product; private int quantity; public int getquantity() { return quantity; public void setquantity(int quantity) { this.quantity = quantity; public Product getproduct() { return product; public void setproduct(product product) { this.product = product; model/product.java package com.example.root.projectku.model; import java.io.serializable; import java.math.bigdecimal; public class Product implements Saleable, Serializable { private static final long serialversionuid = -4073256626483275668L; private int pid; private String pname; private BigDecimal pprice; private String pdescription; private String pimagename; public Product() { super(); public Product(int pid, String pname, BigDecimal pprice, String pdescription, String pimagename) { setid(pid); setname(pname); setprice(pprice); setdescription(pdescription); setimagename(pimagename); public boolean equals(object o) { if (o == null) return false; if (!(o instanceof Product)) return false; return (this.pid == ((Product) o).getid()); public int hashcode() { final int prime = 31; int hash = 1; AO

hash = hash * prime + pid; hash = hash * prime + (pname == null? 0 : pname.hashcode()); hash = hash * prime + (pprice == null? 0 : pprice.hashcode()); hash = hash * prime + (pdescription == null? 0 : pdescription.hashcode()); return hash; public int getid() { return pid; public void setid(int id) { this.pid = id; public BigDecimal getprice() { return pprice; public String getname() { return pname; public void setprice(bigdecimal price) { this.pprice = price; public void setname(string name) { this.pname = name; public String getdescription() { return pdescription; public void setdescription(string pdescription) { this.pdescription = pdescription; public String getimagename() { return pimagename; public void setimagename(string imagename) { this.pimagename = imagename; model/saleable.java package com.example.root.projectku.model; import java.math.bigdecimal; /** * Implements this interface for any product which can be added to shopping cart */ public interface Saleable { BigDecimal getprice(); String getname(); int getid(); AP

model/carthelper.java package com.example.root.projectku.util; import com.example.root.projectku.model.cart; /** * A helper class to retrieve the static shopping cart. Call {@code getcart() to retrieve the shopping cart before you perform any operation on the shopping cart. * * */ public class CartHelper { private static Cart cart = new Cart(); /** * Retrieve the shopping cart. Call this before perform any manipulation on the shopping cart. * * @return the shopping cart */ public static Cart getcart() { if (cart == null) { cart = new Cart(); return cart; MainActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.text.textutils; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import java.util.hashmap; import java.util.map; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private EditText etemail; private EditText etpassword; private EditText etnama, etalamat, ettelp; AQ

private Button btsignin; private TextView tvsignin; private ProgressDialog pdialog; private FirebaseAuth firebaseauth; private DatabaseReference firebasetable,firebasesubtable; String tabel_akun="akun"; String temp_key_akun,temp_key_auth,temp_key_nama,temp_key_alamat,temp_key_telp; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); etemail = (EditText) findviewbyid(r.id.etemail); etpassword = (EditText) findviewbyid(r.id.etpassword); etnama= (EditText) findviewbyid(r.id.etnama); etalamat = (EditText) findviewbyid(r.id.etalamat); ettelp = (EditText) findviewbyid(r.id.ettelp); tvsignin = (TextView) findviewbyid(r.id.tvsignin); btsignup = (Button) findviewbyid(r.id.btsignup); pdialog = new ProgressDialog(this); buttonsignup.setonclicklistener(this); textviewsignin.setonclicklistener(this); private void registeruser(){ String email = etemail.gettext().tostring().trim(); String password = etpassword.gettext().tostring().trim(); if(textutils.isempty(email)){ Toast.makeText(this,"enter email please",toast.length_long).show(); return; if(textutils.isempty(password)){ Toast.makeText(this,"enter password please",toast.length_long).show(); return; pdialog.setmessage("registering Please Wait..."); pdialog.show(); firebaseauth.createuserwithemailandpassword(email, password).addoncompletelistener(this, new OnCompleteListener<AuthResult>() { public void oncomplete(@nonnull Task<AuthResult> task) { if(task.issuccessful()){ firebasetable = FirebaseDatabase.getInstance().getReference().child(tabel_akun); AR

temp_key_akun=edittextemail.gettext().tost ring().trim().replace('.',','); Map<String, Object> map_user = new HashMap<String, Object>(); map_user.put(temp_key_akun, ""); firebasetable.updatechildren(map_user); temp_key_auth=firebaseauth.getcurrentuser( ).getemail().replace('.',','); firebasetable = FirebaseDatabase.getInstance().getReference().child(tabel_akun); firebasesubtable = firebasetable.child(temp_key_auth); temp_key_nama= etnama.gettext().tostring().trim(); temp_key_alamat= etalamat.gettext().tostring().trim(); temp_key_telp= ettelp.gettext().tostring().trim(); Map<String, Object> map_data = new HashMap<String, Object>(); map_data.put("name", temp_key_nama); map_data.put("address", temp_key_alamat); map_data.put("phone", temp_key_telp); firebasesubtable.updatechildren(map_data); finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); else{ Toast.makeText(MainActivity.this,"Registra tion Error",Toast.LENGTH_LONG).show(); pdialog.dismiss(); ); public void onclick(view view) { if(view == btsignup){ registeruser(); if(view == tvsignin){ startactivity(new Intent(this, LoginActivity.class)); activity_main.xml <?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="368dp" AS

android:layout_centerhorizontal="true" android:layout_centervertical="true" android:orientation="vertical" tools:layout_editor_absolutex="16dp" tools:layout_editor_absolutey="119dp"> android:id="@+id/textviewregister" android:textappearance="?android:attr/textappearancelarge" android:text="user Registration" android:textalignment="center" tools:layout_editor_absolutex="8dp" tools:layout_editor_absolutey="0dp" /> <EditText android:id="@+id/etemail" android:layout_margin="15dp" android:hint="enter your email" android:inputtype="textemailaddress" /> <EditText android:id="@+id/etpassword" android:layout_margin="15dp" android:hint="enter your password" android:inputtype="textpassword" /> <EditText android:id="@+id/edittextnama" android:layout_margin="15dp" android:hint="enter your name" /> <EditText android:id="@+id/etalamat" android:layout_margin="15dp" android:hint="enter your address" /> <EditText android:id="@+id/ettelp" android:layout_margin="15dp" android:hint="enter your phone number" android:inputtype="number phone" /> <Button android:id="@+id/btsignup" android:layout_margin="15dp" android:text="signup" /> AT

android:textalignment="center" android:text="already Registered? Sign in here" android:id="@+id/textviewsignin" /> </LinearLayout> LoginActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.text.textutils; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; import com.google.firebase.auth.firebaseuser; public class LoginActivity extends AppCompatActivity implements View.OnClickListener { private Button btsignin; private EditText etemail; private EditText etpassword; private TextView tvsignup; private FirebaseAuth firebaseauth; private ProgressDialog progressdialog; private FirebaseUser firebaseuser; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); etemail = (EditText) findviewbyid(r.id.etemail); etpassword = (EditText) findviewbyid(r.id.etpassword); btsignin = (Button) findviewbyid(r.id.btsignin); tvsignup = (TextView) findviewbyid(r.id.tvsignup); progressdialog = new ProgressDialog(this); btsignin.setonclicklistener(this); AU

tvsignup.setonclicklistener(this); private void userlogin(){ final String email = etemail.gettext().tostring().trim(); String password = etpassword.gettext().tostring().trim(); if (TextUtils.isEmpty(email)) { Toast.makeText(this, "enter email please", Toast.LENGTH_LONG).show(); return; if (TextUtils.isEmpty(password)) { Toast.makeText(this, "enter password please", Toast.LENGTH_LONG).show(); return; progressdialog.setmessage("wait.."); progressdialog.show(); firebaseauth.signinwithemailandpassword(email, password).addoncompletelistener(this, new OnCompleteListener<AuthResult>() { public void oncomplete(@nonnull Task<AuthResult> task) { progressdialog.dismiss(); if (task.issuccessful()) { finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); ); public void onclick(view view) { if(view == btsignin){ userlogin(); if(view == tvsignup){ finish(); startactivity(new Intent(this, MainActivity.class)); activity_login.xml <?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_centervertical="true" android:layout_width="368dp" AV

android:orientation="vertical" tools:layout_editor_absolutey="0dp" tools:layout_editor_absolutex="8dp"> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="user Login" android:id="@+id/textview" android:layout_gravity="center_horizontal" /> <EditText android:id="@+id/etemail" android:layout_margin="15dp" android:hint="enter email" android:inputtype="textemailaddress" /> <EditText android:id="@+id/etpassword" android:layout_margin="15dp" android:hint="enter password" android:inputtype="textpassword" /> <Button android:id="@+id/btsignin" android:layout_margin="15dp" android:text="login" /> android:text="don t have an account? Signup Here" android:id="@+id/tvsignup" android:textalignment="center" android:layout_margin="15dp" /> </LinearLayout> AppLocationService.java package com.example.root.client; import android.app.service; import android.content.context; import android.content.intent; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.os.ibinder; AW

public class AppLocationService extends Service implements LocationListener { protected LocationManager lm; Location loc; private static final long MIN_DISTANCE_FOR_UPDATE = 10; private static final long MIN_TIME_FOR_UPDATE = 1000 * 60 * 2; public AppLocationService(Context context) { lm = (LocationManager) context.getsystemservice(location_service); @SuppressWarnings({"MissingPermission") public Location getlocation(string provider) { if (lm.isproviderenabled(provider)) { lm.requestlocationupdates(provider,min_time_for_update, MIN_DISTANCE_FOR_UPDATE, this); if (lm!= null) { loc = lm.getlastknownlocation(provider); return loc; return null; public void onlocationchanged(location location) { public void onproviderdisabled(string provider) { public void onproviderenabled(string provider) { public void onstatuschanged(string provider, int status, Bundle extras) { public IBinder onbind(intent arg0) { return null; MenuActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.pm.packagemanager; import android.location.location; import android.location.locationmanager; import android.os.bundle; import android.os.strictmode; import android.provider.settings; AX

import android.support.design.widget.floatingactionbutton; import android.support.design.widget.navigationview; import android.support.design.widget.snackbar; import android.support.v4.app.activitycompat; import android.support.v4.view.gravitycompat; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbardrawertoggle; import android.support.v7.app.alertdialog; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.linearlayout; import android.widget.textview; import android.widget.toast; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.childeventlistener; 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.loopj.android.http.asynchttpclient; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.defaulthttpclient; import org.json.jsonarray; import org.json.jsonobject; import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; import java.util.hashmap; import java.util.iterator; import java.util.map; public class MenuActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, OnMapReadyCallback { private String xresult = ""; private JSONObject jobject; private GoogleMap mmap; private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase=firebasedatabase.getinstance().getreference().getroot(), firebasetable, firebasesubtable, firebasesubsubtable, firebaserecord; String tabel = "LokasiToko"; String temp_key_authuser, temp_key_toko; AY

Map<String, Object> map_toko; AsyncHttpClient client = new AsyncHttpClient(); int limitdistance = 1500; int thenearestdistance = 3000000; LatLng lokasiku, lokasiminimarket; String nama = ""; String admin = ""; String barang = ""; String latitude = ""; String longitude = ""; HashMap<String, LatLng> lokasifiltered = new HashMap<String, LatLng>(); private ProgressDialog pdialog; TextView td; LinearLayout llmap; AppLocationService applocservice; double currentlatitude; double currentlongitude; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_menu); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); SupportMapFragment mapfragment = (SupportMapFragment) getsupportfragmentmanager().findfragmentbyid(r.id.mapfragment); mapfragment.getmapasync(this); Toolbar toolbar = (Toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); FloatingActionButton fab = (FloatingActionButton) findviewbyid(r.id.fab); fab.setvisibility(view.gone); fab.setonclicklistener(new View.OnClickListener() { public void onclick(view view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show(); ); DrawerLayout drawer = (DrawerLayout) findviewbyid(r.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setdrawerlistener(toggle); toggle.syncstate(); NavigationView navigationview = (NavigationView) findviewbyid(r.id.nav_view); navigationview.setnavigationitemselectedlistener(this); td = (TextView) findviewbyid(r.id.tvdialog); llmap = (LinearLayout) findviewbyid(r.id.llmap); AZ

private void showsettingsalert(string provider) { AlertDialog.Builder alertdialog = new AlertDialog.Builder( MenuActivity.this); alertdialog.settitle(provider + "SETTINGS"); alertdialog.setmessage(provider + "is not enable! Want to go to settings menu?"); alertdialog.setpositivebutton("settings", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int which) { Intent intent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTI NGS); MenuActivity.this.startActivity(intent); ); alertdialog.setnegativebutton("cancel", new DialogInterface.OnClickListener(){ public void onclick(dialoginterface dialog, int which) { dialog.cancel(); ); alertdialog.show(); public void onbackpressed() { DrawerLayout drawer = (DrawerLayout) findviewbyid(r.id.drawer_layout); if (drawer.isdraweropen(gravitycompat.start)) { drawer.closedrawer(gravitycompat.start); else { super.onbackpressed(); public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.menu, menu); return true; public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if (id == R.id.action_settings) { return true; return super.onoptionsitemselected(item); @SuppressWarnings("StatementWithEmptyBody") public boolean onnavigationitemselected(menuitem item) { int id = item.getitemid(); BA

if (id == R.id.nav_order) { startactivity(new Intent(getApplicationContext(), MenuActivity.class)); finish(); if (id == R.id.nav_profile) { startactivity(new Intent(getApplicationContext(), ProfileActivity.class)); else if (id == R.id.nav_cart) { startactivity(new Intent(getApplicationContext(), ShoppingCartActivity.class)); else if(id == R.id.nav_logout) { firebaseauth.signout(); finish(); startactivity(new Intent(this, MainActivity.class)); DrawerLayout drawer = (DrawerLayout) findviewbyid(r.id.drawer_layout); drawer.closedrawer(gravitycompat.start); return true; public void onmapready(googlemap googlemap) { mmap = googlemap; mmap.setoninfowindowclicklistener(new GoogleMap.OnInfoWindowClickListener() { public void oninfowindowclick(marker marker) { String idc = marker.gettitle(); OrderActivity.NAMA_TOKO = idc; startactivity(new Intent(getApplicationContext(), OrderActivity.class)); ); applocservice=new AppLocationService(MenuActivity.this); Location gpslocation = applocservice.getlocation(locationmanager.gps_provider); if (gpslocation!= null){ currentlatitude = gpslocation.getlatitude(); currentlongitude = gpslocation.getlongitude(); else { showsettingsalert("gps ALERT"); lokasiku = new LatLng(currentLatitude, currentlongitude); pdialog = new ProgressDialog(MenuActivity.this); pdialog.setmessage("getting Data..."); pdialog.setindeterminate(false); BB

pdialog.setcancelable(true); pdialog.show(); try { firebasetable = FirebaseDatabase.getInstance().getReference().child("BarangToko"); firebasetable.addchildeventlistener(new ChildEventListener() { public void onchildadded(datasnapshot datasnapshot, String s) { Iterator i = datasnapshot.getchildren().iterator(); while (i.hasnext()) { nama = datasnapshot.getkey(); i.next(); i.next(); latitude = (String) ((DataSnapshot) i.next()).getvalue(); longitude = (String) ((DataSnapshot) i.next()).getvalue(); try { xresult = getrequestselect("https://maps.googleapis.com/maps/api/distancematrix/jso n?origins=" + Double.toString(lokasiKu.latitude) + "," + Double.toString(lokasiKu.longitude) + "&destinations=" + latitude + "," + longitude + "&key=aizasycwm7kfqs2iqimedf1a6dzpp5jmx180hz8", MenuActivity.this); parse(latitude, longitude); catch (Exception ex) { String dummy = ex.getmessage(); Toast.makeText(getApplicationContext(), "Error: " + dummy, Toast.LENGTH_LONG).show(); if (ActivityCompat.checkSelfPermission(MenuActivity.this, android.manifest.permission.access_fine_location)!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(MenuActivity.this, android.manifest.permission.access_coarse_location)!= PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onrequestpermissionsresult(int requestcode, String[] permissions, // int[] grantresults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. BC

return; mmap.setmylocationenabled(true); mmap.movecamera(cameraupdatefactory.newlatlngzoom(l okasiku, 15)); td.settext("selesai..."); llmap.setvisibility(view.visible); public void onchildchanged(datasnapshot datasnapshot, String s) { public void onchildremoved(datasnapshot datasnapshot) { public void onchildmoved(datasnapshot datasnapshot, String s) { public void oncancelled(databaseerror databaseerror) { ); catch (Exception e) { e.printstacktrace(); pdialog.dismiss(); public static String getrequestselect(string Url, Context ctx) { String sret = ""; HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(Url); try { HttpResponse response = client.execute(request); sret = request(response); catch (Exception ex) { Toast.makeText(ctx, "Gagal " + ex.getmessage() + ", " + ex.tostring(), Toast.LENGTH_LONG).show(); return sret; public static String request(httpresponse response) { String result = ""; try { InputStream in = response.getentity().getcontent(); BufferedReader reader = new BufferedReader( new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while ((line = reader.readline())!= null) { str.append(line + "\n"); in.close(); BD

result = str.tostring(); catch (Exception ex) { result = "Error"; return result; private void parse(string latitude,string longitude) throws Exception { JSONObject object_rows = null; JSONArray array_rows; object_rows = new JSONObject(xResult); array_rows = object_rows.getjsonarray("rows"); for (int i = 0; i < array_rows.length(); i++) { JSONObject object_elements = array_rows.getjsonobject(i); JSONArray array_elements = object_elements.getjsonarray("elements"); for (int ii = 0; ii < array_elements.length(); ii++) { JSONObject object_distance = array_elements.getjsonobject(ii); JSONObject distance_details = object_distance.getjsonobject("distance"); int array_value = distance_details.getint("value"); thenearestdistance = array_value; if (thenearestdistance <= limitdistance) { lokasiminimarket = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude)); Marker marker = mmap.addmarker(new MarkerOptions().position(lokasiMiniMarket).title(nama)); marker.showinfowindow(); activity_menu.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout 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/drawer_layout" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start"> <include layout="@layout/app_bar_menu" android:layout_height="match_parent" /> <android.support.design.widget.navigationview android:id="@+id/nav_view" android:layout_width="wrap_content" BE

android:layout_height="match_parent" android:layout_gravity="start" android:fitssystemwindows="true" app:headerlayout="@layout/nav_header_menu" app:menu="@menu/activity_menu_drawer" /> </android.support.v4.widget.drawerlayout> OrderActivity.java package com.example.root.client; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.text.spannablestring; import android.text.style.underlinespan; import android.util.log; import android.view.view; import android.widget.adapterview; import android.widget.listview; import android.widget.textview; import com.example.root.client.adapter.productadapter; import com.example.root.client.model.product; 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.query; import com.google.firebase.database.valueeventlistener; import java.math.bigdecimal; import java.util.arraylist; import java.util.hashmap; import java.util.list; public class OrderActivity extends AppCompatActivity { public static String NAMA_TOKO = "Jonas"; private static final String TAG = "OrderActivity"; public static List<Product> PRODUCT_LIST = new ArrayList<Product>(); ProductAdapter productadapter; ListView lvproducts; private DatabaseReference firebasedatabase=firebasedatabase.getinstance().getreference().getroot(), firebasetable, firebasesubtable, firebasesubsubtable, firebaserecord; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_order); TextView tvviewshoppingcart = (TextView)findViewById(R.id.tvViewShoppingCart); SpannableString content = new SpannableString(getText(R.string.shopping_cart)); content.setspan(new UnderlineSpan(), 0, content.length(), 0); tvviewshoppingcart.settext(nama_toko); tvviewshoppingcart.setonclicklistener(new View.OnClickListener() { BF

public void onclick(view v) { Intent intent = new Intent(OrderActivity.this, ShoppingCartActivity.class); startactivity(intent); ); lvproducts = (ListView) findviewbyid(r.id.lvproducts); lvproducts.addheaderview(getlayoutinflater().inflate(r.layout.pr oduct_list_header, lvproducts, false)); firebasetable = firebasedatabase.child("barangtoko"); firebasesubtable = firebasetable.child(nama_toko); try { Query query = firebasesubtable.orderbykey(); query.addlistenerforsinglevalueevent(new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { String idbarang=""; String namabarang=""; String hargabarang=""; String deskripsibarang=""; String fotobarang=""; productadapter = new ProductAdapter(getApplicationContext()); PRODUCT_LIST.clear(); Product PRODUCT; for(datasnapshot singlesnapshot : datasnapshot.getchildren()) { int i=0; for(datasnapshot singlesnapshot2 : singlesnapshot.getchildren()) { i++; HashMap<String, String> map = new HashMap<String, String>(); idbarang = Integer.toString(i); namabarang = singlesnapshot2.getkey().tostring(); hargabarang = singlesnapshot2.child("harga").getvalue().tostring(); PRODUCT = new Product(Integer.parseInt(idBarang), namabarang, BigDecimal.valueOf(Integer.parseInt(hargaBarang)), namabarang, "noimage"); PRODUCT_LIST.add(PRODUCT); productadapter.updateproducts(product_list); lvproducts.setadapter(productadapter); lvproducts.setonitemclicklistener(new AdapterView.OnItemClickListener() { public void onitemclick(adapterview<?> parent, View view, BG

int position, long id) { Product product = PRODUCT_LIST.get(position - 1); Intent intent = new Intent(OrderActivity.this, ProductActivity.class); Bundle bundle = new Bundle(); bundle.putserializable("product", product); Log.d(TAG, "View product: " + product.getname()); intent.putextras(bundle); startactivity(intent); ); public void oncancelled(databaseerror databaseerror) { ); catch (Exception ex) { activity_order.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.root.client.orderactivity"> android:id="@+id/tvviewshoppingcart" android:textcolor="@color/blue" android:gravity="center" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:text="@string/shopping_cart" android:textsize="@dimen/small_header_text_size"/> android:id="@+id/tvproductlistheader" BH

android:layout_below="@id/tvviewshoppingcart" android:background="@color/green" android:gravity="center" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:text="@string/product_list" android:textallcaps="true" android:textsize="@dimen/header_text_size" android:textstyle="bold"/> <ListView android:id="@+id/lvproducts" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/tvproductlistheader"/> </RelativeLayout> activity_product.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin"> android:id="@+id/tvviewshoppingcart" android:layout_alignparenttop="true" android:textcolor="@color/blue" android:gravity="center" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:text="@string/shopping_cart" android:textsize="@dimen/small_header_text_size"/> android:id="@+id/tvproductname" android:layout_below="@id/tvviewshoppingcart" android:background="@color/green" android:gravity="center" android:padding="@dimen/common_padding" android:textallcaps="true" android:textsize="@dimen/header_text_size" android:textstyle="bold"/> android:id="@+id/tvproductdesc" BI

android:layout_below="@id/tvproductname" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding"/> <ImageView android:id="@+id/ivproductimage" android:layout_width="wrap_content" android:layout_centerhorizontal="true" android:layout_above="@+id/llaction" android:layout_below="@id/tvproductdesc" android:paddingtop="5dp" android:paddingbottom="5dp"/> <LinearLayout android:id="@id/llaction" android:layout_alignparentbottom="true" android:orientation="horizontal" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center_vertical end" android:text="@string/quantity"/> <Spinner android:id="@+id/spquantity" android:layout_width="0dip" android:layout_weight="0.25"/> <Button android:id="@+id/border" android:layout_width="0dip" android:layout_weight="0.5" android:background="@color/orange" android:text="@string/order" android:textallcaps="true" android:textcolor="@android:color/white" android:textstyle="bold"/> </LinearLayout> </RelativeLayout> activity_shopping_cart.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" BJ

android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin"> android:id="@+id/tvcartheader" android:background="@color/green" android:gravity="center" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:text="@string/shopping_cart" android:textallcaps="true" android:textsize="@dimen/header_text_size" android:textstyle="bold"/> <ListView android:id="@+id/lvcartitems" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/lltotal" android:layout_below="@id/tvcartheader"/> <LinearLayout android:id="@+id/lltotal" android:layout_above="@+id/llbottom" android:orientation="horizontal" android:paddingbottom="5dp" android:paddingtop="5dp" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.75" android:gravity="center_vertical end" android:text="@string/total_price" android:textstyle="bold"/> android:id="@+id/tvtotalprice" android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center" android:text="" android:textstyle="bold"/> </LinearLayout> <LinearLayout android:id="@id/llbottom" android:layout_alignparentbottom="true" android:orientation="horizontal" android:weightsum="1"> <Button android:id="@+id/bhome" BK

android:layout_width="80dp" android:background="@color/orange" android:text="@string/home" android:textallcaps="true" android:textcolor="@android:color/white" android:textstyle="bold" /> <Button android:id="@+id/bclear" android:layout_width="85dp" android:background="@color/orange" android:text="@string/clear_cart" android:textallcaps="true" android:textcolor="@android:color/white" android:textstyle="bold" /> <Button android:id="@+id/bshop" android:layout_width="75dp" android:background="@color/orange" android:text="@string/shop" android:textallcaps="true" android:textcolor="@android:color/white" android:textstyle="bold" /> <Button android:id="@+id/bco" android:layout_width="90dp" android:background="@color/orange" android:text="check Out" android:textallcaps="true" android:textcolor="@android:color/white" android:textstyle="bold" /> </LinearLayout> </RelativeLayout> app_bar_menu.xml <?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:layout_height="match_parent" tools:context="com.example.root.client.menuactivity"> <android.support.design.widget.appbarlayout android:theme="@style/apptheme.appbaroverlay"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" BL

android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:popuptheme="@style/apptheme.popupoverlay" /> </android.support.design.widget.appbarlayout> <include layout="@layout/content_menu" /> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_gravity="bottom end" android:layout_margin="@dimen/fab_margin" app:srccompat="@android:drawable/ic_dialog_email" /> </android.support.design.widget.coordinatorlayout> cart_footer.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/orange" android:orientation="horizontal" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.75" android:gravity="end center_vertical" android:text="@string/total_price" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size" android:textstyle="bold"/> android:id="@+id/tvtotalprice" android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center" android:text="" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size" android:textstyle="bold"/> </LinearLayout> cart_header.java <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" BM

android:background="@color/powderblue" android:orientation="horizontal" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.4" android:gravity="center" android:text="@string/name" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size"/> android:layout_width="0dip" android:layout_weight="0.2" android:gravity="center" android:text="@string/unit_price" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size"/> android:layout_width="0dip" android:layout_weight="0.15" android:gravity="center" android:text="@string/quantity" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size"/> android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center" android:text="@string/price" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size"/> </LinearLayout> content_menu.xml <?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_height="match_parent" android:orientation="vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.example.root.client.menuactivity" BN

tools:showin="@layout/app_bar_menu"> android:id="@+id/tvdialog" android:layout_width="wrap_content" android:text="loading Data..." /> <LinearLayout android:id="@+id/llmap" android:layout_height="match_parent" android:orientation="horizontal" android:visibility="invisible"> <fragment android:id="@+id/mapfragment" android:name="com.google.android.gms.maps.supportmapfragmen t" android:layout_height="428dp" /> </LinearLayout> </LinearLayout> nav_header_menu.xml <?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" android:layout_height="@dimen/nav_header_height" android:background="@drawable/side_nav_bar" android:gravity="bottom" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:theme="@style/themeoverlay.appcompat.dark"> android:id="@+id/textview2" android:paddingtop="@dimen/nav_header_vertical_spacing" android:text="shopping Nearby Me" android:textappearance="@style/textappearance.appcompat.body1" / > </LinearLayout> product_list_header.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" BO

android:background="@color/orange" android:orientation="horizontal" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.65" android:gravity="center" android:text="@string/name" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size"/> android:layout_width="0dip" android:layout_weight="0.35" android:gravity="center" android:text="@string/unit_price" android:textcolor="@android:color/white" android:textsize="@dimen/product_list_header_text_size"/> </LinearLayout> menu/activity_menu_drawer.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkablebehavior="single"> <item android:id="@+id/nav_order" android:title="order Barang" /> <item android:id="@+id/nav_cart" android:title="shopping Cart" /> <item android:id="@+id/nav_profile" android:title="profile" /> <item android:id="@+id/nav_logout" android:title="logout" /> </group> </menu> <resources> <!-- values/google_maps_api.xml BP

TODO: Before you run your application, you need a Google Maps API key. To get one, follow this link, follow the directions and press "Create" at the end: https://console.developers.google.com/flows/enableapi? apiid=maps_android_backend&keytype=client_side_android&r=d1:10:ea:9b:77:4 6:28:7F:A8:C6:59:EA:E3:16:CD:D4:96:A8:E3:F4%3Bcom.example.root.client You can also add your credentials to an existing key, using these values: Package name: D1:10:EA:9B:77:46:28:7F:A8:C6:59:EA:E3:16:CD:D4:96:A8:E3:F4 SHA-1 certificate fingerprint: D1:10:EA:9B:77:46:28:7F:A8:C6:59:EA:E3:16:CD:D4:96:A8:E3:F4 Alternatively, follow the directions here: https://developers.google.com/maps/documentation/android/start#getkey Once you have your key (it starts with "AIza"), replace the "google_maps_key" string in this file. --> <string name="google_maps_key" templatemergestrategy="preserve" translatable="false"> AIzaSyCwm7KFQS2IQiMEdf1A6DzpP5JMx180hZ8 </string> </resources> values/strings.xml <resources> <string name="app_name">client</string> <string name="register">register</string> <string name="login">login</string> <string name="profile">profile</string> <string name="title_activity_menu">menu</string> <string name="navigation_drawer_open">open navigation drawer</string> <string name="navigation_drawer_close">close navigation drawer</string> <string name="action_settings">settings</string> <string name="product_list">product List</string> <string name="shopping_cart">shopping Cart</string> <string name="name">name</string> <string name="unit_price">unit Price</string> <string name="quantity">quantity</string> <string name="view">view</string> <string name="action">action</string> <string name="order">order</string> <string name="price">price</string> <string name="total_price">total Price</string> <string name="remove">remove</string> <string name="clear_cart">clear Cart</string> <string name="shop">shop</string> <string name="delete_item">delete Item</string> BQ

<string name="delete_item_message">are you sure you want to delete this item?</string> <string name="yes">yes</string> <string name="no">no</string> <string name="home">home</string> <string name="status">status Pesanan</string> <string name="status_message">update Status Pesanan?</string> <string name="send">terkirim</string> <string name="cancel">cancel</string> <string name="title_activity_maps">map</string> </resources> values/colors.xml <?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorprimary">#3f51b5</color> <color name="colorprimarydark">#303f9f</color> <color name="coloraccent">#ff4081</color> <color name="green">#008000</color> <color name="orange">#ff5500</color> <color name="blue">#0000ff</color> <color name="black">#00000f</color> <color name="powderblue">#b0e0e6</color> <color name="grey">#eaeaea</color> </resources> BR

BS

BT

BU