From cdb1bd6eec2c90abc9d3d982814552443c7fc3b2 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 13 Feb 2018 16:51:56 -0500 Subject: Update docs (#135) * Update docs * Update format * Update dependencies --- .../ca/allanwang/kau/about/AboutActivityBase.kt | 7 +- .../ca/allanwang/kau/about/AboutPanelDelegate.kt | 6 +- .../kotlin/ca/allanwang/kau/about/LibraryIItem.kt | 9 +- .../main/groovy/ca/allanwang/kau/Versions.groovy | 8 +- .../ca/allanwang/kau/colorpicker/CircleView.kt | 20 ++--- .../ca/allanwang/kau/colorpicker/ColorPalette.kt | 2 +- .../allanwang/kau/colorpicker/ColorPickerView.kt | 28 +++---- core-ui/src/main/res-public/values/public.xml | 2 +- .../kotlin/ca/allanwang/kau/email/EmailBuilder.kt | 15 +++- .../kotlin/ca/allanwang/kau/kpref/KPrefDelegate.kt | 4 +- .../ca/allanwang/kau/kpref/KPrefSingleDelegate.kt | 4 +- .../src/main/kotlin/ca/allanwang/kau/logging/KL.kt | 2 + .../kotlin/ca/allanwang/kau/logging/KauLogger.kt | 2 + .../allanwang/kau/permissions/PermissionManager.kt | 11 ++- .../allanwang/kau/permissions/PermissionResult.kt | 2 + .../ca/allanwang/kau/permissions/Permissions.kt | 3 + .../ca/allanwang/kau/ui/views/RippleCanvas.kt | 1 - .../kotlin/ca/allanwang/kau/utils/FontUtils.kt | 2 +- .../kotlin/ca/allanwang/kau/utils/IIconUtils.kt | 3 +- .../kotlin/ca/allanwang/kau/utils/NetworkUtils.kt | 4 + .../kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt | 2 +- .../main/kotlin/ca/allanwang/kau/xml/Changelog.kt | 3 +- core/src/main/res-public/values/public.xml | 96 +++++++++++----------- docs/Changelog.md | 1 + mediapicker/src/main/res-public/values/public.xml | 4 +- 25 files changed, 133 insertions(+), 108 deletions(-) diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt index 442821f..bfbc941 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt @@ -126,7 +126,8 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde * Method to fetch the library list * This is fetched asynchronously and you may override it to customize the list */ - open fun getLibraries(libs: Libs): List = libs.prepareLibraries(this, null, null, true, true)!! + open fun getLibraries(libs: Libs): List = + libs.prepareLibraries(this, null, null, true, true, true)!! /* * ------------------------------------------------------------------- @@ -164,9 +165,9 @@ abstract class AboutActivityBase(val rClass: Class<*>?, private val configBuilde } } - override fun onPageScrollStateChanged(state: Int) {} + override fun onPageScrollStateChanged(state: Int) = Unit - override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} + override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = Unit override fun onPageSelected(position: Int) { if (pageStatus[position] == 0) pageStatus[position] = 1 // mark as seen if previously null diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt index 47b9ac4..b6ea16b 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt @@ -114,7 +114,7 @@ open class AboutPanelMain : AboutPanelRecycler() { override fun inflatePage(activity: AboutActivityBase, parent: ViewGroup, position: Int): View { with(activity) { - adapter = FastItemThemedAdapter>(configs) + adapter = FastItemThemedAdapter(configs) recycler = fullLinearRecycler(adapter) adapter.add(CutoutIItem { with(configs) { @@ -156,7 +156,7 @@ open class AboutPanelLibs : AboutPanelRecycler() { doAsync { with(activity) { items = getLibraries(if (rClass == null) Libs(activity) else Libs(this, Libs.toStringArray(rClass.fields))) - .map { LibraryIItem(it) } + .map(::LibraryIItem) if (pageStatus[position] == 1) uiThread { addItems(activity, position) } } @@ -181,7 +181,7 @@ open class AboutPanelFaqs : AboutPanelRecycler() { override fun loadItems(activity: AboutActivityBase, position: Int) { with(activity) { kauParseFaq(configs.faqXmlRes, configs.faqParseNewLine) { - items = it.map { FaqIItem(it) } + items = it.map(::FaqIItem) if (pageStatus[position] == 1) addItems(activity, position) } diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt index 89906c3..d71f786 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt @@ -47,10 +47,11 @@ class LibraryIItem(val lib: Library) : KauIItem= Build.VERSION_CODES.N) - Html.fromHtml(lib.libraryDescription, Html.FROM_HTML_MODE_LEGACY) - else Html.fromHtml(lib.libraryDescription) + description.text = when { + lib.libraryDescription.isBlank() -> lib.libraryDescription + Build.VERSION.SDK_INT >= Build.VERSION_CODES.N -> Html.fromHtml(lib.libraryDescription, Html.FROM_HTML_MODE_LEGACY) + else -> Html.fromHtml(lib.libraryDescription) + } bottomDivider.gone() if (lib.libraryVersion?.isNotBlank() == true) { bottomDivider.visible() diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy index 4633a4d..36e444d 100644 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy +++ b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy @@ -10,13 +10,13 @@ class Versions { static def kotlin = '1.2.21' - static def aboutLibraries = '6.0.1' + static def aboutLibraries = '6.0.5' static def anko = '0.10.4' static def blurry = '2.1.1' - static def constraintLayout = '1.1.0-beta4' + static def constraintLayout = '1.1.0-beta5' static def fastAdapter = '3.1.2' - static def fastAdapterCommons = '3.1.2' - static def glide = '4.5.0' + static def fastAdapterCommons = fastAdapter + static def glide = '4.6.1' static def iconics = '3.0.2' static def iconicsGoogle = '3.0.1.2' diff --git a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt index 713b800..c74cba1 100644 --- a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt +++ b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt @@ -47,7 +47,6 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet private val innerPaint: Paint = Paint().apply { isAntiAlias = true } private var selected: Boolean = false var withBorder: Boolean = false - get() = field set(value) { if (field != value) { field = value @@ -65,13 +64,13 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet outerPaint.color = shiftColorDown(color) val selector = createSelector(color) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + foreground = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { val states = arrayOf(intArrayOf(android.R.attr.state_pressed)) val colors = intArrayOf(shiftColorUp(color)) val rippleColors = ColorStateList(states, colors) - foreground = RippleDrawable(rippleColors, selector, null) + RippleDrawable(rippleColors, selector, null) } else { - foreground = selector + selector } } @@ -85,20 +84,17 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet setBackgroundColorRes(color) } - - @Deprecated("") + @Deprecated("Cannot use setBackground() on CircleView", level = DeprecationLevel.ERROR) override fun setBackground(background: Drawable) { throw IllegalStateException("Cannot use setBackground() on CircleView.") } - - @Deprecated("") + @Deprecated("Cannot use setBackgroundDrawable() on CircleView", level = DeprecationLevel.ERROR) override fun setBackgroundDrawable(background: Drawable) { throw IllegalStateException("Cannot use setBackgroundDrawable() on CircleView.") } - - @Deprecated("") + @Deprecated("Cannot use setActivated() on CircleView", level = DeprecationLevel.ERROR) override fun setActivated(activated: Boolean) { throw IllegalStateException("Cannot use setActivated() on CircleView.") } @@ -194,10 +190,10 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet cheatSheet.show() } - companion object { + private companion object { @ColorInt - private fun translucentColor(color: Int): Int { + fun translucentColor(color: Int): Int { val factor = 0.7f val alpha = Math.round(Color.alpha(color) * factor) val red = Color.red(color) diff --git a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt index b08767c..68e3461 100644 --- a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt +++ b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt @@ -344,6 +344,6 @@ internal object ColorPalette { "#DD2C00")) } - fun colorArrayOf(vararg colors: String) = colors.map { Color.parseColor(it) }.toIntArray() + private fun colorArrayOf(vararg colors: String) = colors.map { Color.parseColor(it) }.toIntArray() } diff --git a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPickerView.kt b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPickerView.kt index e9da763..778b775 100644 --- a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPickerView.kt +++ b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPickerView.kt @@ -1,5 +1,6 @@ package ca.allanwang.kau.colorpicker +import android.annotation.SuppressLint import android.content.Context import android.graphics.Color import android.support.annotation.ColorInt @@ -29,6 +30,7 @@ internal class ColorPickerView @JvmOverloads constructor( var isInSub: Boolean = false var isInCustom: Boolean = false var circleSize: Int = context.dimen(R.dimen.kau_color_circle_size).toInt() + @SuppressLint("PrivateResource") val backgroundColor = context.resolveColor(R.attr.md_background_color, if (context.resolveColor(android.R.attr.textColorPrimary).isColorDark) Color.WHITE else 0xff424242.toInt()) val backgroundColorTint = backgroundColor.colorToForeground() @@ -52,7 +54,6 @@ internal class ColorPickerView @JvmOverloads constructor( } } - val gridView: FillGridView by bindView(R.id.md_grid) val customFrame: LinearLayout by bindView(R.id.md_colorChooserCustomFrame) val customColorIndicator: View by bindView(R.id.md_colorIndicator) @@ -126,10 +127,10 @@ internal class ColorPickerView @JvmOverloads constructor( override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { - try { - selectedColor = Color.parseColor("#" + s.toString()) + selectedColor = try { + Color.parseColor("#$s") } catch (e: IllegalArgumentException) { - selectedColor = Color.BLACK + Color.BLACK } customColorIndicator.setBackgroundColor(selectedColor) @@ -171,9 +172,9 @@ internal class ColorPickerView @JvmOverloads constructor( blueValue.text = blueSeekbar.progress.toString() } - override fun onStartTrackingTouch(seekBar: SeekBar) {} + override fun onStartTrackingTouch(seekBar: SeekBar) = Unit - override fun onStopTrackingTouch(seekBar: SeekBar) {} + override fun onStopTrackingTouch(seekBar: SeekBar) = Unit } redSeekbar.setOnSeekBarChangeListener(customRgbListener) greenSeekbar.setOnSeekBarChangeListener(customRgbListener) @@ -187,7 +188,7 @@ internal class ColorPickerView @JvmOverloads constructor( findColor(selectedColor) if (builder.allowCustom) dialog.setActionButton(DialogAction.NEUTRAL, builder.customText) dialog.setActionButton(DialogAction.NEGATIVE, if (isInSub) builder.backText else builder.cancelText) - gridView.fadeIn(onStart = { invalidateGrid() }) + gridView.fadeIn(onStart = this::invalidateGrid) customFrame.fadeOut(onFinish = { customFrame.gone() }) hexInput.removeTextChangedListener(customHexTextWatcher) customHexTextWatcher = null @@ -217,11 +218,10 @@ internal class ColorPickerView @JvmOverloads constructor( hexInput.tint(visibleColor) } - fun findColor(@ColorInt color: Int): Boolean { + private fun findColor(@ColorInt color: Int): Boolean { topIndex = -1 subIndex = -1 - colorsTop.forEachIndexed { - index, topColor -> + colorsTop.forEachIndexed { index, topColor -> if (findSubColor(color, index)) { topIndex = index return true @@ -234,10 +234,9 @@ internal class ColorPickerView @JvmOverloads constructor( return false } - fun findSubColor(@ColorInt color: Int, topIndex: Int): Boolean { + private fun findSubColor(@ColorInt color: Int, topIndex: Int): Boolean { if (colorsSub == null || colorsSub!!.size <= topIndex) return false - colorsSub!![topIndex].forEachIndexed { - index, subColor -> + colorsSub!![topIndex].forEachIndexed { index, subColor -> if (subColor == color) { subIndex = index return true @@ -246,7 +245,7 @@ internal class ColorPickerView @JvmOverloads constructor( return false } - fun invalidateGrid() { + private fun invalidateGrid() { if (gridView.adapter == null) { gridView.adapter = ColorGridAdapter() gridView.selector = ResourcesCompat.getDrawable(resources, R.drawable.kau_transparent, null) @@ -303,6 +302,5 @@ internal class ColorPickerView @JvmOverloads constructor( setOnLongClickListener(this@ColorGridAdapter) } } - } } \ No newline at end of file diff --git a/core-ui/src/main/res-public/values/public.xml b/core-ui/src/main/res-public/values/public.xml index dcaa583..193e088 100644 --- a/core-ui/src/main/res-public/values/public.xml +++ b/core-ui/src/main/res-public/values/public.xml @@ -1,8 +1,8 @@ + - diff --git a/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt b/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt index 9dd5bea..804eacb 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt @@ -15,6 +15,8 @@ import ca.allanwang.kau.utils.* /** * Created by Allan Wang on 2017-06-20. + * + * Helper tool to call an email intent with device information */ class EmailBuilder(val email: String, val subject: String) { var message: String = "Write here." @@ -34,6 +36,9 @@ class EmailBuilder(val email: String, val subject: String) { attachment = uri } + /** + * Optional handler to update the created intent + */ var extras: Intent.() -> Unit = {} data class Package(val packageName: String, val appName: String) @@ -72,10 +77,12 @@ class EmailBuilder(val email: String, val subject: String) { } } - if (packages.isNotEmpty()) emailBuilder.append("\n") - packages.forEach { - if (context.isAppInstalled(it.packageName)) - emailBuilder.append(String.format("\n%s is installed", it.appName)) + if (packages.isNotEmpty()) { + emailBuilder.append("\n") + packages.forEach { + if (context.isAppInstalled(it.packageName)) + emailBuilder.append(String.format("\n%s is installed", it.appName)) + } } if (pairs.isNotEmpty()) { diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefDelegate.kt index ca3701b..33ba807 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefDelegate.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefDelegate.kt @@ -21,8 +21,8 @@ class StringSet(set: Collection) : LinkedHashSet(set) * Also contains an optional mutable postSetter that will be called every time a new value is given */ class KPrefDelegate internal constructor( - private val key: String, private val fallback: T, private val pref: KPref, var postSetter: (value: T) -> Unit = {}, lock: Any? = null -) : ILazyResettable, java.io.Serializable { + private val key: String, private val fallback: T, private val pref: KPref, private var postSetter: (value: T) -> Unit = {}, lock: Any? = null +) : ILazyResettable { private object UNINITIALIZED diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt index ff08e3c..6525305 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt @@ -8,8 +8,8 @@ fun KPref.kprefSingle(key: String) = KPrefSingleDelegate(key, this) * Created by Allan Wang on 2017-06-07. * * Singular KPref Delegate for booleans - * When the shared pref is not initialized, it will return true then set the pref to false - * All subsequent retrievals will be false + * When the shared pref is not initialized, it will return [true] then set the pref to [false] + * All subsequent retrievals will be [false] * This is useful for one time toggles such as showcasing items */ class KPrefSingleDelegate internal constructor(private val key: String, private val pref: KPref, lock: Any? = null) : ILazyResettable { diff --git a/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt b/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt index f690571..9f48ab5 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/logging/KL.kt @@ -4,5 +4,7 @@ import ca.allanwang.kau.BuildConfig /** * Created by Allan Wang on 2017-06-19. + * + * Internal KAU logger */ object KL : KauLogger("KAU", { BuildConfig.DEBUG }) \ No newline at end of file diff --git a/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt b/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt index e639867..799d32f 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt @@ -21,6 +21,8 @@ import android.util.Log * inline fun _d(message: () -> Any?) { * if (BuildConfig.DEBUG) d(message) * } + * This use case allows for a constant boolean check, which should be caught and removed by proguard + * for production builds */ open class KauLogger( /** 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 8b639ad..3b15e0b 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt @@ -15,6 +15,9 @@ import java.lang.ref.WeakReference /** * Created by Allan Wang on 2017-07-03. + * + * Permission manager that is decoupled from activities + * Keeps track of pending requests, and warns about invalid requests */ internal object PermissionManager { @@ -24,7 +27,7 @@ internal object PermissionManager { /** * Retrieve permissions requested in our manifest */ - val manifestPermission = lazyContext> { + private val manifestPermission = lazyContext> { try { it.packageManager.getPackageInfo(it.packageName, PackageManager.GET_PERMISSIONS)?.requestedPermissions ?: emptyArray() } catch (e: Exception) { @@ -44,7 +47,7 @@ internal object PermissionManager { } else KL.d { "Request is postponed since another one is still in progress; did you remember to override onRequestPermissionsResult?" } } - @Synchronized internal fun requestPermissions(context: Context, permissions: Array) { + @Synchronized private fun requestPermissions(context: Context, permissions: Array) { permissions.forEach { if (!manifestPermission(context).contains(it)) { KL.e { "Requested permission $it is not stated in the manifest" } @@ -57,6 +60,10 @@ internal object PermissionManager { ActivityCompat.requestPermissions(activity, permissions, 1) } + /** + * Handles permission result by allowing accepted permissions for all pending requests + * Also cleans up destroyed or completed pending requests + */ fun onRequestPermissionsResult(context: Context, permissions: Array, grantResults: IntArray) { KL.i { "On permission result: pending ${pendingResults.size}" } val count = Math.min(permissions.size, grantResults.size) diff --git a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionResult.kt b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionResult.kt index 14bfdff..ba3e6dd 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionResult.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionResult.kt @@ -4,6 +4,8 @@ import android.content.pm.PackageManager /** * Created by Allan Wang on 2017-07-03. + * + * Pending permission collector */ class PermissionResult(permissions: Array, val callback: (granted: Boolean, deniedPerm: String?) -> Unit) { val permissions = mutableSetOf(*permissions) diff --git a/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt b/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt index 36ad52f..4de6695 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt @@ -3,6 +3,8 @@ package ca.allanwang.kau.permissions import android.Manifest import android.app.Activity import android.content.Context +import android.os.Build +import android.support.annotation.RequiresApi /** @@ -60,6 +62,7 @@ const val PERMISSION_ADD_VOICEMAIL = Manifest.permission.ADD_VOICEMAIL const val PERMISSION_USE_SIP = Manifest.permission.USE_SIP const val PERMISSION_PROCESS_OUTGOING_CALLS = Manifest.permission.PROCESS_OUTGOING_CALLS +@RequiresApi(Build.VERSION_CODES.KITKAT_WATCH) const val PERMISSION_BODY_SENSORS = Manifest.permission.BODY_SENSORS const val PERMISSION_SEND_SMS = Manifest.permission.SEND_SMS diff --git a/core/src/main/kotlin/ca/allanwang/kau/ui/views/RippleCanvas.kt b/core/src/main/kotlin/ca/allanwang/kau/ui/views/RippleCanvas.kt index 86aba6e..62a16d9 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/ui/views/RippleCanvas.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/ui/views/RippleCanvas.kt @@ -12,7 +12,6 @@ import android.view.View /** * Created by Allan Wang on 2016-11-17. * - * * Canvas drawn ripples that keep the previous color * Extends to view dimensions * Supports multiple ripples from varying locations diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt index 3fc509d..05073c7 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt @@ -8,7 +8,7 @@ import android.graphics.Typeface */ object FontUtils { - val sTypefaceCache: MutableMap = mutableMapOf() + private val sTypefaceCache: MutableMap = mutableMapOf() fun get(context: Context, font: String): Typeface { synchronized(sTypefaceCache) { 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 a8c710e..51691af 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt @@ -14,7 +14,8 @@ import com.mikepenz.iconics.typeface.IIcon @KauUtils fun IIcon.toDrawable(c: Context, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {}): Drawable { val state = ColorStateList.valueOf(color) - val icon = IconicsDrawable(c).icon(this).sizeDp(sizeDp).color(state) + val icon = IconicsDrawable(c).icon(this).color(state) + if (sizeDp > 0) icon.sizeDp(sizeDp) icon.builder() return icon } \ No newline at end of file diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt index 53016be..2271c16 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt @@ -1,5 +1,6 @@ package ca.allanwang.kau.utils +import android.annotation.SuppressLint import android.content.Context import android.net.ConnectivityManager @@ -7,6 +8,7 @@ import android.net.ConnectivityManager * Created by Allan Wang on 2017-07-07. */ inline val Context.isNetworkAvailable: Boolean + @SuppressLint("MissingPermission") get() { val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val activeNetworkInfo = connectivityManager.activeNetworkInfo @@ -14,6 +16,7 @@ inline val Context.isNetworkAvailable: Boolean } inline val Context.isWifiConnected: Boolean + @SuppressLint("MissingPermission") get() { val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val activeNetworkInfo = connectivityManager.activeNetworkInfo @@ -21,6 +24,7 @@ inline val Context.isWifiConnected: Boolean } inline val Context.isMobileDataConnected: Boolean + @SuppressLint("MissingPermission") get() { val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val activeNetworkInfo = connectivityManager.activeNetworkInfo diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt index f80c85e..3a34db5 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt @@ -13,7 +13,7 @@ fun RecyclerView.withMarginDecoration(sizeDp: Int, edgeFlags: Int) { class MarginItemDecoration(sizeDp: Int, val edgeFlags: Int) : RecyclerView.ItemDecoration() { - val sizePx = sizeDp.dpToPx + private val sizePx = sizeDp.dpToPx override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { super.getItemOffsets(outRect, view, parent, state) diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt index cbebd55..83b182f 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt @@ -23,8 +23,9 @@ import org.xmlpull.v1.XmlPullParser /** * Created by Allan Wang on 2017-05-28. + * + * Easy changelog loader */ - fun Context.showChangelog(@XmlRes xmlRes: Int, @ColorInt textColor: Int? = null, customize: MaterialDialog.Builder.() -> Unit = {}) { doAsync { val items = parse(this@showChangelog, xmlRes) diff --git a/core/src/main/res-public/values/public.xml b/core/src/main/res-public/values/public.xml index f831c6d..2163b10 100644 --- a/core/src/main/res-public/values/public.xml +++ b/core/src/main/res-public/values/public.xml @@ -1,29 +1,56 @@ - - - - - - - - - - - - - - + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -79,7 +106,8 @@ - + + @@ -87,32 +115,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/Changelog.md b/docs/Changelog.md index 2b8f6d1..782db6e 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -3,6 +3,7 @@ ## v3.6.3 * :core: Check for tablet in email builder * :kpref-activity: Simplify internal code and add better encapsulation +* :kpref-activity: Disable seekbar when kprefseekbar is disabled * Add Chinese, Indonesian, Norwegian, Polish, Thai, and Turkish translations * Add back git versioning * Created gradle plugin for getting version updates diff --git a/mediapicker/src/main/res-public/values/public.xml b/mediapicker/src/main/res-public/values/public.xml index 3c6f0fa..ac608bb 100644 --- a/mediapicker/src/main/res-public/values/public.xml +++ b/mediapicker/src/main/res-public/values/public.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file -- cgit v1.2.3