Update ButterKnife .

Adding configuration gradle file .
Improve build gradle file .
This commit is contained in:
Ahmed Eltaher
2017-02-26 16:44:38 +01:00
parent a6a668e671
commit 481c04ca01
9 changed files with 109 additions and 256 deletions

View File

@@ -1,187 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/retrolambda/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-contrib/2.2.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-core/2.2.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-idling-resource/2.2.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-intents/2.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/exposed-instrumentation-api-publish/0.5/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/rules/0.5/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support.test/runner/0.5/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/multidex-instrumentation/1.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/multidex/1.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-ui/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-utils/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-fragment/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-media-compat/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.jakewharton.hugo/hugo-runtime/1.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.orhanobut/logger/1.15/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.reactivex/rxandroid/1.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/multi-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/retrolambda" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="butterknife-7.0.1" level="project" />
<orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-24.2.1" level="project" />
<orderEntry type="library" exported="" name="hugo-annotations-1.2.1" level="project" />
<orderEntry type="library" exported="" name="okio-1.8.0" level="project" />
<orderEntry type="library" exported="" name="support-fragment-24.2.1" level="project" />
<orderEntry type="library" exported="" name="runner-0.5" level="project" />
<orderEntry type="library" exported="" name="espresso-idling-resource-2.2.2" level="project" />
<orderEntry type="library" exported="" name="accessibility-test-framework-2.0" level="project" />
<orderEntry type="library" exported="" name="hamcrest-library-1.3" level="project" />
<orderEntry type="library" exported="" name="design-24.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="multidex-instrumentation-1.0.1" level="project" />
<orderEntry type="library" exported="" name="espresso-intents-2.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" />
<orderEntry type="library" exported="" name="exposed-instrumentation-api-publish-0.5" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" name="javax.annotation-api-1.2" level="project" />
<orderEntry type="library" exported="" name="dagger-2.0.2" level="project" />
<orderEntry type="library" exported="" name="javawriter-2.1.1" level="project" />
<orderEntry type="library" exported="" name="logging-interceptor-3.3.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-3.3.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="picasso-2.5.2" level="project" />
<orderEntry type="library" exported="" name="processor-1.0.2" level="project" />
<orderEntry type="library" exported="" name="espresso-contrib-2.2.2" level="project" />
<orderEntry type="library" exported="" name="hamcrest-integration-1.3" level="project" />
<orderEntry type="library" exported="" name="hugo-runtime-1.2.1" level="project" />
<orderEntry type="library" exported="" name="annotation-1.0.2" level="project" />
<orderEntry type="library" exported="" name="otto-1.3.8" level="project" />
<orderEntry type="library" exported="" name="jsr305-2.0.1" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="espresso-core-2.2.2" level="project" />
<orderEntry type="library" exported="" name="rules-0.5" level="project" />
<orderEntry type="library" exported="" name="rxjava-1.1.6" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<orderEntry type="library" exported="" name="adapter-rxjava-2.0.2" level="project" />
<orderEntry type="library" exported="" name="javax.inject-1" level="project" />
<orderEntry type="library" exported="" name="retrofit-2.1.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.7" level="project" />
<orderEntry type="library" exported="" name="converter-gson-2.1.0" level="project" />
<orderEntry type="library" exported="" name="rxandroid-1.2.1" level="project" />
<orderEntry type="library" exported="" name="aspectjrt-1.8.5" level="project" />
<orderEntry type="library" exported="" name="support-annotations-24.2.1" level="project" />
<orderEntry type="library" exported="" name="multidex-1.0.1" level="project" />
<orderEntry type="library" exported="" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="logger-1.15" level="project" />
</component>
</module>

View File

@@ -1,18 +1,22 @@
apply plugin: 'com.android.application'
//Daggar
//Dagger
apply plugin: 'com.neenbedankt.android-apt'
//ButterKnife
apply plugin: 'com.jakewharton.butterknife'
//lamda
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'me.tatarka.retrolambda'
apply from: 'configuration.gradle'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
compileSdkVersion project.compileSdkVersion
buildToolsVersion project.buildToolsVersion
defaultConfig {
applicationId 'com.eltaher.task'
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
versionCode project.versionCode
versionName project.versionName
multiDexEnabled true
}
buildTypes {
@@ -44,70 +48,71 @@ repositories {
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:24.2.1'
force "com.android.support:support-annotations:${supportLibraryVersion}"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//android support & recyclerview
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile "com.android.support:recyclerview-v7:${supportLibraryVersion}"
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
//Dagger
compile 'com.google.dagger:dagger:2.0.2'
apt 'com.google.dagger:dagger-compiler:2.0.2'
compile "com.google.dagger:dagger:${daggerVersion}"
apt "com.google.dagger:dagger-compiler:${daggerVersion}"
//Butter knife
compile 'com.jakewharton:butterknife:7.0.1'
compile "com.jakewharton:butterknife:${butterKnifeVersion}"
apt "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
//event bus
compile 'com.squareup:otto:1.3.8'
//Logging
compile 'com.squareup.okhttp3:logging-interceptor:3.3.0'
compile "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
compile 'com.orhanobut:logger:1.15'
// retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.3.0'
compile "com.squareup.retrofit2:retrofit:${retrofitVersion}"
compile "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
compile "com.squareup.okhttp3:okhttp:${okhttpVersion}"
//picasso
compile 'com.squareup.picasso:picasso:2.5.2'
//MultiDex
compile 'com.android.support:multidex:+'
//ParcelablePlease
compile 'com.hannesdorfmann.parcelableplease:parent:1.0.2'
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.2'
compile 'com.hannesdorfmann.parcelableplease:processor:1.0.2'
compile "com.hannesdorfmann.parcelableplease:parent:${parcelablepleaseVersion}"
compile "com.hannesdorfmann.parcelableplease:annotation:${parcelablepleaseVersion}"
compile "com.hannesdorfmann.parcelableplease:processor:${parcelablepleaseVersion}"
//Android RX
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
compile "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
// espresso , junit for testing
testCompile 'junit:junit:4.12'
compile("com.android.support.test:rules:0.5") {
compile('com.android.support.test:rules:0.5') {
exclude group: "javax.inject", module: "javax.inject"
exclude group: 'com.android.support', module: 'support-annotations'
}
compile("com.android.support.test:runner:0.5") {
compile('com.android.support.test:runner:0.5') {
exclude group: "javax.inject", module: "javax.inject"
exclude group: 'com.android.support', module: 'support-annotations'
}
compile("com.android.support.test.espresso:espresso-core:2.2.2") {
compile("com.android.support.test.espresso:espresso-core:${espressoVersion}") {
exclude group: "javax.inject", module: "javax.inject"
exclude group: "com.squareup", module: "javawriter"
exclude group: 'com.android.support', module: 'support-annotations'
}
compile("com.android.support.test.espresso:espresso-contrib:2.2.2") {
compile("com.android.support.test.espresso:espresso-contrib:${espressoVersion}") {
exclude module: "recyclerview-v7"
exclude module: "support-v4"
exclude group: "javax.inject", module: "javax.inject"
exclude group: 'com.android.support', module: 'support-annotations'
}
compile("com.android.support.test.espresso:espresso-intents:2.2.1") {
compile('com.android.support.test.espresso:espresso-intents:2.2.1') {
exclude group: "javax.inject", module: "javax.inject"
exclude group: 'com.android.support', module: 'support-annotations'
}
compile("com.android.support.test.espresso:espresso-idling-resource:2.2.2") {
compile("com.android.support.test.espresso:espresso-idling-resource:${espressoVersion}") {
exclude module: "recyclerview-v7"
exclude module: "support-v4"
exclude group: "javax.inject", module: "javax.inject"
exclude group: 'com.android.support', module: 'support-annotations'
}
}
}

20
app/configuration.gradle Normal file
View File

@@ -0,0 +1,20 @@
ext {
//App name
versionCode = 1
versionName = "1.0"
//Compilation
minSdkVersion = 16
compileSdkVersion = 24
targetSdkVersion = 24
//Libraries
buildToolsVersion = '24.0.1'
supportLibraryVersion = '24.2.1'
daggerVersion = '2.0.2'
parcelablepleaseVersion = '1.0.2'
espressoVersion = '2.2.2'
retrofitVersion = '2.2.0'
okhttpVersion = '3.3.0'
butterKnifeVersion = '8.5.1'
}

View File

@@ -11,8 +11,9 @@ import android.widget.TextView;
import com.task.R;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
@@ -21,25 +22,28 @@ import static android.view.View.VISIBLE;
* Created by AhmedEltaher on 5/12/2016
*/
@SuppressWarnings("ConstantConditions")
public abstract class BaseActivity extends AppCompatActivity implements Presenter.View, ActionBarView {
public abstract class BaseActivity extends AppCompatActivity implements Presenter.View,
ActionBarView {
protected Presenter presenter;
@Nullable
@Bind(R.id.toolbar)
@BindView(R.id.toolbar)
Toolbar toolbar;
@Nullable
@Bind(R.id.ic_toolbar_setting)
@BindView(R.id.ic_toolbar_setting)
ImageView icSettings;
@Nullable
@Bind(R.id.ic_toolbar_refresh)
@BindView(R.id.ic_toolbar_refresh)
protected
ImageView icHome;
private Unbinder unbinder;
protected abstract void initializeDagger();
protected abstract void initializePresenter();
@@ -50,7 +54,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Presente
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutId());
initializeButterKnife();
unbinder = ButterKnife.bind(this);
initializeDagger();
initializePresenter();
initializeToolbar();
@@ -81,10 +85,6 @@ public abstract class BaseActivity extends AppCompatActivity implements Presente
}
}
private void initializeButterKnife() {
ButterKnife.bind(this);
}
protected void initializeToolbar() {
if (toolbar != null) {
setSupportActionBar(toolbar);
@@ -141,4 +141,10 @@ public abstract class BaseActivity extends AppCompatActivity implements Presente
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onDestroy() {
super.onDestroy();
unbinder.unbind();
}
}

View File

@@ -15,6 +15,7 @@ import android.widget.TextView;
import com.task.R;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* Created by AhmedEltaher on 5/12/2016
@@ -35,6 +36,7 @@ public abstract class BaseFragment extends Fragment implements Presenter.View {
private View view;
private Unbinder unbinder;
private String toolbarTitleKey;
@@ -48,9 +50,10 @@ public abstract class BaseFragment extends Fragment implements Presenter.View {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
view = inflater.inflate(getLayoutId(), container, false);
ButterKnife.bind(this, view);
unbinder = ButterKnife.bind(this, view);
if (presenter != null) {
presenter.initialize(getArguments());
}
@@ -76,7 +79,7 @@ public abstract class BaseFragment extends Fragment implements Presenter.View {
@Override
public void onDestroyView() {
super.onDestroyView();
ButterKnife.unbind(this);
unbinder.unbind();
}
public void setTitle(String title) {

View File

@@ -1,5 +1,7 @@
package com.task.ui.component.details;
import static android.text.TextUtils.isEmpty;
import android.widget.ImageView;
import android.widget.TextView;
@@ -12,9 +14,7 @@ import com.task.ui.base.BaseActivity;
import javax.inject.Inject;
import butterknife.Bind;
import static android.text.TextUtils.isEmpty;
import butterknife.BindView;
/**
* Created by AhmedEltaher on 11/12/16.
@@ -25,11 +25,11 @@ public class DetailsActivity extends BaseActivity implements DetailsView {
@Inject
DetailsPresenter presenter;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;
@Bind(R.id.iv_news_main_Image)
@BindView(R.id.iv_news_main_Image)
ImageView ivMainImage;
@Bind(R.id.tv_description)
@BindView(R.id.tv_description)
TextView tvDescription;
@Override

View File

@@ -1,5 +1,14 @@
package com.task.ui.component.news;
import static android.support.design.widget.Snackbar.LENGTH_SHORT;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static com.task.utils.Constants.NEWS_ITEM_KEY;
import static com.task.utils.EspressoIdlingResource.decrement;
import static com.task.utils.EspressoIdlingResource.getIdlingResource;
import static com.task.utils.EspressoIdlingResource.increment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.VisibleForTesting;
@@ -24,17 +33,9 @@ import java.util.List;
import javax.inject.Inject;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;
import static android.support.design.widget.Snackbar.LENGTH_SHORT;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static com.task.utils.Constants.NEWS_ITEM_KEY;
import static com.task.utils.EspressoIdlingResource.decrement;
import static com.task.utils.EspressoIdlingResource.getIdlingResource;
import static com.task.utils.EspressoIdlingResource.increment;
/**
* Created by AhmedEltaher on 5/12/2016
*/
@@ -42,17 +43,17 @@ import static com.task.utils.EspressoIdlingResource.increment;
public class HomeActivity extends BaseActivity implements HomeView {
@Inject
HomePresenter presenter;
@Bind(R.id.rv_news_list)
@BindView(R.id.rv_news_list)
RecyclerView rvNews;
@Bind(R.id.pb_loading)
@BindView(R.id.pb_loading)
ProgressBar pbLoading;
@Bind(R.id.tv_no_data)
@BindView(R.id.tv_no_data)
TextView tvNoData;
@Bind(R.id.rl_news_list)
@BindView(R.id.rl_news_list)
RelativeLayout rlNewsList;
@Bind(R.id.btn_search)
@BindView(R.id.btn_search)
ImageButton btnSearch;
@Bind(R.id.et_search)
@BindView(R.id.et_search)
EditText editTextSearch;
@Override

View File

@@ -11,7 +11,7 @@ import com.task.R;
import com.task.data.remote.dto.NewsItem;
import com.task.ui.base.listeners.RecyclerItemListener;
import butterknife.Bind;
import butterknife.BindView;
import butterknife.ButterKnife;
import static android.text.TextUtils.isEmpty;
@@ -26,13 +26,13 @@ public class NewsViewHolder extends RecyclerView.ViewHolder {
private RecyclerItemListener onItemClickListener;
@Bind(R.id.tv_caption)
@BindView(R.id.tv_caption)
TextView tvCaption;
@Bind(R.id.tv_title)
@BindView(R.id.tv_title)
TextView tvTitle;
@Bind(R.id.rl_news_item)
@BindView(R.id.rl_news_item)
RelativeLayout newsItemLayout;
@Bind(R.id.iv_news_item_image)
@BindView(R.id.iv_news_item_image)
ImageView newsImage;

View File

@@ -3,6 +3,7 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
@@ -11,8 +12,12 @@ buildscript {
//lamda
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
//ButterKnife
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}