mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 00:33:55 +01:00 
			
		
		
		
	Code cleanup and convert CategoriesContract to kotlin
This commit is contained in:
		
							parent
							
								
									5cbc2ad757
								
							
						
					
					
						commit
						7da4bb6dad
					
				
					 5 changed files with 108 additions and 118 deletions
				
			
		| 
						 | 
					@ -1,97 +0,0 @@
 | 
				
			||||||
package fr.free.nrw.commons.upload.categories;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import android.content.Context;
 | 
					 | 
				
			||||||
import androidx.annotation.NonNull;
 | 
					 | 
				
			||||||
import androidx.lifecycle.LiveData;
 | 
					 | 
				
			||||||
import fr.free.nrw.commons.BasePresenter;
 | 
					 | 
				
			||||||
import fr.free.nrw.commons.Media;
 | 
					 | 
				
			||||||
import fr.free.nrw.commons.category.CategoryItem;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * The contract with with UploadCategoriesFragment and its presenter would talk to each other
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
public interface CategoriesContract {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    interface View {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void showProgress(boolean shouldShow);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void showError(String error);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void showError(int stringResourceId);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void setCategories(List<CategoryItem> categories);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void goToNextScreen();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void showNoCategorySelected();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Gets existing category names from media
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        List<String> getExistingCategories();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Returns required context
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        Context getFragmentContext();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Returns to previous fragment
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void goBackToPreviousScreen();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Shows the progress dialog
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void showProgressDialog();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Hides the progress dialog
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void dismissProgressDialog();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Refreshes the categories
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void refreshCategories();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Navigate the user to Login Activity
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void navigateToLoginScreen();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    interface UserActionListener extends BasePresenter<View> {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void searchForCategories(String query);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void verifyCategories();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void onCategoryItemClicked(CategoryItem categoryItem);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Attaches view and media
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void onAttachViewWithMedia(@NonNull CategoriesContract.View view, Media media);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Clears previous selections
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void clearPreviousSelection();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * Update the categories
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        void updateCategories(Media media, String wikiText);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        LiveData<List<CategoryItem>> getCategories();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void selectCategories();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,88 @@
 | 
				
			||||||
 | 
					package fr.free.nrw.commons.upload.categories
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.content.Context
 | 
				
			||||||
 | 
					import androidx.lifecycle.LiveData
 | 
				
			||||||
 | 
					import fr.free.nrw.commons.BasePresenter
 | 
				
			||||||
 | 
					import fr.free.nrw.commons.Media
 | 
				
			||||||
 | 
					import fr.free.nrw.commons.category.CategoryItem
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * The contract with with UploadCategoriesFragment and its presenter would talk to each other
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					interface CategoriesContract {
 | 
				
			||||||
 | 
					    interface View {
 | 
				
			||||||
 | 
					        fun showProgress(shouldShow: Boolean)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun showError(error: String?)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun showError(stringResourceId: Int)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun setCategories(categories: List<CategoryItem>?)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun goToNextScreen()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun showNoCategorySelected()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Gets existing category names from media
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun getExistingCategories(): List<String>?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Returns required context
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun getFragmentContext(): Context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Returns to previous fragment
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun goBackToPreviousScreen()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Shows the progress dialog
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun showProgressDialog()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Hides the progress dialog
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun dismissProgressDialog()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Refreshes the categories
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun refreshCategories()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Navigate the user to Login Activity
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun navigateToLoginScreen()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    interface UserActionListener : BasePresenter<View> {
 | 
				
			||||||
 | 
					        fun searchForCategories(query: String)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun verifyCategories()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun onCategoryItemClicked(categoryItem: CategoryItem)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Attaches view and media
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun onAttachViewWithMedia(view: View, media: Media)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Clears previous selections
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun clearPreviousSelection()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /**
 | 
				
			||||||
 | 
					         * Update the categories
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        fun updateCategories(media: Media, wikiText: String)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun getCategories(): LiveData<List<CategoryItem>>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun selectCategories()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,6 @@ import fr.free.nrw.commons.R
 | 
				
			||||||
import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException
 | 
					import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException
 | 
				
			||||||
import fr.free.nrw.commons.category.CategoryEditHelper
 | 
					import fr.free.nrw.commons.category.CategoryEditHelper
 | 
				
			||||||
import fr.free.nrw.commons.category.CategoryItem
 | 
					import fr.free.nrw.commons.category.CategoryItem
 | 
				
			||||||
import fr.free.nrw.commons.di.CommonsApplicationModule
 | 
					 | 
				
			||||||
import fr.free.nrw.commons.di.CommonsApplicationModule.Companion.IO_THREAD
 | 
					import fr.free.nrw.commons.di.CommonsApplicationModule.Companion.IO_THREAD
 | 
				
			||||||
import fr.free.nrw.commons.di.CommonsApplicationModule.Companion.MAIN_THREAD
 | 
					import fr.free.nrw.commons.di.CommonsApplicationModule.Companion.MAIN_THREAD
 | 
				
			||||||
import fr.free.nrw.commons.repository.UploadRepository
 | 
					import fr.free.nrw.commons.repository.UploadRepository
 | 
				
			||||||
| 
						 | 
					@ -175,7 +174,7 @@ class CategoriesPresenter
 | 
				
			||||||
        ) {
 | 
					        ) {
 | 
				
			||||||
            this.view = view
 | 
					            this.view = view
 | 
				
			||||||
            this.media = media
 | 
					            this.media = media
 | 
				
			||||||
            repository.setSelectedExistingCategories(view.existingCategories)
 | 
					            repository.setSelectedExistingCategories(view.getExistingCategories() ?: emptyList())
 | 
				
			||||||
            compositeDisposable.add(
 | 
					            compositeDisposable.add(
 | 
				
			||||||
                searchTerms
 | 
					                searchTerms
 | 
				
			||||||
                    .observeOn(mainThreadScheduler)
 | 
					                    .observeOn(mainThreadScheduler)
 | 
				
			||||||
| 
						 | 
					@ -224,11 +223,11 @@ class CategoriesPresenter
 | 
				
			||||||
                repository.getSelectedCategories().isNotEmpty()
 | 
					                repository.getSelectedCategories().isNotEmpty()
 | 
				
			||||||
                        ||
 | 
					                        ||
 | 
				
			||||||
                (
 | 
					                (
 | 
				
			||||||
                view.existingCategories != null
 | 
					                view.getExistingCategories() != null
 | 
				
			||||||
                        &&
 | 
					                        &&
 | 
				
			||||||
                repository.getSelectedExistingCategories().size
 | 
					                repository.getSelectedExistingCategories().size
 | 
				
			||||||
                        !=
 | 
					                        !=
 | 
				
			||||||
                view.existingCategories.size
 | 
					                view.getExistingCategories()?.size
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            ) {
 | 
					            ) {
 | 
				
			||||||
                val selectedCategories: MutableList<String> =
 | 
					                val selectedCategories: MutableList<String> =
 | 
				
			||||||
| 
						 | 
					@ -244,7 +243,7 @@ class CategoriesPresenter
 | 
				
			||||||
                        compositeDisposable.add(
 | 
					                        compositeDisposable.add(
 | 
				
			||||||
                            categoryEditHelper
 | 
					                            categoryEditHelper
 | 
				
			||||||
                                .makeCategoryEdit(
 | 
					                                .makeCategoryEdit(
 | 
				
			||||||
                                    view.fragmentContext,
 | 
					                                    view.getFragmentContext(),
 | 
				
			||||||
                                    media,
 | 
					                                    media,
 | 
				
			||||||
                                    selectedCategories,
 | 
					                                    selectedCategories,
 | 
				
			||||||
                                    wikiText,
 | 
					                                    wikiText,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,14 +65,14 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Nullable
 | 
					    @Nullable
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
 | 
					    public View onCreateView(@NonNull final LayoutInflater inflater, @Nullable final ViewGroup container,
 | 
				
			||||||
                             @Nullable Bundle savedInstanceState) {
 | 
					                             @Nullable final Bundle savedInstanceState) {
 | 
				
			||||||
        binding = UploadCategoriesFragmentBinding.inflate(inflater, container, false);
 | 
					        binding = UploadCategoriesFragmentBinding.inflate(inflater, container, false);
 | 
				
			||||||
        return binding.getRoot();
 | 
					        return binding.getRoot();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
 | 
					    public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
 | 
				
			||||||
        super.onViewCreated(view, savedInstanceState);
 | 
					        super.onViewCreated(view, savedInstanceState);
 | 
				
			||||||
        final Bundle bundle = getArguments();
 | 
					        final Bundle bundle = getArguments();
 | 
				
			||||||
        if (bundle != null) {
 | 
					        if (bundle != null) {
 | 
				
			||||||
| 
						 | 
					@ -104,8 +104,8 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
 | 
				
			||||||
        setTvSubTitle();
 | 
					        setTvSubTitle();
 | 
				
			||||||
        binding.tooltip.setOnClickListener(new OnClickListener() {
 | 
					        binding.tooltip.setOnClickListener(new OnClickListener() {
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public void onClick(View v) {
 | 
					            public void onClick(final View v) {
 | 
				
			||||||
                DialogUtil.showAlertDialog(getActivity(), getString(R.string.categories_activity_title), getString(R.string.categories_tooltip), getString(android.R.string.ok), null);
 | 
					                DialogUtil.showAlertDialog(requireActivity(), getString(R.string.categories_activity_title), getString(R.string.categories_tooltip), getString(android.R.string.ok), null, true);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        if (media == null) {
 | 
					        if (media == null) {
 | 
				
			||||||
| 
						 | 
					@ -146,7 +146,7 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void searchForCategory(String query) {
 | 
					    private void searchForCategory(final String query) {
 | 
				
			||||||
        presenter.searchForCategories(query);
 | 
					        presenter.searchForCategories(query);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,28 +170,28 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void showProgress(boolean shouldShow) {
 | 
					    public void showProgress(final boolean shouldShow) {
 | 
				
			||||||
        if (binding != null) {
 | 
					        if (binding != null) {
 | 
				
			||||||
            binding.pbCategories.setVisibility(shouldShow ? View.VISIBLE : View.GONE);
 | 
					            binding.pbCategories.setVisibility(shouldShow ? View.VISIBLE : View.GONE);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void showError(String error) {
 | 
					    public void showError(final String error) {
 | 
				
			||||||
        if (binding != null) {
 | 
					        if (binding != null) {
 | 
				
			||||||
            binding.tilContainerSearch.setError(error);
 | 
					            binding.tilContainerSearch.setError(error);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void showError(int stringResourceId) {
 | 
					    public void showError(final int stringResourceId) {
 | 
				
			||||||
        if (binding != null) {
 | 
					        if (binding != null) {
 | 
				
			||||||
            binding.tilContainerSearch.setError(getString(stringResourceId));
 | 
					            binding.tilContainerSearch.setError(getString(stringResourceId));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void setCategories(List<CategoryItem> categories) {
 | 
					    public void setCategories(final List<CategoryItem> categories) {
 | 
				
			||||||
        if (categories == null) {
 | 
					        if (categories == null) {
 | 
				
			||||||
            adapter.clear();
 | 
					            adapter.clear();
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
| 
						 | 
					@ -229,12 +229,12 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void showNoCategorySelected() {
 | 
					    public void showNoCategorySelected() {
 | 
				
			||||||
        if (media == null) {
 | 
					        if (media == null) {
 | 
				
			||||||
            DialogUtil.showAlertDialog(getActivity(),
 | 
					            DialogUtil.showAlertDialog(requireActivity(),
 | 
				
			||||||
                getString(R.string.no_categories_selected),
 | 
					                getString(R.string.no_categories_selected),
 | 
				
			||||||
                getString(R.string.no_categories_selected_warning_desc),
 | 
					                getString(R.string.no_categories_selected_warning_desc),
 | 
				
			||||||
                getString(R.string.continue_message),
 | 
					                getString(R.string.continue_message),
 | 
				
			||||||
                getString(R.string.cancel),
 | 
					                getString(R.string.cancel),
 | 
				
			||||||
                () -> goToNextScreen(),
 | 
					                this::goToNextScreen,
 | 
				
			||||||
                null);
 | 
					                null);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            Toast.makeText(requireContext(), getString(R.string.no_categories_selected),
 | 
					            Toast.makeText(requireContext(), getString(R.string.no_categories_selected),
 | 
				
			||||||
| 
						 | 
					@ -256,6 +256,7 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Returns required context
 | 
					     * Returns required context
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					    @NonNull
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Context getFragmentContext() {
 | 
					    public Context getFragmentContext() {
 | 
				
			||||||
        return requireContext();
 | 
					        return requireContext();
 | 
				
			||||||
| 
						 | 
					@ -306,7 +307,7 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
 | 
				
			||||||
    public void navigateToLoginScreen() {
 | 
					    public void navigateToLoginScreen() {
 | 
				
			||||||
        final String username = sessionManager.getUserName();
 | 
					        final String username = sessionManager.getUserName();
 | 
				
			||||||
        final CommonsApplication.BaseLogoutListener logoutListener = new CommonsApplication.BaseLogoutListener(
 | 
					        final CommonsApplication.BaseLogoutListener logoutListener = new CommonsApplication.BaseLogoutListener(
 | 
				
			||||||
            getActivity(),
 | 
					            requireActivity(),
 | 
				
			||||||
            requireActivity().getString(R.string.invalid_login_message),
 | 
					            requireActivity().getString(R.string.invalid_login_message),
 | 
				
			||||||
            username
 | 
					            username
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,6 @@ import android.view.LayoutInflater
 | 
				
			||||||
import androidx.fragment.app.FragmentManager
 | 
					import androidx.fragment.app.FragmentManager
 | 
				
			||||||
import androidx.fragment.app.FragmentTransaction
 | 
					import androidx.fragment.app.FragmentTransaction
 | 
				
			||||||
import androidx.test.core.app.ApplicationProvider
 | 
					import androidx.test.core.app.ApplicationProvider
 | 
				
			||||||
import com.nhaarman.mockitokotlin2.times
 | 
					 | 
				
			||||||
import fr.free.nrw.commons.Media
 | 
					import fr.free.nrw.commons.Media
 | 
				
			||||||
import fr.free.nrw.commons.OkHttpConnectionFactory
 | 
					import fr.free.nrw.commons.OkHttpConnectionFactory
 | 
				
			||||||
import fr.free.nrw.commons.R
 | 
					import fr.free.nrw.commons.R
 | 
				
			||||||
| 
						 | 
					@ -184,14 +183,14 @@ class UploadCategoriesFragmentUnitTests {
 | 
				
			||||||
    @Throws(Exception::class)
 | 
					    @Throws(Exception::class)
 | 
				
			||||||
    fun testGetExistingCategories() {
 | 
					    fun testGetExistingCategories() {
 | 
				
			||||||
        Shadows.shadowOf(Looper.getMainLooper()).idle()
 | 
					        Shadows.shadowOf(Looper.getMainLooper()).idle()
 | 
				
			||||||
        fragment.existingCategories
 | 
					        fragment.getExistingCategories()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @Throws(Exception::class)
 | 
					    @Throws(Exception::class)
 | 
				
			||||||
    fun testGetFragmentContext() {
 | 
					    fun testGetFragmentContext() {
 | 
				
			||||||
        Shadows.shadowOf(Looper.getMainLooper()).idle()
 | 
					        Shadows.shadowOf(Looper.getMainLooper()).idle()
 | 
				
			||||||
        fragment.fragmentContext
 | 
					        fragment.getFragmentContext()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue