Added tooltip to sync collections FAB (bitfireAT/davx5#340)

* Added tooltip to sync collections fab

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Greyscale tint for collections sync FAB

* Always use TooltipCompat for FAB tooltips

Closes bitfireAT/davx5#339

---------

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Co-authored-by: Sunik Kupfer <kupfer@bitfire.at>
Co-authored-by: Ricki Hirner <hirner@bitfire.at>
This commit is contained in:
Arnau Mora 2023-08-15 18:20:14 +02:00 committed by Ricki Hirner
parent 4ce33e949b
commit a375a16edf
6 changed files with 9 additions and 8 deletions

View file

@ -15,6 +15,7 @@ import android.view.MenuItem
import androidx.activity.viewModels
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.TooltipCompat
import androidx.core.content.getSystemService
import androidx.core.view.GravityCompat
import androidx.lifecycle.AndroidViewModel
@ -62,6 +63,7 @@ class AccountsActivity: AppCompatActivity(), NavigationView.OnNavigationItemSele
binding = ActivityAccountsBinding.inflate(layoutInflater)
setContentView(binding.root)
TooltipCompat.setTooltipText(binding.content.fab, binding.content.fab.contentDescription)
binding.content.fab.setOnClickListener {
startActivity(Intent(this, LoginActivity::class.java))
}

View file

@ -94,6 +94,7 @@ class AccountActivity: AppCompatActivity() {
}
// "Sync now" fab
TooltipCompat.setTooltipText(binding.sync, binding.sync.contentDescription)
model.networkAvailable.observe(this) { networkAvailable ->
binding.sync.setOnClickListener {
if (!networkAvailable)

View file

@ -30,13 +30,12 @@
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="@style/Widget.MaterialComponents.ExtendedFloatingActionButton.Icon"
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:tooltipText="@string/login_create_account"
android:contentDescription="@string/login_create_account"
app:srcCompat="@drawable/ic_add_white"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -39,26 +39,25 @@
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="@style/Widget.MaterialComponents.ExtendedFloatingActionButton.Icon"
android:id="@+id/refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_margin="@dimen/fab_margin"
android:contentDescription="@string/account_synchronize_collections"
app:backgroundTint="@android:color/white"
app:tint="@color/grey900"
app:srcCompat="@drawable/ic_folder_refresh_outline"
app:layout_anchor="@id/sync"
app:layout_anchorGravity="top|center"/>
app:layout_anchorGravity="top|center"
tools:ignore="ContentDescription" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
style="@style/Widget.MaterialComponents.ExtendedFloatingActionButton.Icon"
android:id="@+id/sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:contentDescription="@string/account_synchronize_now"
android:tooltipText="@string/account_synchronize_now"
app:useCompatPadding="true"
app:srcCompat="@drawable/ic_sync" />

View file

@ -52,6 +52,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:layout_gravity="right|end|bottom"
android:contentDescription="@string/webdav_add_mount_add"
app:srcCompat="@drawable/ic_add_white" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -239,7 +239,6 @@
<string name="account_no_webcals">There are no calendar subscriptions (yet).</string>
<string name="account_swipe_down">Swipe down to refresh the list from the server.</string>
<string name="account_synchronize_now">Synchronize now</string>
<string name="account_synchronize_collections">Synchronize collections</string>
<string name="account_settings">Account settings</string>
<string name="account_rename">Rename account</string>
<string name="account_rename_new_name">Unsaved local data may be dismissed. Re-synchronization is required after renaming. New account name:</string>