Skip to content

Commit

Permalink
Migrate the library repository from jcenter to maven (#50)
Browse files Browse the repository at this point in the history
* upgrade libraries' versions up to the minimum required ones of the latest IDE

* Fix all dependency errors

* Upgrade android plugin

* Replace ExoPlayer related codes with the latest ones

* Remove unnecessary repositories

* Fix lint errors

* Remove unused codes

* Fix erros
  • Loading branch information
SungjunApp authored Jan 24, 2022
1 parent 74dbaac commit a749abc
Show file tree
Hide file tree
Showing 20 changed files with 820 additions and 428 deletions.
7 changes: 2 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ androidExtensions {
experimental = true
}
android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "com.pixlee.pixleeandroidsdk"
minSdkVersion 21
Expand Down Expand Up @@ -48,10 +48,6 @@ android {
}
}

repositories {
jcenter()
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
Expand All @@ -74,6 +70,7 @@ dependencies {

androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'

androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
androidTestImplementation "androidx.test.ext:junit-ktx:" + rootProject.extJUnitVersion
androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jackson"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.pixlee.pixleeandroidsdk.tool.MyViewAction
import com.pixlee.pixleeandroidsdk.tool.OkHttpIdlingResourceRule
Expand All @@ -26,7 +25,6 @@ import org.hamcrest.StringDescription
import org.hamcrest.core.StringContains
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.pixlee.pixleeandroidsdk;

import static org.junit.Assert.assertEquals;

import android.content.Context;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.platform.app.InstrumentationRegistry;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

/**
* Instrumentation test, which will execute on an Android device.
Expand All @@ -19,7 +18,8 @@ public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals("com.pixlee.pixleeandroidsdk", appContext.getPackageName());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.pixlee.pixleeandroidsdk

import android.util.Log
import androidx.test.runner.AndroidJUnit4
import com.fasterxml.jackson.databind.ObjectMapper
import com.pixlee.pixleesdk.network.HMAC
import org.json.JSONException
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import java.security.InvalidKeyException
import java.security.NoSuchAlgorithmException

Expand Down
15 changes: 12 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.pixlee.pixleeandroidsdk">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -17,15 +18,23 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.widgets.ViewerActivity" android:screenOrientation="portrait"/>
<activity android:name=".ui.widgets.HotspotsActivity" android:screenOrientation="portrait"/>
<activity
android:name=".ui.widgets.ViewerActivity"
android:screenOrientation="portrait"
/>
<activity
android:name=".ui.widgets.HotspotsActivity"
android:screenOrientation="portrait"
/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void extractImage(Intent data) {
if (cursor != null) {
cursor.moveToFirst();

String filePath = cursor.getString(cursor.getColumnIndex(filePathColumn[0]));
String filePath = cursor.getString(cursor.getColumnIndexOrThrow(filePathColumn[0]));
uploadFile(filePath);
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class IndexFragment : BaseFragment() {
}

private val localDataSource: LocalDataSource by lazy {
getInstance(context!!)
getInstance(requireContext())
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class KtxAnalyticsFragment : BaseFragment() {

val viewModel: KtxAnalyticsViewModel by lazy {
// get PXLClient
val album = PXLKtxAlbum(context!!)
val album = PXLKtxAlbum(requireContext())
KtxAnalyticsViewModel(album)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,14 @@ class GalleryFragment : BaseFragment(), RequestHandlers<ArrayList<PXLPhoto>?> {
private fun configureViews() {
gridView.setHasFixedSize(true)
listView.setHasFixedSize(true)
val gridLayoutManager: RecyclerView.LayoutManager = GridLayoutManager(context!!.applicationContext, 2)
val listLayoutManager: RecyclerView.LayoutManager = GridLayoutManager(context!!.applicationContext, 1)
val gridLayoutManager: RecyclerView.LayoutManager = GridLayoutManager(requireContext().applicationContext, 2)
val listLayoutManager: RecyclerView.LayoutManager = GridLayoutManager(requireContext().applicationContext, 1)
gridView.layoutManager = gridLayoutManager
listView.layoutManager = listLayoutManager
val li = GalleryClickListener { view, photo -> moveToViewer(view, photo) }
if (gridAdapter == null) {
gridAdapter = GridAdapter(context!!.applicationContext, photoList, li)
listAdapter = ListAdapter(context!!.applicationContext, photoList, li)
gridAdapter = GridAdapter(requireContext().applicationContext, photoList, li)
listAdapter = ListAdapter(requireContext().applicationContext, photoList, li)
menuList?.apply { findItem(R.id.action_live_list).isVisible = false }
}else{
menuList?.apply { findItem(R.id.action_live_list).isVisible = true }
Expand Down Expand Up @@ -386,7 +386,7 @@ class GalleryFragment : BaseFragment(), RequestHandlers<ArrayList<PXLPhoto>?> {
},
isLoopingVideo = true,
soundMuted = true)
ViewerActivity.launch(context!!, info)
ViewerActivity.launch(requireContext(), info)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class KtxGalleryGridFragment : BaseFragment(), LifecycleObserver {

val viewModel: KtxGalleryViewModel by lazy {
// get PXLKtxAlbum
KtxGalleryViewModel(PXLKtxAlbum(context!!))
KtxGalleryViewModel(PXLKtxAlbum(requireContext()))
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
Expand Down Expand Up @@ -476,10 +476,8 @@ class KtxGalleryGridFragment : BaseFragment(), LifecycleObserver {
PhotoLauncher.PXLPhotoView -> addFragmentToActivity(PXLPhotoViewFragment.getInstance(photo))
}
}
//.setNegativeButton(getString(R.string.dialog_cancel), null)
.show()
}
//PXLPhotoViewerActivity.launch(context!!, photo)
}

fun isGrid(): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class KtxGalleryListFragment : BaseFragment(), LifecycleObserver {

val viewModel: KtxGalleryViewModel by lazy {
// get PXLKtxAlbum
KtxGalleryViewModel(PXLKtxAlbum(context!!))
KtxGalleryViewModel(PXLKtxAlbum(requireContext()))
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
Expand Down Expand Up @@ -468,10 +468,8 @@ class KtxGalleryListFragment : BaseFragment(), LifecycleObserver {
PhotoLauncher.PXLPhotoView -> addFragmentToActivity(PXLPhotoViewFragment.getInstance(photo))
}
}
//.setNegativeButton(getString(R.string.dialog_cancel), null)
.show()
}
//PXLPhotoViewerActivity.launch(context!!, photo)
}

fun isGrid(): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ProductViewFragment : BaseFragment() {
circleIcon = ProductViewHolder.CircleIcon().apply {
icon = R.drawable.outline_shopping_bag_black_24
iconColor = Color.DKGRAY
backgroundColor = ContextCompat.getColor(context!!, R.color.yellow_800)
backgroundColor = ContextCompat.getColor(requireContext(), R.color.yellow_800)
padding = 5.px.toInt()
}
}
Expand Down Expand Up @@ -211,7 +211,7 @@ class ProductViewFragment : BaseFragment() {
},
isLoopingVideo = true,
soundMuted = true)
ViewerActivity.launch(context!!, info)
ViewerActivity.launch(requireContext(), info)
}
}

Expand Down
18 changes: 7 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.5.20'
ext.coroutines = "1.3.1"
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,9 +15,8 @@ buildscript {

allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url 'https://jitpack.io' }
google()
mavenCentral()
}
}

Expand Down Expand Up @@ -51,22 +50,19 @@ ext {
material = "1.2.1"

lifecycle = "2.2.0"
//retrofit2 = "2.6.2"
//okhttp3 = "3.12.0" // Supports for kitket
retrofit2 = "2.9.0"
okhttp3 = "4.8.0"
moshi = "1.9.2"
rxJava = "2.2.8"
rxAndroid = "2.1.1"
gson = "2.8.5"
glide = "4.11.0"
glide = "4.12.0"
orhanobutLogger = "2.2.0"
lottie = "3.4.1"
androidJZVideo="1.0.8"

checkerframeworkVersion = '3.3.0'
//exoPlayer="2.12.1"
exoPlayer="2.8.2"
exoPlayer="2.16.1"
supportLibraryVersion = '27.0.0'
jackson = '2.10.3'
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
12 changes: 4 additions & 8 deletions pixleesdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ androidExtensions {
}

android {
compileSdkVersion 29
compileSdkVersion 31

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.2.0"
targetSdkVersion 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
viewBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
Expand Down Expand Up @@ -97,7 +92,7 @@ dependencies {
/**
* Glide Transformation
*/
implementation 'jp.wasabeef:glide-transformations:4.1.0'
implementation 'jp.wasabeef:glide-transformations:4.3.0'

/**
* Lottie for animation
Expand All @@ -111,6 +106,7 @@ dependencies {
implementation "com.google.android.exoplayer:exoplayer-dash:$exoPlayer"
implementation "com.google.android.exoplayer:exoplayer-ui:$exoPlayer"
implementation "com.google.android.exoplayer:extension-ima:$exoPlayer"
implementation "com.google.android.exoplayer:extension-cronet:$exoPlayer"

implementation 'androidx.annotation:annotation:1.1.0'
}
Loading

0 comments on commit a749abc

Please sign in to comment.