diff --git a/app/src/main/java/by/alexandr7035/gitstat/view/profile/ProfileFragment.kt b/app/src/main/java/by/alexandr7035/gitstat/view/profile/ProfileFragment.kt
index 775b06fb..75c4a9c6 100644
--- a/app/src/main/java/by/alexandr7035/gitstat/view/profile/ProfileFragment.kt
+++ b/app/src/main/java/by/alexandr7035/gitstat/view/profile/ProfileFragment.kt
@@ -5,17 +5,17 @@ import android.text.format.DateFormat
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.core.view.isGone
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import by.alexandr7035.gitstat.R
-import by.alexandr7035.gitstat.databinding.FragmentProfileBinding
import by.alexandr7035.gitstat.core.extensions.navigateSafe
import by.alexandr7035.gitstat.core.extensions.observeNullSafe
+import by.alexandr7035.gitstat.databinding.FragmentProfileBinding
import by.alexandr7035.gitstat.view.MainActivity
import com.squareup.picasso.Picasso
import dagger.hilt.android.AndroidEntryPoint
-import timber.log.Timber
@AndroidEntryPoint
@@ -37,8 +37,6 @@ class ProfileFragment : Fragment() {
// Update profile data
viewModel.getUserLiveData().observeNullSafe(viewLifecycleOwner, {
- Timber.tag("DEBUG_TAG").d("livedata updated $it")
-
Picasso.get().load(it.avatar_url).into(binding!!.profileImageView)
// This field can be empty
@@ -61,9 +59,9 @@ class ProfileFragment : Fragment() {
// This field can be empty
if (it.location.isEmpty()) {
- binding!!.locationContainer.visibility = View.GONE
+ setLocationVisibility(false)
} else {
- binding!!.locationContainer.visibility = View.VISIBLE
+ setLocationVisibility(true)
binding!!.locationView.text = it.location
}
@@ -82,6 +80,11 @@ class ProfileFragment : Fragment() {
}
+ private fun setLocationVisibility(isVisible: Boolean) {
+ binding?.locationIcon?.isGone = ! isVisible
+ binding?.locationLabel?.isGone = ! isVisible
+ binding?.locationView?.isGone = ! isVisible
+ }
override fun onDestroyView() {
super.onDestroyView()
diff --git a/app/src/main/res/layout/fragment_profile.xml b/app/src/main/res/layout/fragment_profile.xml
index 9a41bc39..0707271f 100644
--- a/app/src/main/res/layout/fragment_profile.xml
+++ b/app/src/main/res/layout/fragment_profile.xml
@@ -1,7 +1,7 @@
-
-
+ app:layout_constraintTop_toBottomOf="@id/profileSummaryCard">
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginStart="@dimen/profile_card_field_margin"
+ app:layout_constraintBottom_toBottomOf="@+id/privateReposLabel"
+ app:layout_constraintStart_toEndOf="@+id/privateReposLabel"
+ app:layout_constraintTop_toTopOf="@+id/privateReposLabel"
+ tools:text="15" />
+
+
+ app:layout_constraintTop_toTopOf="parent" />
-
+ app:layout_constraintTop_toBottomOf="@id/headerCard">
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ android:layout_marginStart="@dimen/profile_card_label_margin"
+ android:layout_marginTop="@dimen/profile_fields_vertical_spacing"
+ android:text="@string/updated"
+ android:textStyle="bold"
+ app:layout_constraintStart_toEndOf="@id/updatedDateIcon"
+ app:layout_constraintTop_toBottomOf="@id/creationDateLabel" />
-
+
+
+
-
+
-
+
+
+
-
+
+
-
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="@id/fragmentTitle" />
+ app:layout_constraintTop_toTopOf="parent" />
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 98107982..541d1a3f 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -1,4 +1,7 @@
4dp
+ 16dp
+ 8dp
+ 4dp
\ No newline at end of file