Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
migration for support android studio 3
Browse files Browse the repository at this point in the history
  • Loading branch information
derohimat committed Jul 10, 2018
1 parent 4f6f0eb commit 47ca5e4
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 153 deletions.
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}

Expand All @@ -21,6 +21,8 @@ allprojects {
repositories {
maven { url "https://jitpack.io" }
}
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
google()
}
}

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 @@ -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-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
40 changes: 22 additions & 18 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jakewharton.butterknife'

group = 'com.github.derohimat'

android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 27
versionCode 6
versionName "0.6"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

repositories {
maven { url 'https://jitpack.io' }
}

dependencies {
final SUPPORT_LIBRARY_VERSION = '25.3.1'
final SUPPORT_LIBRARY_VERSION = '27.1.1'

compile fileTree(include: ['*.jar'], dir: 'libs')
implementation fileTree(include: ['*.jar'], dir: 'libs')

//----- Android Support
compile "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
api "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION"
api "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
api "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
api "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
api "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"

//----- Nine Olds Animation
compile 'com.nineoldandroids:library:2.4.0'
api 'com.nineoldandroids:library:2.4.0'
//----- Butterknife
compile 'com.jakewharton:butterknife:7.0.1'
implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
//----- Logging
compile 'com.jakewharton.timber:timber:4.5.1'
api 'com.jakewharton.timber:timber:4.7.1'
//----- Image Utils
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'de.hdodenhof:circleimageview:2.2.0'
//----- RecyclerView
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
api 'com.jcodecraeer:xrecyclerview:1.3.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.derohimat.baseapp.ui.BaseActivity;

import butterknife.ButterKnife;
import butterknife.Unbinder;
import timber.log.Timber;

/**
Expand All @@ -31,6 +32,7 @@ public abstract class BaseFragment<Data extends Parcelable> extends Fragment {
protected Context mContext;
protected Data mData;
protected LayoutInflater mInflater;
private Unbinder unbinder;

public BaseFragment() {

Expand All @@ -48,7 +50,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = mInflater.inflate(getResourceLayout(), container, false);
ButterKnife.bind(this, view);
unbinder= ButterKnife.bind(this, view);
return view;
}

Expand Down Expand Up @@ -82,7 +84,7 @@ public void onSaveInstanceState(Bundle outState) {
@Override
public void onDestroyView() {
super.onDestroyView();
ButterKnife.unbind(this);
unbinder.unbind();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.derohimat.baseapp.ui.BaseActivity;

import butterknife.ButterKnife;
import butterknife.Unbinder;
import timber.log.Timber;

/**
Expand All @@ -28,6 +29,7 @@ public abstract class BaseDialogFragment extends DialogFragment {

protected Context mContext;
protected LayoutInflater mInflater;
private Unbinder unbinder;

@Override
public void onAttach(Activity activity) {
Expand All @@ -39,7 +41,7 @@ public void onAttach(Activity activity) {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View view = mInflater.inflate(getResourceLayout(), null);
ButterKnife.bind(this, view);
unbinder = ButterKnife.bind(this, view);
Timber.tag(getClass().getSimpleName());
return setupDialog(view);
}
Expand All @@ -65,6 +67,6 @@ protected void showToast(String message) {
@Override
public void onDestroyView() {
super.onDestroyView();
ButterKnife.unbind(this);
unbinder.unbind();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.squareup.picasso.Picasso;

/**
* Created on : 05-03-2016
Expand All @@ -19,7 +15,7 @@
* GitHub : https://github.com/derohimat
* LinkedIn : https://www.linkedin.com/in/derohimat
*/
public class BaseImageView extends ImageView {
public class BaseImageView extends AppCompatImageView {
private String mImageUrl;

public BaseImageView(Context context) {
Expand All @@ -36,15 +32,15 @@ public BaseImageView(Context context, AttributeSet attrs, int defStyleAttr) {

public void setImageUrl(String url, int errorResourceId) {
mImageUrl = url;
Glide.with(getContext())
Picasso.get()
.load(url)
.error(errorResourceId)
.into(this);
}

public void setImageUrl(String url, int placeHolderResourceId, int errorResourceId) {
mImageUrl = url;
Glide.with(getContext())
Picasso.get()
.load(url)
.placeholder(placeHolderResourceId)
.error(errorResourceId)
Expand All @@ -53,85 +49,20 @@ public void setImageUrl(String url, int placeHolderResourceId, int errorResource

public void setImageUrl(String url, int placeHolderDrawable, Drawable errorDrawable) {
mImageUrl = url;
Glide.with(getContext())
Picasso.get()
.load(url)
.placeholder(placeHolderDrawable)
.error(errorDrawable)
.into(this);
}

public void setImageUrl(String url, final ProgressBar progressBar) {
mImageUrl = url;
progressBar.setVisibility(VISIBLE);
Glide.with(getContext())
.load(url)
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
progressBar.setVisibility(GONE);
return false;
}

@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
progressBar.setVisibility(GONE);
return false;
}
})
.into(this);
}

public void setImageUrl(String url, final ProgressBar progressBar, int errorResourceId) {
mImageUrl = url;
progressBar.setVisibility(VISIBLE);
Glide.with(getContext())
.load(url)
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
progressBar.setVisibility(GONE);
return false;
}

@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
progressBar.setVisibility(GONE);
return false;
}
})
.error(errorResourceId)
.into(this);
}

public void setImageUrl(String url, final ProgressBar progressBar, Drawable errorDrawable) {
mImageUrl = url;
progressBar.setVisibility(VISIBLE);
Glide.with(getContext())
.load(url)
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
progressBar.setVisibility(GONE);
return false;
}

@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
progressBar.setVisibility(GONE);
return false;
}
})
.error(errorDrawable)
.into(this);
}

public String getImageUrl() {
return mImageUrl;
}

public void setImageUrl(String url) {
mImageUrl = url;
Glide.with(getContext())
Picasso.get()
.load(url)
.into(this);
}
Expand Down
Loading

0 comments on commit 47ca5e4

Please sign in to comment.