diff options
19 files changed, 89 insertions, 155 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/library/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt index 476b7f8..63af3cf 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt @@ -17,9 +17,9 @@ import ca.allanwang.kau.logging.KL import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.dimenPixelSize import ca.allanwang.kau.utils.string -import ca.allanwang.kau.views.KauCutoutTextView -import ca.allanwang.kau.widgets.KauElasticDragDismissFrameLayout -import ca.allanwang.kau.widgets.KauInkPageIndicator +import ca.allanwang.kau.views.CutoutTextView +import ca.allanwang.kau.widgets.ElasticDragDismissFrameLayout +import ca.allanwang.kau.widgets.InkPageIndicator import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.entity.Library import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter @@ -39,9 +39,9 @@ import java.security.InvalidParameterException */ abstract class AboutActivityBase(val rClass: Class<*>, val configBuilder: Configs.() -> Unit = {}) : AppCompatActivity() { - val draggableFrame: KauElasticDragDismissFrameLayout by bindView(R.id.about_draggable_frame) + val draggableFrame: ElasticDragDismissFrameLayout by bindView(R.id.about_draggable_frame) val pager: ViewPager by bindView(R.id.about_pager) - val indicator: KauInkPageIndicator by bindView(R.id.about_indicator) + val indicator: InkPageIndicator by bindView(R.id.about_indicator) val configs: Configs by lazy { Configs().apply { configBuilder() } } override fun onCreate(savedInstanceState: Bundle?) { @@ -52,7 +52,7 @@ abstract class AboutActivityBase(val rClass: Class<*>, val configBuilder: Config pageMargin = dimenPixelSize(R.dimen.kau_spacing_normal) } indicator.setViewPager(pager) - draggableFrame.addListener(object : KauElasticDragDismissFrameLayout.SystemChromeFader(this) { + draggableFrame.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) { override fun onDragDismissed() { // if we drag dismiss downward then the default reversal of the enter // transition would slide content upward which looks weird. So reverse it. @@ -91,14 +91,14 @@ abstract class AboutActivityBase(val rClass: Class<*>, val configBuilder: Config fun inflateMainPage(layoutInflater: LayoutInflater, parent: ViewGroup): View { val v = layoutInflater.inflate(R.layout.kau_about_section_main, parent, false) postInflateMainPage( - v.findViewById<KauCutoutTextView>(R.id.about_main_cutout), + v.findViewById<CutoutTextView>(R.id.about_main_cutout), v.findViewById<FrameLayout>(R.id.about_main_bottom_container), v.findViewById<TextView>(R.id.about_main_bottom_text) ) return v } - open fun postInflateMainPage(cutout: KauCutoutTextView, bottomContainer: FrameLayout, bottomText: TextView) { + open fun postInflateMainPage(cutout: CutoutTextView, bottomContainer: FrameLayout, bottomText: TextView) { with (configs) { cutout.text = string(cutoutTextRes, cutoutText) bottomText.text = string(mainPageTitleRes, mainPageTitle) diff --git a/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/ColorPickerDialog.kt b/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/ColorPickerDialog.kt index 07f5e17..7c57c26 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/ColorPickerDialog.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/dialogs/color/ColorPickerDialog.kt @@ -71,8 +71,8 @@ fun Context.colorPickerDialog(contract: ColorContract): MaterialDialog { negativeText(contract.cancelText) if (contract.allowCustom) neutralText(contract.presetText) onPositive { dialog, _ -> contract.colorCallback?.invoke(view.selectedColor); dialog.dismiss() } - onNegative { dialog, _ -> view.backOrCancel() } - if (contract.allowCustom) onNeutral { dialog, _ -> view.toggleCustom() } + onNegative { _, _ -> view.backOrCancel() } + if (contract.allowCustom) onNeutral { _, _ -> view.toggleCustom() } showListener { view.refreshColors() } if (contract.theme != null) theme(contract.theme!!) build() diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt index a2985f0..9a9f7d4 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefActivity.kt @@ -17,7 +17,7 @@ import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.resolveColor import ca.allanwang.kau.utils.statusBarColor import ca.allanwang.kau.utils.string -import ca.allanwang.kau.widgets.KauTextSlider +import ca.allanwang.kau.widgets.TextSlider import ca.allanwang.kau.views.RippleCanvas import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter @@ -32,13 +32,13 @@ abstract class KPrefActivity : AppCompatActivity(), KPrefActivityContract { val bgCanvas: RippleCanvas by bindView(R.id.kau_ripple) val toolbarCanvas: RippleCanvas by bindView(R.id.kau_toolbar_ripple) val toolbar: Toolbar by bindView(R.id.kau_toolbar) - val toolbarTitle: KauTextSlider by bindView(R.id.kau_toolbar_text) + val toolbarTitle: TextSlider by bindView(R.id.kau_toolbar_text) val prefHolder: ViewAnimator by bindView(R.id.kau_holder) private lateinit var globalOptions: GlobalOptions var animate: Boolean = true set(value) { field = value - toolbarTitle.animationType = if (value) KauTextSlider.ANIMATION_SLIDE_HORIZONTAL else KauTextSlider.ANIMATION_NONE + toolbarTitle.animationType = if (value) TextSlider.ANIMATION_SLIDE_HORIZONTAL else TextSlider.ANIMATION_NONE } private val SLIDE_IN_LEFT_ITEMS: Animation by lazy { AnimationUtils.loadAnimation(this, R.anim.kau_slide_in_left) } diff --git a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt index b2490ac..c077a06 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt @@ -21,7 +21,7 @@ import ca.allanwang.kau.animators.NoAnimator import ca.allanwang.kau.kotlin.nonReadable import ca.allanwang.kau.searchview.SearchView.Configs import ca.allanwang.kau.utils.* -import ca.allanwang.kau.views.KauBoundedCardView +import ca.allanwang.kau.views.BoundedCardView import com.jakewharton.rxbinding2.widget.RxTextView import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter import com.mikepenz.google_material_typeface_library.GoogleMaterial @@ -207,7 +207,7 @@ class SearchView @JvmOverloads constructor( val configs = Configs() //views private val shadow: View by bindView(R.id.search_shadow) - private val card: KauBoundedCardView by bindView(R.id.search_cardview) + private val card: BoundedCardView by bindView(R.id.search_cardview) private val iconNav: ImageView by bindView(R.id.search_nav) private val editText: AppCompatEditText by bindView(R.id.search_edit_text) val textEvents: Observable<String> diff --git a/library/src/main/kotlin/ca/allanwang/kau/views/KauBoundedCardView.kt b/library/src/main/kotlin/ca/allanwang/kau/views/BoundedCardView.kt index 60f5176..0cb65d0 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/views/KauBoundedCardView.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/views/BoundedCardView.kt @@ -16,7 +16,7 @@ import ca.allanwang.kau.utils.parentVisibleHeight * This view should be used with wrap_content as its height * Defaults to at most the parent's visible height */ -class KauBoundedCardView @JvmOverloads constructor( +class BoundedCardView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : CardView(context, attrs, defStyleAttr) { @@ -33,9 +33,9 @@ class KauBoundedCardView @JvmOverloads constructor( init { if (attrs != null) { - val styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.KauBoundedCardView) - maxHeight = styledAttrs.getDimensionPixelSize(R.styleable.KauBoundedCardView_kau_maxHeight, -1) - maxHeightPercent = styledAttrs.getFloat(R.styleable.KauBoundedCardView_kau_maxHeightPercent, -1.0f) + val styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.BoundedCardView) + maxHeight = styledAttrs.getDimensionPixelSize(R.styleable.BoundedCardView_maxHeight, -1) + maxHeightPercent = styledAttrs.getFloat(R.styleable.BoundedCardView_maxHeightPercent, -1.0f) styledAttrs.recycle() } } diff --git a/library/src/main/kotlin/ca/allanwang/kau/views/KauCutoutTextView.kt b/library/src/main/kotlin/ca/allanwang/kau/views/CutoutTextView.kt index 8df604a..b113c3d 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/views/KauCutoutTextView.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/views/CutoutTextView.kt @@ -32,7 +32,7 @@ import ca.allanwang.kau.utils.parentVisibleHeight /** * A view which punches out some text from an opaque color block, allowing you to see through it. */ -class KauCutoutTextView @JvmOverloads constructor( +class CutoutTextView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : View(context, attrs, defStyleAttr) { private val textPaint: TextPaint = TextPaint(Paint.ANTI_ALIAS_FLAG) @@ -49,13 +49,13 @@ class KauCutoutTextView @JvmOverloads constructor( init { if (attrs != null) { - val a = context.obtainStyledAttributes(attrs, R.styleable.KauCutoutTextView, 0, 0) - if (a.hasValue(R.styleable.KauCutoutTextView_kau_font)) - textPaint.typeface = context.getFont(a.getString(R.styleable.KauCutoutTextView_kau_font)) - foregroundColor = a.getColor(R.styleable.KauCutoutTextView_kau_foregroundColor, foregroundColor) - text = a.getString(R.styleable.KauCutoutTextView_android_text) ?: text - minHeight = a.getDimension(R.styleable.KauCutoutTextView_android_minHeight, minHeight) - heightPercentage = a.getFloat(R.styleable.KauCutoutTextView_kau_heightPercentageToScreen, heightPercentage) + val a = context.obtainStyledAttributes(attrs, R.styleable.CutoutTextView, 0, 0) + if (a.hasValue(R.styleable.CutoutTextView_font)) + textPaint.typeface = context.getFont(a.getString(R.styleable.CutoutTextView_font)) + foregroundColor = a.getColor(R.styleable.CutoutTextView_foregroundColor, foregroundColor) + text = a.getString(R.styleable.CutoutTextView_android_text) ?: text + minHeight = a.getDimension(R.styleable.CutoutTextView_android_minHeight, minHeight) + heightPercentage = a.getFloat(R.styleable.CutoutTextView_heightPercentageToScreen, heightPercentage) a.recycle() } maxTextSize = context.dimenPixelSize(R.dimen.kau_display_4_text_size).toFloat() diff --git a/library/src/main/kotlin/ca/allanwang/kau/widgets/KauElasticDragDismissFrameLayout.kt b/library/src/main/kotlin/ca/allanwang/kau/widgets/ElasticDragDismissFrameLayout.kt index d186647..081db22 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/widgets/KauElasticDragDismissFrameLayout.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/widgets/ElasticDragDismissFrameLayout.kt @@ -31,7 +31,7 @@ import ca.allanwang.kau.utils.* * Applies an elasticity factor to reduce movement as you approach the given dismiss distance. * Optionally also scales down content during drag. */ -class KauElasticDragDismissFrameLayout @JvmOverloads constructor( +class ElasticDragDismissFrameLayout @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0 ) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) { @@ -50,24 +50,15 @@ class KauElasticDragDismissFrameLayout @JvmOverloads constructor( private var callbacks: MutableList<ElasticDragDismissCallback> = mutableListOf() init { - - val a = getContext().obtainStyledAttributes( - attrs, R.styleable.KauElasticDragDismissFrameLayout, 0, 0) - - if (a.hasValue(R.styleable.KauElasticDragDismissFrameLayout_kau_dragDismissDistance)) { - dragDismissDistance = a.getDimensionPixelSize(R.styleable.KauElasticDragDismissFrameLayout_kau_dragDismissDistance, 0).toFloat() - } else if (a.hasValue(R.styleable.KauElasticDragDismissFrameLayout_kau_dragDismissFraction)) { - dragDismissFraction = a.getFloat(R.styleable.KauElasticDragDismissFrameLayout_kau_dragDismissFraction, dragDismissFraction) - } - if (a.hasValue(R.styleable.KauElasticDragDismissFrameLayout_kau_dragDismissScale)) { - dragDismissScale = a.getFloat(R.styleable.KauElasticDragDismissFrameLayout_kau_dragDismissScale, dragDismissScale) + if (attrs != null) { + val a = getContext().obtainStyledAttributes(attrs, R.styleable.ElasticDragDismissFrameLayout, 0, 0) + dragDismissDistance = a.getDimensionPixelSize(R.styleable.ElasticDragDismissFrameLayout_dragDismissDistance, Int.MAX_VALUE).toFloat() + dragDismissFraction = a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragDismissFraction, dragDismissFraction) + dragDismissScale = a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragDismissScale, dragDismissScale) shouldScale = dragDismissScale != 1f + dragElacticity = a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragElasticity, dragElacticity) + a.recycle() } - if (a.hasValue(R.styleable.KauElasticDragDismissFrameLayout_kau_dragElasticity)) { - dragElacticity = a.getFloat(R.styleable.KauElasticDragDismissFrameLayout_kau_dragElasticity, - dragElacticity) - } - a.recycle() } abstract class ElasticDragDismissCallback { diff --git a/library/src/main/kotlin/ca/allanwang/kau/widgets/KauInkPageIndicator.java b/library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java index 1f2dc9a..8bdfd5c 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/widgets/KauInkPageIndicator.java +++ b/library/src/main/kotlin/ca/allanwang/kau/widgets/InkPageIndicator.java @@ -41,7 +41,7 @@ import ca.allanwang.kau.utils.AnimHolder; /** * An ink inspired widget for indicating pages in a {@link ViewPager}. */ -public class KauInkPageIndicator extends View implements ViewPager.OnPageChangeListener, +public class InkPageIndicator extends View implements ViewPager.OnPageChangeListener, View.OnAttachStateChangeListener { // defaults @@ -113,35 +113,35 @@ public class KauInkPageIndicator extends View implements ViewPager.OnPageChangeL float controlX2; float controlY2; - public KauInkPageIndicator(Context context) { + public InkPageIndicator(Context context) { this(context, null, 0); } - public KauInkPageIndicator(Context context, AttributeSet attrs) { + public InkPageIndicator(Context context, AttributeSet attrs) { this(context, attrs, 0); } - public KauInkPageIndicator(Context context, AttributeSet attrs, int defStyle) { + public InkPageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final int density = (int) context.getResources().getDisplayMetrics().density; // Load attributes final TypedArray a = getContext().obtainStyledAttributes( - attrs, R.styleable.KauInkPageIndicator, defStyle, 0); + attrs, R.styleable.InkPageIndicator, defStyle, 0); - dotDiameter = a.getDimensionPixelSize(R.styleable.KauInkPageIndicator_kau_dotDiameter, + dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter, DEFAULT_DOT_SIZE * density); dotRadius = dotDiameter / 2; halfDotRadius = dotRadius / 2; - gap = a.getDimensionPixelSize(R.styleable.KauInkPageIndicator_kau_dotGap, + gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap, DEFAULT_GAP * density); - animDuration = (long) a.getInteger(R.styleable.KauInkPageIndicator_kau_animationDuration, + animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration, DEFAULT_ANIM_DURATION); animHalfDuration = animDuration / 2; - unselectedColour = a.getColor(R.styleable.KauInkPageIndicator_kau_pageIndicatorColor, + unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR); - selectedColour = a.getColor(R.styleable.KauInkPageIndicator_kau_currentPageIndicatorColor, + selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor, DEFAULT_SELECTED_COLOUR); a.recycle(); @@ -169,7 +169,7 @@ public class KauInkPageIndicator extends View implements ViewPager.OnPageChangeL viewPager.getAdapter().registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { - setPageCount(KauInkPageIndicator.this.viewPager.getAdapter().getCount()); + setPageCount(InkPageIndicator.this.viewPager.getAdapter().getCount()); } }); setCurrentPageImmediate(); diff --git a/library/src/main/kotlin/ca/allanwang/kau/widgets/KauTextSlider.kt b/library/src/main/kotlin/ca/allanwang/kau/widgets/TextSlider.kt index 02b4912..528dabc 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/widgets/KauTextSlider.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/widgets/TextSlider.kt @@ -19,7 +19,7 @@ import java.util.* * Text switcher with global text color and embedded sliding animations * Also has a stack to keep track of title changes */ -class KauTextSlider @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null +class TextSlider @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null ) : TextSwitcher(context, attrs) { val titleStack: Stack<CharSequence?> = Stack() @@ -68,8 +68,8 @@ class KauTextSlider @JvmOverloads constructor(context: Context, attrs: Attribute init { if (attrs != null) { - val styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.KauTextSlider) - animationType = styledAttrs.getInteger(R.styleable.KauTextSlider_kau_animation_type, ANIMATION_SLIDE_HORIZONTAL) + val styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.TextSlider) + animationType = styledAttrs.getInteger(R.styleable.TextSlider_animation_type, ANIMATION_SLIDE_HORIZONTAL) styledAttrs.recycle() } } diff --git a/library/src/main/res/layout/kau_about_section_main.xml b/library/src/main/res/layout/kau_about_section_main.xml index 32b3f19..e501f60 100644 --- a/library/src/main/res/layout/kau_about_section_main.xml +++ b/library/src/main/res/layout/kau_about_section_main.xml @@ -12,13 +12,13 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - <ca.allanwang.kau.views.KauCutoutTextView + <ca.allanwang.kau.views.CutoutTextView android:id="@+id/about_main_cutout" android:layout_width="0dp" android:layout_height="@dimen/kau_about_header_height" android:minHeight="@dimen/kau_about_header_height" - app:kau_foregroundColor="?android:colorAccent" - app:kau_heightPercentageToScreen="0.5" + app:foregroundColor="?android:colorAccent" + app:heightPercentageToScreen="0.5" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/library/src/main/res/layout/kau_activity_about.xml b/library/src/main/res/layout/kau_activity_about.xml index a2db0e9..33cc781 100644 --- a/library/src/main/res/layout/kau_activity_about.xml +++ b/library/src/main/res/layout/kau_activity_about.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> -<ca.allanwang.kau.widgets.KauElasticDragDismissFrameLayout +<ca.allanwang.kau.widgets.ElasticDragDismissFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/about_draggable_frame" android:layout_width="match_parent" android:layout_height="match_parent" - app:kau_dragDismissDistance="@dimen/kau_drag_dismiss_distance" - app:kau_dragDismissScale="0.95" + app:dragDismissDistance="@dimen/kau_drag_dismiss_distance" + app:dragDismissScale="0.95" tools:context=".about.AboutActivityBase"> <android.support.v4.view.ViewPager @@ -15,13 +15,13 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - <ca.allanwang.kau.widgets.KauInkPageIndicator + <ca.allanwang.kau.widgets.InkPageIndicator android:id="@+id/about_indicator" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top|center_horizontal" android:layout_marginTop="@dimen/kau_padding_normal" - app:kau_pageIndicatorColor="@color/kau_about_page_indicator_dark" - app:kau_currentPageIndicatorColor="@color/kau_about_page_indicator_dark_selected" /> + app:pageIndicatorColor="@color/kau_about_page_indicator_dark" + app:currentPageIndicatorColor="@color/kau_about_page_indicator_dark_selected" /> -</ca.allanwang.kau.widgets.KauElasticDragDismissFrameLayout> +</ca.allanwang.kau.widgets.ElasticDragDismissFrameLayout> diff --git a/library/src/main/res/layout/kau_activity_kpref.xml b/library/src/main/res/layout/kau_activity_kpref.xml index b3c0f78..05cacb5 100644 --- a/library/src/main/res/layout/kau_activity_kpref.xml +++ b/library/src/main/res/layout/kau_activity_kpref.xml @@ -24,12 +24,12 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - <ca.allanwang.kau.widgets.KauTextSlider + <ca.allanwang.kau.widgets.TextSlider android:id="@+id/kau_toolbar_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" - app:kau_animation_type="slide_horizontal" /> + app:animation_type="slide_horizontal" /> </android.support.v7.widget.Toolbar> diff --git a/library/src/main/res/layout/kau_recycler_textslider.xml b/library/src/main/res/layout/kau_recycler_textslider.xml index f051902..1402cfb 100644 --- a/library/src/main/res/layout/kau_recycler_textslider.xml +++ b/library/src/main/res/layout/kau_recycler_textslider.xml @@ -13,12 +13,12 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - <ca.allanwang.kau.widgets.KauTextSlider + <ca.allanwang.kau.widgets.TextSlider android:id="@+id/kau_toolbar_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" - app:kau_animation_type="slide_vertical" /> + app:animation_type="slide_vertical" /> </android.support.v7.widget.Toolbar> diff --git a/library/src/main/res/layout/kau_search_view.xml b/library/src/main/res/layout/kau_search_view.xml index cd1c4bd..ff9fd74 100644 --- a/library/src/main/res/layout/kau_search_view.xml +++ b/library/src/main/res/layout/kau_search_view.xml @@ -11,14 +11,14 @@ android:background="@color/kau_shadow_overlay" android:visibility="gone" /> - <ca.allanwang.kau.views.KauBoundedCardView + <ca.allanwang.kau.views.BoundedCardView android:id="@+id/search_cardview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/kau_search_base_margin" android:layout_marginStart="@dimen/kau_search_base_margin" app:cardCornerRadius="@dimen/kau_search_base_corners" - app:kau_maxHeightPercent="0.9"> + app:maxHeightPercent="0.9"> <LinearLayout android:layout_width="match_parent" @@ -108,6 +108,6 @@ </LinearLayout> - </ca.allanwang.kau.views.KauBoundedCardView> + </ca.allanwang.kau.views.BoundedCardView> </merge>
\ No newline at end of file diff --git a/library/src/main/res/values/attr.xml b/library/src/main/res/values/attr.xml index 6a32807..daeb5e3 100644 --- a/library/src/main/res/values/attr.xml +++ b/library/src/main/res/values/attr.xml @@ -1,40 +1,40 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="ResourceName"> - <declare-styleable name="KauBoundedCardView"> - <attr name="kau_maxHeight" format="dimension" /> - <attr name="kau_maxHeightPercent" format="float" /> + <declare-styleable name="BoundedCardView"> + <attr name="maxHeight" format="dimension" /> + <attr name="maxHeightPercent" format="float" /> </declare-styleable> - <declare-styleable name="KauTextSlider"> - <attr name="kau_animation_type" format="enum"> + <declare-styleable name="TextSlider"> + <attr name="animation_type" format="enum"> <enum name="none" value="1000" /> <enum name="slide_horizontal" value="1001" /> <enum name="slide_vertical" value="1002" /> </attr> </declare-styleable> - <declare-styleable name="KauInkPageIndicator"> - <attr name="kau_dotDiameter" format="dimension" /> - <attr name="kau_dotGap" format="dimension" /> - <attr name="kau_animationDuration" format="integer" /> - <attr name="kau_pageIndicatorColor" format="color" /> - <attr name="kau_currentPageIndicatorColor" format="color" /> + <declare-styleable name="InkPageIndicator"> + <attr name="dotDiameter" format="dimension" /> + <attr name="dotGap" format="dimension" /> + <attr name="animationDuration" format="integer" /> + <attr name="pageIndicatorColor" format="color" /> + <attr name="currentPageIndicatorColor" format="color" /> </declare-styleable> - <declare-styleable name="KauElasticDragDismissFrameLayout"> - <attr name="kau_dragDismissDistance" format="dimension" /> - <attr name="kau_dragDismissFraction" format="float" /> - <attr name="kau_dragDismissScale" format="float" /> - <attr name="kau_dragElasticity" format="float" /> + <declare-styleable name="ElasticDragDismissFrameLayout"> + <attr name="dragDismissDistance" format="dimension" /> + <attr name="dragDismissFraction" format="float" /> + <attr name="dragDismissScale" format="float" /> + <attr name="dragElasticity" format="float" /> </declare-styleable> - <declare-styleable name="KauCutoutTextView"> - <attr name="kau_foregroundColor" format="color" /> + <declare-styleable name="CutoutTextView"> + <attr name="foregroundColor" format="color" /> <attr name="android:text" /> <attr name="android:minHeight" /> - <attr name="kau_heightPercentageToScreen" format="float" /> - <attr name="kau_font" format="string" /> + <attr name="heightPercentageToScreen" format="float" /> + <attr name="font"/> </declare-styleable> </resources>
\ No newline at end of file diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index c424284..5e6eb4c 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -23,7 +23,7 @@ android:name=".AnimActivity" android:theme="@style/AppTheme.Slide" /> <activity - android:name=".AboutActivity2" + android:name=".AboutActivity" android:theme="@style/Kau.Translucent.About" /> </application> diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt index 2e4106f..e97c530 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt @@ -1,57 +1,10 @@ package ca.allanwang.kau.sample -import android.os.Bundle -import android.os.Handler import ca.allanwang.kau.about.AboutActivityBase -import ca.allanwang.kau.about.MainItem -import ca.allanwang.kau.adapters.SectionAdapter -import ca.allanwang.kau.logging.KL -import ca.allanwang.kau.utils.string /** * Created by Allan Wang on 2017-06-27. */ class AboutActivity : AboutActivityBase(R.string::class.java) { - val mainHeader = SectionAdapter<MainItem>() - - override fun onCreateSections(): List<Pair<String, SectionAdapter<*>>> = listOf( - // libSection, - String.format(string(R.string.kau_about_x), "KAU") to mainHeader - ) - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - sectionsChain.baseAdapter.withPositionBasedStateManagement(false) - } - - override fun onPostCreate() { - Handler().postDelayed({ - mainHeader.add(MainItem { - title = string(R.string.app_name) - author = "Allan Wang" - version = BuildConfig.VERSION_NAME - }) - mainHeader.add(MainItem { - title = string(R.string.app_name) - author = "Allan Wang" - version = BuildConfig.VERSION_NAME - }) - mainHeader.add(MainItem { }) - mainHeader.add(MainItem { }) - KL.e(R.layout.kau_about_item_library.toString()) - KL.e(R.layout.kau_about_item_main.toString()) - KL.e(R.id.kau_item_about_library.toString()) - KL.e(R.id.kau_item_about_main.toString()) -// KL.e(sectionsChain.baseAdapter.getItemViewType(0).toString()) -// KL.e(sectionsChain.baseAdapter.getItemViewType(6).toString()) - with(sectionsChain.baseAdapter) { - KL.e(mainHeader.adapterItemCount.toString()) - KL.e(getAdapter(1)?.getGlobalPosition(0)?.toString() ?: "") - KL.e((getItem(0) is MainItem).toString()) - KL.e((getItem(6) is MainItem).toString()) -// KL.e((getItem(6) is MainItem).toString()) - } - }, 2000) - } }
\ No newline at end of file diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity2.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity2.kt deleted file mode 100644 index 0e2a3fb..0000000 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity2.kt +++ /dev/null @@ -1,10 +0,0 @@ -package ca.allanwang.kau.sample - -import ca.allanwang.kau.about.AboutActivityBase - -/** - * Created by Allan Wang on 2017-06-27. - */ -class AboutActivity2 : AboutActivityBase(R.string::class.java) { - -}
\ No newline at end of file diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index 46c5968..53fa68e 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -149,7 +149,7 @@ class MainActivity : KPrefActivity() { plainText(R.string.kau_lorem_ipsum) { onClick = { _, _, _ -> - startActivity(AboutActivity2::class.java, transition = true) + startActivity(AboutActivity::class.java, transition = true) false } } |