Вот решение для нового проекта Dagger.
Эти две строки отвечают за создание структуры времени компиляции в Dagger 2.
compile 'com.google.dagger:dagger:2.14.1'
// создает структуру во время компиляции
annotationProcessor 'com.google.dagger:dagger-compiler:2.14.1'
// создает структуру во время компиляции на основе аннотации, которые вы предоставили.
Полная настройка Dagger
//dagger 2
compile 'com.google.dagger:dagger:2.14.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.14.1'
//to enable DaggerActivity, DaggerBroadcastReceiver, DaggerFragment etc classes
compile 'com.google.dagger:dagger-android:2.14.1'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.14.1'
//support libraries with dagger 2
compile 'com.google.dagger:dagger-android-support:2.14.1'
Примечание : необходимо настроить процесс аннотации, как показано на скриншоте ниже. Вы можете сделать это File>Other Settings>Default Settings>
поиск "Annotation processor"
My favourite is to extend jQuery with this tiny convenience:
$.fn.exists = function () {
return this.length !== 0;
}
Used like:
$("#notAnElement").exists();
More explicit than using length.
if ( $("#anid").length ) {
alert("element(s) found")
}
else {
alert("nothing found")
}
The selector returns an array of jQuery objects. If no matching elements are found, it returns an empty array. You can check the .length
of the collection returned by the selector or check whether the first array element is 'undefined'.
You can use any the following examples inside an IF statement and they all produce the same result. True, if the selector found a matching element, false otherwise.
$('#notAnElement').length > 0
$('#notAnElement').get(0) !== undefined
$('#notAnElement')[0] !== undefined