diff options
author | Allan Wang <me@allanwang.ca> | 2019-08-16 00:24:22 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-08-16 00:24:22 -0700 |
commit | 71dcceaf1970873596a59a734f1a574120beff6b (patch) | |
tree | d8d79984f591ec5fc43ac93a15715eaef9b887d3 /core/src/main/kotlin/ca | |
parent | d6f213563be35b183f81e20e95d925dbd65e4694 (diff) | |
parent | a9407288fad0d30e71e2f6862b66533e043f9311 (diff) | |
download | kau-71dcceaf1970873596a59a734f1a574120beff6b.tar.gz kau-71dcceaf1970873596a59a734f1a574120beff6b.tar.bz2 kau-71dcceaf1970873596a59a734f1a574120beff6b.zip |
Fix conflicts
Diffstat (limited to 'core/src/main/kotlin/ca')
12 files changed, 24 insertions, 25 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt index 96adfa3..b549523 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt @@ -82,7 +82,7 @@ internal object PermissionManager { if (!manifestPermission(context).contains(it)) { KL.e { "Requested permission $it is not stated in the manifest" } context.toast("$it is not in the manifest") - //we'll let the request pass through so it can be denied and so the callback can be triggered + // we'll let the request pass through so it can be denied and so the callback can be triggered } } val activity = (context as? Activity) diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt index 0b1dd88..9f23b63 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt @@ -37,7 +37,7 @@ internal class RelativeSlider(var curPage: SwipeBackPage) : SwipeListener { * Set offset of previous page based on the edge flag and percentage scrolled */ override fun onScroll(percent: Float, px: Int, edgeFlag: Int) { - if (offset == 0f) return //relative slider is not enabled + if (offset == 0f) return // relative slider is not enabled val page = SwipeBackHelper.getPrePage(curPage) ?: return if (percent == 0f) { page.swipeBackLayout.x = 0f diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt index 1c6de12..0cb6935 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackHelper.kt @@ -57,7 +57,7 @@ internal object SwipeBackHelper { fun finish(activity: Activity) = this[activity]?.scrollToFinishActivity() internal fun getPrePage(page: SwipeBackPage): SwipeBackPage? { - //clean invalid pages + // clean invalid pages pageStack.kauRemoveIf { it.activityRef.get() == null } return pageStack.getOrNull(pageStack.indexOf(page) - 1) } diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt index 0fb0046..921cd1f 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt @@ -167,7 +167,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( dragHelper = ViewDragHelper.create(this, ViewDragCallback()) val density = resources.displayMetrics.density val minVel = MIN_FLING_VELOCITY * density - //allow touch from anywhere on the screen + // allow touch from anywhere on the screen edgeSize = Math.max(resources.displayMetrics.widthPixels, resources.displayMetrics.heightPixels) minVelocity = minVel // maxVelocity = 2.5f * minVel @@ -371,7 +371,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( super.onViewPositionChanged(changedView, left, top, dx, dy) val contentView = contentViewRef.get() ?: return KL.e { "KauSwipe cannot change view position as contentView is null; is onPostCreate called?" } - //make sure that we are using the proper axis + // make sure that we are using the proper axis scrollPercent = Math.abs( if (horizontal) left.toFloat() / contentView.width else (top.toFloat() / contentView.height) @@ -399,7 +399,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( override fun onViewReleased(releasedChild: View, xvel: Float, yvel: Float) { var result = Pair(0, 0) if (scrollPercent <= scrollThreshold) { - //threshold not met; check velocities + // threshold not met; check velocities if ((edgeFlag == SWIPE_EDGE_LEFT && xvel > MIN_FLING_VELOCITY) || (edgeFlag == SWIPE_EDGE_RIGHT && xvel < -MIN_FLING_VELOCITY) || (edgeFlag == SWIPE_EDGE_TOP && yvel > MIN_FLING_VELOCITY) || @@ -407,7 +407,7 @@ internal class SwipeBackLayout @JvmOverloads constructor( ) result = exitCaptureOffsets(edgeFlag, releasedChild) } else { - //threshold met; fling to designated side + // threshold met; fling to designated side result = exitCaptureOffsets(edgeFlag, releasedChild) } dragHelper.settleCapturedViewAt(result.first, result.second) diff --git a/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt index 8800c2d..b1e442f 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/ui/views/MeasureSpecDelegate.kt @@ -122,7 +122,7 @@ class MeasureSpecDelegate : MeasureSpecContract { if (relativeWidthToParent > 0) { width = relativeWidthToParent * parentFrame.width() } - //second cycle - relative to each other + // second cycle - relative to each other if (relativeHeight > 0) { height = relativeHeight * width } else if (relativeWidth > 0) { diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt index 3b593a6..279bcd3 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt @@ -85,7 +85,7 @@ inline fun Activity.restart(intentBuilder: Intent.() -> Unit = {}) { i.putExtras(oldExtras) i.intentBuilder() startActivity(i) - overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_fade_out) //No transitions + overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_fade_out) // No transitions finish() overridePendingTransition(R.anim.kau_fade_in, R.anim.kau_fade_out) } diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt index 3de0297..ab7b341 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt @@ -157,7 +157,7 @@ fun String.toColor(): Int { return Color.parseColor(toParse) } -//Get ColorStateList +// Get ColorStateList fun Context.colorStateList(@ColorInt color: Int): ColorStateList { val disabledColor = color.adjustAlpha(0.3f) return ColorStateList( diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt index 2f552ed..cf68066 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -119,7 +119,7 @@ fun Context.startLink(vararg url: String?) { fun Context.startLink(@StringRes url: Int) = startLink(string(url)) -//Toast helpers +// Toast helpers inline fun View.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG, log: Boolean = false) = context.toast(id, duration, log) @@ -136,7 +136,7 @@ inline fun Context.toast(text: String, duration: Int = Toast.LENGTH_LONG, log: B const val INVALID_ID = 0 -//Resource retrievers +// Resource retrievers inline fun Context.string(@StringRes id: Int): String = getString(id) inline fun Context.string(@StringRes id: Int, fallback: String?): String? = @@ -167,7 +167,7 @@ inline fun Context.animation(@AnimRes id: Int) = AnimationUtils.loadAnimation(th inline fun Context.plural(@PluralsRes id: Int, quantity: Number) = resources.getQuantityString(id, quantity.toInt(), quantity.toInt()) -//Attr retrievers +// Attr retrievers fun Context.resolveColor(@AttrRes attr: Int, @ColorInt fallback: Int = 0): Int { val a = theme.obtainStyledAttributes(intArrayOf(attr)) try { diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt index 52ea57d..dc7b214 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt @@ -20,8 +20,7 @@ import android.graphics.Color import android.graphics.drawable.Drawable import androidx.annotation.ColorInt import com.mikepenz.iconics.IconicsDrawable -import com.mikepenz.iconics.colorInt -import com.mikepenz.iconics.sizeDp +import com.mikepenz.iconics.dsl.iconicsDrawable import com.mikepenz.iconics.typeface.IIcon /** @@ -33,9 +32,9 @@ fun IIcon.toDrawable( sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {} -): Drawable { - val icon = IconicsDrawable(c).icon(this).colorInt(color) - if (sizeDp > 0) icon.sizeDp(sizeDp) - icon.builder() - return icon -} +): Drawable = c.iconicsDrawable(this) { + this.color = colorInt(color) + if (sizeDp > 0) { + size = sizeDp(sizeDp) + } +}.apply(builder) diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt index aaef160..fac9421 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt @@ -246,7 +246,7 @@ private fun <T, V : View> requiredResettable(ids: IntArray, finder: T.(Int) -> V private fun <T, V : View> optionalResettable(ids: IntArray, finder: T.(Int) -> View?) = LazyResettable { t: T, _ -> ids.map { t.finder(it) as V? }.filterNotNull() } -//Like Kotterknife's lazy delegate but is resettable +// Like Kotterknife's lazy delegate but is resettable private class LazyResettable<in T, out V>(initializer: (T, KProperty<*>) -> V) : Lazy<T, V>(initializer) { override fun getValue(thisRef: T, property: KProperty<*>): V { KotterknifeRegistry.register(thisRef!!, this) diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt index 4055847..0bd534e 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt @@ -54,13 +54,13 @@ fun Context.isAppEnabled(packageName: String): Boolean { @KauUtils fun Context.showAppInfo(packageName: String) { try { - //Open the specific App Info page: + // Open the specific App Info page: val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) intent.data = Uri.parse("package:$packageName") startActivity(intent) } catch (e: ActivityNotFoundException) { e.printStackTrace() - //Open the generic Apps page: + // Open the generic Apps page: val intent = Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS) startActivity(intent) } diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt index 73d7d6c..afde735 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt @@ -43,7 +43,7 @@ fun Context.kauParseFaq( resources.getXml(xmlRes).use { parser: XmlResourceParser -> var eventType = parser.eventType var question: Spanned? = null - var flag = -1 //-1, 0, 1 -> invalid, question, answer + var flag = -1 // -1, 0, 1 -> invalid, question, answer while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { flag = when (parser.name) { |