Skip to content

Commit

Permalink
Final commit for version 1 of CycloFit
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-gupta99 committed Nov 26, 2022
1 parent c93b67e commit a68b042
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 37 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/com/example/cyclofit/model/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class User(
val phone :Long = 0L,
val sos:String =" ",
val weight : String = " ",
val image : String = " "
val image : String = " ",
val profile : Int = 0
):Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -45,38 +45,9 @@ class ProfileActivity : BaseActivity() , View.OnClickListener {

// et_name_profile.setText(mUserDetails.name)

val sharedPreferences = getSharedPreferences(Constants.CYCLOFIT_PREFERENCES, Context.MODE_PRIVATE)
val check = sharedPreferences.getString(Constants.ONBOARDING_FLAG,"")!!

if(check=="yes")
{
title_profile.text = "Complete Profile"
et_name_profile.isEnabled = true
iv_select_profile.setImageDrawable(resources.getDrawable(R.drawable.add_photo))

}else{
title_profile.text = "Edit Profile"
GlideLoader(this).loadUserPicture(mUserDetails.image,user_image)
iv_select_profile.setImageDrawable(resources.getDrawable(R.drawable.add_photo))


if(mUserDetails.phone != 0L)
{
et_phoneNo_profile.setText(mUserDetails.phone.toString())
}
if(mUserDetails.weight.isNotEmpty())
{
et_weight_profile.setText(mUserDetails.weight)
}
if(mUserDetails.sos.isNotEmpty())
{
et_sos_profile.setText(mUserDetails.sos)
}
if(mUserDetails.name.isNotEmpty())
{
et_name_profile.setText(mUserDetails.name.toString())
}
}
title_profile.text = "Complete Profile"
et_name_profile.isEnabled = true
iv_select_profile.setImageDrawable(resources.getDrawable(R.drawable.add_photo))

user_image.setOnClickListener(this)
btn_done.setOnClickListener (this)
Expand Down Expand Up @@ -189,6 +160,7 @@ class ProfileActivity : BaseActivity() , View.OnClickListener {
userHashMap[Constants.SOS] = stream
}

userHashMap[Constants.PROFILE_COMPLETED] = 1

// showProgressbar(resources.getString(R.string.please_wait))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.google.firebase.auth.FirebaseAuth
class SignInFragment : BaseFragment(){

lateinit var binding : FragmentSignInBinding
private lateinit var mUserDetails : User

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
Expand Down Expand Up @@ -87,10 +88,19 @@ class SignInFragment : BaseFragment(){
editor.putString(Constants.ONBOARDING_FLAG,"yes")
editor.apply()

Handler(Looper.getMainLooper()).postDelayed({
val intent = Intent(requireActivity(),ProfileActivity::class.java)
requireActivity().startActivity(intent)
}, 200)
if(user.profile == 0) {
Handler(Looper.getMainLooper()).postDelayed({
val intent = Intent(requireActivity(), ProfileActivity::class.java)
requireActivity().startActivity(intent)
requireActivity().finish()
}, 200)
}else{
Handler(Looper.getMainLooper()).postDelayed({
val intent = Intent(requireActivity(), DashboardActivity::class.java)
requireActivity().startActivity(intent)
requireActivity().finish()
}, 200)
}
}

private fun validateLoginDetails():Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ object Constants{
const val SOS = "sos"
var bingo :String = ""
const val PUT_EXTRA = "put"
const val PROFILE_COMPLETED = "profile"


fun showImageChooser(activity : Activity)
Expand Down

0 comments on commit a68b042

Please sign in to comment.