For #8649: No bookmarks here strings are close to the top

fennec/production
Hakkı Kaan Çalışkan 4 years ago committed by Emily Kager
parent 88765c348b
commit c8d36ddc36

@ -18,6 +18,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavDirections
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.component_bookmark.view.*
import kotlinx.android.synthetic.main.fragment_bookmark.view.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO
@ -57,7 +58,6 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
private lateinit var bookmarkStore: BookmarkFragmentStore
private lateinit var bookmarkView: BookmarkView
private lateinit var signInView: SignInView
private var _bookmarkInteractor: BookmarkFragmentInteractor? = null
protected val bookmarkInteractor: BookmarkFragmentInteractor
get() = _bookmarkInteractor!!
@ -97,9 +97,8 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
metrics = metrics!!
)
bookmarkView = BookmarkView(view.bookmarkLayout, bookmarkInteractor)
signInView = SignInView(view.bookmarkLayout, findNavController())
signInView.view.visibility = View.GONE
bookmarkView = BookmarkView(view.bookmarkLayout, bookmarkInteractor, findNavController())
bookmarkView.view.bookmark_folders_sign_in.visibility = View.GONE
viewLifecycleOwner.lifecycle.addObserver(
BookmarkDeselectNavigationListener(
@ -150,9 +149,9 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
if (currentGuid == BookmarkRoot.Root.id &&
requireComponents.backgroundServices.accountManager.authenticatedAccount() == null
) {
signInView.view.visibility = View.VISIBLE
bookmarkView.view.bookmark_folders_sign_in.visibility = View.VISIBLE
} else {
signInView.view.visibility = View.GONE
bookmarkView.view.bookmark_folders_sign_in.visibility = View.GONE
}
initialJob = loadInitialBookmarkFolder(currentGuid)

@ -8,12 +8,14 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.navigation.NavController
import kotlinx.android.synthetic.main.component_bookmark.view.*
import mozilla.appservices.places.BookmarkRoot
import mozilla.components.concept.storage.BookmarkNode
import mozilla.components.support.base.feature.UserInteractionHandler
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.NavGraphDirections
import org.mozilla.fenix.library.LibraryPageView
import org.mozilla.fenix.library.SelectionInteractor
@ -95,7 +97,8 @@ interface BookmarkViewInteractor : SelectionInteractor<BookmarkNode> {
class BookmarkView(
container: ViewGroup,
val interactor: BookmarkViewInteractor
val interactor: BookmarkViewInteractor,
private val navController: NavController
) : LibraryPageView(container), UserInteractionHandler {
val view: View = LayoutInflater.from(container.context)
@ -112,6 +115,9 @@ class BookmarkView(
bookmarkAdapter = BookmarkAdapter(view.bookmarks_empty_view, interactor)
adapter = bookmarkAdapter
}
view.bookmark_folders_sign_in.setOnClickListener {
navController.navigate(NavGraphDirections.actionGlobalTurnOnSync())
}
}
fun update(state: BookmarkFragmentState) {

@ -1,31 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.library.bookmarks
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.NavController
import com.google.android.material.button.MaterialButton
import kotlinx.android.extensions.LayoutContainer
import org.mozilla.fenix.NavGraphDirections
import org.mozilla.fenix.R
class SignInView(
private val container: ViewGroup,
private val navController: NavController
) : LayoutContainer {
override val containerView: View?
get() = container
val view: MaterialButton = LayoutInflater.from(container.context)
.inflate(R.layout.component_sign_in, container, true)
.findViewById(R.id.bookmark_folders_sign_in)
init {
view.setOnClickListener { navController.navigate(NavGraphDirections.actionGlobalTurnOnSync()) }
}
}

@ -2,35 +2,45 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<FrameLayout
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/bookmarks_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout 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/bookmarks_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bookmark_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/library_site_item" />
android:id="@+id/bookmark_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/library_site_item" />
<TextView
android:id="@+id/bookmarks_empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="10dp"
android:paddingBottom="0dp"
android:text="@string/bookmarks_empty_message"
android:textColor="?secondaryText"
android:textSize="16sp"
android:visibility="gone" />
android:id="@+id/bookmarks_empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/bookmarks_empty_message"
android:textColor="?secondaryText"
android:textSize="16sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/bookmark_folders_sign_in"
style="@style/NeutralButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
android:text="@string/bookmark_sign_in_button" />
<ProgressBar
android:id="@+id/bookmarks_progress_bar"

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<com.google.android.material.button.MaterialButton
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bookmark_folders_sign_in"
style="@style/NeutralButton"
android:text="@string/bookmark_sign_in_button"
android:layout_marginHorizontal="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>

@ -11,6 +11,6 @@
<LinearLayout
android:id="@+id/bookmarkLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

Loading…
Cancel
Save