Skip to content

Commit

Permalink
Update. Close #10. Close #11. Fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
jahirfiquitiva committed Jan 31, 2018
1 parent 1846052 commit 0f0b5f2
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 35 deletions.
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ ext.versions = [
buildTools : '27.0.3',
// Gradle Plugins
gradle : '3.0.1',
kotlin : '1.2.20',
kotlin : '1.2.21',
libs : '2.0',
// App Versions:
versionCode : 115,
versionName : '1.1.5',
versionCode : 116,
versionName : '1.1.6',
// Dependencies
frames : '2.1.8',
frames : '2.1.9',
bottomNav : '2.1.0',
oneSignal : '3.7.1'
]
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@
*/
package jahirfiquitiva.libs.kuper.data.models

import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.net.Uri
import android.support.annotation.ColorInt
import jahirfiquitiva.libs.kuper.helpers.utils.KLCK_PACKAGE
import jahirfiquitiva.libs.kuper.helpers.utils.KLCK_PICKER
import jahirfiquitiva.libs.kuper.helpers.utils.KLWP_PACKAGE
import jahirfiquitiva.libs.kuper.helpers.utils.KLWP_PICKER
import jahirfiquitiva.libs.kuper.helpers.utils.KWGT_PACKAGE
import jahirfiquitiva.libs.kuper.helpers.utils.KWGT_PICKER

data class KuperKomponent(
val type: Type,
Expand Down Expand Up @@ -47,8 +54,15 @@ data class KuperKomponent(
val rightLandPath = if (hasIntent) previewLandPath else previewPath

fun getIntent(context: Context): Intent? {
return if (hasIntent) {
val intent = Intent()
if (hasIntent) {
val component: ComponentName = when (type) {
KuperKomponent.Type.WALLPAPER -> ComponentName(KLWP_PACKAGE, KLWP_PICKER)
KuperKomponent.Type.WIDGET -> ComponentName(KWGT_PACKAGE, KWGT_PICKER)
KuperKomponent.Type.LOCKSCREEN -> ComponentName(KLCK_PACKAGE, KLCK_PICKER)
else -> null
} ?: return null

val intent = Intent().apply { setComponent(component) }
try {
intent.data = Uri.Builder()
.scheme("kfile")
Expand All @@ -58,8 +72,8 @@ data class KuperKomponent(
} catch (e: Exception) {
intent.data = Uri.parse("kfile://${context.packageName}/$path")
}
intent
} else null
return intent
} else return null
}

enum class Type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package jahirfiquitiva.libs.kuper.helpers.utils

const val KWGT_PACKAGE = "org.kustom.widget.pro"
const val KLWP_PACKAGE = "org.kustom.wallpaper.pro"
const val KLCK_PACKAGE = "org.kustom.lockscreen.pro"
const val KWGT_PACKAGE = "org.kustom.widget"
const val KLWP_PACKAGE = "org.kustom.wallpaper"
const val KLCK_PACKAGE = "org.kustom.lockscreen"
const val KWGT_PICKER = "org.kustom.widget.picker.WidgetPicker"
const val KLWP_PICKER = "org.kustom.lib.editor.WpAdvancedEditorActivity"
const val KLCK_PICKER = "org.kustom.lib.editor.LockAdvancedEditorActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ import jahirfiquitiva.libs.kuper.R

class CreditsActivity : CreditsActivity() {
override fun getDashboardTitle(): Int = R.string.kuper_dashboard
override fun getTranslationSite(): String = "http://j.mp/KuperTranslations"
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ import jahirfiquitiva.libs.kauextensions.extensions.getBoolean
import jahirfiquitiva.libs.kauextensions.extensions.getPrimaryTextColorFor
import jahirfiquitiva.libs.kauextensions.extensions.getSecondaryTextColorFor
import jahirfiquitiva.libs.kauextensions.extensions.hasContent
import jahirfiquitiva.libs.kauextensions.extensions.hideAllItems
import jahirfiquitiva.libs.kauextensions.extensions.inactiveIconsColor
import jahirfiquitiva.libs.kauextensions.extensions.primaryColor
import jahirfiquitiva.libs.kauextensions.extensions.showAllItems
import jahirfiquitiva.libs.kauextensions.extensions.tint
import jahirfiquitiva.libs.kauextensions.ui.fragments.adapters.FragmentsAdapter
import jahirfiquitiva.libs.kauextensions.ui.widgets.SearchView
import jahirfiquitiva.libs.kauextensions.ui.widgets.bindSearchView
import jahirfiquitiva.libs.kauextensions.ui.widgets.CustomSearchView
import jahirfiquitiva.libs.kuper.R
import jahirfiquitiva.libs.kuper.helpers.extensions.inAssetsAndWithContent
import jahirfiquitiva.libs.kuper.helpers.extensions.kuperKonfigs
Expand All @@ -63,7 +64,7 @@ abstract class KuperActivity : BaseFramesActivity() {
private val bottomNavigation: AHBottomNavigation by bind(R.id.bottom_navigation)
private val pager: PseudoViewPager by bind(R.id.pager)

private var searchView: SearchView? = null
private var searchView: CustomSearchView? = null

private var currentItemId = 0

Expand Down Expand Up @@ -159,24 +160,22 @@ abstract class KuperActivity : BaseFramesActivity() {
it.changeOptionVisibility(R.id.about, getBoolean(R.bool.isKuper))
it.changeOptionVisibility(R.id.settings, getBoolean(R.bool.isKuper))

searchView = bindSearchView(it, R.id.search)
searchView?.listener = object : SearchView.SearchListener {
override fun onQueryChanged(query: String) {
doSearch(query)
}

override fun onQuerySubmit(query: String) {
doSearch(query)
}

override fun onSearchOpened(searchView: SearchView) {}

override fun onSearchClosed(searchView: SearchView) {
doSearch()
}
val searchItem = it.findItem(R.id.search)
searchView = searchItem.actionView as CustomSearchView?
searchView?.onExpand = { it.hideAllItems() }
searchView?.onCollapse = {
it.showAllItems()
doSearch()
}
searchView?.onQueryChanged = { doSearch(it) }
searchView?.onQuerySubmit = { doSearch(it) }
searchView?.bindToItem(searchItem)

val hint = bottomNavigation.getItem(currentItemId)?.getTitle(this).orEmpty()
searchView?.hintText = getString(R.string.search_x, hint.toLowerCase())
searchView?.queryHint = getString(R.string.search_x, hint.toLowerCase())

searchView?.tint(getPrimaryTextColorFor(primaryColor, 0.6F))
it.tint(getActiveIconsColorFor(primaryColor, 0.6F))
}

toolbar.tint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ import jahirfiquitiva.libs.kuper.ui.fragments.SettingsFragment

class SettingsActivity : SettingsActivity() {
override fun settingsFragment(): Fragment = SettingsFragment()
override fun getTranslationSite(): String = "http://j.mp/KuperTranslations"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import ca.allanwang.kau.utils.setPaddingBottom
import com.bumptech.glide.Glide
import com.pluscubed.recyclerfastscroll.RecyclerFastScroller
import jahirfiquitiva.libs.archhelpers.ui.fragments.ViewModelFragment
import jahirfiquitiva.libs.frames.helpers.extensions.buildMaterialDialog
import jahirfiquitiva.libs.frames.helpers.utils.PLAY_STORE_LINK_PREFIX
import jahirfiquitiva.libs.frames.ui.widgets.EmptyViewRecyclerView
import jahirfiquitiva.libs.kauextensions.extensions.actv
Expand Down Expand Up @@ -155,7 +156,6 @@ class KuperFragment : ViewModelFragment<KuperKomponent>() {
} catch (e: Exception) {
val itemPkg = when (item.type) {
KuperKomponent.Type.ZOOPER -> ZOOPER_PACKAGE
KuperKomponent.Type.KOMPONENT,
KuperKomponent.Type.WALLPAPER -> KLWP_PACKAGE
KuperKomponent.Type.WIDGET -> KWGT_PACKAGE
KuperKomponent.Type.LOCKSCREEN -> KLCK_PACKAGE
Expand All @@ -164,7 +164,15 @@ class KuperFragment : ViewModelFragment<KuperKomponent>() {
if (itemPkg.hasContent())
contxt.openLink(PLAY_STORE_LINK_PREFIX + itemPkg)
}
}
} ?: {
if (item.type == KuperKomponent.Type.KOMPONENT) {
contxt.buildMaterialDialog {
title(R.string.komponents)
content(R.string.open_komponents)
positiveText(android.R.string.ok)
}.show()
}
}()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import jahirfiquitiva.libs.frames.ui.fragments.SettingsFragment
class SettingsFragment : SettingsFragment() {
override fun initPreferences() {
super.initPreferences()
val storagePrefs = findPreference("storage_settings") as PreferenceCategory
val storagePrefs = findPreference("storage_settings") as? PreferenceCategory
val dbPref = findPreference("clear_database")
storagePrefs.removePreference(dbPref)
if (dbPref != null) storagePrefs?.removePreference(dbPref)
}
}
1 change: 1 addition & 0 deletions library/src/main/res/values/private_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
<string name="media_utils">Media Utilities</string>
<string name="kolorette">Kolorette</string>
<bool name="isKuper">true</bool>
<bool name="isFrames">false</bool>
</resources>
1 change: 1 addition & 0 deletions library/src/main/res/values/translatable_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@
<string name="permission_request_assets">%1$s requires access to storage in order to be able to install assets</string>
<string name="permission_request_wallpaper">%1$s requires access to storage in order to be able to show your wallpaper in widgets previews</string>

<string name="open_komponents">In order to add a Komponent, open Kustom and press + on the editor Toolbar, then select Komponent and find this pack.</string>
</resources>

0 comments on commit 0f0b5f2

Please sign in to comment.