Skip to content

Commit

Permalink
[Hotfix] jitpack build error (#51)
Browse files Browse the repository at this point in the history
* Fix jitpack jdk version errors

* Add java11 installment to jitpack.yml

* Replace deprecated kotlin-android-extensions with view binding

* Fix simpledemo app

* Fix demo app

* Fix an ui bug

* Remove warnings

* Fix a lint error

* Add jcenter() at the last of the repository list

* Upgrade libraries

* Restore a missing library

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Add MavenPublication

* Change the location of MavenPublication

* enable org.gradle.parallel=true for faster build
  • Loading branch information
SungjunApp authored Jan 26, 2022
1 parent a749abc commit 6387a9c
Show file tree
Hide file tree
Showing 38 changed files with 747 additions and 607 deletions.
38 changes: 21 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
androidExtensions {
experimental = true
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
}

android {
compileSdkVersion 31
compileSdkVersion COMPILE_SDK_VERSION as int
defaultConfig {
applicationId "com.pixlee.pixleeandroidsdk"
minSdkVersion 21
targetSdkVersion 30
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -18,8 +18,8 @@ android {
buildConfigField "String", "PIXLEE_ALBUM_ID", "\"" + PIXLEE_ALBUM_ID + "\""
buildConfigField "String", "PIXLEE_SKU", "\"" + PIXLEE_SKU + "\""
}
viewBinding {
enabled = true
buildFeatures {
viewBinding true
}
buildTypes {
release {
Expand All @@ -29,8 +29,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

testOptions {
Expand All @@ -46,18 +46,22 @@ android {
}
}
}
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation 'junit:junit:4.13'
testImplementation "junit:junit:$junit"

/**
* testing
Expand All @@ -68,8 +72,8 @@ dependencies {
//testImplementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8"
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp3"

androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation "androidx.test:runner:$androidxRunner"
androidTestImplementation "androidx.test:rules:$androidXrules"

androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
androidTestImplementation "androidx.test.ext:junit-ktx:" + rootProject.extJUnitVersion
Expand Down Expand Up @@ -99,7 +103,7 @@ dependencies {
implementation "com.github.bumptech.glide:okhttp3-integration:$glide"
annotationProcessor "com.github.bumptech.glide:compiler:$glide"

implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation "androidx.recyclerview:recyclerview:$recyclerview"
implementation "com.squareup.retrofit2:converter-gson:$retrofit2"

implementation project(':pixleesdk')
Expand Down
41 changes: 27 additions & 14 deletions app/src/main/java/com/pixlee/pixleeandroidsdk/ui/IndexFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.pixlee.pixleeandroidsdk.MainActivity
import com.pixlee.pixleeandroidsdk.R
import com.pixlee.pixleeandroidsdk.data.LocalDataSource
import com.pixlee.pixleeandroidsdk.data.LocalRepository.Companion.getInstance
import com.pixlee.pixleeandroidsdk.databinding.FragmentIndexBinding
import com.pixlee.pixleeandroidsdk.ui.analytics.AnalyticsFragment
import com.pixlee.pixleeandroidsdk.ui.analytics.KtxAnalyticsFragment
import com.pixlee.pixleeandroidsdk.ui.gallery.GalleryFragment
Expand All @@ -16,7 +17,6 @@ import com.pixlee.pixleeandroidsdk.ui.gallery.KtxGalleryListFragment
import com.pixlee.pixleeandroidsdk.ui.uioptions.ProductViewFragment
import com.pixlee.pixleeandroidsdk.ui.uploader.ImageUploaderFragment
import com.pixlee.pixleeandroidsdk.ui.widgets.HotspotsActivity
import kotlinx.android.synthetic.main.fragment_index.*

/**
* This is an index page of the app.
Expand All @@ -28,8 +28,21 @@ class IndexFragment : BaseFragment() {
return R.string.app_name
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_index, container, false)
private var _binding: FragmentIndexBinding? = null
private val binding get() = _binding!!

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentIndexBinding.inflate(inflater, container, false)
return binding.root
}

private val localDataSource: LocalDataSource by lazy {
Expand All @@ -44,49 +57,49 @@ class IndexFragment : BaseFragment() {
}

fun initKtxButtons() {
btKtxAlbumList.setOnClickListener {
binding.btKtxAlbumList.setOnClickListener {
addFragmentToActivity(KtxGalleryListFragment())
}

btKtxAlbumGrid.setOnClickListener {
binding.btKtxAlbumGrid.setOnClickListener {
addFragmentToActivity(KtxGalleryGridFragment())
}

btKtxAnalytics.setOnClickListener {
binding.btKtxAnalytics.setOnClickListener {
addFragmentToActivity(KtxAnalyticsFragment())
}

btnProductView.setOnClickListener {
binding.btnProductView.setOnClickListener {
addFragmentToActivity(ProductViewFragment())
}

btnHotspots.setOnClickListener {
binding.btnHotspots.setOnClickListener {
context?.let { HotspotsActivity.launch(it) }
}
}

fun initJavaButtons() {
btAlbum.setOnClickListener {
binding.btAlbum.setOnClickListener {
addFragmentToActivity(GalleryFragment.getInstance(false))
}

btImageUploader.setOnClickListener {
binding.btImageUploader.setOnClickListener {
addFragmentToActivity(ImageUploaderFragment())
}

btAnalytics.setOnClickListener {
binding.btAnalytics.setOnClickListener {
addFragmentToActivity(AnalyticsFragment())
}
}

fun initWidgetButtons() {
localDataSource.getConfig().also {
switchDarkMode.isChecked = it.isDarkMode
binding.switchDarkMode.isChecked = it.isDarkMode
}

switchDarkMode.setOnClickListener {
binding.switchDarkMode.setOnClickListener {
(localDataSource.getConfig()).also {
it.isDarkMode = switchDarkMode.isChecked
it.isDarkMode = binding.switchDarkMode.isChecked
localDataSource.setConfig(it)
(activity as MainActivity).setConfig(it)
}
Expand Down
Loading

0 comments on commit 6387a9c

Please sign in to comment.