Commit d9b66ffb authored by Donald's avatar Donald

stuff

parent 937de386
......@@ -17,6 +17,7 @@ import java.util.ArrayList;
/**
* Created by dnld on 1/7/16.
*/
public class PhotosAdapter extends RecyclerView.Adapter<PhotosAdapter.ViewHolder> {
ArrayList<Photo> photos;
......
......@@ -4,7 +4,6 @@ import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.util.Log;
import java.io.File;
import java.util.ArrayList;
......@@ -27,6 +26,7 @@ public class HandlingPhotos implements Parcelable {
return new HandlingPhotos[size];
}
};
public String FolderPath;
public String ID;
public String DisplayName;
......@@ -110,7 +110,7 @@ public class HandlingPhotos implements Parcelable {
}
public String getPreviewAlbumImg() {
Log.wtf("asdfsfd", settings.coverPath);
//Log.wtf("asdfsfd", settings.coverPath);
if (settings.coverPath != null) return settings.coverPath;
return photos.get(0).Path;
}
......
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
import java.util.ArrayList;
......@@ -67,7 +68,7 @@ public class MadiaStoreHandler {
MediaStore.Images.Media.MIME_TYPE
};
Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
Uri images = MediaStore.Images.Media.INTERNAL_CONTENT_URI;
Cursor cur = context.getContentResolver().query(
images,
projection,
......@@ -120,6 +121,7 @@ public class MadiaStoreHandler {
int mimeColumn = cur.getColumnIndex(
MediaStore.Images.Media.MIME_TYPE);
do {
Log.wtf("asdasdasd", cur.getString(pathColumn) + "");
list.add(new Photo(
cur.getString(pathColumn),
cur.getString(dateColumn),
......
package com.leafpic.app;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
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.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
......@@ -18,6 +21,7 @@ import com.afollestad.materialdialogs.MaterialDialog;
import com.leafpic.app.Adapters.PhotosPagerAdapter;
import com.leafpic.app.Animations.DepthPageTransformer;
import com.leafpic.app.Base.HandlingPhotos;
import com.leafpic.app.Base.Photo;
import com.leafpic.app.utils.StringUtils;
/**
......@@ -50,6 +54,28 @@ public class PhotoActivity extends AppCompatActivity {
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mCustomPagerAdapter);
mViewPager.setCurrentItem(photos.getCurrentPhotoIndex());
Photo f = photos.getCurrentPhoto();
String[] projection = new String[]{
MediaStore.Images.Media.DATE_TAKEN,
MediaStore.Images.Media.DATA,
MediaStore.Images.Media.MIME_TYPE
};
Log.wtf("asdasdasd", f.Path);
Cursor cursor = getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
projection,
MediaStore.Images.Media.DATA + " = ?",
new String[]{f.Path}, "");
if (cursor.moveToFirst()) {
int columnIndex = cursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE);
StringUtils.showToast(getApplicationContext(), cursor.getString(columnIndex));
}
cursor.close();
mViewPager.setPageTransformer(true, new DepthPageTransformer());
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
......
package com.leafpic.app;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.net.Uri;
......@@ -13,7 +15,6 @@ import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.*;
import android.text.Html;
......@@ -83,6 +84,22 @@ public class PhotosActivity extends AppCompatActivity {
});
*/
private long getVideoIdFromFilePath(String filePath,
ContentResolver contentResolver) {
long videoId;
Uri videosUri = MediaStore.Video.Media.getContentUri("internal");
String[] projection = {MediaStore.Images.ImageColumns._ID};
// TODO This will break if we have no matching item in the MediaStore.
Cursor cursor = contentResolver.query(videosUri, projection, MediaStore.Images.ImageColumns.DATA + " LIKE ?", new String[]{filePath}, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(projection[0]);
videoId = cursor.getLong(columnIndex);
cursor.close();
return videoId;
}
public void LoadPhotos() {
try {
......@@ -362,9 +379,8 @@ public class PhotosActivity extends AppCompatActivity {
.onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
StringUtils.showToast(getApplicationContext(), "Not implemented yet!");
//albums.excludeAlbum(photos.FolderPath);
// finish();
customAlbumsHandler.excludeAlbum(photos.ID);
finish();
}
})
.show();
......@@ -379,16 +395,16 @@ public class PhotosActivity extends AppCompatActivity {
ArrayList<Uri> files = new ArrayList<Uri>();
for (Photo f : photos.selectedPhotos) {
File file = new File(f.Path);
files.add(Uri.fromFile(file));
}
for (Photo f : photos.selectedPhotos)
files.add(Uri.fromFile(new File(f.Path)));
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files);
startActivity(intent);
break;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
onBackPressed();
//NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_camera:
......
......@@ -110,14 +110,14 @@
>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gridPhotos"
android:numColumns="3"
android:verticalSpacing="2dp"
android:horizontalSpacing="2dp"
android:clipToPadding="false"
android:background="@color/md_dark_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gridPhotos"
android:numColumns="3"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:clipToPadding="false"
android:background="@color/md_dark_background"
/>
<!--app:layout_behavior="@StringUtils/appbar_scrolling_view_behavior"-->
</android.support.v7.widget.CardView>
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/selectedPicIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:elevation="10dp"
android:src="@mipmap/ic_check_circle_white_18dp"
android:layout_gravity="top|end"
......@@ -36,7 +37,7 @@
android:id="@+id/pic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:layout_margin="1dp"
android:minHeight="120dp"
android:scaleType="fitXY"
/>
</FrameLayout>
\ No newline at end of file
</FrameLayout>
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