mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 08:43:52 +01:00 
			
		
		
		
	Merge branch 'master' into wikidataEdits
This commit is contained in:
		
						commit
						0e86741cc4
					
				
					 126 changed files with 1634 additions and 665 deletions
				
			
		| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
package fr.free.nrw.commons.upload;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import javax.inject.Inject;
 | 
			
		||||
import javax.inject.Singleton;
 | 
			
		||||
 | 
			
		||||
@Singleton
 | 
			
		||||
public class GpsCategoryModel {
 | 
			
		||||
    private Set<String> categorySet;
 | 
			
		||||
 | 
			
		||||
    @Inject
 | 
			
		||||
    public GpsCategoryModel() {
 | 
			
		||||
        clear();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void clear() {
 | 
			
		||||
        categorySet = new HashSet<>();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean getGpsCatExists() {
 | 
			
		||||
        return !categorySet.isEmpty();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<String> getCategoryList() {
 | 
			
		||||
        return new ArrayList<>(categorySet);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCategoryList(List<String> categoryList) {
 | 
			
		||||
        clear();
 | 
			
		||||
        categorySet.addAll(categoryList != null ? categoryList : new ArrayList<>());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void add(String categoryString) {
 | 
			
		||||
        categorySet.add(categoryString);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +26,8 @@ import android.widget.GridView;
 | 
			
		|||
import android.widget.RelativeLayout;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
 | 
			
		||||
import butterknife.BindView;
 | 
			
		||||
import butterknife.ButterKnife;
 | 
			
		||||
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
 | 
			
		||||
import com.facebook.drawee.view.SimpleDraweeView;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -41,9 +43,13 @@ public class MultipleUploadListFragment extends Fragment {
 | 
			
		|||
        void OnMultipleUploadInitiated();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private GridView photosGrid;
 | 
			
		||||
    @BindView(R.id.multipleShareBackground)
 | 
			
		||||
    GridView photosGrid;
 | 
			
		||||
 | 
			
		||||
    @BindView(R.id.multipleBaseTitle)
 | 
			
		||||
    EditText baseTitle;
 | 
			
		||||
 | 
			
		||||
    private PhotoDisplayAdapter photosAdapter;
 | 
			
		||||
    private EditText baseTitle;
 | 
			
		||||
    private TitleTextWatcher textWatcher = new TitleTextWatcher();
 | 
			
		||||
 | 
			
		||||
    private Point photoSize;
 | 
			
		||||
| 
						 | 
				
			
			@ -166,9 +172,7 @@ public class MultipleUploadListFragment extends Fragment {
 | 
			
		|||
    @Override
 | 
			
		||||
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 | 
			
		||||
        View view = inflater.inflate(R.layout.fragment_multiple_uploads_list, container, false);
 | 
			
		||||
        photosGrid = view.findViewById(R.id.multipleShareBackground);
 | 
			
		||||
        baseTitle = view.findViewById(R.id.multipleBaseTitle);
 | 
			
		||||
 | 
			
		||||
        ButterKnife.bind(this,view);
 | 
			
		||||
        photosAdapter = new PhotoDisplayAdapter();
 | 
			
		||||
        photosGrid.setAdapter(photosAdapter);
 | 
			
		||||
        photosGrid.setOnItemClickListener((AdapterView.OnItemClickListener) getActivity());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,249 +0,0 @@
 | 
			
		|||
package fr.free.nrw.commons.upload;
 | 
			
		||||
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.net.Uri;
 | 
			
		||||
 | 
			
		||||
import com.android.volley.Cache;
 | 
			
		||||
import com.android.volley.NetworkResponse;
 | 
			
		||||
import com.android.volley.Request;
 | 
			
		||||
import com.android.volley.RequestQueue;
 | 
			
		||||
import com.android.volley.Response;
 | 
			
		||||
import com.android.volley.VolleyError;
 | 
			
		||||
import com.android.volley.toolbox.HttpHeaderParser;
 | 
			
		||||
import com.android.volley.toolbox.JsonRequest;
 | 
			
		||||
import com.android.volley.toolbox.Volley;
 | 
			
		||||
import com.google.gson.Gson;
 | 
			
		||||
import com.google.gson.GsonBuilder;
 | 
			
		||||
 | 
			
		||||
import java.io.UnsupportedEncodingException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import timber.log.Timber;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Uses the Volley library to implement asynchronous calls to the Commons MediaWiki API to match
 | 
			
		||||
 * GPS coordinates with nearby Commons categories. Parses the results using GSON to obtain a list
 | 
			
		||||
 * of relevant categories.
 | 
			
		||||
 */
 | 
			
		||||
public class MwVolleyApi {
 | 
			
		||||
 | 
			
		||||
    private static RequestQueue REQUEST_QUEUE;
 | 
			
		||||
    private static final Gson GSON = new GsonBuilder().create();
 | 
			
		||||
 | 
			
		||||
    private static Set<String> categorySet;
 | 
			
		||||
    private static List<String> categoryList;
 | 
			
		||||
 | 
			
		||||
    private static final String MWURL = "https://commons.wikimedia.org/";
 | 
			
		||||
    private final Context context;
 | 
			
		||||
 | 
			
		||||
    public MwVolleyApi(Context context) {
 | 
			
		||||
        this.context = context;
 | 
			
		||||
        categorySet = new HashSet<>();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static List<String> getGpsCat() {
 | 
			
		||||
        return categoryList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void setGpsCat(List<String> cachedList) {
 | 
			
		||||
        categoryList = new ArrayList<>();
 | 
			
		||||
        categoryList.addAll(cachedList);
 | 
			
		||||
        Timber.d("Setting GPS cats from cache: %s", categoryList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void request(String coords) {
 | 
			
		||||
        String apiUrl = buildUrl(coords);
 | 
			
		||||
        Timber.d("URL: %s", apiUrl);
 | 
			
		||||
 | 
			
		||||
        JsonRequest<QueryResponse> request = new QueryRequest(apiUrl,
 | 
			
		||||
                new LogResponseListener<>(), new LogResponseErrorListener());
 | 
			
		||||
        getQueue().add(request);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Builds URL with image coords for MediaWiki API calls
 | 
			
		||||
     * Example URL: https://commons.wikimedia.org/w/api.php?action=query&prop=categories|coordinates|pageprops&format=json&clshow=!hidden&coprop=type|name|dim|country|region|globe&codistancefrompoint=38.11386944444445|13.356263888888888&generator=geosearch&redirects=&ggscoord=38.11386944444445|1.356263888888888&ggsradius=100&ggslimit=10&ggsnamespace=6&ggsprop=type|name|dim|country|region|globe&ggsprimary=all&formatversion=2
 | 
			
		||||
     * @param coords Coordinates to build query with
 | 
			
		||||
     * @return URL for API query
 | 
			
		||||
     */
 | 
			
		||||
    private String buildUrl(String coords) {
 | 
			
		||||
 | 
			
		||||
        Uri.Builder builder = Uri.parse(MWURL).buildUpon();
 | 
			
		||||
 | 
			
		||||
        builder.appendPath("w")
 | 
			
		||||
                .appendPath("api.php")
 | 
			
		||||
                .appendQueryParameter("action", "query")
 | 
			
		||||
                .appendQueryParameter("prop", "categories|coordinates|pageprops")
 | 
			
		||||
                .appendQueryParameter("format", "json")
 | 
			
		||||
                .appendQueryParameter("clshow", "!hidden")
 | 
			
		||||
                .appendQueryParameter("coprop", "type|name|dim|country|region|globe")
 | 
			
		||||
                .appendQueryParameter("codistancefrompoint", coords)
 | 
			
		||||
                .appendQueryParameter("generator", "geosearch")
 | 
			
		||||
                .appendQueryParameter("ggscoord", coords)
 | 
			
		||||
                .appendQueryParameter("ggsradius", "10000")
 | 
			
		||||
                .appendQueryParameter("ggslimit", "10")
 | 
			
		||||
                .appendQueryParameter("ggsnamespace", "6")
 | 
			
		||||
                .appendQueryParameter("ggsprop", "type|name|dim|country|region|globe")
 | 
			
		||||
                .appendQueryParameter("ggsprimary", "all")
 | 
			
		||||
                .appendQueryParameter("formatversion", "2");
 | 
			
		||||
 | 
			
		||||
        return builder.toString();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private synchronized RequestQueue getQueue() {
 | 
			
		||||
        if (REQUEST_QUEUE == null) {
 | 
			
		||||
            REQUEST_QUEUE = Volley.newRequestQueue(context);
 | 
			
		||||
        }
 | 
			
		||||
        return REQUEST_QUEUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class LogResponseListener<T> implements Response.Listener<T> {
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onResponse(T response) {
 | 
			
		||||
            Timber.d(response.toString());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class LogResponseErrorListener implements Response.ErrorListener {
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onErrorResponse(VolleyError error) {
 | 
			
		||||
            Timber.e(error.toString());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class QueryRequest extends JsonRequest<QueryResponse> {
 | 
			
		||||
 | 
			
		||||
        public QueryRequest(String url,
 | 
			
		||||
                            Response.Listener<QueryResponse> listener,
 | 
			
		||||
                            Response.ErrorListener errorListener) {
 | 
			
		||||
            super(Request.Method.GET, url, null, listener, errorListener);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        protected Response<QueryResponse> parseNetworkResponse(NetworkResponse response) {
 | 
			
		||||
            String json = parseString(response);
 | 
			
		||||
            QueryResponse queryResponse = GSON.fromJson(json, QueryResponse.class);
 | 
			
		||||
            return Response.success(queryResponse, cacheEntry(response));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Cache.Entry cacheEntry(NetworkResponse response) {
 | 
			
		||||
            return HttpHeaderParser.parseCacheHeaders(response);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private String parseString(NetworkResponse response) {
 | 
			
		||||
            try {
 | 
			
		||||
                return new String(response.data, HttpHeaderParser.parseCharset(response.headers));
 | 
			
		||||
            } catch (UnsupportedEncodingException e) {
 | 
			
		||||
                return new String(response.data);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class GpsCatExists {
 | 
			
		||||
        private static boolean gpsCatExists;
 | 
			
		||||
 | 
			
		||||
        public static void setGpsCatExists(boolean gpsCat) {
 | 
			
		||||
            gpsCatExists = gpsCat;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static boolean getGpsCatExists() {
 | 
			
		||||
            return gpsCatExists;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class QueryResponse {
 | 
			
		||||
        private Query query = new Query();
 | 
			
		||||
 | 
			
		||||
        private String printSet() {
 | 
			
		||||
            if (categorySet == null || categorySet.isEmpty()) {
 | 
			
		||||
                GpsCatExists.setGpsCatExists(false);
 | 
			
		||||
                Timber.d("gpsCatExists=%b", GpsCatExists.getGpsCatExists());
 | 
			
		||||
                return "No collection of categories";
 | 
			
		||||
            } else {
 | 
			
		||||
                GpsCatExists.setGpsCatExists(true);
 | 
			
		||||
                Timber.d("gpsCatExists=%b", GpsCatExists.getGpsCatExists());
 | 
			
		||||
                return "CATEGORIES FOUND" + categorySet.toString();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public String toString() {
 | 
			
		||||
            if (query != null) {
 | 
			
		||||
                return "query=" + query.toString() + "\n" + printSet();
 | 
			
		||||
            } else {
 | 
			
		||||
                return "No pages found";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class Query {
 | 
			
		||||
        private Page [] pages;
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public String toString() {
 | 
			
		||||
            StringBuilder builder = new StringBuilder("pages=" + "\n");
 | 
			
		||||
            if (pages != null) {
 | 
			
		||||
                for (Page page : pages) {
 | 
			
		||||
                    builder.append(page.toString());
 | 
			
		||||
                    builder.append("\n");
 | 
			
		||||
                }
 | 
			
		||||
                builder.replace(builder.length() - 1, builder.length(), "");
 | 
			
		||||
                return builder.toString();
 | 
			
		||||
            } else {
 | 
			
		||||
                return "No pages found";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class Page {
 | 
			
		||||
        private int pageid;
 | 
			
		||||
        private int ns;
 | 
			
		||||
        private String title;
 | 
			
		||||
        private Category[] categories;
 | 
			
		||||
        private Category category;
 | 
			
		||||
 | 
			
		||||
        public Page() {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public String toString() {
 | 
			
		||||
 | 
			
		||||
            StringBuilder builder = new StringBuilder("PAGEID=" + pageid + " ns=" + ns + " title=" + title + "\n" + " CATEGORIES= ");
 | 
			
		||||
 | 
			
		||||
            if (categories == null || categories.length == 0) {
 | 
			
		||||
                builder.append("no categories exist\n");
 | 
			
		||||
            } else {
 | 
			
		||||
                for (Category category : categories) {
 | 
			
		||||
                    builder.append(category.toString());
 | 
			
		||||
                    builder.append("\n");
 | 
			
		||||
                    if (category != null) {
 | 
			
		||||
                        String categoryString = category.toString().replace("Category:", "");
 | 
			
		||||
                        categorySet.add(categoryString);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            categoryList = new ArrayList<>(categorySet);
 | 
			
		||||
            builder.replace(builder.length() - 1, builder.length(), "");
 | 
			
		||||
            return builder.toString();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class Category {
 | 
			
		||||
        private String title;
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public String toString() {
 | 
			
		||||
            return title;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
package fr.free.nrw.commons.upload;
 | 
			
		||||
 | 
			
		||||
import android.Manifest;
 | 
			
		||||
import android.annotation.SuppressLint;
 | 
			
		||||
import android.app.Activity;
 | 
			
		||||
import android.animation.Animator;
 | 
			
		||||
import android.animation.AnimatorListenerAdapter;
 | 
			
		||||
| 
						 | 
				
			
			@ -31,16 +32,16 @@ import android.support.v4.app.ActivityCompat;
 | 
			
		|||
import android.support.v4.app.FragmentManager;
 | 
			
		||||
import android.support.v4.content.ContextCompat;
 | 
			
		||||
import android.support.v4.graphics.BitmapCompat;
 | 
			
		||||
import android.support.v7.app.AlertDialog;
 | 
			
		||||
import android.util.Log;
 | 
			
		||||
import android.view.MenuItem;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.view.WindowManager;
 | 
			
		||||
import android.view.animation.DecelerateInterpolator;
 | 
			
		||||
import android.view.inputmethod.InputMethodManager;
 | 
			
		||||
import android.widget.FrameLayout;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
import android.widget.Toast;
 | 
			
		||||
 | 
			
		||||
import butterknife.BindView;
 | 
			
		||||
import butterknife.OnClick;
 | 
			
		||||
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
 | 
			
		||||
import com.facebook.drawee.view.SimpleDraweeView;
 | 
			
		||||
import com.github.chrisbanes.photoview.PhotoView;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,14 +74,16 @@ import fr.free.nrw.commons.modifications.ModificationsContentProvider;
 | 
			
		|||
import fr.free.nrw.commons.modifications.ModifierSequence;
 | 
			
		||||
import fr.free.nrw.commons.modifications.ModifierSequenceDao;
 | 
			
		||||
import fr.free.nrw.commons.modifications.TemplateRemoveModifier;
 | 
			
		||||
import fr.free.nrw.commons.mwapi.CategoryApi;
 | 
			
		||||
 | 
			
		||||
import fr.free.nrw.commons.mwapi.MediaWikiApi;
 | 
			
		||||
import io.reactivex.schedulers.Schedulers;
 | 
			
		||||
import fr.free.nrw.commons.utils.ViewUtil;
 | 
			
		||||
import timber.log.Timber;
 | 
			
		||||
 | 
			
		||||
import android.support.design.widget.FloatingActionButton;
 | 
			
		||||
import static fr.free.nrw.commons.upload.ExistingFileAsync.Result.DUPLICATE_PROCEED;
 | 
			
		||||
import static fr.free.nrw.commons.upload.ExistingFileAsync.Result.NO_DUPLICATE;
 | 
			
		||||
import static java.lang.Long.min;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Activity for the title/desc screen after image is selected. Also starts processing image
 | 
			
		||||
| 
						 | 
				
			
			@ -91,6 +94,22 @@ public class ShareActivity
 | 
			
		|||
        implements SingleUploadFragment.OnUploadActionInitiated,
 | 
			
		||||
        OnCategoriesSaveHandler,SimilarImageDialogFragment.onResponse {
 | 
			
		||||
 | 
			
		||||
    @BindView(R.id.container)
 | 
			
		||||
    FrameLayout flContainer;
 | 
			
		||||
    @BindView(R.id.backgroundImage)
 | 
			
		||||
    SimpleDraweeView backgroundImageView;
 | 
			
		||||
    @BindView(R.id.media_map)
 | 
			
		||||
    FloatingActionButton mapsFragment; //Lets stick to camelCase
 | 
			
		||||
    @BindView(R.id.media_upload_zoom_in)
 | 
			
		||||
    FloatingActionButton zoomInButton;
 | 
			
		||||
    @BindView(R.id.media_upload_zoom_out)
 | 
			
		||||
    FloatingActionButton zoomOutButton;
 | 
			
		||||
    @BindView(R.id.main_fab)
 | 
			
		||||
    FloatingActionButton mainFab;
 | 
			
		||||
    @BindView(R.id.expanded_image)
 | 
			
		||||
    PhotoView expandedImageView;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private static final int REQUEST_PERM_ON_CREATE_STORAGE = 1;
 | 
			
		||||
    private static final int REQUEST_PERM_ON_CREATE_LOCATION = 2;
 | 
			
		||||
    private static final int REQUEST_PERM_ON_CREATE_STORAGE_AND_LOCATION = 3;
 | 
			
		||||
| 
						 | 
				
			
			@ -108,8 +127,12 @@ public class ShareActivity
 | 
			
		|||
    @Inject
 | 
			
		||||
    ModifierSequenceDao modifierSequenceDao;
 | 
			
		||||
    @Inject
 | 
			
		||||
    CategoryApi apiCall;
 | 
			
		||||
    @Inject
 | 
			
		||||
    @Named("default_preferences")
 | 
			
		||||
    SharedPreferences prefs;
 | 
			
		||||
    @Inject
 | 
			
		||||
    GpsCategoryModel gpsCategoryModel;
 | 
			
		||||
 | 
			
		||||
    private String source;
 | 
			
		||||
    private String mimeType;
 | 
			
		||||
| 
						 | 
				
			
			@ -145,6 +168,12 @@ public class ShareActivity
 | 
			
		|||
    private FloatingActionButton mainFab;
 | 
			
		||||
    private boolean isFABOpen = false;
 | 
			
		||||
 | 
			
		||||
          //Had to make them class variables, to extract out the click listeners, also I see no harm in this
 | 
			
		||||
    final Rect startBounds = new Rect();
 | 
			
		||||
    final Rect finalBounds = new Rect();
 | 
			
		||||
    final Point globalOffset = new Point();
 | 
			
		||||
    private float startScaleFinal;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Called when user taps the submit button.
 | 
			
		||||
| 
						 | 
				
			
			@ -254,7 +283,6 @@ public class ShareActivity
 | 
			
		|||
        setContentView(R.layout.activity_share);
 | 
			
		||||
        ButterKnife.bind(this);
 | 
			
		||||
        initBack();
 | 
			
		||||
        backgroundImageView = (SimpleDraweeView) findViewById(R.id.backgroundImage);
 | 
			
		||||
        backgroundImageView.setHierarchy(GenericDraweeHierarchyBuilder
 | 
			
		||||
                .newInstance(getResources())
 | 
			
		||||
                .setPlaceholderImage(VectorDrawableCompat.create(getResources(),
 | 
			
		||||
| 
						 | 
				
			
			@ -286,37 +314,6 @@ public class ShareActivity
 | 
			
		|||
        if (mediaUri != null) {
 | 
			
		||||
            backgroundImageView.setImageURI(mediaUri);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        mainFab = (FloatingActionButton) findViewById(R.id.main_fab);
 | 
			
		||||
        /*
 | 
			
		||||
         * called when upper arrow floating button
 | 
			
		||||
         */
 | 
			
		||||
        mainFab.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
                if(!isFABOpen){
 | 
			
		||||
                    showFABMenu();
 | 
			
		||||
                }else{
 | 
			
		||||
                    closeFABMenu();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        zoomInButton = (FloatingActionButton) findViewById(R.id.media_upload_zoom_in);
 | 
			
		||||
        try {
 | 
			
		||||
            zoomInButton.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
                @Override
 | 
			
		||||
                public void onClick(View v) {
 | 
			
		||||
                    zoomImageFromThumb(backgroundImageView, mediaUri);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        } catch (Exception e){
 | 
			
		||||
            Log.i("exception", e.toString());
 | 
			
		||||
        }
 | 
			
		||||
        zoomOutButton = (FloatingActionButton) findViewById(R.id.media_upload_zoom_out);
 | 
			
		||||
 | 
			
		||||
        if (savedInstanceState != null) {
 | 
			
		||||
            contribution = savedInstanceState.getParcelable("contribution");
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -378,25 +375,13 @@ public class ShareActivity
 | 
			
		|||
                    .commitAllowingStateLoss();
 | 
			
		||||
        }
 | 
			
		||||
        uploadController.prepareService();
 | 
			
		||||
        maps_fragment = (FloatingActionButton) findViewById(R.id.media_map);
 | 
			
		||||
        maps_fragment.setVisibility(View.VISIBLE);
 | 
			
		||||
        mapsFragment.setVisibility(View.VISIBLE);
 | 
			
		||||
        if( imageObj == null || imageObj.imageCoordsExists != true){
 | 
			
		||||
            maps_fragment.setVisibility(View.INVISIBLE);
 | 
			
		||||
            mapsFragment.setVisibility(View.INVISIBLE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        maps_fragment.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
                if( imageObj != null && imageObj.imageCoordsExists == true) {
 | 
			
		||||
                    Uri gmmIntentUri = Uri.parse("google.streetview:cbll=" + imageObj.getDecLatitude() + "," + imageObj.getDecLongitude());
 | 
			
		||||
                    Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
 | 
			
		||||
                    mapIntent.setPackage("com.google.android.apps.maps");
 | 
			
		||||
                    startActivity(mapIntent);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Function to display the zoom and map FAB
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -404,11 +389,11 @@ public class ShareActivity
 | 
			
		|||
        isFABOpen=true;
 | 
			
		||||
 | 
			
		||||
        if( imageObj != null && imageObj.imageCoordsExists == true)
 | 
			
		||||
        maps_fragment.setVisibility(View.VISIBLE);
 | 
			
		||||
        mapsFragment.setVisibility(View.VISIBLE);
 | 
			
		||||
        zoomInButton.setVisibility(View.VISIBLE);
 | 
			
		||||
 | 
			
		||||
        mainFab.animate().rotationBy(180);
 | 
			
		||||
        maps_fragment.animate().translationY(-getResources().getDimension(R.dimen.second_fab));
 | 
			
		||||
        mapsFragment.animate().translationY(-getResources().getDimension(R.dimen.second_fab));
 | 
			
		||||
        zoomInButton.animate().translationY(-getResources().getDimension(R.dimen.first_fab));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -418,7 +403,7 @@ public class ShareActivity
 | 
			
		|||
    private void closeFABMenu(){
 | 
			
		||||
        isFABOpen=false;
 | 
			
		||||
        mainFab.animate().rotationBy(-180);
 | 
			
		||||
        maps_fragment.animate().translationY(0);
 | 
			
		||||
        mapsFragment.animate().translationY(0);
 | 
			
		||||
        zoomInButton.animate().translationY(0).setListener(new Animator.AnimatorListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onAnimationStart(Animator animator) {
 | 
			
		||||
| 
						 | 
				
			
			@ -428,7 +413,7 @@ public class ShareActivity
 | 
			
		|||
            @Override
 | 
			
		||||
            public void onAnimationEnd(Animator animator) {
 | 
			
		||||
                if(!isFABOpen){
 | 
			
		||||
                    maps_fragment.setVisibility(View.GONE);
 | 
			
		||||
                    mapsFragment.setVisibility(View.GONE);
 | 
			
		||||
                    zoomInButton.setVisibility(View.GONE);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -446,6 +431,7 @@ public class ShareActivity
 | 
			
		|||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onRequestPermissionsResult(int requestCode,
 | 
			
		||||
                                           @NonNull String[] permissions, @NonNull int[] grantResults) {
 | 
			
		||||
| 
						 | 
				
			
			@ -699,8 +685,9 @@ public class ShareActivity
 | 
			
		|||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //I might not be supposed to change it, but still, I saw it
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onPostiveResponse() {
 | 
			
		||||
    public void onPositiveResponse() {
 | 
			
		||||
        imageObj = tempImageObj;
 | 
			
		||||
        decimalCoords = imageObj.getCoords(false);// Not necessary to use gps as image already ha EXIF data
 | 
			
		||||
        Timber.d("EXIF from tempImageObj");
 | 
			
		||||
| 
						 | 
				
			
			@ -716,8 +703,9 @@ public class ShareActivity
 | 
			
		|||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initiates retrieval of image coordinates or user coordinates, and caching of coordinates.
 | 
			
		||||
     * Then initiates the calls to MediaWiki API through an instance of MwVolleyApi.
 | 
			
		||||
     * Then initiates the calls to MediaWiki API through an instance of CategpryApi.
 | 
			
		||||
     */
 | 
			
		||||
    @SuppressLint("CheckResult")
 | 
			
		||||
    public void useImageCoords() {
 | 
			
		||||
        if (decimalCoords != null) {
 | 
			
		||||
            Timber.d("Decimal coords of image: %s", decimalCoords);
 | 
			
		||||
| 
						 | 
				
			
			@ -730,20 +718,27 @@ public class ShareActivity
 | 
			
		|||
                cacheController.setQtPoint(decLongitude, decLatitude);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            MwVolleyApi apiCall = new MwVolleyApi(this);
 | 
			
		||||
 | 
			
		||||
            List<String> displayCatList = cacheController.findCategory();
 | 
			
		||||
            boolean catListEmpty = displayCatList.isEmpty();
 | 
			
		||||
 | 
			
		||||
            // If no categories found in cache, call MediaWiki API to match image coords with nearby Commons categories
 | 
			
		||||
            if (catListEmpty) {
 | 
			
		||||
                cacheFound = false;
 | 
			
		||||
                apiCall.request(decimalCoords);
 | 
			
		||||
                apiCall.request(decimalCoords)
 | 
			
		||||
                        .subscribeOn(Schedulers.io())
 | 
			
		||||
                        .observeOn(Schedulers.io())
 | 
			
		||||
                        .subscribe(
 | 
			
		||||
                                gpsCategoryModel::setCategoryList,
 | 
			
		||||
                                throwable -> {
 | 
			
		||||
                                    Timber.e(throwable);
 | 
			
		||||
                                    gpsCategoryModel.clear();
 | 
			
		||||
                                }
 | 
			
		||||
                        );
 | 
			
		||||
                Timber.d("displayCatList size 0, calling MWAPI %s", displayCatList);
 | 
			
		||||
            } else {
 | 
			
		||||
                cacheFound = true;
 | 
			
		||||
                Timber.d("Cache found, setting categoryList in MwVolleyApi to %s", displayCatList);
 | 
			
		||||
                MwVolleyApi.setGpsCat(displayCatList);
 | 
			
		||||
                Timber.d("Cache found, setting categoryList in model to %s", displayCatList);
 | 
			
		||||
                gpsCategoryModel.setCategoryList(displayCatList);
 | 
			
		||||
            }
 | 
			
		||||
        }else{
 | 
			
		||||
            Timber.d("EXIF: no coords");
 | 
			
		||||
| 
						 | 
				
			
			@ -864,26 +859,19 @@ public class ShareActivity
 | 
			
		|||
            scaled = bitmap;
 | 
			
		||||
        }
 | 
			
		||||
        // Load the high-resolution "zoomed-in" image.
 | 
			
		||||
        PhotoView expandedImageView = (PhotoView) findViewById(
 | 
			
		||||
                R.id.expanded_image);
 | 
			
		||||
        expandedImageView.setImageBitmap(scaled);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        // Calculate the starting and ending bounds for the zoomed-in image.
 | 
			
		||||
        // This step involves lots of math. Yay, math.
 | 
			
		||||
        final Rect startBounds = new Rect();
 | 
			
		||||
        final Rect finalBounds = new Rect();
 | 
			
		||||
        final Point globalOffset = new Point();
 | 
			
		||||
 | 
			
		||||
        // The start bounds are the global visible rectangle of the thumbnail,
 | 
			
		||||
        // and the final bounds are the global visible rectangle of the container
 | 
			
		||||
        // view. Also set the container view's offset as the origin for the
 | 
			
		||||
        // bounds, since that's the origin for the positioning animation
 | 
			
		||||
        // properties (X, Y).
 | 
			
		||||
        thumbView.getGlobalVisibleRect(startBounds);
 | 
			
		||||
        findViewById(R.id.container)
 | 
			
		||||
                .getGlobalVisibleRect(finalBounds, globalOffset);
 | 
			
		||||
        flContainer.getGlobalVisibleRect(finalBounds, globalOffset);
 | 
			
		||||
        startBounds.offset(-globalOffset.x, -globalOffset.y);
 | 
			
		||||
        finalBounds.offset(-globalOffset.x, -globalOffset.y);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -954,53 +942,86 @@ public class ShareActivity
 | 
			
		|||
        // Upon clicking the zoomed-in image, it should zoom back down
 | 
			
		||||
        // to the original bounds and show the thumbnail instead of
 | 
			
		||||
        // the expanded image.
 | 
			
		||||
        final float startScaleFinal = startScale;
 | 
			
		||||
        zoomOutButton.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View view) {
 | 
			
		||||
                if (CurrentAnimator != null) {
 | 
			
		||||
                    CurrentAnimator.cancel();
 | 
			
		||||
                }
 | 
			
		||||
                zoomOutButton.setVisibility(View.GONE);
 | 
			
		||||
                mainFab.setVisibility(View.VISIBLE);
 | 
			
		||||
        startScaleFinal = startScale;
 | 
			
		||||
 | 
			
		||||
                // Animate the four positioning/sizing properties in parallel,
 | 
			
		||||
                // back to their original values.
 | 
			
		||||
                AnimatorSet set = new AnimatorSet();
 | 
			
		||||
                set.play(ObjectAnimator
 | 
			
		||||
                        .ofFloat(expandedImageView, View.X, startBounds.left))
 | 
			
		||||
                        .with(ObjectAnimator
 | 
			
		||||
                                .ofFloat(expandedImageView,
 | 
			
		||||
                                        View.Y,startBounds.top))
 | 
			
		||||
                        .with(ObjectAnimator
 | 
			
		||||
                                .ofFloat(expandedImageView,
 | 
			
		||||
                                        View.SCALE_X, startScaleFinal))
 | 
			
		||||
                        .with(ObjectAnimator
 | 
			
		||||
                                .ofFloat(expandedImageView,
 | 
			
		||||
                                        View.SCALE_Y, startScaleFinal));
 | 
			
		||||
                set.setDuration(ShortAnimationDuration);
 | 
			
		||||
                set.setInterpolator(new DecelerateInterpolator());
 | 
			
		||||
                set.addListener(new AnimatorListenerAdapter() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void onAnimationEnd(Animator animation) {
 | 
			
		||||
                        thumbView.setAlpha(1f);
 | 
			
		||||
                        expandedImageView.setVisibility(View.GONE);
 | 
			
		||||
                        CurrentAnimator = null;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                   @Override
 | 
			
		||||
                    public void onAnimationCancel(Animator animation) {
 | 
			
		||||
                       thumbView.setAlpha(1f);
 | 
			
		||||
                       expandedImageView.setVisibility(View.GONE);
 | 
			
		||||
                        CurrentAnimator = null;
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                set.start();
 | 
			
		||||
                CurrentAnimator = set;
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * called when upper arrow floating button
 | 
			
		||||
     */
 | 
			
		||||
    @OnClick(R.id.main_fab)
 | 
			
		||||
    public void onMainFabClicked() {
 | 
			
		||||
        if (!isFABOpen) {
 | 
			
		||||
            showFABMenu();
 | 
			
		||||
        } else {
 | 
			
		||||
            closeFABMenu();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @OnClick(R.id.media_upload_zoom_in)
 | 
			
		||||
    public void onZoomInFabClicked() {
 | 
			
		||||
        //This try catch block was originally holding the entire click listener on the fab button, I did not wanted to risk exceptions
 | 
			
		||||
        try {
 | 
			
		||||
            zoomImageFromThumb(backgroundImageView, mediaUri);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            Log.i("exception", e.toString());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @OnClick(R.id.media_upload_zoom_out)
 | 
			
		||||
    public void onZoomOutFabClicked() {
 | 
			
		||||
        if (CurrentAnimator != null) {
 | 
			
		||||
            CurrentAnimator.cancel();
 | 
			
		||||
        }
 | 
			
		||||
        zoomOutButton.setVisibility(View.GONE);
 | 
			
		||||
        mainFab.setVisibility(View.VISIBLE);
 | 
			
		||||
 | 
			
		||||
        // Animate the four positioning/sizing properties in parallel,
 | 
			
		||||
        // back to their original values.
 | 
			
		||||
        AnimatorSet set = new AnimatorSet();
 | 
			
		||||
        set.play(ObjectAnimator
 | 
			
		||||
                .ofFloat(expandedImageView, View.X, startBounds.left))
 | 
			
		||||
                .with(ObjectAnimator
 | 
			
		||||
                        .ofFloat(expandedImageView,
 | 
			
		||||
                                View.Y, startBounds.top))
 | 
			
		||||
                .with(ObjectAnimator
 | 
			
		||||
                        .ofFloat(expandedImageView,
 | 
			
		||||
                                View.SCALE_X, startScaleFinal))
 | 
			
		||||
                .with(ObjectAnimator
 | 
			
		||||
                        .ofFloat(expandedImageView,
 | 
			
		||||
                                View.SCALE_Y, startScaleFinal));
 | 
			
		||||
        set.setDuration(ShortAnimationDuration);
 | 
			
		||||
        set.setInterpolator(new DecelerateInterpolator());
 | 
			
		||||
        set.addListener(new AnimatorListenerAdapter() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onAnimationEnd(Animator animation) {
 | 
			
		||||
                //background image view is thumbView
 | 
			
		||||
                backgroundImageView.setAlpha(1f);
 | 
			
		||||
                expandedImageView.setVisibility(View.GONE);
 | 
			
		||||
                CurrentAnimator = null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onAnimationCancel(Animator animation) {
 | 
			
		||||
                //background image view is thumbView
 | 
			
		||||
                backgroundImageView.setAlpha(1f);
 | 
			
		||||
                expandedImageView.setVisibility(View.GONE);
 | 
			
		||||
                CurrentAnimator = null;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        set.start();
 | 
			
		||||
        CurrentAnimator = set;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @OnClick(R.id.media_map)
 | 
			
		||||
    public void onFabShowMapsClicked() {
 | 
			
		||||
        if (imageObj != null && imageObj.imageCoordsExists == true) {
 | 
			
		||||
            Uri gmmIntentUri = Uri
 | 
			
		||||
                    .parse("google.streetview:cbll=" + imageObj.getDecLatitude() + "," + imageObj
 | 
			
		||||
                            .getDecLongitude());
 | 
			
		||||
            Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
 | 
			
		||||
            mapIntent.setPackage("com.google.android.apps.maps");
 | 
			
		||||
            startActivity(mapIntent);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,9 @@ import android.view.ViewGroup;
 | 
			
		|||
import android.view.Window;
 | 
			
		||||
import android.widget.Button;
 | 
			
		||||
 | 
			
		||||
import butterknife.BindView;
 | 
			
		||||
import butterknife.ButterKnife;
 | 
			
		||||
import butterknife.OnClick;
 | 
			
		||||
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
 | 
			
		||||
import com.facebook.drawee.view.SimpleDraweeView;
 | 
			
		||||
import com.facebook.imagepipeline.listener.RequestListener;
 | 
			
		||||
| 
						 | 
				
			
			@ -29,29 +32,33 @@ import fr.free.nrw.commons.R;
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
public class SimilarImageDialogFragment extends DialogFragment {
 | 
			
		||||
 | 
			
		||||
    @BindView(R.id.orginalImage)
 | 
			
		||||
    SimpleDraweeView originalImage;
 | 
			
		||||
    @BindView(R.id.possibleImage)
 | 
			
		||||
    SimpleDraweeView possibleImage;
 | 
			
		||||
    @BindView(R.id.postive_button)
 | 
			
		||||
    Button positiveButton;
 | 
			
		||||
    @BindView(R.id.negative_button)
 | 
			
		||||
    Button negativeButton;
 | 
			
		||||
    onResponse mOnResponse;//Implemented interface from shareActivity
 | 
			
		||||
    Boolean gotResponse = false;
 | 
			
		||||
 | 
			
		||||
    public SimilarImageDialogFragment() {
 | 
			
		||||
    }
 | 
			
		||||
    public interface onResponse{
 | 
			
		||||
        public void onPostiveResponse();
 | 
			
		||||
        public void onPositiveResponse();
 | 
			
		||||
 | 
			
		||||
        public void onNegativeResponse();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 | 
			
		||||
        View view =  inflater.inflate(R.layout.fragment_similar_image_dialog, container, false);
 | 
			
		||||
        ButterKnife.bind(this,view);
 | 
			
		||||
        Set<RequestListener> requestListeners = new HashSet<>();
 | 
			
		||||
        requestListeners.add(new RequestLoggingListener());
 | 
			
		||||
 | 
			
		||||
        originalImage =(SimpleDraweeView) view.findViewById(R.id.orginalImage);
 | 
			
		||||
        possibleImage =(SimpleDraweeView) view.findViewById(R.id.possibleImage);
 | 
			
		||||
        positiveButton = (Button) view.findViewById(R.id.postive_button);
 | 
			
		||||
        negativeButton = (Button) view.findViewById(R.id.negative_button);
 | 
			
		||||
 | 
			
		||||
        originalImage.setHierarchy(GenericDraweeHierarchyBuilder
 | 
			
		||||
                .newInstance(getResources())
 | 
			
		||||
                .setPlaceholderImage(VectorDrawableCompat.create(getResources(),
 | 
			
		||||
| 
						 | 
				
			
			@ -70,22 +77,6 @@ public class SimilarImageDialogFragment extends DialogFragment {
 | 
			
		|||
        originalImage.setImageURI(Uri.fromFile(new File(getArguments().getString("originalImagePath"))));
 | 
			
		||||
        possibleImage.setImageURI(Uri.fromFile(new File(getArguments().getString("possibleImagePath"))));
 | 
			
		||||
 | 
			
		||||
        negativeButton.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View view) {
 | 
			
		||||
                mOnResponse.onNegativeResponse();
 | 
			
		||||
                gotResponse = true;
 | 
			
		||||
                dismiss();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        positiveButton.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View view) {
 | 
			
		||||
                mOnResponse.onPostiveResponse();
 | 
			
		||||
                gotResponse = true;
 | 
			
		||||
                dismiss();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        return view;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -105,8 +96,23 @@ public class SimilarImageDialogFragment extends DialogFragment {
 | 
			
		|||
    @Override
 | 
			
		||||
    public void onDismiss(DialogInterface dialog) {
 | 
			
		||||
//        I user dismisses dialog by pressing outside the dialog.
 | 
			
		||||
        if(!gotResponse)
 | 
			
		||||
        if (!gotResponse) {
 | 
			
		||||
            mOnResponse.onNegativeResponse();
 | 
			
		||||
        }
 | 
			
		||||
        super.onDismiss(dialog);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @OnClick(R.id.negative_button)
 | 
			
		||||
    public void onNegativeButtonClicked() {
 | 
			
		||||
        mOnResponse.onNegativeResponse();
 | 
			
		||||
        gotResponse = true;
 | 
			
		||||
        dismiss();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @OnClick(R.id.postive_button)
 | 
			
		||||
    public void onPositiveButtonClicked() {
 | 
			
		||||
        mOnResponse.onPositiveResponse();
 | 
			
		||||
        gotResponse = true;
 | 
			
		||||
        dismiss();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue