Browse Source

Tracking: replace tick with button (#5768)

* make check only visible after selecting an item

* replace tick with button and send to bottom

* fixed button visibility

* grey btn out

* resolving some bits

* removing the tick from appbar

* remove useless lines, appl insetter
OncePunchedMan 3 years ago
parent
commit
c666dd623d

+ 12 - 12
app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchDialog.kt

@@ -64,23 +64,18 @@ class TrackSearchDialog : DialogController {
 
 
         // Toolbar stuff
         // Toolbar stuff
         binding!!.toolbar.setNavigationOnClickListener { dialog?.dismiss() }
         binding!!.toolbar.setNavigationOnClickListener { dialog?.dismiss() }
-        binding!!.toolbar.setOnMenuItemClickListener {
-            when (it.itemId) {
-                R.id.done -> {
-                    val adapter = adapter ?: return@setOnMenuItemClickListener true
-                    val item = adapter.items.getOrNull(adapter.selectedItemPosition)
-                    if (item != null) {
-                        trackController.presenter.registerTracking(item, service)
-                        dialog?.dismiss()
-                    }
-                }
+        binding!!.trackBtn.setOnClickListener {
+            val adapter = adapter ?: return@setOnClickListener
+            val item = adapter.items.getOrNull(adapter.selectedItemPosition)
+            if (item != null) {
+                trackController.presenter.registerTracking(item, service)
+                dialog?.dismiss()
             }
             }
-            true
         }
         }
 
 
         // Create adapter
         // Create adapter
         adapter = TrackSearchAdapter(currentTrackUrl) { which ->
         adapter = TrackSearchAdapter(currentTrackUrl) { which ->
-            binding!!.toolbar.menu.findItem(R.id.done).isEnabled = which != null
+            binding!!.trackBtn.isEnabled = which != null
         }
         }
         binding!!.trackSearchRecyclerview.adapter = adapter
         binding!!.trackSearchRecyclerview.adapter = adapter
 
 
@@ -142,6 +137,11 @@ class TrackSearchDialog : DialogController {
                 margin(horizontal = true)
                 margin(horizontal = true)
             }
             }
         }
         }
+        binding!!.trackBtn.applyInsetter {
+            type(navigationBars = true) {
+                margin()
+            }
+        }
 
 
         return AppCompatDialog(activity!!, R.style.ThemeOverlay_Tachiyomi_Dialog_Fullscreen).apply {
         return AppCompatDialog(activity!!, R.style.ThemeOverlay_Tachiyomi_Dialog_Fullscreen).apply {
             setContentView(binding!!.root)
             setContentView(binding!!.root)

+ 9 - 1
app/src/main/res/layout/track_search_dialog.xml

@@ -17,7 +17,6 @@
             android:layout_height="?attr/actionBarSize"
             android:layout_height="?attr/actionBarSize"
             android:theme="?attr/actionBarTheme"
             android:theme="?attr/actionBarTheme"
             app:contentInsetStartWithNavigation="0dp"
             app:contentInsetStartWithNavigation="0dp"
-            app:menu="@menu/track_search"
             app:navigationIcon="@drawable/ic_close_24dp"
             app:navigationIcon="@drawable/ic_close_24dp"
             app:title="@string/add_tracking" />
             app:title="@string/add_tracking" />
 
 
@@ -86,6 +85,15 @@
 
 
         </FrameLayout>
         </FrameLayout>
 
 
+        <Button
+            android:id="@+id/track_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginHorizontal="16dp"
+            android:layout_marginVertical="4dp"
+            android:text="@string/action_track"
+            android:enabled="false" />
+
     </LinearLayout>
     </LinearLayout>
 
 
 </androidx.coordinatorlayout.widget.CoordinatorLayout>
 </androidx.coordinatorlayout.widget.CoordinatorLayout>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -400,6 +400,7 @@
     <string name="tracking_info">One-way sync to update the chapter progress in tracking services. Set up tracking for individual manga entries from their tracking button.</string>
     <string name="tracking_info">One-way sync to update the chapter progress in tracking services. Set up tracking for individual manga entries from their tracking button.</string>
     <string name="enhanced_services">Enhanced services</string>
     <string name="enhanced_services">Enhanced services</string>
     <string name="enhanced_tracking_info">Services that provide enhanced features for specific sources. Manga are automatically tracked when added to your library.</string>
     <string name="enhanced_tracking_info">Services that provide enhanced features for specific sources. Manga are automatically tracked when added to your library.</string>
+    <string name="action_track">Track</string>
 
 
       <!-- Browse section -->
       <!-- Browse section -->
     <string name="pref_enable_automatic_extension_updates">Check for extension updates</string>
     <string name="pref_enable_automatic_extension_updates">Check for extension updates</string>