Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
RajuSE committed Oct 4, 2020
2 parents cd390be + ef5c9d7 commit 84a99c4
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 419 deletions.
2 changes: 1 addition & 1 deletion InstaPopSave-Android-Lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ext {

PUBLISH_GROUP_ID = 'devx.insta.popsave'
PUBLISH_ARTIFACT_ID = 'InstaPopSave-Android'
PUBLISH_VERSION = '1.1.1'
PUBLISH_VERSION = '1.2.0'
}

/*
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import android.widget.LinearLayout
import android.widget.RelativeLayout
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.view.SimpleDraweeView
import java.lang.IllegalArgumentException


class PopSaveDrawee
Expand Down Expand Up @@ -43,6 +45,9 @@ class PopSaveDrawee
private fun init(context: Context, attributes: AttributeSet?) {
attributes?.let { _ ->

if (!PopSaveSetup.isSetupDone) {
throw IllegalArgumentException("Please call PopSaveSetup.setup(context) in Application class")
}
inflate(context, R.layout.layout_popsave_drawee, this)
simpleDraweeView = findViewById(R.id.frescoImageView)
simpleDraweeView?.visibility = View.GONE
Expand Down Expand Up @@ -126,6 +131,9 @@ class PopSaveDrawee
}

fun popNow() {
if (!PopSaveSetup.isSetupDone) {
throw IllegalArgumentException("Please call PopSaveSetup.setup(context) in Application class")
}
simpleDraweeView!!.visibility = View.VISIBLE
popSaveRoot!!.visibility = View.VISIBLE

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package devx.insta.popsave

import android.content.Context
import com.facebook.drawee.backends.pipeline.Fresco

object PopSaveSetup {

init {
println("Singleton class PopSaveSetup init.")
}

var isSetupDone = false

fun setup(context: Context){
isSetupDone=true
Fresco.initialize(context)
}

}
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Screenshot shows how InstaPopSave was used for "Add to wishlist" interaction for
Add this in your app's build.gradle file:
```groovy
dependencies {
implementation 'devx.insta.popsave:InstaPopSave-Android:1.1.1'
implementation 'devx.insta.popsave:InstaPopSave-Android:1.2.0'
}
```

Expand All @@ -31,18 +31,14 @@ Or add PopSave as a new dependency inside your pom.xml
<dependency>
<groupId>devx.insta.popsave</groupId>
<artifactId>InstaPopSave-Android</artifactId>
<version>1.1.1</version>
<version>1.2.0</version>
<type>pom</type>
</dependency>
```

Add this in your Application class and add Fresco v2 to gradle
```groovy
Fresco.initialize(applicationContext)
```

also,
Don't forget to declare internet permission.
declare internet permission.
```xml
<uses-permission android:name="android.permission.INTERNET" />
```
Expand Down
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// implementation project(path: ':InstaPopSave-Android-Lib')
implementation "com.android.support:design:${google_support_version}"
implementation 'devx.insta.popsave:InstaPopSave-Android:1.1.1'
implementation 'devx.insta.popsave:InstaPopSave-Android:1.2.0'

implementation "com.github.bumptech.glide:okhttp3-integration:${glide_version}"
implementation "com.github.bumptech.glide:glide:${glide_version}"
annotationProcessor "com.github.bumptech.glide:compiler:${glide_version}"
kapt "com.github.bumptech.glide:compiler:${glide_version}"

implementation 'com.facebook.fresco:fresco:2.0.0'
}
14 changes: 2 additions & 12 deletions app/src/main/java/dev/testapp/MyApplication.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
package dev.testapp

import android.app.Application
import com.facebook.common.logging.FLog
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.imagepipeline.core.ImagePipelineConfig
import com.facebook.imagepipeline.listener.RequestListener
import com.facebook.imagepipeline.listener.RequestLoggingListener
import devx.insta.popsave.PopSaveSetup

class MyApplication : Application() {

override fun onCreate() {
super.onCreate()

// var requestListeners = HashSet<RequestListener>();
// requestListeners.add( RequestLoggingListener());
// var config = ImagePipelineConfig.newBuilder(applicationContext)
// .setRequestListeners(requestListeners)
// .build();

Fresco.initialize(applicationContext)
PopSaveSetup.setup(this)
}

}

0 comments on commit 84a99c4

Please sign in to comment.