Merge branch 'master' of https://github.com/commons-app/apps-android-commons into feature/switch_to_butterknife

This commit is contained in:
Ashish 2018-05-09 14:59:14 +05:30
commit d378d9b9c8
13 changed files with 310 additions and 27 deletions

View file

@ -5,23 +5,30 @@ If you're not sure where to start head on to [this wiki page](https://github.com
Here's a gist of the guidelines, Here's a gist of the guidelines,
# Make separate commits for logically separate changes 1. Make separate commits for logically separate changes
# Describe your changes well in the commit message 1. Describe your changes well in the commit message
The first line of the commit message should be a short description of what has The first line of the commit message should be a short description of what has
changed. It is also good to prefix the first line with "area: " where the "area" changed. It is also good to prefix the first line with "area: " where the "area"
is a filename or identifier for the general area of the code being modified. is a filename or identifier for the general area of the code being modified.
The body should provide a meaningful commit message. The body should provide a meaningful commit message.
# Write Javadocs 1. Write Javadocs
We require contributors to include Javadocs for all new methods and classes submitted via PRs (after 1 May 2018). This is aimed at making it easier for new contributors to dive into our codebase, especially those who are new to Android development. A few things to note: We require contributors to include Javadocs for all new methods and classes
submitted via PRs (after 1 May 2018). This is aimed at making it easier for
new contributors to dive into our codebase, especially those who are new to
Android development. A few things to note:
- This should not replace the need for code that is easily-readable in and of itself - This should not replace the need for code that is easily-readable in
- Please make sure that your Javadocs are reasonably descriptive, not just a copy of the method name and of itself
- Please do not use `@author` tags - we aim for collective code ownership, and if needed, GitHub allows us to see who wrote something without needing to add these tags - Please make sure that your Javadocs are reasonably descriptive, not just
a copy of the method name
- Please do not use `@author` tags - we aim for collective code ownership,
and if needed, Git allows us to see who wrote something without needing
to add these tags (`git blame`)
# Write tests for your code (if possible) 1. Write tests for your code (if possible)
# Make sure the Wiki pages don't become stale by updating them (if needed) 1. Make sure the Wiki pages don't become stale by updating them (if needed)

View file

@ -1,15 +1,15 @@
## Description ## Description (required)
Fixes #{GitHub issue number} Fixes #{GitHub issue number and title}
{Describe the changes made and why they were made.} {Describe the changes made and why they were made.}
## Tests performed ## Tests performed (required)
Tested on {API level & name of device/emulator}, with {build variant, e.g. ProdDebug}. Tested on {API level & name of device/emulator}, with {build variant, e.g. ProdDebug}.
{Please test your PR at least once before submitting.} ## Screenshots showing what changed (optional)
## Screenshots showing what changed
{Only for user interface changes, otherwise remove this section. See [how to take a screenshot](https://android.stackexchange.com/questions/1759/how-to-take-a-screenshot-with-an-android-device)} {Only for user interface changes, otherwise remove this section. See [how to take a screenshot](https://android.stackexchange.com/questions/1759/how-to-take-a-screenshot-with-an-android-device)}
_Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request._

View file

@ -25,6 +25,8 @@ dependencies {
transitive=true transitive=true
} }
implementation "com.github.deano2390:MaterialShowcaseView:1.2.0"
implementation "com.android.support:support-v4:$SUPPORT_LIB_VERSION" implementation "com.android.support:support-v4:$SUPPORT_LIB_VERSION"
implementation "com.android.support:appcompat-v7:$SUPPORT_LIB_VERSION" implementation "com.android.support:appcompat-v7:$SUPPORT_LIB_VERSION"
implementation "com.android.support:design:$SUPPORT_LIB_VERSION" implementation "com.android.support:design:$SUPPORT_LIB_VERSION"

View file

@ -61,8 +61,8 @@ public class MediaDataExtractor {
} }
try{ try{
Timber.d("Nominated for deletion: " + mediaWikiApi.pageExists("Commons:Deletion_requests/"+filename)); deletionStatus = mediaWikiApi.pageExists("Commons:Deletion_requests/" + filename);
deletionStatus = mediaWikiApi.pageExists("Commons:Deletion_requests/"+filename); Timber.d("Nominated for deletion: " + deletionStatus);
} }
catch (Exception e){ catch (Exception e){
Timber.d(e.getMessage()); Timber.d(e.getMessage());

View file

@ -4,14 +4,18 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetBehavior; import android.support.design.widget.BottomSheetBehavior;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -25,6 +29,7 @@ import com.google.gson.GsonBuilder;
import java.util.List; import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -41,6 +46,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import timber.log.Timber; import timber.log.Timber;
import uk.co.deanwild.materialshowcaseview.IShowcaseListener;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
public class NearbyActivity extends NavigationBaseActivity implements LocationUpdateListener { public class NearbyActivity extends NavigationBaseActivity implements LocationUpdateListener {
@ -56,12 +63,15 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
LinearLayout bottomSheetDetails; LinearLayout bottomSheetDetails;
@BindView(R.id.transparentView) @BindView(R.id.transparentView)
View transparentView; View transparentView;
@BindView(R.id.fab_recenter)
View fabRecenter;
@Inject @Inject
LocationServiceManager locationManager; LocationServiceManager locationManager;
@Inject @Inject
NearbyController nearbyController; NearbyController nearbyController;
@Inject
@Named("application_preferences") SharedPreferences applicationPrefs;
private LatLng curLatLng; private LatLng curLatLng;
private Bundle bundle; private Bundle bundle;
private Disposable placesDisposable; private Disposable placesDisposable;
@ -72,11 +82,18 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
private NearbyListFragment nearbyListFragment; private NearbyListFragment nearbyListFragment;
private static final String TAG_RETAINED_MAP_FRAGMENT = NearbyMapFragment.class.getSimpleName(); private static final String TAG_RETAINED_MAP_FRAGMENT = NearbyMapFragment.class.getSimpleName();
private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName(); private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName();
private View listButton; // Reference to list button to use in tutorial
private final String NETWORK_INTENT_ACTION = "android.net.conn.CONNECTIVITY_CHANGE"; private final String NETWORK_INTENT_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
private BroadcastReceiver broadcastReceiver; private BroadcastReceiver broadcastReceiver;
private boolean isListShowcaseAdded = false;
private boolean isMapShowCaseAdded = false;
private LatLng lastKnownLocation; private LatLng lastKnownLocation;
private MaterialShowcaseView secondSingleShowCaseView;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -126,6 +143,39 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
MenuInflater inflater = getMenuInflater(); MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_nearby, menu); inflater.inflate(R.menu.menu_nearby, menu);
new Handler().post(() -> {
listButton = findViewById(R.id.action_display_list);
secondSingleShowCaseView = new MaterialShowcaseView.Builder(this)
.setTarget(listButton)
.setDismissText(getString(R.string.showcase_view_got_it_button))
.setContentText(getString(R.string.showcase_view_list_icon))
.setDelay(500) // optional but starting animations immediately in onCreate can make them choppy
.singleUse(ViewUtil.SHOWCASE_VIEW_ID_1) // provide a unique ID used to ensure it is only shown once
.setDismissStyle(Typeface.defaultFromStyle(Typeface.BOLD))
.setListener(new IShowcaseListener() {
@Override
public void onShowcaseDisplayed(MaterialShowcaseView materialShowcaseView) {
}
// If dismissed, we can inform fragment to start showcase sequence there
@Override
public void onShowcaseDismissed(MaterialShowcaseView materialShowcaseView) {
nearbyMapFragment.onNearbyMaterialShowcaseDismissed();
}
})
.build();
isListShowcaseAdded = true;
if (isMapShowCaseAdded) { // If map showcase is also ready, start ShowcaseSequence
// Probably this case is not possible. Just added to be careful
setMapViewTutorialShowCase();
}
});
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
@ -420,6 +470,45 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
updateMapFragment(false); updateMapFragment(false);
updateListFragment(); updateListFragment();
} }
isMapShowCaseAdded = true;
}
public void setMapViewTutorialShowCase() {
/*
*This showcase view will be the first step of our nearbyMaterialShowcaseSequence. The reason we use a
* single item instead of adding another step to nearbyMaterialShowcaseSequence is that we are not able to
* call withoutShape() method on steps. For mapView we need an showcase view without
* any circle on it, it should cover the whole page.
* */
MaterialShowcaseView firstSingleShowCaseView = new MaterialShowcaseView.Builder(this)
.setTarget(nearbyMapFragment.mapView)
.setDismissText(getString(R.string.showcase_view_got_it_button))
.setContentText(getString(R.string.showcase_view_whole_nearby_activity))
.setDelay(500) // optional but starting animations immediately in onCreate can make them choppy
.singleUse(ViewUtil.SHOWCASE_VIEW_ID_2) // provide a unique ID used to ensure it is only shown once
.withoutShape() // no shape on map view since there are no view to focus on
.setDismissStyle(Typeface.defaultFromStyle(Typeface.BOLD))
.setListener(new IShowcaseListener() {
@Override
public void onShowcaseDisplayed(MaterialShowcaseView materialShowcaseView) {
}
@Override
public void onShowcaseDismissed(MaterialShowcaseView materialShowcaseView) {
/* Add other nearbyMaterialShowcaseSequence here, it will make the user feel as they are a
* nearbyMaterialShowcaseSequence whole together.
* */
secondSingleShowCaseView.show(NearbyActivity.this);
}
})
.build();
if (applicationPrefs.getBoolean("firstRunNearby", true)) {
applicationPrefs.edit().putBoolean("firstRunNearby", false).apply();
firstSingleShowCaseView.show(this);
}
} }
private void lockNearbyView(boolean lock) { private void lockNearbyView(boolean lock) {

View file

@ -7,6 +7,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -58,13 +59,14 @@ import fr.free.nrw.commons.contributions.ContributionController;
import fr.free.nrw.commons.utils.UriDeserializer; import fr.free.nrw.commons.utils.UriDeserializer;
import fr.free.nrw.commons.utils.ViewUtil; import fr.free.nrw.commons.utils.ViewUtil;
import timber.log.Timber; import timber.log.Timber;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.content.pm.PackageManager.PERMISSION_GRANTED;
public class NearbyMapFragment extends DaggerFragment { public class NearbyMapFragment extends DaggerFragment {
private MapView mapView; public MapView mapView;
private List<NearbyBaseMarker> baseMarkerOptions; private List<NearbyBaseMarker> baseMarkerOptions;
private fr.free.nrw.commons.location.LatLng curLatLng; private fr.free.nrw.commons.location.LatLng curLatLng;
public fr.free.nrw.commons.location.LatLng[] boundaryCoordinates; public fr.free.nrw.commons.location.LatLng[] boundaryCoordinates;
@ -111,6 +113,10 @@ public class NearbyMapFragment extends DaggerFragment {
private final double CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT = 0.06; private final double CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT = 0.06;
private final double CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE = 0.04; private final double CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE = 0.04;
private boolean isSecondMaterialShowcaseDismissed;
private boolean isMapReady;
private MaterialShowcaseView thirdSingleShowCaseView;
private Bundle bundleForUpdtes;// Carry information from activity about changed nearby places and current location private Bundle bundleForUpdtes;// Carry information from activity about changed nearby places and current location
@Inject @Inject
@ -163,7 +169,6 @@ public class NearbyMapFragment extends DaggerFragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
Timber.d("onCreateView called"); Timber.d("onCreateView called");
if (curLatLng != null) { if (curLatLng != null) {
Timber.d("curLatLng found, setting up map view..."); Timber.d("curLatLng found, setting up map view...");
@ -476,6 +481,7 @@ public class NearbyMapFragment extends DaggerFragment {
mapView.getMapAsync(new OnMapReadyCallback() { mapView.getMapAsync(new OnMapReadyCallback() {
@Override @Override
public void onMapReady(MapboxMap mapboxMap) { public void onMapReady(MapboxMap mapboxMap) {
((NearbyActivity)getActivity()).setMapViewTutorialShowCase();
NearbyMapFragment.this.mapboxMap = mapboxMap; NearbyMapFragment.this.mapboxMap = mapboxMap;
updateMapSignificantly(); updateMapSignificantly();
} }
@ -519,6 +525,7 @@ public class NearbyMapFragment extends DaggerFragment {
private void addNearbyMarkerstoMapBoxMap() { private void addNearbyMarkerstoMapBoxMap() {
mapboxMap.addMarkers(baseMarkerOptions); mapboxMap.addMarkers(baseMarkerOptions);
mapboxMap.setOnInfoWindowCloseListener(marker -> { mapboxMap.setOnInfoWindowCloseListener(marker -> {
if (marker == selected) { if (marker == selected) {
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
@ -534,6 +541,7 @@ public class NearbyMapFragment extends DaggerFragment {
}); });
mapboxMap.setOnMarkerClickListener(marker -> { mapboxMap.setOnMarkerClickListener(marker -> {
if (marker instanceof NearbyMarker) { if (marker instanceof NearbyMarker) {
this.selected = marker; this.selected = marker;
NearbyMarker nearbyMarker = (NearbyMarker) marker; NearbyMarker nearbyMarker = (NearbyMarker) marker;
@ -541,6 +549,7 @@ public class NearbyMapFragment extends DaggerFragment {
passInfoToSheet(place); passInfoToSheet(place);
bottomSheetListBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); bottomSheetListBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
} }
return false; return false;
}); });
@ -634,7 +643,19 @@ public class NearbyMapFragment extends DaggerFragment {
addAnchorToSmallFABs(fabGallery, getActivity().findViewById(R.id.empty_view).getId()); addAnchorToSmallFABs(fabGallery, getActivity().findViewById(R.id.empty_view).getId());
addAnchorToSmallFABs(fabCamera, getActivity().findViewById(R.id.empty_view1).getId()); addAnchorToSmallFABs(fabCamera, getActivity().findViewById(R.id.empty_view1).getId());
thirdSingleShowCaseView = new MaterialShowcaseView.Builder(this.getActivity())
.setTarget(fabPlus)
.setDismissText(getString(R.string.showcase_view_got_it_button))
.setContentText(getString(R.string.showcase_view_plus_fab))
.setDelay(500) // optional but starting animations immediately in onCreate can make them choppy
.singleUse(ViewUtil.SHOWCASE_VIEW_ID_3) // provide a unique ID used to ensure it is only shown once
.setDismissStyle(Typeface.defaultFromStyle(Typeface.BOLD))
.build();
isMapReady = true;
if (isSecondMaterialShowcaseDismissed) {
thirdSingleShowCaseView.show(getActivity());
}
} }
@ -791,6 +812,13 @@ public class NearbyMapFragment extends DaggerFragment {
this.bundleForUpdtes = bundleForUpdtes; this.bundleForUpdtes = bundleForUpdtes;
} }
public void onNearbyMaterialShowcaseDismissed() {
isSecondMaterialShowcaseDismissed = true;
if (isMapReady) {
thirdSingleShowCaseView.show(getActivity());
}
}
@Override @Override
public void onStart() { public void onStart() {

View file

@ -0,0 +1,18 @@
package fr.free.nrw.commons.nearby;
import android.app.Activity;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseSequence;
import uk.co.deanwild.materialshowcaseview.ShowcaseConfig;
public class NearbyMaterialShowcaseSequence extends MaterialShowcaseSequence {
public NearbyMaterialShowcaseSequence(Activity activity, String sequenceID) {
super(activity, sequenceID);
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(500); // half second between each showcase view
this.setConfig(config);
this.singleUse(sequenceID); // Display tutorial only once
}
}

View file

@ -81,8 +81,7 @@ import fr.free.nrw.commons.mwapi.MediaWikiApi;
import fr.free.nrw.commons.utils.ViewUtil; import fr.free.nrw.commons.utils.ViewUtil;
import timber.log.Timber; 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.DUPLICATE_PROCEED;
import static fr.free.nrw.commons.upload.ExistingFileAsync.Result.NO_DUPLICATE; import static fr.free.nrw.commons.upload.ExistingFileAsync.Result.NO_DUPLICATE;
import static java.lang.Long.min; import static java.lang.Long.min;
@ -122,6 +121,7 @@ public class ShareActivity
private Uri mediaUri; private Uri mediaUri;
private Contribution contribution; private Contribution contribution;
private SimpleDraweeView backgroundImageView; private SimpleDraweeView backgroundImageView;
private FloatingActionButton maps_fragment;
private boolean cacheFound; private boolean cacheFound;
@ -145,6 +145,8 @@ public class ShareActivity
private long ShortAnimationDuration; private long ShortAnimationDuration;
private FloatingActionButton zoomInButton; private FloatingActionButton zoomInButton;
private FloatingActionButton zoomOutButton; private FloatingActionButton zoomOutButton;
private FloatingActionButton mainFab;
private boolean isFABOpen = false;
/** /**
@ -284,6 +286,24 @@ public class ShareActivity
if (mediaUri != null) { if (mediaUri != null) {
backgroundImageView.setImageURI(mediaUri); 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); zoomInButton = (FloatingActionButton) findViewById(R.id.media_upload_zoom_in);
try { try {
zoomInButton.setOnClickListener(new View.OnClickListener() { zoomInButton.setOnClickListener(new View.OnClickListener() {
@ -358,7 +378,74 @@ public class ShareActivity
.commitAllowingStateLoss(); .commitAllowingStateLoss();
} }
uploadController.prepareService(); uploadController.prepareService();
maps_fragment = (FloatingActionButton) findViewById(R.id.media_map);
maps_fragment.setVisibility(View.VISIBLE);
if( imageObj == null || imageObj.imageCoordsExists != true){
maps_fragment.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
*/
private void showFABMenu(){
isFABOpen=true;
if( imageObj != null && imageObj.imageCoordsExists == true)
maps_fragment.setVisibility(View.VISIBLE);
zoomInButton.setVisibility(View.VISIBLE);
mainFab.animate().rotationBy(180);
maps_fragment.animate().translationY(-getResources().getDimension(R.dimen.second_fab));
zoomInButton.animate().translationY(-getResources().getDimension(R.dimen.first_fab));
}
/*
* function to close the zoom and map FAB
*/
private void closeFABMenu(){
isFABOpen=false;
mainFab.animate().rotationBy(-180);
maps_fragment.animate().translationY(0);
zoomInButton.animate().translationY(0).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
if(!isFABOpen){
maps_fragment.setVisibility(View.GONE);
zoomInButton.setVisibility(View.GONE);
}
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
}
@Override @Override
public void onRequestPermissionsResult(int requestCode, public void onRequestPermissionsResult(int requestCode,
@ -461,6 +548,9 @@ public class ShareActivity
detectUnwantedPicturesAsync.execute(); detectUnwantedPicturesAsync.execute();
} }
/*
* to display permission snackbar in share activity
*/
private Snackbar requestPermissionUsingSnackBar(String rationale, private Snackbar requestPermissionUsingSnackBar(String rationale,
final String[] perms, final String[] perms,
final int code) { final int code) {
@ -693,7 +783,9 @@ public class ShareActivity
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
// Get SHA1 of file from input stream /*
* Get SHA1 of file from input stream
*/
private String getSHA1(InputStream is) { private String getSHA1(InputStream is) {
MessageDigest digest; MessageDigest digest;
@ -730,6 +822,9 @@ public class ShareActivity
} }
} }
/*
* function to provide pinch zoom
*/
private void zoomImageFromThumb(final View thumbView, Uri imageuri ) { private void zoomImageFromThumb(final View thumbView, Uri imageuri ) {
// If there's an animation in progress, cancel it // If there's an animation in progress, cancel it
// immediately and proceed with this one. // immediately and proceed with this one.
@ -737,6 +832,8 @@ public class ShareActivity
CurrentAnimator.cancel(); CurrentAnimator.cancel();
} }
ViewUtil.hideKeyboard(ShareActivity.this.findViewById(R.id.titleEdit | R.id.descEdit)); ViewUtil.hideKeyboard(ShareActivity.this.findViewById(R.id.titleEdit | R.id.descEdit));
closeFABMenu();
mainFab.setVisibility(View.GONE);
InputStream input = null; InputStream input = null;
Bitmap scaled = null; Bitmap scaled = null;
try { try {
@ -866,7 +963,7 @@ public class ShareActivity
CurrentAnimator.cancel(); CurrentAnimator.cancel();
} }
zoomOutButton.setVisibility(View.GONE); zoomOutButton.setVisibility(View.GONE);
zoomInButton.setVisibility(View.VISIBLE); mainFab.setVisibility(View.VISIBLE);
// Animate the four positioning/sizing properties in parallel, // Animate the four positioning/sizing properties in parallel,
// back to their original values. // back to their original values.

View file

@ -10,6 +10,10 @@ import android.widget.Toast;
public class ViewUtil { public class ViewUtil {
public static final String SHOWCASE_VIEW_ID_1 = "SHOWCASE_VIEW_ID_1";
public static final String SHOWCASE_VIEW_ID_2 = "SHOWCASE_VIEW_ID_2";
public static final String SHOWCASE_VIEW_ID_3 = "SHOWCASE_VIEW_ID_3";
public static void showSnackbar(View view, int messageResourceId) { public static void showSnackbar(View view, int messageResourceId) {
Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show(); Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show();
} }

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M7.41,15.41L12,10.83l4.59,4.58L18,14l-6,-6 -6,6z"/>
</vector>

View file

@ -41,8 +41,6 @@
</FrameLayout> </FrameLayout>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -50,8 +48,21 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginRight="@dimen/standard_gap" android:layout_marginRight="@dimen/standard_gap"
android:layout_marginBottom="@dimen/standard_gap" android:layout_marginBottom="@dimen/standard_gap"
app:backgroundTint="@color/button_blue"
app:srcCompat="@drawable/ic_keyboard_arrow_up_black_24dp"
android:id="@+id/main_fab"/>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:visibility="gone"
android:layout_marginRight="@dimen/standard_gap"
android:src="@drawable/ic_zoom_in_white_24dp" android:src="@drawable/ic_zoom_in_white_24dp"
android:layout_above="@+id/main_fab"
android:id="@+id/media_upload_zoom_in"/> android:id="@+id/media_upload_zoom_in"/>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -61,7 +72,19 @@
android:layout_marginRight="@dimen/standard_gap" android:layout_marginRight="@dimen/standard_gap"
android:layout_marginBottom="@dimen/standard_gap" android:layout_marginBottom="@dimen/standard_gap"
android:src="@drawable/ic_zoom_out_white_24dp" android:src="@drawable/ic_zoom_out_white_24dp"
android:layout_above="@+id/main_fab"
android:id="@+id/media_upload_zoom_out"/> android:id="@+id/media_upload_zoom_out"/>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_above="@+id/media_upload_zoom_in"
android:visibility="gone"
android:layout_marginRight="@dimen/standard_gap"
app:srcCompat="@drawable/ic_map_white_24dp"
android:id="@+id/media_map"/>
</RelativeLayout> </RelativeLayout>
<android.support.design.widget.NavigationView <android.support.design.widget.NavigationView

View file

@ -23,4 +23,6 @@
<dimen name="subheading_text_size">20sp</dimen> <dimen name="subheading_text_size">20sp</dimen>
<dimen name="normal_text">16sp</dimen> <dimen name="normal_text">16sp</dimen>
<dimen name="description_text_size">14sp</dimen> <dimen name="description_text_size">14sp</dimen>
<dimen name="first_fab">15dp</dimen>
<dimen name="second_fab">25dp</dimen>
</resources> </resources>

View file

@ -271,8 +271,16 @@
<string name="about_translate_cancel">Cancel</string> <string name="about_translate_cancel">Cancel</string>
<string name="retry">Retry</string> <string name="retry">Retry</string>
<string name="showcase_view_got_it_button">Got it!</string>
<string name="showcase_view_whole_nearby_activity">These are the places near you that need pictures to illustrate their Wikipedia articles</string>
<string name="showcase_view_list_icon">Tapping this button brings up a list of these places</string>
<string name="showcase_view_plus_fab">You can upload a picture for any place from your gallery or camera</string>
<string name="no_images_found">No images found!</string> <string name="no_images_found">No images found!</string>
<string name="error_loading_images">Error occurred while loading images.</string> <string name="error_loading_images">Error occurred while loading images.</string>
<string name="image_uploaded_by">Uploaded by: %1$s</string> <string name="image_uploaded_by">Uploaded by: %1$s</string>
<string name="share_app_title">Share App</string> <string name="share_app_title">Share App</string>
<string name="share_coordinates_not_present">Coordinates were not specified during image selection</string>
</resources> </resources>