Commit 3ec951fc authored by Donald's avatar Donald

clean

parent 4cf0a0d8
......@@ -26,7 +26,6 @@ public class PhotosPagerAdapter extends android.support.v4.view.PagerAdapter {
LayoutInflater mLayoutInflater;
ArrayList<Photo> mResources;
private View.OnTouchListener onTouchListener;
private View.OnClickListener onClickListener;
public PhotosPagerAdapter(Context context, ArrayList<Photo> ph) {
......@@ -35,7 +34,7 @@ public class PhotosPagerAdapter extends android.support.v4.view.PagerAdapter {
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void setOnGifClickListener(View.OnClickListener ls) {
public void setOnClickListener(View.OnClickListener ls) {
onClickListener = ls;
}
......@@ -44,9 +43,6 @@ public class PhotosPagerAdapter extends android.support.v4.view.PagerAdapter {
return mResources.size();
}
public void setOnPictureTouchListener(View.OnTouchListener ls) {
onTouchListener = ls;
}
@Override
public boolean isViewFromObject(View view, Object object) {
......@@ -79,7 +75,7 @@ public class PhotosPagerAdapter extends android.support.v4.view.PagerAdapter {
picture.setImage(ImageSource.bitmap(bitmap));
}
});
picture.setOnTouchListener(onTouchListener);
picture.setOnClickListener(onClickListener);
picture.setMaxScale(10);
}
......
......@@ -33,7 +33,6 @@ public class HiddenPhotosHandler extends SQLiteOpenHelper {
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " +
TABLE_PHOTOS + "(" +
PHOTO_PATH + " TEXT," +
......@@ -59,7 +58,6 @@ public class HiddenPhotosHandler extends SQLiteOpenHelper {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("DELETE FROM " + TABLE_PHOTOS + " WHERE " + PHOTO_FOLDER_PATH + "='" + string.quoteReplace(path) + "'");
db.close();
}
void getAlbums(File dir) {
......@@ -69,9 +67,7 @@ public class HiddenPhotosHandler extends SQLiteOpenHelper {
!dir.getAbsolutePath().contains("Voice") &&
!dir.getAbsolutePath().contains("Audio")) {
String[] children = dir.list();
for (String child : children) {
File temp = new File(dir, child);
for (File temp : dir.listFiles()) {
if (temp.isDirectory()) {
addHiddeNImagesFromFolder(temp);
getAlbums(temp);
......@@ -90,9 +86,7 @@ public class HiddenPhotosHandler extends SQLiteOpenHelper {
public void addImagesFromFolder(File dir) {
String[] children = dir.list();
for (String child : children) {
for (String child : dir.list()) {
File temp = new File(dir, child);
String mime = string.getMimeType(temp.getAbsolutePath());
......
......@@ -7,7 +7,9 @@ import android.support.annotation.NonNull;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.*;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import com.afollestad.materialdialogs.DialogAction;
......@@ -43,24 +45,12 @@ public class PhotoActivity extends AppCompatActivity {
Bundle data = getIntent().getExtras();
photos = data.getParcelable("album");
photos.setContext(PhotoActivity.this);
final GestureDetector gestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
toggleSystemUI();
return true;
}
});
mCustomPagerAdapter = new PhotosPagerAdapter(this, photos.photos);
mCustomPagerAdapter.setOnPictureTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});
mCustomPagerAdapter.setOnGifClickListener(new View.OnClickListener() {
mCustomPagerAdapter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toggleSystemUI();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment