From 334eb275437d1a397e39be7d7f629d07606861ce Mon Sep 17 00:00:00 2001 From: Goodnew Date: Tue, 14 May 2019 13:19:54 +0100 Subject: [PATCH] Updating Repo with Demo Version --- .idea/codeStyles/Project.xml | 3 + .idea/misc.xml | 2 +- app/src/main/AndroidManifest.xml | 6 +- .../android/glook/AddBusinessActivity.kt | 24 +- .../example/android/glook/AddCardActivity.kt | 71 ++++ .../android/glook/AddServiceActivity.kt | 31 +- .../com/example/android/glook/BaseActivity.kt | 28 +- .../com/example/android/glook/HomeActivity.kt | 70 +++- .../example/android/glook/LoginActivity.kt | 76 ++++- .../com/example/android/glook/MainActivity.kt | 27 +- .../java/com/example/android/glook/Poko.kt | 31 +- .../android/glook/adapters/HomeListAdapter.kt | 48 +++ .../main/res/drawable/account_settings.xml | 5 + app/src/main/res/drawable/empty.xml | 5 + .../main/res/drawable/ic_appointment_svg.xml | 14 + .../drawable/ic_credit_cards_payment_svg.xml | 9 + app/src/main/res/drawable/ic_profile_svg.xml | 5 + app/src/main/res/drawable/ic_salary_svg.xml | 8 + app/src/main/res/drawable/ic_services_svg.xml | 8 + app/src/main/res/drawable/ic_support_svg.xml | 10 + .../main/res/layout/activity_add_business.xml | 54 ++-- app/src/main/res/layout/activity_add_card.xml | 10 +- .../main/res/layout/activity_add_service.xml | 48 +-- app/src/main/res/layout/activity_earnings.xml | 106 ++---- app/src/main/res/layout/activity_home.xml | 2 +- app/src/main/res/layout/activity_login.xml | 4 +- app/src/main/res/layout/activity_signup.xml | 9 +- app/src/main/res/layout/activity_splash.xml | 2 +- app/src/main/res/layout/app_bar_home.xml | 4 +- .../main/res/layout/appointment_requests.xml | 11 +- .../main/res/layout/businss_page_layout.xml | 130 ++++++++ app/src/main/res/layout/content_home.xml | 306 +----------------- .../main/res/layout/home_item_list_layout.xml | 49 +++ .../res/layout/list_item_payment_history.xml | 2 +- app/src/main/res/layout/nav_header_home.xml | 2 +- .../main/res/menu/activity_home_drawer.xml | 23 +- app/src/main/res/menu/home.xml | 4 +- app/src/main/res/values/strings.xml | 3 +- gradle.properties | 1 - 39 files changed, 697 insertions(+), 554 deletions(-) create mode 100644 app/src/main/java/com/example/android/glook/adapters/HomeListAdapter.kt create mode 100644 app/src/main/res/drawable/account_settings.xml create mode 100644 app/src/main/res/drawable/empty.xml create mode 100644 app/src/main/res/drawable/ic_appointment_svg.xml create mode 100644 app/src/main/res/drawable/ic_credit_cards_payment_svg.xml create mode 100644 app/src/main/res/drawable/ic_profile_svg.xml create mode 100644 app/src/main/res/drawable/ic_salary_svg.xml create mode 100644 app/src/main/res/drawable/ic_services_svg.xml create mode 100644 app/src/main/res/drawable/ic_support_svg.xml create mode 100644 app/src/main/res/layout/businss_page_layout.xml create mode 100644 app/src/main/res/layout/home_item_list_layout.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 34dc27c..9acaff1 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,5 +1,8 @@ + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 7bfef59..a69b05d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bea637f..02c5e64 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@ - + +// if (uri.isSuccessful){ +// downloadUrl = uri.result.toString() +// }else { +// toast(uri.exception!!.message.toString()) +// } +// +// image_url = uri.toString() +// toast(image_url!!) +// } upload = Upload(shop_name_et.text.toString().trim(), taskSnapshot.uploadSessionUri.toString()) + image_url = taskSnapshot.uploadSessionUri.toString() + uploadBussinessDetails() //adding an upload to firebase database // val uploadId = mDatabase!!.push().key @@ -143,15 +160,16 @@ class AddBusinessActivity : AppCompatActivity() { progressDialog.setTitle("Adding Business Information to Database") progressDialog.show() - val shop= Shops(shopName!!, shopAddress!!, shopBvn!!, upload!!) + val shop= Shops(shopName!!, shopAddress!!, shopBvn!!, image_url!!) var database: DatabaseReference = FirebaseDatabase.getInstance().reference // ... - database!!.child("Vendor Stores").child(userId!!).setValue(shop). + database!!.child("vendor_stores").child(userId!!).setValue(shop). addOnSuccessListener { progressDialog.dismiss() toast("Upload Complete") startActivity(Intent(this, AddServiceActivity::class.java)) + finish() }. addOnFailureListener{exception -> toast(exception.message!!) diff --git a/app/src/main/java/com/example/android/glook/AddCardActivity.kt b/app/src/main/java/com/example/android/glook/AddCardActivity.kt index 01a4dc4..6966ae2 100644 --- a/app/src/main/java/com/example/android/glook/AddCardActivity.kt +++ b/app/src/main/java/com/example/android/glook/AddCardActivity.kt @@ -1,12 +1,83 @@ package com.example.android.glook +import android.app.ProgressDialog +import android.content.Intent import android.support.v7.app.AppCompatActivity import android.os.Bundle +import android.text.TextUtils +import com.google.firebase.auth.FirebaseAuth +import com.google.firebase.auth.FirebaseUser +import com.google.firebase.database.DatabaseReference +import com.google.firebase.database.FirebaseDatabase +import kotlinx.android.synthetic.main.activity_add_card.* +import kotlinx.android.synthetic.main.activity_add_service.* +import org.jetbrains.anko.toast class AddCardActivity : AppCompatActivity() { + private var serviceName1 : String? = null + private var serviceCost1 : String? = null + // private var serviceName2 : String? = null +// private var serviceCost2 : String? = null + private var service: Service? = null + + private var mDatabase: DatabaseReference? = null + var currentFirebaseUser: FirebaseUser? = null + var userId : String? =null + + private var database: DatabaseReference? = null + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_add_card) + + + database = FirebaseDatabase.getInstance().reference + + + currentFirebaseUser = FirebaseAuth.getInstance().currentUser + userId = currentFirebaseUser!!.uid + + submit_card_btn.setOnClickListener{checkEditTextFields()} + } + + private fun checkEditTextFields() { + val progressDialog = ProgressDialog(this) + progressDialog.setTitle("Processing") + progressDialog.show() + + var accountName = account_name_et.text.toString() + var accountNumber = account_number_et.text.toString() + var bankName = bank_name_et.text.toString() + + if(TextUtils.isEmpty(accountName) || TextUtils.isEmpty(accountNumber) || TextUtils.isEmpty(bankName)){ + progressDialog.dismiss() + account_name_et.error = "Please enter your account name" + account_number_et.error = "Please enter your account number" + bank_name_et.error = "Please enter your bank name" + + }else{ + + + + val cardPoko = CardPoko(accountName, accountNumber, bankName) + database!!.child("vendor_cards").child(userId!!).setValue(cardPoko). + addOnSuccessListener { + toast("Upload Successfull") + startActivity(Intent(this, HomeActivity::class.java)) + finish() + } + .addOnFailureListener{exception -> + toast(exception.message!!) + + } + + } + + + + + } + } diff --git a/app/src/main/java/com/example/android/glook/AddServiceActivity.kt b/app/src/main/java/com/example/android/glook/AddServiceActivity.kt index 056ab69..e6391b4 100644 --- a/app/src/main/java/com/example/android/glook/AddServiceActivity.kt +++ b/app/src/main/java/com/example/android/glook/AddServiceActivity.kt @@ -18,15 +18,15 @@ class AddServiceActivity : AppCompatActivity() { private var serviceName1 : String? = null private var serviceCost1 : String? = null - private var serviceName2 : String? = null - private var serviceCost2 : String? = null +// private var serviceName2 : String? = null +// private var serviceCost2 : String? = null private var service: Service? = null private var mDatabase: DatabaseReference? = null var currentFirebaseUser: FirebaseUser? = null var userId : String? =null - private lateinit var database: DatabaseReference + private var database: DatabaseReference? = null // ... @@ -37,7 +37,7 @@ class AddServiceActivity : AppCompatActivity() { database = FirebaseDatabase.getInstance().reference - currentFirebaseUser = FirebaseAuth.getInstance().getCurrentUser() + currentFirebaseUser = FirebaseAuth.getInstance().currentUser userId = currentFirebaseUser!!.uid submit_service_btn.setOnClickListener{checkEditTextFields()} @@ -50,8 +50,8 @@ class AddServiceActivity : AppCompatActivity() { serviceName1 = service_name1.text.toString() serviceCost1 = service_cost1.text.toString() - serviceName2 = service_name2.text.toString() - serviceCost2 = service_cost2.text.toString() +// serviceName2 = service_name2.text.toString() +// serviceCost2 = service_cost2.text.toString() if(TextUtils.isEmpty(serviceName1) || TextUtils.isEmpty(serviceCost1)){ service_name1.error = "Please enter a service name" @@ -60,23 +60,22 @@ class AddServiceActivity : AppCompatActivity() { }else{ - if(TextUtils.isEmpty(serviceName2) || TextUtils.isEmpty(serviceCost2)){ - service = Service(serviceName1!!, serviceCost1!!) - }else{ - service = Service(serviceName1!!, serviceCost1!!) - } - } - database.child("services").child(userId!!).setValue(service). + service = Service(serviceName1!!, serviceCost1!!, userId!!) + database!!.child("services").child(userId!!).setValue(service). addOnSuccessListener { toast("Upload Successfull") startActivity(Intent(this, HomeActivity::class.java)) finish() } - .addOnFailureListener{exception -> - toast(exception.message!!) + .addOnFailureListener{exception -> + toast(exception.message!!) + + } + + } + - } diff --git a/app/src/main/java/com/example/android/glook/BaseActivity.kt b/app/src/main/java/com/example/android/glook/BaseActivity.kt index ded3ed5..99de94a 100644 --- a/app/src/main/java/com/example/android/glook/BaseActivity.kt +++ b/app/src/main/java/com/example/android/glook/BaseActivity.kt @@ -2,24 +2,26 @@ package com.example.android.glook import android.app.ProgressDialog import android.content.Context -import android.support.constraint.ConstraintLayout import android.support.design.widget.Snackbar import android.view.View import android.widget.ProgressBar -fun showProgressDialog(message : String, context: Context){ - var rootLayout: ConstraintLayout? = null - var progressBar : ProgressBar? = null - progressBar = ProgressBar(context, null, android.R.attr.progressBarStyleLargeInverse) - var params: ConstraintLayout.LayoutParams = ConstraintLayout.LayoutParams(100,100) - rootLayout!!.addView(progressBar, params) - // progressBar!!.visibility(View.VISIBLE) - +//fun showProgressDialog(message : String, context: Context){ +// var rootLayout: ConstraintLayout? = null +// var progressBar : ProgressBar? = null +// progressBar = ProgressBar(context, null, android.R.attr.progressBarStyleLargeInverse) +// var params: ConstraintLayout.LayoutParams = ConstraintLayout.LayoutParams(100,100) +// rootLayout!!.addView(progressBar, params) +// // progressBar!!.visibility(View.VISIBLE) +// +// +//} +interface OnItemClickListener { + fun onItemClick(item: HomePoko) } - -fun showMessage(view: View, message: String){ - Snackbar.make(view, message, Snackbar.LENGTH_INDEFINITE).setAction("Action", null).show() -} \ No newline at end of file +//fun showMessage(view: View, message: String){ +// Snackbar.make(view, message, Snackbar.LENGTH_INDEFINITE).setAction("Action", null).show() +//} \ No newline at end of file diff --git a/app/src/main/java/com/example/android/glook/HomeActivity.kt b/app/src/main/java/com/example/android/glook/HomeActivity.kt index 142c8a1..fc9cfc0 100644 --- a/app/src/main/java/com/example/android/glook/HomeActivity.kt +++ b/app/src/main/java/com/example/android/glook/HomeActivity.kt @@ -2,24 +2,44 @@ package com.example.android.glook import android.content.Intent import android.os.Bundle -import android.support.design.widget.Snackbar import android.support.design.widget.NavigationView +import android.support.v4.content.ContextCompat.startActivity import android.support.v4.view.GravityCompat import android.support.v7.app.ActionBarDrawerToggle import android.support.v7.app.AppCompatActivity +import android.support.v7.widget.GridLayoutManager import android.view.Menu import android.view.MenuItem +import android.widget.Toast +import com.example.android.glook.adapters.HomeListAdapter +import com.google.firebase.auth.FirebaseAuth import kotlinx.android.synthetic.main.activity_home.* import kotlinx.android.synthetic.main.app_bar_home.* import kotlinx.android.synthetic.main.content_home.* class HomeActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener { + private var mAuth : FirebaseAuth? = null + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_home) setSupportActionBar(toolbar) + /**Initialize the Firebase Autentication object**/ + mAuth = FirebaseAuth.getInstance() + //val listHomePoko: ArrayList = ArrayList() + + /**Create and populate an array using the method @createListHomePoko**/ + var listHomePoko = createListHomePoko() + + //Set the layout Manager on the recyclerView object and set it to a GridView with a column span of 2 + recyclerView.layoutManager = GridLayoutManager(this, 2) + + + val homeAdapter = HomeListAdapter(listHomePoko, this,{ partItem : HomePoko -> homeItemClicked(partItem) }) + homeAdapter.notifyDataSetChanged() + recyclerView.adapter = homeAdapter val toggle = ActionBarDrawerToggle( this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close @@ -28,12 +48,39 @@ class HomeActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte toggle.syncState() nav_view.setNavigationItemSelectedListener(this) - home_services_card.setOnClickListener { startActivity (Intent(this, AddServiceActivity::class.java)) } - home_profile_card.setOnClickListener { startActivity (Intent(this, ProfileActivity::class.java)) } - home_earnings_card.setOnClickListener { startActivity (Intent(this, EarningsActivity::class.java)) } } - override fun onBackPressed() { + + private fun createListHomePoko() : ArrayList { + var homeList = ArrayList() + homeList.add(HomePoko(R.drawable.ic_salary_svg, "Earnings")) + homeList.add(HomePoko(R.drawable.ic_appointment_svg, "Appointments")) + homeList.add(HomePoko(R.drawable.ic_credit_cards_payment_svg, "Payments")) + homeList.add(HomePoko(R.drawable.ic_profile_svg, "Profile")) + homeList.add(HomePoko(R.drawable.ic_services_svg, "Services")) + homeList.add(HomePoko(R.drawable.ic_support_svg, "Help and Support")) + return homeList + } + + private fun homeItemClicked(homeItem : HomePoko) { + Toast.makeText(this, " You Clicked: ${homeItem.actionDesc}", Toast.LENGTH_SHORT).show() + + if (homeItem.actionDesc == "Earnings"){startActivity(Intent(this, EarningsActivity::class.java))} + // else if (homeItem.actionDesc == "Appointments"){startActivity(Intent(this,EarningsActivity::class.java ))} + else if (homeItem.actionDesc == "Payments"){startActivity(Intent(this,AddCardActivity::class.java ))} + //else if (homeItem.actionDesc == "Profile"){startActivity(Intent(this,ProfileActivity::class.java ))} + else if (homeItem.actionDesc == "Services"){startActivity(Intent(this,AddServiceActivity::class.java ))} + else{} + + + // Launch second activity, pass part ID as string parameter +// val activityIntent = Intent(this, PartDetailActivity::class.java) +// //activityIntent.putExtra(Intent.EXTRA_TEXT, homeItem.id.toString()) +// startActivity(activityIntent) + } + + + override fun onBackPressed() { if (drawer_layout.isDrawerOpen(GravityCompat.START)) { drawer_layout.closeDrawer(GravityCompat.START) } else { @@ -47,19 +94,30 @@ class HomeActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte return true } + override fun onOptionsItemSelected(item: MenuItem): Boolean { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. when (item.itemId) { - R.id.action_settings -> return true + R.id.action_logout -> signOut() else -> return super.onOptionsItemSelected(item) } + return true + } + + private fun signOut() { + mAuth!!.signOut() + startActivity(Intent(this, LoginActivity::class.java)) + finish() } + override fun onNavigationItemSelected(item: MenuItem): Boolean { // Handle navigation view item clicks here. when (item.itemId) { + R.id.nav_logout -> signOut() + } diff --git a/app/src/main/java/com/example/android/glook/LoginActivity.kt b/app/src/main/java/com/example/android/glook/LoginActivity.kt index b5da3b1..2860622 100644 --- a/app/src/main/java/com/example/android/glook/LoginActivity.kt +++ b/app/src/main/java/com/example/android/glook/LoginActivity.kt @@ -4,18 +4,24 @@ import android.app.ProgressDialog import android.content.Intent import android.support.v7.app.AppCompatActivity import android.os.Bundle +import android.support.v4.content.ContextCompat.startActivity import android.support.v7.widget.CardView import android.text.TextUtils +import android.util.Log import android.widget.Button import android.widget.EditText import com.google.firebase.auth.FirebaseAuth +import com.google.firebase.auth.FirebaseUser +import com.google.firebase.database.DataSnapshot +import com.google.firebase.database.DatabaseError +import com.google.firebase.database.FirebaseDatabase +import com.google.firebase.database.ValueEventListener import kotlinx.android.synthetic.main.activity_login.* class LoginActivity : AppCompatActivity() { private var mAuth: FirebaseAuth? = null - private var loginCard: CardView? = null private var login_email_et: EditText? = null @@ -24,6 +30,10 @@ class LoginActivity : AppCompatActivity() { private var phone : String? = null private var firstName: String? = null private var lastName: String? = null + private var hasService: Boolean= false + + private var currentFirebaseUser: FirebaseUser? = null + private var userId : String? =null override fun onCreate(savedInstanceState: Bundle?) { @@ -31,6 +41,8 @@ class LoginActivity : AppCompatActivity() { setContentView(R.layout.activity_login) + + mAuth = FirebaseAuth.getInstance() login_email_et = findViewById(R.id.login_email_et) @@ -39,8 +51,9 @@ class LoginActivity : AppCompatActivity() { sign_in_btn!!.setOnClickListener{logInUser()} - sign_up_link.setOnClickListener{startActivity(Intent(this, SignupActivity::class.java)) - finish()} + sign_up_link.setOnClickListener{startActivity(Intent(this, SignupActivity::class.java))} + + val intent = intent if (intent.hasExtra("email")){ @@ -59,6 +72,25 @@ class LoginActivity : AppCompatActivity() { //forgot_password_link.setOnClickListener{startActivity(Intent(this, ForgotPasswordActivity::class.java))} } + fun checkForService(){ + var rootRef = FirebaseDatabase.getInstance().reference + + rootRef.addListenerForSingleValueEvent(object : ValueEventListener { + override fun onCancelled(p0: DatabaseError) { + + } + + override fun onDataChange(snapshot: DataSnapshot) { + if (snapshot.hasChild("vendor_stores/$userId")) { + // run some code + hasService = true + } + } + }) + + } + + private fun logInUser() { @@ -73,25 +105,36 @@ class LoginActivity : AppCompatActivity() { if (TextUtils.isEmpty(email) && TextUtils.isEmpty(password)){ progressDialog.dismiss() - login_email_et!!.setError("Please enter a valid email") - login_password_et!!.setError("Please enter your password") + login_email_et!!.error = "Please enter a valid email" + login_password_et!!.error = "Please enter your password" }else{ progressDialog.setTitle("Logging In...") - mAuth!!.signInWithEmailAndPassword(email, password.toString()) + mAuth!!.signInWithEmailAndPassword(email, password) .addOnCompleteListener { task -> if (task.isSuccessful) { + currentFirebaseUser = FirebaseAuth.getInstance().currentUser + userId = currentFirebaseUser!!.uid + checkForService() + progressDialog.dismiss() - val loginIntent = Intent(this,AddBusinessActivity::class.java) - // val user = User(firstName, lastName, email, password, phone) + + if (hasService){ + startActivity(Intent(this, HomeActivity::class.java)) + finish() + }else{ + val loginIntent = Intent(this,AddBusinessActivity::class.java) + // val user = User(firstName, lastName, email, password, phone) - loginIntent.putExtra("firstName",firstName) - // loginIntent.putExtra("email", email) - //loginIntent.putExtra("password",password) - loginIntent.putExtra("lastName",lastName) - loginIntent.putExtra("phone",phone) - startActivity(loginIntent) - finish() + loginIntent.putExtra("firstName",firstName) + // loginIntent.putExtra("email", email) + //loginIntent.putExtra("password",password) + loginIntent.putExtra("lastName",lastName) + loginIntent.putExtra("phone",phone) + startActivity(loginIntent) + finish() + } + //Manage error }else // val user = User(firstName, lastName, email, password, phone) @@ -103,7 +146,8 @@ class LoginActivity : AppCompatActivity() { } } } +} //ProgressDialog proDialog = ProgressDialog.show(this, "title", "message"); -} + diff --git a/app/src/main/java/com/example/android/glook/MainActivity.kt b/app/src/main/java/com/example/android/glook/MainActivity.kt index cec61a4..2451b9b 100644 --- a/app/src/main/java/com/example/android/glook/MainActivity.kt +++ b/app/src/main/java/com/example/android/glook/MainActivity.kt @@ -3,7 +3,9 @@ package com.example.android.glook import android.content.Intent import android.support.v7.app.AppCompatActivity import android.os.Bundle +import android.util.Log import android.widget.Button +import com.google.firebase.auth.FirebaseAuth import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { @@ -18,17 +20,38 @@ class MainActivity : AppCompatActivity() { signIn.setOnClickListener{ startActivity(Intent(this,LoginActivity::class.java)) + finish() } signUp.setOnClickListener{ startActivity(Intent(this,SignupActivity::class.java)) + finish() - } + }} + + + + override fun onStart() { + super.onStart() + val user = FirebaseAuth.getInstance().getCurrentUser() + if (user != null) { + // User is signed in + var i = Intent(this, HomeActivity::class.java) + // i!!.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK, Intent.FLAG_ACTIVITY_CLEAR_TASK) + startActivity(i) + } else { + // User is signed out + Log.d("LoginActivity", "onAuthStateChanged:signed_out") + } } -} + + } + + + diff --git a/app/src/main/java/com/example/android/glook/Poko.kt b/app/src/main/java/com/example/android/glook/Poko.kt index c674b94..bdb7c06 100644 --- a/app/src/main/java/com/example/android/glook/Poko.kt +++ b/app/src/main/java/com/example/android/glook/Poko.kt @@ -7,11 +7,38 @@ data class User(val firstName: String, val lastName: String, val email: String, @IgnoreExtraProperties -data class Shops(val shopName: String, val shopAdress: String, val shopBvn: String, val upload: Upload) +data class Shops(val shopName: String, val shopAdress: String, val shopBvn: String, val image_url: String) @IgnoreExtraProperties data class Upload(var name: String?, var url: String) @IgnoreExtraProperties -data class Service(var serviceName: String, var serviceCost: String) +data class Service(var serviceName: String, var serviceCost: String, var userId: String) + +data class HomePoko(var actionImage: Int, var actionDesc: String) + +data class CardPoko(var accountName: String, var accountNumber: String, var bankName: String) + +class Model { + + var name: String? = null + var image_drawable: Int = 0 + + fun getNames(): String { + return name.toString() + } + + fun setNames(name: String) { + this.name = name + } + + fun getImage_drawables(): Int { + return image_drawable + } + + fun setImage_drawables(image_drawable: Int) { + this.image_drawable = image_drawable + } + +} diff --git a/app/src/main/java/com/example/android/glook/adapters/HomeListAdapter.kt b/app/src/main/java/com/example/android/glook/adapters/HomeListAdapter.kt new file mode 100644 index 0000000..84008af --- /dev/null +++ b/app/src/main/java/com/example/android/glook/adapters/HomeListAdapter.kt @@ -0,0 +1,48 @@ +package com.example.android.glook.adapters + +import android.content.Context +import android.support.v7.widget.RecyclerView +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import com.example.android.glook.HomePoko +import kotlinx.android.synthetic.main.home_item_list_layout.view.* + + +class HomeListAdapter(val items: ArrayList, val context: Context, val clickListener: (HomePoko) -> Unit): RecyclerView.Adapter() { + + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { +// holder.itemImage.setImageResource(items.get(position).actionImage) +// holder.itemText.text = items.get(position).actionDesc + (holder as ViewHolder).bind(items[position], clickListener) + } + + + override fun onCreateViewHolder(parent: ViewGroup, p1: Int): ViewHolder { + val view: View = LayoutInflater.from(parent.context) + .inflate(com.example.android.glook.R.layout.home_item_list_layout, parent, false) + return ViewHolder(view) + } + + override fun getItemCount(): Int { + return items.size + } + + + class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { + val itemImage: ImageView = view.findViewById(com.example.android.glook.R.id.list_item_image) + val itemText: TextView = view.findViewById(com.example.android.glook.R.id.list_item_text) +// view.setOnClickListener { clickListener(part)} + + fun bind(part: HomePoko, clickListener: (HomePoko) -> Unit) { + itemView.list_item_text.text = part.actionDesc + itemView.list_item_image.setImageResource(part.actionImage) + itemView.setOnClickListener { clickListener(part) } + + } + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable/account_settings.xml b/app/src/main/res/drawable/account_settings.xml new file mode 100644 index 0000000..0ef1207 --- /dev/null +++ b/app/src/main/res/drawable/account_settings.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/empty.xml b/app/src/main/res/drawable/empty.xml new file mode 100644 index 0000000..9e5c6f6 --- /dev/null +++ b/app/src/main/res/drawable/empty.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_appointment_svg.xml b/app/src/main/res/drawable/ic_appointment_svg.xml new file mode 100644 index 0000000..ae603fb --- /dev/null +++ b/app/src/main/res/drawable/ic_appointment_svg.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_credit_cards_payment_svg.xml b/app/src/main/res/drawable/ic_credit_cards_payment_svg.xml new file mode 100644 index 0000000..e7e4725 --- /dev/null +++ b/app/src/main/res/drawable/ic_credit_cards_payment_svg.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/ic_profile_svg.xml b/app/src/main/res/drawable/ic_profile_svg.xml new file mode 100644 index 0000000..d0f385e --- /dev/null +++ b/app/src/main/res/drawable/ic_profile_svg.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/ic_salary_svg.xml b/app/src/main/res/drawable/ic_salary_svg.xml new file mode 100644 index 0000000..ca9ef28 --- /dev/null +++ b/app/src/main/res/drawable/ic_salary_svg.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_services_svg.xml b/app/src/main/res/drawable/ic_services_svg.xml new file mode 100644 index 0000000..87c4c56 --- /dev/null +++ b/app/src/main/res/drawable/ic_services_svg.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_support_svg.xml b/app/src/main/res/drawable/ic_support_svg.xml new file mode 100644 index 0000000..6fa48c1 --- /dev/null +++ b/app/src/main/res/drawable/ic_support_svg.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/activity_add_business.xml b/app/src/main/res/layout/activity_add_business.xml index b679707..a2e18e9 100644 --- a/app/src/main/res/layout/activity_add_business.xml +++ b/app/src/main/res/layout/activity_add_business.xml @@ -14,30 +14,29 @@ android:layout_height="80dp" app:srcCompat="@drawable/logo" android:id="@+id/imageView7" + android:layout_marginStart="8dp" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp" - android:layout_marginStart="8dp" - app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp" android:layout_marginRight="8dp" - app:layout_constraintHorizontal_bias="0.498" android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintVertical_bias="0.051"/> + app:layout_constraintHorizontal_bias="0.469" + app:layout_constraintVertical_bias="0.071"/> + android:textColor="@color/colorPrimary" + app:layout_constraintBottom_toTopOf="@+id/business_info" + app:layout_constraintTop_toBottomOf="@+id/imageView7" app:layout_constraintStart_toStartOf="@+id/imageView7" + app:layout_constraintEnd_toEndOf="@+id/imageView7"/> + app:layout_constraintEnd_toEndOf="@+id/textView9" + app:layout_constraintStart_toStartOf="@+id/textView9"/> + android:padding="@dimen/mid_padding" + app:layout_constraintStart_toStartOf="@+id/textlayout4" + app:layout_constraintEnd_toEndOf="@+id/textlayout4"> + android:background="#E2DDDD"/>