Skip to content

Commit a7a7d12

Browse files
profile thumbnail removed, with minor UI updates and fixes
1 parent fe850f6 commit a7a7d12

File tree

42 files changed

+37
-122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+37
-122
lines changed

app/src/main/java/com/github/code/gambit/helper/auth/AuthData.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ data class AuthData(
44
var fullname: String,
55
var email: String,
66
var password: String,
7-
var thumbnail: String?,
87
var confirmationCode: String?
98
)

app/src/main/java/com/github/code/gambit/ui/activity/main/MainActivity.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.github.code.gambit.databinding.ActivityMainBinding
2424
import com.github.code.gambit.helper.file.FileUploadState
2525
import com.github.code.gambit.ui.OnItemClickListener
2626
import com.github.code.gambit.ui.fragment.BottomNavController
27+
import com.github.code.gambit.ui.fragment.auth.AuthFragment
2728
import com.github.code.gambit.ui.fragment.home.main.HomeFragment
2829
import com.github.code.gambit.utility.SystemManager
2930
import com.github.code.gambit.utility.extention.bottomNavHide
@@ -212,6 +213,12 @@ class MainActivity : AppCompatActivity(), BottomNavController {
212213

213214
override fun onBackPressed() {
214215
if (!userManager.isAuthenticated()) {
216+
val fragment =
217+
supportFragmentManager.findFragmentById(R.id.nav_host_fragment_container)?.childFragmentManager?.fragments?.first()
218+
if (fragment is AuthFragment && fragment.currentPage != 0) {
219+
fragment.setPage(0)
220+
return
221+
}
215222
super.onBackPressed()
216223
return
217224
}

app/src/main/java/com/github/code/gambit/ui/fragment/auth/AuthFragment.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AuthFragment : Fragment(R.layout.fragment_auth) {
2727
private lateinit var _binding: FragmentAuthBinding
2828
private val binding get() = _binding
2929

30-
private val currentPage get() = binding.fragmentContainer.currentItem
30+
val currentPage get() = binding.fragmentContainer.currentItem
3131

3232
private val viewModel: AuthViewModel by viewModels()
3333

@@ -171,4 +171,10 @@ class AuthFragment : Fragment(R.layout.fragment_auth) {
171171
private fun enableInteraction() {
172172
binding.buttonSubmit.isEnabled = true
173173
}
174+
175+
fun setPage(page: Int) {
176+
if (page == 0 || page == 1) {
177+
binding.tabLayout.getTabAt(page)?.select()
178+
}
179+
}
174180
}

app/src/main/java/com/github/code/gambit/ui/fragment/auth/AuthViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ constructor(
101101
}
102102

103103
private suspend fun resetForgotPassword(userEmail: String, newPassword: String, confirmationCode: String) {
104-
when (val res = authRepository.resetForgotPassword(AuthData("", userEmail, newPassword, null, confirmationCode))) {
104+
when (val res = authRepository.resetForgotPassword(AuthData("", userEmail, newPassword, confirmationCode))) {
105105
is ServiceResult.Error -> {
106106
if (res.exception.cause is CodeMismatchException) {
107107
postValue(AuthState.CodeMissMatch)

app/src/main/java/com/github/code/gambit/ui/fragment/auth/LoginFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class LoginFragment : Fragment(R.layout.fragment_login) {
9696
if (error) {
9797
return null
9898
}
99-
return AuthData("", username, password, null, null)
99+
return AuthData("", username, password, null)
100100
}
101101

102102
// validates the input fields
@@ -122,6 +122,6 @@ class LoginFragment : Fragment(R.layout.fragment_login) {
122122
binding.root.snackbar("Validation error!!")
123123
return null
124124
}
125-
return AuthData("", username, password, null, null)
125+
return AuthData("", username, password, null)
126126
}
127127
}

app/src/main/java/com/github/code/gambit/ui/fragment/auth/SignUpFragment.kt

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
package com.github.code.gambit.ui.fragment.auth
22

3-
import android.content.Intent
4-
import android.net.Uri
53
import android.os.Bundle
6-
import android.provider.MediaStore
74
import android.view.View
8-
import androidx.activity.result.ActivityResultLauncher
95
import androidx.fragment.app.Fragment
106
import com.github.code.gambit.R
117
import com.github.code.gambit.databinding.FragmentSignUpBinding
128
import com.github.code.gambit.helper.auth.AuthData
139
import com.github.code.gambit.utility.SystemManager
1410
import com.github.code.gambit.utility.extention.snackbar
1511
import dagger.hilt.android.AndroidEntryPoint
16-
import timber.log.Timber
1712
import javax.inject.Inject
1813

1914
@AndroidEntryPoint
@@ -30,31 +25,9 @@ class SignUpFragment : Fragment(R.layout.fragment_sign_up) {
3025
@Inject
3126
lateinit var systemManager: SystemManager
3227

33-
lateinit var launcher: ActivityResultLauncher<Intent>
34-
var profileImage: Uri? = null
35-
3628
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
3729
super.onViewCreated(view, savedInstanceState)
3830
_binding = FragmentSignUpBinding.bind(view)
39-
40-
binding.dpContainer.setOnClickListener {
41-
systemManager.launchActivity(launcher, Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI))
42-
}
43-
}
44-
45-
override fun onCreate(savedInstanceState: Bundle?) {
46-
super.onCreate(savedInstanceState)
47-
registerCallback()
48-
}
49-
50-
private fun registerCallback() {
51-
launcher = systemManager.requestImage(this) {
52-
if (it != null) {
53-
binding.profileImage.setImageURI(it)
54-
Timber.i(it.toString())
55-
profileImage = it
56-
}
57-
}
5831
}
5932

6033
// validates the input fields
@@ -106,6 +79,6 @@ class SignUpFragment : Fragment(R.layout.fragment_sign_up) {
10679
binding.root.snackbar("Validation error!!")
10780
return null
10881
}
109-
return AuthData(fullName, userEmail, password, profileImage.toString(), null)
82+
return AuthData(fullName, userEmail, password, null)
11083
}
11184
}

app/src/main/java/com/github/code/gambit/utility/extention/extension.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fun AuthSignUpOptions.Builder<*>.defaultBuilder(authData: AuthData): AuthSignUpO
3434
mutableListOf
3535
(
3636
AuthUserAttribute(AuthUserAttributeKey.email(), authData.email),
37-
AuthUserAttribute(AuthUserAttributeKey.custom(AppConstant.AUTH_ATTRIBUTE_CUSTOM_PROFILE), authData.thumbnail),
37+
AuthUserAttribute(AuthUserAttributeKey.custom(AppConstant.AUTH_ATTRIBUTE_CUSTOM_PROFILE), ""),
3838
AuthUserAttribute(AuthUserAttributeKey.name(), authData.fullname)
3939
)
4040
).build()
-568 Bytes
Binary file not shown.
-922 Bytes
Binary file not shown.
-247 Bytes
Binary file not shown.
-386 Bytes
Binary file not shown.
-502 Bytes
Binary file not shown.
-191 Bytes
Binary file not shown.
-386 Bytes
Binary file not shown.
-734 Bytes
Binary file not shown.
-211 Bytes
Binary file not shown.
-797 Bytes
Binary file not shown.
-1.51 KB
Binary file not shown.
-510 Bytes
Binary file not shown.
-846 Bytes
Binary file not shown.
-530 Bytes
Binary file not shown.
-1.27 KB
Binary file not shown.
-753 Bytes
Binary file not shown.
-2.43 KB
Binary file not shown.
-1.15 KB
Binary file not shown.
-2.95 KB
Binary file not shown.
-1.28 KB
Binary file not shown.
-4.72 KB
Binary file not shown.
-548 Bytes
Binary file not shown.
-1.32 KB
Binary file not shown.
-303 Bytes
Binary file not shown.
-857 Bytes
Binary file not shown.
-1.67 KB
Binary file not shown.
-334 Bytes
Binary file not shown.
-976 Bytes
Binary file not shown.
-2.57 KB
Binary file not shown.
-436 Bytes
Binary file not shown.

app/src/main/res/drawable/ic_next.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24"
6+
android:tint="?attr/colorControlNormal">
7+
<path
8+
android:fillColor="@android:color/white"
9+
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
10+
</vector>

app/src/main/res/layout/fragment_auth.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@
4545
app:layout_anchorGravity="top|end"
4646
android:backgroundTint="@color/login_signup_button_color"
4747
app:icon="@drawable/ic_next"
48-
app:iconTint="@color/raw_white"
4948
app:iconGravity="textEnd"
5049
app:cornerRadius="12dp"
51-
app:iconSize="16dp"
50+
app:iconSize="22dp"
5251
android:layout_marginEnd="32dp"/>
5352

5453

app/src/main/res/layout/fragment_login.xml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -63,34 +63,6 @@
6363
android:inputType="textPassword" />
6464
</com.google.android.material.textfield.TextInputLayout>
6565

66-
<LinearLayout
67-
android:id="@+id/linearLayout"
68-
android:layout_width="wrap_content"
69-
android:layout_height="wrap_content"
70-
android:layout_marginStart="16dp"
71-
android:layout_marginTop="16dp"
72-
android:weightSum="3">
73-
74-
<ImageButton
75-
android:layout_width="wrap_content"
76-
android:layout_height="wrap_content"
77-
android:layout_gravity="center_vertical"
78-
android:layout_weight="2"
79-
android:background="@android:color/transparent"
80-
android:contentDescription="@string/facebook_authentication"
81-
android:src="@drawable/ic_fb" />
82-
83-
<ImageButton
84-
android:layout_width="wrap_content"
85-
android:layout_height="wrap_content"
86-
android:layout_marginStart="12dp"
87-
android:layout_weight="1"
88-
android:background="@android:color/transparent"
89-
android:contentDescription="@string/google_authentication"
90-
android:src="@drawable/ic_gp" />
91-
92-
</LinearLayout>
93-
9466
</LinearLayout>
9567

9668
<LinearLayout
@@ -100,10 +72,10 @@
10072
app:layout_constraintBottom_toBottomOf="parent"
10173
app:layout_constraintStart_toStartOf="parent"
10274
app:layout_constraintTop_toBottomOf="@+id/linearLayout2"
75+
app:layout_constraintVertical_bias="0.3"
10376
android:layout_marginStart="16dp"
10477
android:layout_marginBottom="32dp">
10578

106-
10779
<TextView
10880
android:id="@+id/forgot_password_text"
10981
android:layout_width="match_parent"

app/src/main/res/layout/fragment_sign_up.xml

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,22 @@
1616
android:layout_width="match_parent"
1717
android:layout_height="wrap_content"
1818
android:layout_marginStart="16dp"
19+
android:paddingTop="64dp"
20+
android:paddingBottom="64dp"
1921
android:orientation="horizontal"
2022
app:layout_constraintStart_toStartOf="parent"
2123
app:layout_constraintTop_toTopOf="parent">
2224

23-
<androidx.cardview.widget.CardView
24-
android:id="@+id/profile_upload_image_container"
25-
android:layout_width="64dp"
26-
android:layout_height="64dp"
27-
app:cardCornerRadius="32dp">
28-
<ImageView
29-
android:id="@+id/profile_image"
30-
android:layout_width="match_parent"
31-
android:layout_height="match_parent"
32-
android:contentDescription="@string/profile_image"
33-
android:scaleType="centerCrop"
34-
android:src="@drawable/ic_default_dp" />
35-
</androidx.cardview.widget.CardView>
36-
37-
<!--com.google.android.material.floatingactionbutton.FloatingActionButton
38-
android:id="@+id/upload_dp_fab"
39-
style="@style/Widget.App.FloatingActionButton"
40-
android:layout_width="wrap_content"
41-
android:layout_height="wrap_content"
42-
android:contentDescription="@string/upload_a_profile_picture_optional"
43-
android:src="@drawable/iclink" -->
44-
4525
<TextView
4626
android:id="@+id/upload_dp_text"
4727
android:layout_width="wrap_content"
4828
android:layout_height="wrap_content"
4929
android:layout_gravity="center_vertical"
50-
android:layout_marginStart="32dp"
51-
android:text="@string/upload_a_profile_picture_optional"
52-
android:textColor="@color/black" />
30+
android:text="@string/create_new_account"
31+
android:textColor="@color/black"
32+
android:textSize="24sp"/>
5333
</LinearLayout>
5434

55-
5635
<com.google.android.material.textfield.TextInputLayout
5736
android:id="@+id/full_name_input"
5837
style="@style/input_theme"
@@ -121,35 +100,5 @@
121100
android:layout_height="match_parent"
122101
android:inputType="textPassword" />
123102
</com.google.android.material.textfield.TextInputLayout>
124-
125-
126-
<LinearLayout
127-
android:layout_width="wrap_content"
128-
android:layout_height="wrap_content"
129-
android:layout_marginStart="16dp"
130-
android:visibility="gone"
131-
android:weightSum="3"
132-
app:layout_constraintStart_toStartOf="parent"
133-
app:layout_constraintTop_toBottomOf="@id/password_input">
134-
135-
<ImageButton
136-
android:layout_width="wrap_content"
137-
android:layout_height="wrap_content"
138-
android:layout_gravity="center_vertical"
139-
android:layout_weight="2"
140-
android:background="@android:color/transparent"
141-
android:contentDescription="@string/facebook_authentication"
142-
android:src="@drawable/ic_fb" />
143-
144-
<ImageButton
145-
android:layout_width="wrap_content"
146-
android:layout_height="wrap_content"
147-
android:layout_marginStart="12dp"
148-
android:layout_weight="1"
149-
android:background="@android:color/transparent"
150-
android:contentDescription="@string/google_authentication"
151-
android:src="@drawable/ic_gp" />
152-
153-
</LinearLayout>
154103
</androidx.constraintlayout.widget.ConstraintLayout>
155104
</ScrollView>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
<string name="forgot_password">Forgot Password?</string>
3030
<string name="full_name">Full Name</string>
3131
<string name="confirm_password">Confirm Password</string>
32-
<string name="upload_a_profile_picture_optional">Upload a profile picture [Optional]</string>
3332
<string name="user_email">User Email</string>
3433
<string name="verification_code">Verification Code</string>
3534
<string name="please_type_the_verification_code_send_to">Please type the verification code send to</string>
@@ -91,4 +90,5 @@
9190
<string name="submit">Submit</string>
9291
<string name="no_change">No change</string>
9392
<string name="delete">Delete</string>
93+
<string name="create_new_account">Create a new account</string>
9494
</resources>

0 commit comments

Comments
 (0)