Merge pull request #1062 from maskaravivek/dagger

Refactor usage of DaggerApplication with CommonsDaggerApplication
This commit is contained in:
neslihanturan 2018-01-15 13:51:59 +03:00 committed by GitHub
commit a88469feec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 469 additions and 327 deletions

View file

@ -1,7 +1,9 @@
package fr.free.nrw.commons.nearby;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
@ -16,13 +18,14 @@ import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
import dagger.android.support.AndroidSupportInjection;
import dagger.android.support.DaggerFragment;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.location.LatLng;
import fr.free.nrw.commons.utils.UriDeserializer;
import timber.log.Timber;
public class NearbyListFragment extends DaggerFragment {
public class NearbyListFragment extends Fragment {
private static final Type LIST_TYPE = new TypeToken<List<Place>>() {
}.getType();
private static final Type CUR_LAT_LNG_TYPE = new TypeToken<LatLng>() {
@ -40,6 +43,12 @@ public class NearbyListFragment extends DaggerFragment {
setRetainInstance(true);
}
@Override
public void onAttach(Context context) {
AndroidSupportInjection.inject(this);
super.onAttach(context);
}
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,

View file

@ -1,11 +1,14 @@
package fr.free.nrw.commons.nearby;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.ButterKnife;
import dagger.android.support.AndroidSupportInjection;
import dagger.android.support.DaggerFragment;
import fr.free.nrw.commons.R;
import timber.log.Timber;
@ -13,11 +16,17 @@ import timber.log.Timber;
/**
* Tells user that Nearby Places cannot be displayed if location permissions are denied
*/
public class NoPermissionsFragment extends DaggerFragment {
public class NoPermissionsFragment extends Fragment {
public NoPermissionsFragment() {
}
@Override
public void onAttach(Context context) {
AndroidSupportInjection.inject(this);
super.onAttach(context);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {