From 7d8a44b75f11c9bdfb14e81f857b3a6d98998d22 Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Fri, 7 Sep 2018 17:20:03 +0300 Subject: [PATCH] Create Contributions Fragment structure which will hold Media Detail Fragment and Contributions List Fragment --- .../contributions/ContributionsFragment.java | 215 +++++++++++++++++- 1 file changed, 213 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java index 2003606ee..3f94e9076 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java @@ -1,6 +1,217 @@ package fr.free.nrw.commons.contributions; -import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; +import android.app.FragmentManager; +import android.app.LoaderManager; +import android.content.Context; +import android.content.Intent; +import android.content.Loader; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.database.DataSetObserver; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; -public class ContributionsFragment extends CommonsDaggerSupportFragment { +import java.util.List; + +import javax.inject.Inject; +import javax.inject.Named; + +import fr.free.nrw.commons.Media; +import fr.free.nrw.commons.R; +import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; +import fr.free.nrw.commons.media.MediaDetailPagerFragment; +import fr.free.nrw.commons.mwapi.MediaWikiApi; +import fr.free.nrw.commons.nearby.NearbyPlaces; +import fr.free.nrw.commons.notification.Notification; +import fr.free.nrw.commons.notification.NotificationController; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; +import timber.log.Timber; + +public class ContributionsFragment + extends CommonsDaggerSupportFragment + implements LoaderManager.LoaderCallbacks, + AdapterView.OnItemClickListener, + MediaDetailPagerFragment.MediaDetailProvider, + FragmentManager.OnBackStackChangedListener, + ContributionsListFragment.SourceRefresher { + @Inject + @Named("default_preferences") + SharedPreferences prefs; + @Inject + ContributionDao contributionDao; + @Inject + MediaWikiApi mediaWikiApi; + @Inject + NotificationController notificationController; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return super.onCreateView(inflater, container, savedInstanceState); + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + } + + /** + * Replace FrameLayout with ContributionsListFragment, user will see contributions list. + * Creates new one if null. + */ + public void setContributionsListFragment() { + + } + + /** + * Replace FrameLayout with MediaDetailPagerFragment, user will see details of selected media. + * Creates new one if null. + */ + public void setMediaDetailPagerFragment() { + + } + + /** + * Just getter method of ContributionsListFragment child of ContributionsFragment + * @return contributionsListFragment, if any created + */ + public NewContributionsListFragment getContributionsListFragment() { + return null; + } + + /** + * Just getter method of MediaDetailPagerFragment child of ContributionsFragment + * @return mediaDetailsFragment, if any created + */ + public MediaDetailPagerFragment getMediaDetailPagerFragment() { + return null; + } + + + + + @Override + public void onBackStackChanged() { + + } + + @Override + public Loader onCreateLoader(int i, Bundle bundle) { + return null; + } + + @Override + public void onLoadFinished(Loader loader, Cursor cursor) { + + } + + @Override + public void onLoaderReset(Loader loader) { + + } + + /** + * Called when onAuthCookieAcquired is called on authenticated parent activity + * @param uploadServiceIntent + */ + public void onAuthCookieAcquired(Intent uploadServiceIntent) { + + } + + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + + } + + /** + * Replace whatever is in the current contributionsFragmentContainer view with + * mediaDetailPagerFragment, and preserve previous state in back stack. + * Called when user selects a contribution. + */ + private void showDetail(int i) { + + } + + /** + * Retry upload when it is failed + * @param i position of upload which will be retried + */ + public void retryUpload(int i) { + + } + + /** + * Delete a failed upload attempt + * @param i position of upload attempt which will be deteled + */ + public void deleteUpload(int i) { + + } + + @Override + public void refreshSource() { + + } + + @Override + public Media getMediaAtPosition(int i) { + return null; + } + + @Override + public int getTotalMediaCount() { + return 0; + } + + @Override + public void notifyDatasetChanged() { + + } + + @Override + public void registerDataSetObserver(DataSetObserver observer) { + + } + + @Override + public void unregisterDataSetObserver(DataSetObserver observer) { + + } + + + @SuppressWarnings("ConstantConditions") + private void setUploadCount() { + + } + + + private void displayUploadCount(Integer uploadCount) { + + } + + public void betaSetUploadCount(int betaUploadCount) { + displayUploadCount(betaUploadCount); + } + + /** + * Updates notification indicator on toolbar to indicate there are unread notifications + * @param unreadNotifications + */ + public void updateNotificationsNotification(List unreadNotifications) { + + } + + /** + * Update nearby indicator on cardview on main screen + * @param nearbyPlaces + */ + public void updateNearbyNotification(List nearbyPlaces) { + + } } +