Skip to content

Commit

Permalink
Update (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
jahirfiquitiva authored May 5, 2018
1 parent 9b15e2f commit 0b300d3
Show file tree
Hide file tree
Showing 107 changed files with 2,669 additions and 2,646 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ proguard/
/.idea/dictionaries
/.idea/inspectionProfiles
/.idea/libraries
/.idea/caches
/.idea/codeStyles
/.idea/markdown-navigator
/.idea/*.xml
#gradle.properties
Expand All @@ -88,4 +90,4 @@ proguard/
/captures
/projectFilesBackup
/reports
/report
/report
63 changes: 34 additions & 29 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ ext.versions = [
targetSdk : 27,
buildTools : '27.0.3',
// Versions:
versionCode : 113,
versionName : '1.1.3',
versionCode : 114,
versionName : '1.1.4',
// Gradle Plugins
gradle : '3.0.1',
kotlin : '1.2.21',
gradle : '3.1.1',
kotlin : '1.2.41',
libs : '2.0',
// Dependencies
kuper : '1.3.0',
materialDrawer: '6.0.6',
kuper : '1.3.1',
materialDrawer: '6.0.7',
counterFab : '1.0.3',
bridge : '5.1.2',
oneSignal : '3.7.1'
oneSignal : '3.8.3'
]

ext.gradlePlugins = [
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 @@ -19,4 +19,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ tasks.whenTaskAdded { task ->
}
}

apply from: '../lib-artifacts.gradle'
apply from: '../lib-artifacts.gradle'
4 changes: 3 additions & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
package="jahirfiquitiva.libs.blueprint">

<uses-permission android:name="com.android.vending.CHECK_LICENSE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@
package jahirfiquitiva.libs.blueprint.helpers.extensions

import android.content.Context
import android.support.v4.app.Fragment
import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.helpers.utils.BPKonfigs
import jahirfiquitiva.libs.kauextensions.extensions.ctxt
import jahirfiquitiva.libs.kauextensions.ui.activities.ThemedActivity
import java.util.concurrent.TimeUnit

internal val Context.bpKonfigs: BPKonfigs
get() = BPKonfigs(this)
@Suppress("DEPRECATION", "UNCHECKED_CAST")
internal val Fragment.configs: BPKonfigs
get() = (activity as? ThemedActivity<BPKonfigs>)?.configs
?: activity?.let { BPKonfigs(it) }
?: context?.let { BPKonfigs(it) }
?: BPKonfigs(ctxt)

fun Context.millisToText(millis: Long): String {
when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.startLink
import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.data.models.Launcher
import jahirfiquitiva.libs.frames.helpers.extensions.jfilter
import jahirfiquitiva.libs.frames.helpers.utils.PLAY_STORE_LINK_PREFIX
import jahirfiquitiva.libs.kauextensions.extensions.showToast
import jahirfiquitiva.libs.kauextensions.extensions.stringArray
Expand Down Expand Up @@ -138,7 +139,7 @@ internal val Context.supportedLaunchers: ArrayList<Launcher>
internal val Context.enabledLaunchers: ArrayList<Launcher>
get() {
val enabled = stringArray(R.array.launchers)
return ArrayList(supportedLaunchers.filter { enabled.contains(it.key) })
return supportedLaunchers.jfilter { enabled.contains(it.key) }
}

fun Context.executeLauncherIntent(launcherKey: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import ca.allanwang.kau.utils.integer
import jahirfiquitiva.libs.archhelpers.tasks.QAsync
import jahirfiquitiva.libs.blueprint.BuildConfig
import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.helpers.extensions.bpKonfigs
import jahirfiquitiva.libs.blueprint.helpers.utils.BPKonfigs
import jahirfiquitiva.libs.blueprint.quest.App
import jahirfiquitiva.libs.blueprint.quest.IconRequest
import jahirfiquitiva.libs.blueprint.quest.events.RequestsCallback
Expand Down Expand Up @@ -161,7 +161,7 @@ class RequestsViewModel : ViewModel() {
.filterXmlId(R.xml.appfilter)
.withTimeLimit(
context.integer(R.integer.time_limit_in_minutes),
context.bpKonfigs.prefs)
BPKonfigs(context).prefs)
.maxSelectionCount(context.integer(R.integer.max_apps_to_request))
.setCallback(callback)
.build().loadApps(onProgress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ import jahirfiquitiva.libs.blueprint.quest.utils.saveAll
import jahirfiquitiva.libs.blueprint.quest.utils.saveIcon
import jahirfiquitiva.libs.blueprint.quest.utils.wipe
import jahirfiquitiva.libs.blueprint.quest.utils.zip
import jahirfiquitiva.libs.frames.helpers.extensions.jfilter
import jahirfiquitiva.libs.kauextensions.extensions.getAppName
import jahirfiquitiva.libs.kauextensions.extensions.getUri
import jahirfiquitiva.libs.kauextensions.extensions.hasContent
import jahirfiquitiva.libs.kauextensions.extensions.readBoolean
import jahirfiquitiva.libs.kauextensions.extensions.readEnum
import jahirfiquitiva.libs.kauextensions.extensions.writeBoolean
import jahirfiquitiva.libs.kauextensions.extensions.writeEnum
import okhttp3.MultipartBody
import org.json.JSONObject
import org.xmlpull.v1.XmlPullParser
import java.io.File
Expand Down Expand Up @@ -176,7 +178,7 @@ class IconRequest private constructor() {
request = this
}

@IntDef(STATE_NORMAL.toLong(), STATE_LIMITED.toLong(), STATE_TIME_LIMITED.toLong())
@IntDef(STATE_NORMAL, STATE_LIMITED, STATE_TIME_LIMITED)
@Retention(AnnotationRetention.SOURCE)
annotation class State

Expand Down Expand Up @@ -804,22 +806,25 @@ class IconRequest private constructor() {
}

if (uploadToArctic) {

Bridge.config()
.host(host)
.defaultHeader("TokenID", apiKey)
.defaultHeader("Accept", "application/json")
.defaultHeader("User-Agent", "afollestad/icon-request")
.validators(RemoteValidator())

try {
val zipFile = buildZip(
date,
ArrayList(arcticZipFiles.filter { it.name.endsWith("png", true) }))
date, arcticZipFiles.jfilter { it.name.endsWith("png", true) })
cleanFiles()
if (zipFile != null) {
val form = MultipartForm()
form.add("archive", zipFile)
form.add("apps", JSONObject(jsonSb?.toString().orEmpty()).toString())

post("/v1/request").throwIfNotSuccess().body(form).request()

BPLog.d { "Request uploaded to the server!" }

val amount = requestsLeft - selectedApps.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package jahirfiquitiva.libs.blueprint.quest.utils

import android.content.Context
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import jahirfiquitiva.libs.blueprint.helpers.utils.BPLog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ import android.content.pm.ResolveInfo

internal class NameComparator(private val mPM: PackageManager) : Comparator<ResolveInfo> {
override fun compare(ra: ResolveInfo, rb: ResolveInfo): Int {
var sa: CharSequence = ra.loadLabel(mPM) ?: ""
if (!sa.hasContent()) {
sa = ra.activityInfo.packageName
try {
var sa: CharSequence = ra.loadLabel(mPM) ?: ""
var sb: CharSequence = rb.loadLabel(mPM) ?: ""

if (!sa.hasContent()) sa = ra.activityInfo.packageName
if (!sb.hasContent()) sb = rb.activityInfo.packageName

if (!sa.hasContent() && !sb.hasContent()) return 0
if (!sa.hasContent()) return -1
if (!sb.hasContent()) return 1
return sa.toString().compareTo(sb.toString())
} catch (e: Exception) {
return 0
}
var sb: CharSequence = rb.loadLabel(mPM) ?: ""
if (!sa.hasContent()) {
sb = rb.activityInfo.packageName
}
return sa.toString().compareTo(sb.toString())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ package jahirfiquitiva.libs.blueprint.ui.activities

import com.github.javiersantos.piracychecker.PiracyChecker
import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.helpers.utils.BPKonfigs
import jahirfiquitiva.libs.kuper.ui.activities.KuperActivity

class BlueprintKuperActivity : KuperActivity() {
override val configs: BPKonfigs by lazy { BPKonfigs(this) }
override fun getLicKey(): String? = ""
override fun getLicenseChecker(): PiracyChecker? = null
override fun amazonInstallsEnabled(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
package jahirfiquitiva.libs.blueprint.ui.activities

import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.helpers.utils.BPKonfigs
import jahirfiquitiva.libs.frames.ui.activities.CreditsActivity

class CreditsActivity : CreditsActivity() {
override val configs: BPKonfigs by lazy { BPKonfigs(this) }
override fun lightTheme(): Int = R.style.BlueprintLightTheme
override fun darkTheme(): Int = R.style.BlueprintDarkTheme
override fun amoledTheme(): Int = R.style.BlueprintAmoledTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import android.view.MenuItem
import ca.allanwang.kau.email.sendEmail
import com.pluscubed.recyclerfastscroll.RecyclerFastScroller
import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.helpers.utils.BPKonfigs
import jahirfiquitiva.libs.blueprint.ui.adapters.HelpAdapter
import jahirfiquitiva.libs.blueprint.ui.adapters.HelpItem
import jahirfiquitiva.libs.frames.helpers.extensions.jfilter
import jahirfiquitiva.libs.frames.ui.widgets.EmptyViewRecyclerView
import jahirfiquitiva.libs.kauextensions.extensions.bind
import jahirfiquitiva.libs.kauextensions.extensions.getActiveIconsColorFor
Expand All @@ -44,7 +46,9 @@ import jahirfiquitiva.libs.kauextensions.ui.activities.ThemedActivity
import jahirfiquitiva.libs.kauextensions.ui.widgets.CustomSearchView

@SuppressLint("MissingSuperCall")
class HelpActivity : ThemedActivity() {
class HelpActivity : ThemedActivity<BPKonfigs>() {

override val configs: BPKonfigs by lazy { BPKonfigs(this) }
override fun lightTheme(): Int = R.style.BlueprintLightTheme
override fun darkTheme(): Int = R.style.BlueprintDarkTheme
override fun amoledTheme(): Int = R.style.BlueprintAmoledTheme
Expand Down Expand Up @@ -137,12 +141,9 @@ class HelpActivity : ThemedActivity() {

private fun doSearch(filter: String = "") {
if (filter.hasContent()) {
adapter.setItems(
ArrayList(
faqs.filter {
(it.question.contains(filter, true) || it.answer.contains(
filter, true))
}))
adapter.setItems(faqs.jfilter {
(it.question.contains(filter, true) || it.answer.contains(filter, true))
})
} else {
adapter.setItems(faqs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.Toast
import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.helpers.extensions.bpKonfigs
import jahirfiquitiva.libs.blueprint.helpers.utils.BPKonfigs

class LauncherIconRestorerActivity : AppCompatActivity() {

private val configs: BPKonfigs by lazy { BPKonfigs(this) }

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pm = packageManager
Expand All @@ -45,15 +47,13 @@ class LauncherIconRestorerActivity : AppCompatActivity() {
val content: String
if (className != null) {
val component = ComponentName(packageName, componentName)
if (!bpKonfigs.launcherIconShown) {
bpKonfigs.launcherIconShown = true
if (!configs.launcherIconShown) {
configs.launcherIconShown = true
pm.setComponentEnabledSetting(
component,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP)
content = getString(
R.string.launcher_icon_restored,
getString(R.string.app_name))
content = getString(R.string.launcher_icon_restored, getString(R.string.app_name))
} else {
content = getString(
R.string.launcher_icon_not_restored,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ package jahirfiquitiva.libs.blueprint.ui.activities

import android.support.v4.app.Fragment
import jahirfiquitiva.libs.blueprint.R
import jahirfiquitiva.libs.blueprint.helpers.utils.BPKonfigs
import jahirfiquitiva.libs.blueprint.ui.fragments.SettingsFragment
import jahirfiquitiva.libs.frames.ui.activities.SettingsActivity

class SettingsActivity : SettingsActivity() {
override val configs: BPKonfigs by lazy { BPKonfigs(this) }
override fun lightTheme(): Int = R.style.BlueprintLightTheme
override fun darkTheme(): Int = R.style.BlueprintDarkTheme
override fun amoledTheme(): Int = R.style.BlueprintAmoledTheme
Expand Down
Loading

0 comments on commit 0b300d3

Please sign in to comment.