Global Search (#849)

* Global Search

* Cards are now independent of design by use of recycler.

* Added local

* Some attribute fixes + moved onclick to controller.

* Lots of improvements to code

* Reversed some stuff. Thanks API 16

* Code fixes

* Performance improvements

* Moved adapter creation to constructor

* Small changes

* Removed sources settings from settings menu. Added OnChangeListener in catalogue. Made setting icon visible if room.

* bug fix

* Code review part uno

* Code review part uno-2

* Single recycler approach

* Add last source used

* Fix scroll state and some layout issues

* Fix wrong item binding

* Use data class for items

* Calculate item position and count while binding

* Fix background color with slices

* Reuse slices. Fix card background. Flatten constraint layout

* Fix global_search scroll issue

* Store last state with global search

* Minor changes

* Remove catalogue toolbar spinner. Persist catalogue across process restarts

* Save view state of recycler views. Set toolbar title with current query
This commit is contained in:
Bram van de Kerkhof
2017-09-23 13:11:39 +02:00
committed by inorichi
parent 56bde40035
commit 54c8b3ef29
61 changed files with 1852 additions and 262 deletions

View File

@@ -105,7 +105,7 @@ val Context.powerManager: PowerManager
*
* @param intent intent that contains broadcast information
*/
fun Context.sendLocalBroadcast(intent:Intent){
fun Context.sendLocalBroadcast(intent: Intent) {
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
}

View File

@@ -4,9 +4,12 @@ package eu.kanade.tachiyomi.util
import android.graphics.Color
import android.graphics.Point
import android.graphics.Typeface
import android.support.design.widget.Snackbar
import android.view.View
import android.widget.TextView
import com.amulyakhare.textdrawable.TextDrawable
import com.amulyakhare.textdrawable.util.ColorGenerator
/**
* Returns coordinates of view.
@@ -43,3 +46,21 @@ inline fun View.invisible() {
inline fun View.gone() {
visibility = View.GONE
}
/**
* Returns a TextDrawable determined by input
*
* @param text text of [TextDrawable]
* @param random random color
*/
fun View.getRound(text: String, random : Boolean = true): TextDrawable {
val size = Math.min(this.width, this.height)
return TextDrawable.builder()
.beginConfig()
.width(size)
.height(size)
.textColor(Color.WHITE)
.useFont(Typeface.DEFAULT)
.endConfig()
.buildRound(text, if (random) ColorGenerator.MATERIAL.randomColor else ColorGenerator.MATERIAL.getColor(text))
}