From 6b6a69727769722a1caee201a79a8edf2f5a405b Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Tue, 14 May 2019 11:37:57 +0300 Subject: [PATCH] Add main views on fragment --- .../mvp/fragments/NearbyParentFragment.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/mvp/fragments/NearbyParentFragment.java b/app/src/main/java/fr/free/nrw/commons/nearby/mvp/fragments/NearbyParentFragment.java index 8a73060fb..0d8dde8ae 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/mvp/fragments/NearbyParentFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/mvp/fragments/NearbyParentFragment.java @@ -1,16 +1,83 @@ package fr.free.nrw.commons.nearby.mvp.fragments; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.ProgressBar; + +import com.google.gson.Gson; + +import javax.inject.Inject; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; +import butterknife.BindView; +import butterknife.ButterKnife; +import fr.free.nrw.commons.R; import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; import fr.free.nrw.commons.location.LatLng; +import fr.free.nrw.commons.location.LocationServiceManager; import fr.free.nrw.commons.location.LocationUpdateListener; +import fr.free.nrw.commons.nearby.NearbyController; +import fr.free.nrw.commons.nearby.NearbyListFragment; +import fr.free.nrw.commons.nearby.NearbyMapFragment; import fr.free.nrw.commons.nearby.mvp.contract.NearbyParentFragmentContract; import fr.free.nrw.commons.wikidata.WikidataEditListener; +/** + * This fragment is under MainActivity at the came level with ContributionFragment and holds + * two nearby element fragments as NearbyMapFragment and NearbyListFragment + */ public class NearbyParentFragment extends CommonsDaggerSupportFragment implements LocationUpdateListener, WikidataEditListener.WikidataP18EditListener, NearbyParentFragmentContract.View { + @BindView(R.id.progressBar) + ProgressBar progressBar; + @BindView(R.id.bottom_sheet) + LinearLayout bottomSheet; + @BindView(R.id.bottom_sheet_details) + LinearLayout bottomSheetDetails; + @BindView(R.id.transparentView) + View transparentView; + @BindView(R.id.container_sheet) + FrameLayout frameLayout; + @BindView(R.id.loading_nearby_list) + ConstraintLayout loading_nearby_layout; + + @Inject + LocationServiceManager locationManager; + @Inject + NearbyController nearbyController; + @Inject + WikidataEditListener wikidataEditListener; + @Inject + Gson gson; + + public fr.free.nrw.commons.nearby.NearbyMapFragment nearbyMapFragment; + private fr.free.nrw.commons.nearby.NearbyListFragment nearbyListFragment; + private static final String TAG_RETAINED_MAP_FRAGMENT = NearbyMapFragment.class.getSimpleName(); + private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName(); + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setRetainInstance(true); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_nearby, container, false); + ButterKnife.bind(this, view); + return view; + } + @Override public void onLocationChangedSignificantly(LatLng latLng) {