-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* MediaDetailFragment: add zoom feature * fragment_media_detail: add SimpleDrawee for Scroll picture * ZoomableActivity: activity which facilitates zoom in * activity_zoomable: xml for zoom activity * zoomControllers: controllers for handling gesture and zooming * MediaDetailFragment: fixing name of image variable * MediaDetailFragment: display as per the aspect ratio of image * add zoom activity to AndroidManifest * fix travis ci faliure * fix resizing of image
- Loading branch information
1 parent
5fd88ef
commit 642ed51
Showing
16 changed files
with
2,295 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
app/src/main/java/fr/free/nrw/commons/media/ZoomableActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package fr.free.nrw.commons.media; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
import fr.free.nrw.commons.R; | ||
import fr.free.nrw.commons.media.zoomControllers.zoomable.DoubleTapGestureListener; | ||
import fr.free.nrw.commons.media.zoomControllers.zoomable.ZoomableDraweeView; | ||
import timber.log.Timber; | ||
|
||
import android.graphics.Bitmap; | ||
import android.graphics.BitmapFactory; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import com.facebook.drawee.backends.pipeline.Fresco; | ||
import com.facebook.drawee.interfaces.DraweeController; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.facebook.drawee.view.SimpleDraweeView; | ||
import com.github.chrisbanes.photoview.PhotoView; | ||
|
||
import java.io.InputStream; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
|
||
public class ZoomableActivity extends AppCompatActivity { | ||
private Uri imageUri; | ||
|
||
@BindView(R.id.zoomable) | ||
ZoomableDraweeView photo; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
imageUri = getIntent().getData(); | ||
if (null == imageUri) { | ||
throw new IllegalArgumentException("No data to display"); | ||
} | ||
Timber.d("URl = " + imageUri); | ||
|
||
setContentView(R.layout.activity_zoomable); | ||
ButterKnife.bind(this); | ||
init(); | ||
} | ||
|
||
private void init() { | ||
if( imageUri != null ) { | ||
photo.setAllowTouchInterceptionWhileZoomed(true); | ||
photo.setIsLongpressEnabled(false); | ||
photo.setTapListener(new DoubleTapGestureListener(photo)); | ||
DraweeController controller = Fresco.newDraweeControllerBuilder() | ||
.setUri(imageUri) | ||
.build(); | ||
photo.setController(controller); | ||
} | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.