diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cc2ca5eba..78f461918 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,13 +11,6 @@ - - - - - - - : AppCompatActivity(), OnApplyWindo this.binding = binding super.setContentView(binding.root) (binding.root.findViewById(R.id.toolbar) as? Toolbar)?.let(this::setSupportActionBar) - val params = (binding.root.findViewById(R.id.toolbar) as? Toolbar)?.layoutParams as? AppBarLayout.LayoutParams + val params = (binding.root.findViewById(R.id.toolbar_card))?.layoutParams as? AppBarLayout.LayoutParams ViewCompat.setOnApplyWindowInsetsListener(binding.root, this) if (get().isToolbarHideWhenScrolling) { params?.scrollFlags = SCROLL_FLAG_SCROLL or SCROLL_FLAG_ENTER_ALWAYS diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/MaterialSearchView.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/MaterialSearchView.kt deleted file mode 100644 index fcb18c4de..000000000 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/MaterialSearchView.kt +++ /dev/null @@ -1,231 +0,0 @@ -/*https://github.com/lapism/search*/ - -package org.koitharu.kotatsu.base.ui.widgets.search - -import android.animation.LayoutTransition -import android.content.Context -import android.util.AttributeSet -import android.view.View -import android.view.ViewGroup -import android.widget.LinearLayout -import androidx.coordinatorlayout.widget.CoordinatorLayout -import androidx.core.content.ContextCompat -import org.koitharu.kotatsu.R -import org.koitharu.kotatsu.base.ui.widgets.search.internal.SearchLayout - -class MaterialSearchView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0, - defStyleRes: Int = 0 -) : SearchLayout(context, attrs, defStyleAttr, defStyleRes), CoordinatorLayout.AttachedBehavior { - - // ********************************************************************************************* - private var mBehavior: CoordinatorLayout.Behavior<*> = SearchBehavior() - private var mTransition: LayoutTransition? = null - private var mStrokeWidth: Int = 0 - private var mRadius: Float = 0f - private var mElevation: Float = 0f - - // ********************************************************************************************* - init { - inflate(context, R.layout.layout_search_view, this) - init() - setTransition() - - val a = context.obtainStyledAttributes( - attrs, R.styleable.MaterialSearchView, defStyleAttr, defStyleRes - ) - - if (a.hasValue(R.styleable.MaterialSearchView_search_navigationIconSupport)) { - navigationIconSupport = a.getInt( - R.styleable.MaterialSearchView_search_navigationIconSupport, - NavigationIconSupport.NONE - ) - } - - if (a.hasValue(R.styleable.MaterialSearchView_search_navigationIcon)) { - setNavigationIconImageDrawable(a.getDrawable(R.styleable.MaterialSearchView_search_navigationIcon)) - } - - if (a.hasValue(R.styleable.MaterialSearchView_search_clearIcon)) { - setClearIconImageDrawable(a.getDrawable(R.styleable.MaterialSearchView_search_clearIcon)) - } else { - setClearIconImageDrawable( - ContextCompat.getDrawable( - context, - R.drawable.ic_clear - ) - ) - } - - if (a.hasValue(R.styleable.MaterialSearchView_search_micIcon)) { - setMicIconImageDrawable(a.getDrawable(R.styleable.MaterialSearchView_search_micIcon)) - } else { - setMicIconImageDrawable( - ContextCompat.getDrawable( - context, - R.drawable.ic_mic_none - ) - ) - } - - if (a.hasValue(R.styleable.MaterialSearchView_search_menuIcon)) { - setMicIconImageDrawable(a.getDrawable(R.styleable.MaterialSearchView_search_menuIcon)) - } else { - setMicIconImageDrawable( - ContextCompat.getDrawable( - context, - R.drawable.ic_more - ) - ) - } - - if (a.hasValue(R.styleable.MaterialSearchView_search_dividerColor)) { - setDividerColor(a.getInt(R.styleable.MaterialSearchView_search_dividerColor, 0)) - } - - val defaultShadowColor = ContextCompat.getColor(context, R.color.shadow) - setShadowColor( - a.getInt( - R.styleable.MaterialSearchView_search_shadowColor, - defaultShadowColor - ) - ) - - if (a.hasValue(R.styleable.MaterialSearchView_search_textHint)) { - setTextHint(a.getText(R.styleable.MaterialSearchView_search_textHint)) - } - - if (a.hasValue(R.styleable.MaterialSearchView_search_strokeColor)) { - setBackgroundStrokeColor(a.getInt(R.styleable.MaterialSearchView_search_strokeColor, 0)) - } - - if (a.hasValue(R.styleable.MaterialSearchView_search_strokeWidth)) { - setBackgroundStrokeWidth(a.getInt(R.styleable.MaterialSearchView_search_strokeWidth, 0)) - } - - val defaultTransitionDuration = - context.resources.getInteger(R.integer.search_animation_duration) - setTransitionDuration( - a.getInt( - R.styleable.MaterialSearchView_search_transitionDuration, - defaultTransitionDuration - ).toLong() - ) - - val defaultRadius = context.resources.getDimensionPixelSize(R.dimen.search_radius) - setBackgroundRadius( - a.getInt(R.styleable.MaterialSearchView_search_radius, defaultRadius).toFloat() - ) - - val defaultElevation = context.resources.getDimensionPixelSize(R.dimen.search_elevation) - elevation = - a.getInt(R.styleable.MaterialSearchView_android_elevation, defaultElevation).toFloat() - - val imeOptions = a.getInt(R.styleable.MaterialSearchView_android_imeOptions, -1) - if (imeOptions != -1) { - setTextImeOptions(imeOptions) - } - - val inputType = a.getInt(R.styleable.MaterialSearchView_android_inputType, -1) - if (inputType != -1) { - setTextInputType(inputType) - } - - a.recycle() - } - - // ********************************************************************************************* - override fun addFocus() { - mOnFocusChangeListener?.onFocusChange(true) - showKeyboard() - - mStrokeWidth = getBackgroundStrokeWidth() - mRadius = getBackgroundRadius() - mElevation = elevation - - setBackgroundStrokeWidth(context.resources.getDimensionPixelSize(R.dimen.search_stroke_width_focus)) - setBackgroundRadius(resources.getDimensionPixelSize(R.dimen.search_radius_focus).toFloat()) - elevation = - context.resources.getDimensionPixelSize(R.dimen.search_elevation_focus).toFloat() - - val left = context.resources.getDimensionPixelSize(R.dimen.search_dp_16) - val params = mSearchEditText?.layoutParams as LinearLayout.LayoutParams - params.setMargins(left, 0, 0, 0) - mSearchEditText?.layoutParams = params - - margins = Margins.FOCUS - setLayoutHeight(context.resources.getDimensionPixelSize(R.dimen.search_layout_height_focus)) - - mViewShadow?.visibility = View.VISIBLE - - mViewDivider?.visibility = View.VISIBLE - mViewAnim?.visibility = View.VISIBLE - mRecyclerView?.visibility = View.VISIBLE - - // layoutTransition = null - } - - override fun removeFocus() { - // layoutTransition = mTransition - - mOnFocusChangeListener?.onFocusChange(false) - hideKeyboard() - - val params = mSearchEditText?.layoutParams as LinearLayout.LayoutParams - params.setMargins(0, 0, 0, 0) - mSearchEditText?.layoutParams = params - - setBackgroundStrokeWidth(mStrokeWidth) - setBackgroundRadius(mRadius) - elevation = mElevation - - setLayoutHeight(context.resources.getDimensionPixelSize(R.dimen.search_layout_height)) - margins = Margins.NO_FOCUS - - mViewShadow?.visibility = View.GONE - - mRecyclerView?.visibility = View.GONE - mViewAnim?.visibility = View.GONE - mViewDivider?.visibility = View.GONE - } - - override fun getBehavior(): CoordinatorLayout.Behavior<*> { - return mBehavior - } - - fun setBehavior(behavior: CoordinatorLayout.Behavior<*>) { - mBehavior = behavior - } - - fun setTransitionDuration(duration: Long) { - mTransition?.setDuration(duration) - layoutTransition = mTransition - } - - private fun setTransition() { - mTransition = LayoutTransition() - mTransition?.enableTransitionType(LayoutTransition.CHANGING) - mTransition?.addTransitionListener(object : LayoutTransition.TransitionListener { - override fun startTransition( - transition: LayoutTransition?, - container: ViewGroup?, - view: View?, - transitionType: Int - ) { - - } - - override fun endTransition( - transition: LayoutTransition?, - container: ViewGroup?, - view: View?, - transitionType: Int - ) { - - } - }) - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/SearchArrowDrawable.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/SearchArrowDrawable.kt deleted file mode 100644 index 752c0071d..000000000 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/SearchArrowDrawable.kt +++ /dev/null @@ -1,62 +0,0 @@ -/*https://github.com/lapism/search*/ - -package org.koitharu.kotatsu.base.ui.widgets.search - -import android.animation.ObjectAnimator -import android.content.Context -import android.util.Property -import android.view.animation.AccelerateDecelerateInterpolator -import androidx.appcompat.graphics.drawable.DrawerArrowDrawable -import androidx.core.content.ContextCompat - -class SearchArrowDrawable constructor(context: Context) : DrawerArrowDrawable(context) { - - var position: Float - get() = progress - set(position) { - progress = position - } - - init { - color = ContextCompat.getColor(context, android.R.color.white) - } - - fun animate(state: Float, duration: Long) { - val anim: ObjectAnimator = if (state == ARROW) { - ObjectAnimator.ofFloat( - this, - PROGRESS, - MENU, - state - ) - } else { - ObjectAnimator.ofFloat( - this, - PROGRESS, - ARROW, - state - ) - } - anim.interpolator = AccelerateDecelerateInterpolator() - anim.duration = duration - anim.start() - } - - companion object { - - const val MENU = 0.0f - const val ARROW = 1.0f - - private val PROGRESS = - object : Property(Float::class.java, "progress") { - override fun set(obj: SearchArrowDrawable, value: Float?) { - obj.progress = value!! - } - - override fun get(obj: SearchArrowDrawable): Float { - return obj.progress - } - } - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/SearchBehavior.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/SearchBehavior.kt deleted file mode 100644 index 04e897837..000000000 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/SearchBehavior.kt +++ /dev/null @@ -1,54 +0,0 @@ -/*https://github.com/lapism/search*/ - -package org.koitharu.kotatsu.base.ui.widgets.search - -import android.view.View -import android.widget.LinearLayout -import androidx.coordinatorlayout.widget.CoordinatorLayout -import androidx.core.view.ViewCompat -import com.google.android.material.appbar.AppBarLayout -import com.google.android.material.bottomnavigation.BottomNavigationView -import org.koitharu.kotatsu.base.ui.widgets.search.internal.SearchLayout - -class SearchBehavior : CoordinatorLayout.Behavior() { - - override fun layoutDependsOn( - parent: CoordinatorLayout, - child: S, - dependency: View - ): Boolean { - return if (dependency is AppBarLayout) { - true - } else - if (dependency is LinearLayout || dependency is BottomNavigationView) { - dependency.z = child.z + 1 - true - } else { - super.layoutDependsOn(parent, child, dependency) - } - } - - override fun onDependentViewChanged( - parent: CoordinatorLayout, - child: S, - dependency: View - ): Boolean { - if (dependency is AppBarLayout) { - child.translationY = dependency.getY() - return true - } - return super.onDependentViewChanged(parent, child, dependency) - } - - override fun onStartNestedScroll( - coordinatorLayout: CoordinatorLayout, - child: S, - directTargetChild: View, - target: View, - axes: Int, - type: Int - ): Boolean { - return axes == ViewCompat.SCROLL_AXIS_VERTICAL - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchEditText.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchEditText.kt deleted file mode 100644 index 312e59e9f..000000000 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchEditText.kt +++ /dev/null @@ -1,40 +0,0 @@ -/*https://github.com/lapism/search*/ - -package org.koitharu.kotatsu.base.ui.widgets.search.internal - -import android.content.Context -import android.util.AttributeSet -import android.view.KeyEvent -import androidx.annotation.AttrRes -import androidx.appcompat.widget.AppCompatEditText - -class SearchEditText : AppCompatEditText { - - var clearFocusOnBackPressed: Boolean = false - - constructor(context: Context) : super(context) - - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - - constructor(context: Context, attrs: AttributeSet?, @AttrRes defStyleAttr: Int) : super( - context, - attrs, - defStyleAttr - ) - - override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean { - if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP && clearFocusOnBackPressed) { - if (hasFocus()) { - clearFocus() - return true - } - } - return super.onKeyPreIme(keyCode, event) - } - - override fun clearFocus() { - super.clearFocus() - text?.clear() - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchLayout.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchLayout.kt deleted file mode 100644 index 0c00f32de..000000000 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchLayout.kt +++ /dev/null @@ -1,725 +0,0 @@ -/*https://github.com/lapism/search*/ - -package org.koitharu.kotatsu.base.ui.widgets.search.internal - -import android.content.Context -import android.content.res.ColorStateList -import android.graphics.ColorFilter -import android.graphics.PorterDuff -import android.graphics.Rect -import android.graphics.Typeface -import android.graphics.drawable.Drawable -import android.os.Parcelable -import android.text.Editable -import android.text.TextUtils -import android.text.TextWatcher -import android.util.AttributeSet -import android.view.View -import android.view.ViewGroup -import android.view.inputmethod.InputMethodManager -import android.widget.FrameLayout -import android.widget.ImageButton -import android.widget.LinearLayout -import androidx.annotation.* -import androidx.core.content.ContextCompat -import androidx.recyclerview.widget.DefaultItemAnimator -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import com.google.android.material.card.MaterialCardView -import org.koitharu.kotatsu.R - -abstract class SearchLayout @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0, - defStyleRes: Int = 0 -) : FrameLayout(context, attrs, defStyleAttr, defStyleRes), View.OnClickListener { - - // ********************************************************************************************* - // Better way than enum class :-) - @IntDef( - NavigationIconSupport.NONE, - NavigationIconSupport.MENU, - NavigationIconSupport.ARROW, - NavigationIconSupport.SEARCH - ) - @Retention(AnnotationRetention.SOURCE) - annotation class NavigationIconSupport { - companion object { - const val NONE = 0 - const val MENU = 1 - const val ARROW = 2 - const val SEARCH = 3 - } - } - - @IntDef( - Margins.NO_FOCUS, - Margins.FOCUS - ) - @Retention(AnnotationRetention.SOURCE) - internal annotation class Margins { - companion object { - const val NO_FOCUS = 4 - const val FOCUS = 5 - } - } - - // ********************************************************************************************* - private var mImageViewMic: ImageButton? = null - private var mImageViewMenu: ImageButton? = null - protected var mRecyclerView: RecyclerView? = null - private var mMaterialCardView: MaterialCardView? = null - var mSearchEditText: SearchEditText? = null - protected var mViewShadow: View? = null - protected var mViewDivider: View? = null - protected var mViewAnim: View? = null - protected var mOnFocusChangeListener: OnFocusChangeListener? = null - - private var mLinearLayout: LinearLayout? = null - private var mImageViewNavigation: ImageButton? = null - private var mImageViewClear: ImageButton? = null - private var mOnQueryTextListener: OnQueryTextListener? = null - private var mOnNavigationClickListener: OnNavigationClickListener? = null - private var mOnMicClickListener: OnMicClickListener? = null - private var mOnMenuClickListener: OnMenuClickListener? = null - private var mOnClearClickListener: OnClearClickListener? = null - - // ********************************************************************************************* - @NavigationIconSupport - @get:NavigationIconSupport - var navigationIconSupport: Int = 0 - set(@NavigationIconSupport navigationIconSupport) { - field = navigationIconSupport - - when (navigationIconSupport) { - NavigationIconSupport.NONE - -> { - setNavigationIconImageDrawable(null) - } - NavigationIconSupport.MENU -> { - setNavigationIconImageDrawable( - ContextCompat.getDrawable( - context, - R.drawable.ic_menu - ) - ) - } - NavigationIconSupport.ARROW -> { - setNavigationIconImageDrawable( - ContextCompat.getDrawable( - context, - R.drawable.ic_arrow_back - ) - ) - } - NavigationIconSupport.SEARCH -> { - setNavigationIconImageDrawable( - ContextCompat.getDrawable( - context, - R.drawable.ic_search - ) - ) - } - } - } - - @Margins - @get:Margins - protected var margins: Int = 0 - set(@Margins margins) { - field = margins - - val left: Int - val top: Int - val right: Int - val bottom: Int - val params = mMaterialCardView?.layoutParams as LayoutParams? - - when (margins) { - Margins.NO_FOCUS -> { - left = - context.resources.getDimensionPixelSize(R.dimen.search_margins_left_right) - top = - context.resources.getDimensionPixelSize(R.dimen.search_margins_top_bottom) - right = - context.resources.getDimensionPixelSize(R.dimen.search_margins_left_right) - bottom = - context.resources.getDimensionPixelSize(R.dimen.search_margins_top_bottom) - - params?.width = ViewGroup.LayoutParams.MATCH_PARENT - params?.height = ViewGroup.LayoutParams.WRAP_CONTENT - params?.setMargins(left, top, right, bottom) - mMaterialCardView?.layoutParams = params - } - Margins.FOCUS -> { - left = - context.resources.getDimensionPixelSize(R.dimen.search_margins_focus) - top = - context.resources.getDimensionPixelSize(R.dimen.search_margins_focus) - right = - context.resources.getDimensionPixelSize(R.dimen.search_margins_focus) - bottom = - context.resources.getDimensionPixelSize(R.dimen.search_margins_focus) - - params?.width = ViewGroup.LayoutParams.MATCH_PARENT - params?.height = ViewGroup.LayoutParams.MATCH_PARENT - params?.setMargins(left, top, right, bottom) - mMaterialCardView?.layoutParams = params - } - } - } - - // ********************************************************************************************* - protected abstract fun addFocus() - - protected abstract fun removeFocus() - - // ********************************************************************************************* - protected fun init() { - mLinearLayout = findViewById(R.id.search_linear_layout) - - mImageViewNavigation = findViewById(R.id.search_image_view_navigation) - mImageViewNavigation?.setOnClickListener(this) - - mImageViewMic = findViewById(R.id.search_image_view_mic) - mImageViewMic?.setOnClickListener(this) - - mImageViewMenu = findViewById(R.id.search_image_view_menu) - mImageViewMenu?.setOnClickListener(this) - - mImageViewClear = findViewById(R.id.search_image_view_clear) - mImageViewClear?.visibility = View.GONE - mImageViewClear?.setOnClickListener(this) - - mSearchEditText = findViewById(R.id.search_search_edit_text) - mSearchEditText?.addTextChangedListener(object : TextWatcher { - override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { - - } - - override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { - this@SearchLayout.onTextChanged(s) - } - - override fun afterTextChanged(s: Editable?) { - - } - }) - mSearchEditText?.setOnEditorActionListener { _, _, _ -> - onSubmitQuery() - return@setOnEditorActionListener true // true - } - mSearchEditText?.setOnFocusChangeListener { _, hasFocus -> - if (hasFocus) { - addFocus() - } else { - removeFocus() - } - } - - mRecyclerView = findViewById(R.id.search_recycler_view) - mRecyclerView?.visibility = View.GONE - mRecyclerView?.layoutManager = LinearLayoutManager(context) - mRecyclerView?.isNestedScrollingEnabled = false - mRecyclerView?.itemAnimator = DefaultItemAnimator() - mRecyclerView?.overScrollMode = View.OVER_SCROLL_NEVER - mRecyclerView?.addOnScrollListener(object : RecyclerView.OnScrollListener() { - override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { - super.onScrollStateChanged(recyclerView, newState) - if (newState == RecyclerView.SCROLL_STATE_DRAGGING) { - hideKeyboard() - } - } - }) - - mViewShadow = findViewById(R.id.search_view_shadow) - mViewShadow?.visibility = View.GONE - - mViewDivider = findViewById(R.id.search_view_divider) - mViewDivider?.visibility = View.GONE - - mViewAnim = findViewById(R.id.search_view_anim) - mViewAnim?.visibility = View.GONE - - mMaterialCardView = findViewById(R.id.search_material_card_view) - margins = Margins.NO_FOCUS - - isClickable = true - isFocusable = true - isFocusableInTouchMode = true - } - - // ********************************************************************************************* - fun setNavigationIconVisibility(visibility: Int) { - mImageViewNavigation?.visibility = visibility - } - - fun setNavigationIconImageResource(@DrawableRes resId: Int) { - mImageViewNavigation?.setImageResource(resId) - } - - fun setNavigationIconImageDrawable(@Nullable drawable: Drawable?) { - mImageViewNavigation?.setImageDrawable(drawable) - } - - fun setNavigationIconColorFilter(color: Int) { - mImageViewNavigation?.setColorFilter(color) - } - - fun setNavigationIconColorFilter(color: Int, mode: PorterDuff.Mode) { - mImageViewNavigation?.setColorFilter(color, mode) - } - - fun setNavigationIconColorFilter(cf: ColorFilter?) { - mImageViewNavigation?.colorFilter = cf - } - - fun clearNavigationIconColorFilter() { - mImageViewNavigation?.clearColorFilter() - } - - fun setNavigationIconContentDescription(contentDescription: CharSequence) { - mImageViewNavigation?.contentDescription = contentDescription - } - - // ********************************************************************************************* - fun setMicIconImageResource(@DrawableRes resId: Int) { - mImageViewMic?.setImageResource(resId) - } - - fun setMicIconImageDrawable(@Nullable drawable: Drawable?) { - mImageViewMic?.setImageDrawable(drawable) - } - - fun setMicIconColorFilter(color: Int) { - mImageViewMic?.setColorFilter(color) - } - - fun setMicIconColorFilter(color: Int, mode: PorterDuff.Mode) { - mImageViewMic?.setColorFilter(color, mode) - } - - fun setMicIconColorFilter(cf: ColorFilter?) { - mImageViewMic?.colorFilter = cf - } - - fun clearMicIconColorFilter() { - mImageViewMic?.clearColorFilter() - } - - fun setMicIconContentDescription(contentDescription: CharSequence) { - mImageViewMic?.contentDescription = contentDescription - } - - // ********************************************************************************************* - fun setMenuIconImageResource(@DrawableRes resId: Int) { - mImageViewMenu?.setImageResource(resId) - } - - fun setMenuIconImageDrawable(@Nullable drawable: Drawable?) { - mImageViewMenu?.setImageDrawable(drawable) - } - - fun setMenuIconColorFilter(color: Int) { - mImageViewMenu?.setColorFilter(color) - } - - fun setMenuIconColorFilter(color: Int, mode: PorterDuff.Mode) { - mImageViewMenu?.setColorFilter(color, mode) - } - - fun setMenuIconColorFilter(cf: ColorFilter?) { - mImageViewMenu?.colorFilter = cf - } - - fun clearMenuIconColorFilter() { - mImageViewMenu?.clearColorFilter() - } - - fun setMenuIconContentDescription(contentDescription: CharSequence) { - mImageViewMenu?.contentDescription = contentDescription - } - - // ********************************************************************************************* - fun setClearIconImageResource(@DrawableRes resId: Int) { - mImageViewClear?.setImageResource(resId) - } - - fun setClearIconImageDrawable(@Nullable drawable: Drawable?) { - mImageViewClear?.setImageDrawable(drawable) - } - - fun setClearIconColorFilter(color: Int) { - mImageViewClear?.setColorFilter(color) - } - - fun setClearIconColorFilter(color: Int, mode: PorterDuff.Mode) { - mImageViewClear?.setColorFilter(color, mode) - } - - fun setClearIconColorFilter(cf: ColorFilter?) { - mImageViewClear?.colorFilter = cf - } - - fun clearClearIconColorFilter() { - mImageViewClear?.clearColorFilter() - } - - fun setClearIconContentDescription(contentDescription: CharSequence) { - mImageViewClear?.contentDescription = contentDescription - } - - // ********************************************************************************************* - fun setAdapterLayoutManager(@Nullable layout: RecyclerView.LayoutManager?) { - mRecyclerView?.layoutManager = layout - } - - // only when height == match_parent - fun setAdapterHasFixedSize(hasFixedSize: Boolean) { - mRecyclerView?.setHasFixedSize(hasFixedSize) - } - - fun addAdapterItemDecoration(@NonNull decor: RecyclerView.ItemDecoration) { - mRecyclerView?.addItemDecoration(decor) - } - - fun removeAdapterItemDecoration(@NonNull decor: RecyclerView.ItemDecoration) { - mRecyclerView?.removeItemDecoration(decor) - } - - fun setAdapter(@Nullable adapter: RecyclerView.Adapter<*>?) { - mRecyclerView?.adapter = adapter - } - - @Nullable - fun getAdapter(): RecyclerView.Adapter<*>? { - return mRecyclerView?.adapter - } - - // ********************************************************************************************* - /** - * Typeface.NORMAL - * Typeface.BOLD - * Typeface.ITALIC - * Typeface.BOLD_ITALIC - * - * Typeface.DEFAULT - * Typeface.DEFAULT_BOLD - * Typeface.SANS_SERIF - * Typeface.SERIF - * Typeface.MONOSPACE - * - * Typeface.create(Typeface.NORMAL, Typeface.DEFAULT) - */ - fun setTextTypeface(@Nullable tf: Typeface?) { - mSearchEditText?.typeface = tf - } - - fun getTextTypeface(): Typeface? { - return mSearchEditText?.typeface - } - - fun setTextInputType(type: Int) { - mSearchEditText?.inputType = type - } - - fun getTextInputType(): Int? { - return mSearchEditText?.inputType - } - - fun setTextImeOptions(imeOptions: Int) { - mSearchEditText?.imeOptions = imeOptions - } - - fun getTextImeOptions(): Int? { - return mSearchEditText?.imeOptions - } - - fun setTextQuery(query: CharSequence?, submit: Boolean) { - mSearchEditText?.setText(query) - if (query != null) { - mSearchEditText?.setSelection(mSearchEditText?.length()!!) - } - if (submit && !TextUtils.isEmpty(query)) { - onSubmitQuery() - } - } - - @Nullable - fun getTextQuery(): CharSequence? { - return mSearchEditText?.text - } - - fun setTextHint(hint: CharSequence?) { - mSearchEditText?.hint = hint - } - - fun getTextHint(): CharSequence? { - return mSearchEditText?.hint - } - - fun setTextColor(@ColorInt color: Int) { - mSearchEditText?.setTextColor(color) - } - - fun setTextSize(size: Float) { - mSearchEditText?.textSize = size - } - - fun setTextGravity(gravity: Int) { - mSearchEditText?.gravity = gravity - } - - fun setTextHint(@StringRes resid: Int) { - mSearchEditText?.setHint(resid) - } - - fun setTextHintColor(@ColorInt color: Int) { - mSearchEditText?.setHintTextColor(color) - } - - fun setClearFocusOnBackPressed(clearFocusOnBackPressed: Boolean) { - mSearchEditText?.clearFocusOnBackPressed = clearFocusOnBackPressed - } - - // ********************************************************************************************* - override fun setBackgroundColor(@ColorInt color: Int) { - mMaterialCardView?.setCardBackgroundColor(color) - } - - fun setBackgroundColor(@Nullable color: ColorStateList?) { - mMaterialCardView?.setCardBackgroundColor(color) - } - - override fun setElevation(elevation: Float) { - mMaterialCardView?.cardElevation = elevation - mMaterialCardView?.maxCardElevation = elevation - } - - override fun getElevation(): Float { - return mMaterialCardView?.elevation!! - } - - fun setBackgroundRadius(radius: Float) { - mMaterialCardView?.radius = radius - } - - fun getBackgroundRadius(): Float { - return mMaterialCardView?.radius!! - } - - fun setBackgroundRippleColor(@ColorRes rippleColorResourceId: Int) { - mMaterialCardView?.setRippleColorResource(rippleColorResourceId) - } - - fun setBackgroundRippleColorResource(@Nullable rippleColor: ColorStateList?) { - mMaterialCardView?.rippleColor = rippleColor - } - - fun setBackgroundStrokeColor(@ColorInt strokeColor: Int) { - mMaterialCardView?.strokeColor = strokeColor - } - - fun setBackgroundStrokeColor(strokeColor: ColorStateList) { - mMaterialCardView?.setStrokeColor(strokeColor) - } - - fun setBackgroundStrokeWidth(@Dimension strokeWidth: Int) { - mMaterialCardView?.strokeWidth = strokeWidth - } - - @Dimension - fun getBackgroundStrokeWidth(): Int { - return mMaterialCardView?.strokeWidth!! - } - - // ********************************************************************************************* - fun setDividerColor(@ColorInt color: Int) { - mViewDivider?.setBackgroundColor(color) - } - - fun setShadowColor(@ColorInt color: Int) { - mViewShadow?.setBackgroundColor(color) - } - - // ********************************************************************************************* - fun setOnFocusChangeListener(listener: OnFocusChangeListener) { - mOnFocusChangeListener = listener - } - - fun setOnQueryTextListener(listener: OnQueryTextListener) { - mOnQueryTextListener = listener - } - - fun setOnNavigationClickListener(listener: OnNavigationClickListener) { - mOnNavigationClickListener = listener - } - - fun setOnMicClickListener(listener: OnMicClickListener) { - mOnMicClickListener = listener - } - - fun setOnMenuClickListener(listener: OnMenuClickListener) { - mOnMenuClickListener = listener - } - - fun setOnClearClickListener(listener: OnClearClickListener) { - mOnClearClickListener = listener - } - - // ********************************************************************************************* - fun showKeyboard() { - if (!isInEditMode) { - val inputMethodManager = - context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager - inputMethodManager.showSoftInput( - mSearchEditText, - InputMethodManager.RESULT_UNCHANGED_SHOWN - ) - } - } - - fun hideKeyboard() { - if (!isInEditMode) { - val inputMethodManager = - context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager - inputMethodManager.hideSoftInputFromWindow( - windowToken, - InputMethodManager.RESULT_UNCHANGED_SHOWN - ) - } - } - - // ********************************************************************************************* - protected fun setLayoutHeight(height: Int) { - val params = mLinearLayout?.layoutParams - params?.height = height - params?.width = ViewGroup.LayoutParams.MATCH_PARENT - mLinearLayout?.layoutParams = params - } - - // ********************************************************************************************* - private fun onTextChanged(newText: CharSequence) { - if (!TextUtils.isEmpty(newText)) { - mImageViewMic?.visibility = View.GONE - mImageViewClear?.visibility = View.VISIBLE - } else { - mImageViewClear?.visibility = View.GONE - if (mSearchEditText?.hasFocus()!!) { - mImageViewMic?.visibility = View.VISIBLE - } else { - mImageViewMic?.visibility = View.GONE - } - } - - if (mOnQueryTextListener != null) { - mOnQueryTextListener?.onQueryTextChange(newText) - } - } - - private fun onSubmitQuery() { - val query = mSearchEditText?.text - if (query != null && TextUtils.getTrimmedLength(query) > 0) { - if (mOnQueryTextListener == null || !mOnQueryTextListener!!.onQueryTextSubmit(query.toString())) { - mSearchEditText?.text = query - } - } - } - - // ********************************************************************************************* - override fun onSaveInstanceState(): Parcelable? { - val superState = super.onSaveInstanceState() - val ss = SearchViewSavedState(superState!!) - if (mSearchEditText?.text!!.isNotEmpty()) { - ss.query = mSearchEditText?.text - } - ss.hasFocus = mSearchEditText?.hasFocus()!! - return ss - } - - override fun onRestoreInstanceState(state: Parcelable?) { - if (state !is SearchViewSavedState) { - super.onRestoreInstanceState(state) - return - } - super.onRestoreInstanceState(state.superState) - if (state.hasFocus) { - mSearchEditText?.requestFocus() - } - if (state.query != null) { - setTextQuery(state.query, false) - } - requestLayout() - } - - override fun requestFocus(direction: Int, previouslyFocusedRect: Rect?): Boolean { - return if (!isFocusable) { - false - } else { - mSearchEditText?.requestFocus(direction, previouslyFocusedRect)!! - } - } - - override fun clearFocus() { - super.clearFocus() - mSearchEditText?.clearFocus() - } - - override fun onClick(view: View?) { - if (view === mImageViewNavigation) { - if (mOnNavigationClickListener != null) { - mOnNavigationClickListener?.onNavigationClick(mSearchEditText?.hasFocus()!!) - } - } else if (view === mImageViewMic) { - if (mOnMicClickListener != null) { - mOnMicClickListener?.onMicClick() - } - } else if (view === mImageViewMenu) { - if (mOnMenuClickListener != null) { - mOnMenuClickListener?.onMenuClick() - } - } else if (view === mImageViewClear) { - if (mSearchEditText?.text!!.isNotEmpty()) { - mSearchEditText?.text!!.clear() - } - if (mOnClearClickListener != null) { - mOnClearClickListener?.onClearClick() - } - } - } - - // ********************************************************************************************* - interface OnFocusChangeListener { - - fun onFocusChange(hasFocus: Boolean) - } - - interface OnQueryTextListener { - - fun onQueryTextChange(newText: CharSequence): Boolean - - fun onQueryTextSubmit(query: CharSequence): Boolean - } - - interface OnNavigationClickListener { - - fun onNavigationClick(hasFocus: Boolean) - } - - interface OnMicClickListener { - - fun onMicClick() - } - - interface OnMenuClickListener { - - fun onMenuClick() - } - - interface OnClearClickListener { - - fun onClearClick() - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchViewSavedState.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchViewSavedState.kt deleted file mode 100644 index 394a770c9..000000000 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/internal/SearchViewSavedState.kt +++ /dev/null @@ -1,21 +0,0 @@ -/*https://github.com/lapism/search*/ - -package org.koitharu.kotatsu.base.ui.widgets.search.internal - -import android.os.Parcel -import android.os.Parcelable -import android.text.TextUtils -import android.view.View - -internal class SearchViewSavedState(superState: Parcelable) : View.BaseSavedState(superState) { - - var query: CharSequence? = null - var hasFocus: Boolean = false - - override fun writeToParcel(out: Parcel, flags: Int) { - super.writeToParcel(out, flags) - TextUtils.writeToParcel(query, out, flags) - out.writeInt(if (hasFocus) 1 else 0) - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/util/SearchUtils.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/util/SearchUtils.kt deleted file mode 100644 index ed93e0848..000000000 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/widgets/search/util/SearchUtils.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.koitharu.kotatsu.base.ui.widgets.search.util - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.speech.RecognizerIntent - -object SearchUtils { - - const val SPEECH_REQUEST_CODE = 300 - - @JvmStatic - fun setVoiceSearch(activity: Activity, text: String) { - val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) - // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtra( - RecognizerIntent.EXTRA_LANGUAGE_MODEL, - RecognizerIntent.LANGUAGE_MODEL_FREE_FORM - ) - intent.putExtra(RecognizerIntent.EXTRA_PROMPT, text) - intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1) - - activity.startActivityForResult( - intent, - SPEECH_REQUEST_CODE - ) - } - - @JvmStatic - fun isVoiceSearchAvailable(context: Context): Boolean { - val pm = context.packageManager - val activities = - pm.queryIntentActivities(Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0) - return activities.size != 0 - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/favourites/ui/list/FavouritesListViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/favourites/ui/list/FavouritesListViewModel.kt index bdbd4991a..ec13864b9 100644 --- a/app/src/main/java/org/koitharu/kotatsu/favourites/ui/list/FavouritesListViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/favourites/ui/list/FavouritesListViewModel.kt @@ -28,6 +28,8 @@ class FavouritesListViewModel( when { list.isEmpty() -> listOf( EmptyState( + R.drawable.ic_heart_outline, + R.string.text_empty_holder_primary, if (categoryId == 0L) { R.string.you_have_not_favourites_yet } else { diff --git a/app/src/main/java/org/koitharu/kotatsu/history/ui/HistoryListViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/history/ui/HistoryListViewModel.kt index 081fdc0e0..539d68d77 100644 --- a/app/src/main/java/org/koitharu/kotatsu/history/ui/HistoryListViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/history/ui/HistoryListViewModel.kt @@ -44,7 +44,7 @@ class HistoryListViewModel( createListModeFlow() ) { list, grouped, mode -> when { - list.isEmpty() -> listOf(EmptyState(R.string.text_history_holder)) + list.isEmpty() -> listOf(EmptyState(R.drawable.ic_history, R.string.text_history_holder_primary, R.string.text_history_holder_secondary)) else -> mapList(list, grouped, mode) } }.onFirst { diff --git a/app/src/main/java/org/koitharu/kotatsu/list/ui/adapter/EmptyStateListAD.kt b/app/src/main/java/org/koitharu/kotatsu/list/ui/adapter/EmptyStateListAD.kt index 77481c8c5..29ecc9b30 100644 --- a/app/src/main/java/org/koitharu/kotatsu/list/ui/adapter/EmptyStateListAD.kt +++ b/app/src/main/java/org/koitharu/kotatsu/list/ui/adapter/EmptyStateListAD.kt @@ -1,14 +1,23 @@ package org.koitharu.kotatsu.list.ui.adapter -import android.widget.TextView -import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegate -import org.koitharu.kotatsu.R +import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding +import org.koitharu.kotatsu.databinding.ItemEmptyStateBinding import org.koitharu.kotatsu.list.ui.model.EmptyState import org.koitharu.kotatsu.list.ui.model.ListModel -fun emptyStateListAD() = adapterDelegate(R.layout.item_empty_state) { +fun emptyStateListAD() = adapterDelegateViewBinding( + { inflater, parent -> ItemEmptyStateBinding.inflate(inflater, parent, false) } +) { bind { - (itemView as TextView).setText(item.text) + with(binding.icon) { + setImageResource(item.icon) + } + with(binding.textPrimary) { + setText(item.textPrimary) + } + with(binding.textSecondary) { + setText(item.textSecondary) + } } } \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/list/ui/model/EmptyState.kt b/app/src/main/java/org/koitharu/kotatsu/list/ui/model/EmptyState.kt index e23c5b59b..0613f2e24 100644 --- a/app/src/main/java/org/koitharu/kotatsu/list/ui/model/EmptyState.kt +++ b/app/src/main/java/org/koitharu/kotatsu/list/ui/model/EmptyState.kt @@ -1,7 +1,10 @@ package org.koitharu.kotatsu.list.ui.model +import androidx.annotation.DrawableRes import androidx.annotation.StringRes data class EmptyState( - @StringRes val text: Int + @DrawableRes val icon: Int, + @StringRes val textPrimary: Int, + @StringRes val textSecondary: Int ) : ListModel \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/local/ui/LocalListViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/local/ui/LocalListViewModel.kt index 715b287b6..2ab348b6c 100644 --- a/app/src/main/java/org/koitharu/kotatsu/local/ui/LocalListViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/local/ui/LocalListViewModel.kt @@ -45,7 +45,7 @@ class LocalListViewModel( when { error != null -> listOf(error.toErrorState(canRetry = true)) list == null -> listOf(LoadingState) - list.isEmpty() -> listOf(EmptyState(R.string.text_local_holder)) + list.isEmpty() -> listOf(EmptyState(R.drawable.ic_storage, R.string.text_local_holder_primary, R.string.text_local_holder_secondary)) else -> list.toUi(mode) } }.asLiveDataDistinct( diff --git a/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt b/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt index 409041966..06c5e4d36 100644 --- a/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt +++ b/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt @@ -186,11 +186,11 @@ class MainActivity : BaseActivity(), } override fun onWindowInsetsChanged(insets: Insets) { - binding.toolbar.updatePadding( - top = insets.top, - left = insets.left, - right = insets.right - ) + binding.toolbarCard.updateLayoutParams { + topMargin = insets.top + 16 + leftMargin = insets.left + 32 + rightMargin = insets.right + 32 + } binding.fab.updateLayoutParams { bottomMargin = insets.bottom + topMargin leftMargin = insets.left + topMargin diff --git a/app/src/main/java/org/koitharu/kotatsu/remotelist/ui/RemoteListViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/remotelist/ui/RemoteListViewModel.kt index b36ead35a..d280a10ec 100644 --- a/app/src/main/java/org/koitharu/kotatsu/remotelist/ui/RemoteListViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/remotelist/ui/RemoteListViewModel.kt @@ -37,7 +37,7 @@ class RemoteListViewModel( when { list.isNullOrEmpty() && error != null -> listOf(error.toErrorState(canRetry = true)) list == null -> listOf(LoadingState) - list.isEmpty() -> listOf(EmptyState(R.string.nothing_found)) + list.isEmpty() -> listOf(EmptyState(R.drawable.ic_search, R.string.nothing_found, R.string._empty)) else -> { val result = ArrayList(list.size + 1) list.toUi(result, mode) diff --git a/app/src/main/java/org/koitharu/kotatsu/search/ui/SearchViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/search/ui/SearchViewModel.kt index 14b3711a1..80e87ca2c 100644 --- a/app/src/main/java/org/koitharu/kotatsu/search/ui/SearchViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/search/ui/SearchViewModel.kt @@ -34,7 +34,7 @@ class SearchViewModel( when { list.isNullOrEmpty() && error != null -> listOf(error.toErrorState(canRetry = true)) list == null -> listOf(LoadingState) - list.isEmpty() -> listOf(EmptyState(R.string.nothing_found)) + list.isEmpty() -> listOf(EmptyState(R.drawable.ic_search, R.string.nothing_found, R.string.text_search_holder_secondary)) else -> { val result = ArrayList(list.size + 1) list.toUi(result, mode) diff --git a/app/src/main/java/org/koitharu/kotatsu/search/ui/global/GlobalSearchViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/search/ui/global/GlobalSearchViewModel.kt index 72b64f509..00dee0bff 100644 --- a/app/src/main/java/org/koitharu/kotatsu/search/ui/global/GlobalSearchViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/search/ui/global/GlobalSearchViewModel.kt @@ -35,7 +35,7 @@ class GlobalSearchViewModel( when { list.isNullOrEmpty() && error != null -> listOf(error.toErrorState(canRetry = true)) list == null -> listOf(LoadingState) - list.isEmpty() -> listOf(EmptyState(R.string.nothing_found)) + list.isEmpty() -> listOf(EmptyState(R.drawable.ic_search, R.string.nothing_found, R.string.text_search_holder_secondary)) else -> { val result = ArrayList(list.size + 1) list.toUi(result, mode) diff --git a/app/src/main/java/org/koitharu/kotatsu/tracker/ui/FeedViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/tracker/ui/FeedViewModel.kt index c187bde99..d0bee70ce 100644 --- a/app/src/main/java/org/koitharu/kotatsu/tracker/ui/FeedViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/tracker/ui/FeedViewModel.kt @@ -39,7 +39,7 @@ class FeedViewModel( hasNextPage ) { list, isHasNextPage -> when { - list.isEmpty() -> listOf(EmptyState(R.string.text_feed_holder)) + list.isEmpty() -> listOf(EmptyState(R.drawable.ic_feed, R.string.text_empty_holder_primary, R.string.text_feed_holder)) isHasNextPage -> list + LoadingFooter else -> list } diff --git a/app/src/main/res/color/navigation_item_color_tint.xml b/app/src/main/res/color/navigation_item_color_tint.xml new file mode 100644 index 000000000..bffbeeb10 --- /dev/null +++ b/app/src/main/res/color/navigation_item_color_tint.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_browser.xml b/app/src/main/res/layout/activity_browser.xml index 36b76f907..778023fa4 100644 --- a/app/src/main/res/layout/activity_browser.xml +++ b/app/src/main/res/layout/activity_browser.xml @@ -11,7 +11,7 @@ style="@style/Widget.Kotatsu.AppBar" android:layout_width="0dp" android:layout_height="wrap_content" - app:elevation="0dp" + android:elevation="4dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> diff --git a/app/src/main/res/layout/activity_categories.xml b/app/src/main/res/layout/activity_categories.xml index aa9a032e0..48043eb74 100644 --- a/app/src/main/res/layout/activity_categories.xml +++ b/app/src/main/res/layout/activity_categories.xml @@ -11,7 +11,7 @@ style="@style/Widget.Kotatsu.AppBar" android:layout_width="match_parent" android:layout_height="wrap_content" - app:elevation="0dp"> + android:elevation="4dp"> - + android:layout_height="50dp" + android:layout_marginStart="16dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="8dp" + app:cardCornerRadius="8dp" + app:cardElevation="4dp"> + + + + @@ -58,6 +75,9 @@ android:layout_height="match_parent" android:layout_gravity="start" app:insetForeground="@android:color/transparent" + app:itemHorizontalPadding="16dp" + app:itemIconPadding="24dp" + app:itemIconTint="@color/navigation_item_color_tint" app:menu="@menu/nav_drawer" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index 7a7a4ab76..914660497 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -10,7 +10,7 @@ style="@style/Widget.Kotatsu.AppBar" android:layout_width="match_parent" android:layout_height="wrap_content" - app:elevation="0dp"> + android:elevation="4dp"> + android:elevation="4dp"> + android:elevation="4dp"> + android:elevation="4dp"> - \ No newline at end of file + android:orientation="vertical" + android:padding="16dp"> + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_tracklog.xml b/app/src/main/res/layout/item_tracklog.xml index 38766f184..3621a779c 100644 --- a/app/src/main/res/layout/item_tracklog.xml +++ b/app/src/main/res/layout/item_tracklog.xml @@ -6,19 +6,22 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" + android:paddingStart="16dp" android:paddingEnd="16dp"> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/navigation_header.xml b/app/src/main/res/layout/navigation_header.xml index cc5b83e5a..f4acadd0d 100644 --- a/app/src/main/res/layout/navigation_header.xml +++ b/app/src/main/res/layout/navigation_header.xml @@ -8,13 +8,28 @@ android:fitsSystemWindows="true" android:orientation="vertical"> - + + + + + + + - #1976D2 - #1565C0 + #4098EF + #2C7CD6 @android:color/black #2EFFFFFF diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 6b7e4328d..79b3a97ab 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -23,7 +23,7 @@ История пуста Читать Добавить закладку - Добавьте интересующую Вас мангу в избренное, чтобы не потерять её + Добавьте интересующую Вас мангу в избранное, чтобы не потерять её В избранное Создать категорию Добавить @@ -116,9 +116,13 @@ Переименовать Вы уверены, что хотите удалить категорию \"%s\"? \nВся манга из данной категории будет утеряна. Удалить категорию + Как-то здесь пусто… + Попробуйте переформулировать запрос. Категории помогают упорядочивать избранную мангу. Нажмите «+», чтобы создать категорию - Здесь будет оборажаться манга, которую Вы читаете. Вы можете найти, что почитать, в боковом меню - У Вас пока нет сохранённой манги. Вы можете сохранить мангу из онлайн каталога или импортировать из файла + Здесь будет отображаться манга, которую Вы читаете + Вы можете найти, что почитать, в боковом меню. + У Вас пока нет сохранённой манги + Вы можете сохранить мангу из онлайн каталога или импортировать из файла. Полка с мангой Недавняя манга Анимация листания diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 13b53d3c4..fdb266936 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -13,29 +13,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e0bfcd8a6..80d309d6d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,6 @@ Kotatsu + Close menu Open menu Local storage @@ -117,9 +118,13 @@ Rename Do you really want to remove category \"%s\" from your favourites? \nAll containing manga will be lost. Remove category + It\'s kind of empty here… You can use categories to organize your favourite manga. Press «+» to create a category - Manga you are reading will be displayed here. You can find what to read in side menu - You have not any saved manga yet. You can save it from online sources or import from file + Try to reformulate the query. + Manga you are reading will be displayed here + You can find what to read in side menu. + You have not any saved manga yet + You can save it from online sources or import from file. Manga shelf Recent manga Pages animation diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index b3a63cefa..ce368d8a2 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -29,6 +29,12 @@ @dimen/nav_item_horizontal_padding + + + +