Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
jahirfiquitiva committed Sep 12, 2019
1 parent 5a9e2e7 commit d20741e
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 80 deletions.
22 changes: 13 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
language: android
dist: trusty
sudo: false
jdk:
- oraclejdk8

env:
global:
- ANDROID_API=29
- ANDROID_BUILD_TOOLS=29.0.0
- ANDROID_BUILD_TOOLS=29.0.2

android:
components:
Expand All @@ -14,15 +18,16 @@ android:
- extra-android-support
- extra-google-m2repository
- extra-android-m2repository
licenses:
- '.+'

before_install:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- yes | sdkmanager "platforms;android-$ANDROID_API"
- yes | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS"

jdk:
- oraclejdk8

script: if [[ "$TRAVIS_TAG" ]]; then ./gradlew clean :app:assembleRelease --stacktrace; else ./gradlew clean test --stacktrace; fi
script: if [[ "$TRAVIS_TAG" ]]; then ./gradlew clean :app:assembleRelease --full-stacktrace; else ./gradlew clean test --full-stacktrace; fi

branches:
except:
Expand All @@ -34,14 +39,12 @@ branches:
notifications:
email: false
slack:
rooms: jahirfiquitiva:StCMaxV85iad38DdSMBY43xW
rooms: jahirfiquitiva:BPPLJNqX4mxGp8h2lkkotgNn
template:
- 'Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}: ''%{commit_subject}''>) by
%{author} for %{repository_name}@%{branch}, %{result} in %{duration}. <%{build_url}|Check
details>.'
sudo: false
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
Expand All @@ -57,6 +60,7 @@ cache:
before_script:
- rm -rf $TRAVIS_BUILD_DIR/app/build/outputs
- chmod +x gradlew
- chmod +x gradle/wrapper/gradle-wrapper.jar
after_success:
- chmod +x ./publish_apk.sh; ./publish_apk.sh
- chmod +x ./publish_apk.sh; ./publish_apk.sh
10 changes: 8 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ buildscript {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.5'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
*/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
signingConfigs {
Expand Down Expand Up @@ -60,7 +62,6 @@ android {
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "1234567890"]
*/

applicationId "jahirfiquitiva.apps.blueprint.demo"
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
Expand All @@ -80,6 +81,7 @@ android {
shrinkResources false
proguardFiles 'proguard-android-optimize.txt', 'proguard-rules.pro'
consumerProguardFiles 'proguard-android-optimize.txt', 'proguard-rules.pro'
multiDexKeepProguard file('proguard-rules.pro')
signingConfig signingConfigs.release
}
}
Expand All @@ -103,6 +105,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package jahirfiquitiva.apps.blueprint.demo

import jahirfiquitiva.libs.blueprint.ui.BlueprintApp
import jahirfiquitiva.libs.blueprint.BlueprintApp

// TODO: Remove comment marks to enable
// import com.onesignal.OneSignal
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<!-- TODO: Change this link -->
<!-- This is the link for the JSON file where you have listed your wallpapers -->
<string name="json_url">https://jahirfiquitiva.com/frames/wallpapers.json</string>
<string name="json_url">https://jahir.dev/frames/wallpapers.json</string>

<!-- Default wallpapers download folder. Always write it like '%1$s/xxxxxxx' -->
<string name="default_download_folder">%1$s/Blueprint/Wallpapers</string>
Expand Down
14 changes: 7 additions & 7 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ ext.versions = [
// Projects
minSdk : 16,
targetSdk : 29,
buildTools : '29.0.0',
buildTools : '29.0.2',
// Versions:
versionCode: 147,
versionName: '1.4.7',
versionCode: 148,
versionName: '1.4.8',
// Gradle Plugins
gradle : '3.4.2',
kotlin : '1.3.21',
gradle : '3.5.0',
kotlin : '1.3.50',
libs : '2.1',
// Dependencies
kuper : '1.6.9',
kuper : '1.7.0',
counterFab : '1.2.1',
fuel : '1.16.0',
oneSignal : '3.11.1'
oneSignal : '3.11.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-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 changes: 5 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ android {
shrinkResources false
proguardFiles 'proguard-android-optimize.txt', 'proguard-rules.pro'
consumerProguardFiles 'proguard-android-optimize.txt', 'proguard-rules.pro'
multiDexKeepProguard file('proguard-rules.pro')
}
}

Expand All @@ -73,6 +74,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
Expand All @@ -90,8 +95,6 @@ dependencies {
api(libraries.counterFab) {
exclude group: 'com.android.support'
}
// MultiDex :'(
api 'androidx.multidex:multidex:2.0.1'
}

configurations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jahirfiquitiva.libs.blueprint.ui
package jahirfiquitiva.libs.blueprint

import android.content.Context
import androidx.multidex.MultiDex
import androidx.multidex.MultiDexApplication
import jahirfiquitiva.libs.kuper.KuperApp

open class BlueprintApp : MultiDexApplication() {
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
MultiDex.install(this)
}
}
open class BlueprintApp : KuperApp()
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package jahirfiquitiva.libs.blueprint.providers.viewmodels

import android.content.Context
import android.os.Build
import android.os.Environment
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
Expand Down Expand Up @@ -104,13 +105,24 @@ class RequestsViewModel : ViewModel() {
data.observe(owner, Observer<MutableList<App>> { r -> r?.let { onUpdated(it) } })
}

@Suppress("DEPRECATION")
private fun internalLoad(
context: Context,
debug: Boolean,
host: String? = null,
apiKey: String? = null,
forceLoad: Boolean = false
) {

val externalFolder = try {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
Environment.getExternalStorageDirectory()
}
context.getExternalFilesDir(null) ?: Environment.getExternalStorageDirectory()
} catch (e: Exception) {
Environment.getExternalStorageDirectory()
}

val list = IconRequest.get()?.apps.orEmpty()
if (list.isEmpty() || forceLoad) {
IconRequest.start(context)
Expand All @@ -120,11 +132,7 @@ class RequestsViewModel : ViewModel() {
.toEmail(context.getString(R.string.email))
.withAPIHost(host.orEmpty())
.withAPIKey(apiKey)
.saveDir(
File(
context.getString(
R.string.request_save_location,
Environment.getExternalStorageDirectory())))
.saveDir(File(context.getString(R.string.request_save_location, externalFolder)))
.filterXml(R.xml.appfilter)
.withTimeLimit(
context.int(R.integer.time_limit_in_minutes), BPKonfigs(context).prefs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,20 @@ abstract class BaseBlueprintActivity : BaseFramesActivity<BPKonfigs>() {
return super.onCreateOptionsMenu(menu)
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
item?.let {
when (it.itemId) {
R.id.refresh -> {
refreshWallpapers()
refreshRequests()
}
R.id.changelog -> showChanges()
R.id.select_all -> toggleSelectAll()
R.id.templates -> launchKuperActivity()
R.id.help -> launchHelpActivity()
R.id.about -> startActivity(Intent(this, CreditsActivity::class.java))
R.id.settings -> startActivity(Intent(this, SettingsActivity::class.java))
R.id.donate -> doDonation()
else -> {
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.refresh -> {
refreshWallpapers()
refreshRequests()
}
R.id.changelog -> showChanges()
R.id.select_all -> toggleSelectAll()
R.id.templates -> launchKuperActivity()
R.id.help -> launchHelpActivity()
R.id.about -> startActivity(Intent(this, CreditsActivity::class.java))
R.id.settings -> startActivity(Intent(this, SettingsActivity::class.java))
R.id.donate -> doDonation()
else -> {
}
}
return super.onOptionsItemSelected(item)
Expand Down Expand Up @@ -305,19 +303,19 @@ abstract class BaseBlueprintActivity : BaseFramesActivity<BPKonfigs>() {
}

@SuppressLint("MissingSuperCall")
override fun onSaveInstanceState(outState: Bundle?) {
outState?.putString("toolbarTitle", toolbar?.title?.toString() ?: getAppName())
outState?.putInt("currentSectionId", currentSectionId)
override fun onSaveInstanceState(outState: Bundle) {
outState.putString("toolbarTitle", toolbar?.title?.toString() ?: getAppName())
outState.putInt("currentSectionId", currentSectionId)
super.onSaveInstanceState(outState)
}

override fun onRestoreInstanceState(savedInstanceState: Bundle?) {
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState)
toolbar?.title = savedInstanceState?.getString("toolbarTitle", getAppName())
supportActionBar?.title = savedInstanceState?.getString("toolbarTitle", getAppName())
toolbar?.title = savedInstanceState.getString("toolbarTitle", getAppName())
supportActionBar?.title = savedInstanceState.getString("toolbarTitle", getAppName())

val default = if (isIconsPicker) DEFAULT_ICONS_SECTION_ID else DEFAULT_HOME_SECTION_ID
initCurrentSectionId(savedInstanceState?.getInt("currentSectionId", default) ?: default)
initCurrentSectionId(savedInstanceState.getInt("currentSectionId", default))

dialog = mdDialog {
message(R.string.loading)
Expand All @@ -328,7 +326,10 @@ abstract class BaseBlueprintActivity : BaseFramesActivity<BPKonfigs>() {
dialog?.show()
initFragments()
postDelayed(25) {
navigateToItem(getNavigationItemWithId(currentSectionId), true, true)
navigateToItem(
getNavigationItemWithId(currentSectionId),
fromClick = true,
force = true)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,13 @@ abstract class DrawerBlueprintActivity : BaseBlueprintActivity(),
toggle?.syncState()
}

override fun onConfigurationChanged(newConfig: Configuration?) {
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
toggle?.onConfigurationChanged(newConfig)
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (toggle?.onOptionsItemSelected(item) == true) {
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (toggle?.onOptionsItemSelected(item) == true) return true
return super.onOptionsItemSelected(item)
}

Expand Down
Loading

0 comments on commit d20741e

Please sign in to comment.