diff --git a/build.gradle b/build.gradle index 4618a6f..1f8be0b 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } } @@ -21,6 +21,8 @@ allprojects { repositories { maven { url "https://jitpack.io" } } + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + google() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 63eff58..ebb0d91 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/library/build.gradle b/library/build.gradle index 5d1f891..bf6affa 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,20 +1,23 @@ 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 { @@ -22,26 +25,27 @@ repositories { } 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' } \ No newline at end of file diff --git a/library/src/main/java/net/derohimat/baseapp/ui/fragment/BaseFragment.java b/library/src/main/java/net/derohimat/baseapp/ui/fragment/BaseFragment.java index ade91e7..60d854d 100644 --- a/library/src/main/java/net/derohimat/baseapp/ui/fragment/BaseFragment.java +++ b/library/src/main/java/net/derohimat/baseapp/ui/fragment/BaseFragment.java @@ -16,6 +16,7 @@ import net.derohimat.baseapp.ui.BaseActivity; import butterknife.ButterKnife; +import butterknife.Unbinder; import timber.log.Timber; /** @@ -31,6 +32,7 @@ public abstract class BaseFragment extends Fragment { protected Context mContext; protected Data mData; protected LayoutInflater mInflater; + private Unbinder unbinder; public BaseFragment() { @@ -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; } @@ -82,7 +84,7 @@ public void onSaveInstanceState(Bundle outState) { @Override public void onDestroyView() { super.onDestroyView(); - ButterKnife.unbind(this); + unbinder.unbind(); } @Override diff --git a/library/src/main/java/net/derohimat/baseapp/ui/fragment/dialog/BaseDialogFragment.java b/library/src/main/java/net/derohimat/baseapp/ui/fragment/dialog/BaseDialogFragment.java index 9aa00af..077aec3 100644 --- a/library/src/main/java/net/derohimat/baseapp/ui/fragment/dialog/BaseDialogFragment.java +++ b/library/src/main/java/net/derohimat/baseapp/ui/fragment/dialog/BaseDialogFragment.java @@ -14,6 +14,7 @@ import net.derohimat.baseapp.ui.BaseActivity; import butterknife.ButterKnife; +import butterknife.Unbinder; import timber.log.Timber; /** @@ -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) { @@ -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); } @@ -65,6 +67,6 @@ protected void showToast(String message) { @Override public void onDestroyView() { super.onDestroyView(); - ButterKnife.unbind(this); + unbinder.unbind(); } } diff --git a/library/src/main/java/net/derohimat/baseapp/ui/view/BaseImageView.java b/library/src/main/java/net/derohimat/baseapp/ui/view/BaseImageView.java index 5ab91fa..27123c3 100644 --- a/library/src/main/java/net/derohimat/baseapp/ui/view/BaseImageView.java +++ b/library/src/main/java/net/derohimat/baseapp/ui/view/BaseImageView.java @@ -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 @@ -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) { @@ -36,7 +32,7 @@ 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); @@ -44,7 +40,7 @@ public void setImageUrl(String url, int errorResourceId) { public void setImageUrl(String url, int placeHolderResourceId, int errorResourceId) { mImageUrl = url; - Glide.with(getContext()) + Picasso.get() .load(url) .placeholder(placeHolderResourceId) .error(errorResourceId) @@ -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() { - @Override - public boolean onException(Exception e, String model, Target target, boolean isFirstResource) { - progressBar.setVisibility(GONE); - return false; - } - - @Override - public boolean onResourceReady(GlideDrawable resource, String model, Target 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() { - @Override - public boolean onException(Exception e, String model, Target target, boolean isFirstResource) { - progressBar.setVisibility(GONE); - return false; - } - - @Override - public boolean onResourceReady(GlideDrawable resource, String model, Target 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() { - @Override - public boolean onException(Exception e, String model, Target target, boolean isFirstResource) { - progressBar.setVisibility(GONE); - return false; - } - - @Override - public boolean onResourceReady(GlideDrawable resource, String model, Target 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); } diff --git a/sample/build.gradle b/sample/build.gradle index 7361dc3..eded74b 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,12 +1,10 @@ apply plugin: 'com.android.application' -apply plugin: 'com.neenbedankt.android-apt' -apply plugin: 'me.tatarka.retrolambda' - apply from: '../config/quality.gradle' +apply plugin: 'com.jakewharton.butterknife' android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" + compileSdkVersion 27 + buildToolsVersion "27.0.3" signingConfigs { config { @@ -20,7 +18,7 @@ android { defaultConfig { applicationId "net.derohimat.samplebasemvp" minSdkVersion 15 - targetSdkVersion 25 + targetSdkVersion 27 versionCode 6 versionName "0.6" } @@ -65,46 +63,45 @@ dependencies { final OKHTTP_VERSION = '3.8.0' final DAGGER_VERSION = '2.10' - compile project(':library') - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support.constraint:constraint-layout:1.0.2' + implementation project(':library') + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support.constraint:constraint-layout:1.1.2' //----- Dagger - compile "com.google.dagger:dagger:$DAGGER_VERSION" - apt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" - provided 'org.glassfish:javax.annotation:10.0-b28' //Required by Dagger2 + implementation "com.google.dagger:dagger:$DAGGER_VERSION" + annotationProcessor "com.google.dagger:dagger-compiler:$DAGGER_VERSION" + compileOnly 'org.glassfish:javax.annotation:10.0-b28' //Required by Dagger2 //----- Retrofit - compile("com.squareup.retrofit2:retrofit:$RETROFIT_VERSION") { + implementation("com.squareup.retrofit2:retrofit:$RETROFIT_VERSION") { // exclude Retrofit’s OkHttp peer-dependency module and define your own module import exclude module: 'okhttp' } - compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION" - compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION" - compile "com.squareup.okhttp3:okhttp:$OKHTTP_VERSION" - compile "com.squareup.okhttp3:logging-interceptor:$OKHTTP_VERSION" + implementation "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION" + implementation "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION" + implementation "com.squareup.okhttp3:okhttp:$OKHTTP_VERSION" + implementation "com.squareup.okhttp3:logging-interceptor:$OKHTTP_VERSION" //----- The core of Reactive Programming - compile 'io.reactivex:rxjava:1.2.5' - compile 'io.reactivex:rxandroid:1.2.1' + implementation 'io.reactivex:rxjava:1.3.0' + implementation 'io.reactivex:rxandroid:1.2.1' //----- Eventbuss - compile 'org.greenrobot:eventbus:3.0.0' + implementation 'org.greenrobot:eventbus:3.1.1' + + //----- Butterknife + implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT' + annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT' //----- Easy Permission Management - compile "com.karumi:dexter:3.0.0" + implementation "com.karumi:dexter:4.2.0" //----- Testing - testCompile 'junit:junit:4.12' - androidTestApt "com.google.dagger:dagger-compiler:$DAGGER_VERSION" - androidTestCompile 'com.android.support:support-annotations:25.3.1' - androidTestCompile "com.android.support.test:runner:0.5" - androidTestCompile "com.android.support.test:rules:0.5" - androidTestCompile "com.android.support.test.espresso:espresso-core:2.2.2" - androidTestCompile "org.hamcrest:hamcrest-library:1.3" -} - -// Log out test results to console -tasks.matching {it instanceof Test}.all { - testLogging.events = ["failed", "passed", "skipped"] + testImplementation 'junit:junit:4.12' + androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$DAGGER_VERSION" + androidTestImplementation 'com.android.support:support-annotations:27.1.1' + androidTestImplementation "com.android.support.test:runner:1.0.2" + androidTestImplementation "com.android.support.test:rules:1.0.2" + androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.2" + androidTestImplementation "org.hamcrest:hamcrest-library:1.3" } \ No newline at end of file diff --git a/sample/src/main/java/net/derohimat/samplebasemvp/view/activity/main/MainActivity.java b/sample/src/main/java/net/derohimat/samplebasemvp/view/activity/main/MainActivity.java index 8b0c0f9..8d790ef 100644 --- a/sample/src/main/java/net/derohimat/samplebasemvp/view/activity/main/MainActivity.java +++ b/sample/src/main/java/net/derohimat/samplebasemvp/view/activity/main/MainActivity.java @@ -26,30 +26,30 @@ import javax.inject.Inject; -import butterknife.Bind; +import butterknife.BindView; import butterknife.OnClick; import timber.log.Timber; public class MainActivity extends MvpActivity implements MainView { private static ProgressBar mProgressBar = null; - @Bind(R.id.textview_main_city) + @BindView(R.id.textview_main_city) TextView textview_main_city; - @Bind(R.id.textView_main_conditions) + @BindView(R.id.textView_main_conditions) TextView textView_main_conditions; - @Bind(R.id.textView_main_current_temperature) + @BindView(R.id.textView_main_current_temperature) TextView textView_main_current_temperature; - @Bind(R.id.textView_main_min_max) + @BindView(R.id.textView_main_min_max) TextView textView_main_min_max; - @Bind(R.id.textView_main_pressure) + @BindView(R.id.textView_main_pressure) TextView textView_main_pressure; - @Bind(R.id.textView_main_humidity) + @BindView(R.id.textView_main_humidity) TextView textView_main_humidity; - @Bind(R.id.textView_main_wind) + @BindView(R.id.textView_main_wind) TextView textView_main_wind; - @Bind(R.id.imageView_main_icon) + @BindView(R.id.imageView_main_icon) ImageView imageView_main_icon; - @Bind(R.id.button_main_next_days) + @BindView(R.id.button_main_next_days) Button button_main_next_days; @Inject EventBus eventBus; diff --git a/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailFragment.java b/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailFragment.java index 25190d8..107b784 100644 --- a/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailFragment.java +++ b/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailFragment.java @@ -16,13 +16,13 @@ import net.derohimat.samplebasemvp.data.remote.model.forecast.List; import net.derohimat.samplebasemvp.util.DialogFactory; -import butterknife.Bind; +import butterknife.BindView; public class DetailFragment extends BaseFragment implements DetailView { private static final String ARG_EXAMPLE = "ARG_EXAMPLE"; - @Bind(R.id.recyclerview_details) + @BindView(R.id.recyclerview_details) BaseRecyclerView mRecyclerView; private DetailPresenter mPresenter; diff --git a/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailHolder.java b/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailHolder.java index f45b8d5..2d33701 100644 --- a/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailHolder.java +++ b/sample/src/main/java/net/derohimat/samplebasemvp/view/fragment/detail/DetailHolder.java @@ -12,7 +12,7 @@ import net.derohimat.samplebasemvp.data.remote.model.forecast.List; import net.derohimat.samplebasemvp.view.activity.main.MainActivity; -import butterknife.Bind; +import butterknife.BindView; /** @@ -20,13 +20,13 @@ */ public class DetailHolder extends BaseItemViewHolder { - @Bind(R.id.row_textView_forecast) + @BindView(R.id.row_textView_forecast) TextView row_textView_forecast; - @Bind(R.id.row_imageView_forecast) + @BindView(R.id.row_imageView_forecast) BaseImageView row_imageView_forecast; - @Bind(R.id.row_details_cardview) + @BindView(R.id.row_details_cardview) CardView row_details_cardview; public DetailHolder(Context context, View itemView, BaseRecyclerAdapter.OnItemClickListener itemClickListener,