Commit e74aa94a authored by Gilbert Ndresaj's avatar Gilbert Ndresaj

Merge remote-tracking branch 'refs/remotes/DNLDsht/master'

# Conflicts:
#	app/src/main/java/com/leafpic/app/PhotoActivity.java
parents d91ef3e0 7562b0f4
......@@ -18,13 +18,13 @@
<activity android:name=".SettingsActivity"
android:label="Setting"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:theme="@style/Theme.AppCompat.NoActionBar"
>
</activity>
<activity android:name=".AlbumsActivity"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:theme="@style/Theme.AppCompat.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
......@@ -35,7 +35,7 @@
<activity android:name=".PhotosActivity"
android:label="Album"
android:parentActivityName=".AlbumsActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:theme="@style/Theme.AppCompat.NoActionBar"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
......
......@@ -42,6 +42,7 @@ public class PhotosAdapter extends RecyclerView.Adapter<PhotosAdapter.ViewHolder
public void onBindViewHolder(PhotosAdapter.ViewHolder holder, int position) {
Photo f = photos.get(position);
Glide.clear(holder.imageView);//fix corruption
if (f.MIME.equals("image/gif")) {
Ion.with(holder.imageView.getContext())
......
......@@ -11,7 +11,6 @@ import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
......@@ -28,7 +27,6 @@ import com.leafpic.app.utils.StringUtils;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/**
* Created by dnld on 12/12/15.
......@@ -47,8 +45,6 @@ public class PhotoActivity extends AppCompatActivity {
setContentView(R.layout.activity_photo);
initUiTweaks();
try {
Bundle data = getIntent().getExtras();
photos = data.getParcelable("album");
photos.setContext(PhotoActivity.this);
......@@ -63,27 +59,6 @@ public class PhotoActivity extends AppCompatActivity {
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
......@@ -165,14 +140,16 @@ public class PhotoActivity extends AppCompatActivity {
return true;
case R.id.renamePhoto:
new MaterialDialog.Builder(this)
.title("Rename Photo")
.inputType(InputType.TYPE_CLASS_TEXT)
.input(null, StringUtils.getPhotoNamebyPath(photos.getCurrentPhoto().Path), new MaterialDialog.InputCallback() {
@Override
public void onInput(MaterialDialog dialog, CharSequence input) {
photos.renamePhoto(photos.getCurrentPhoto().Path, String.valueOf(input));
// StringUtils.showToast(getApplicationContext(), "I have to fix this!");
photos.renamePhoto(
photos.getCurrentPhoto().Path,
input + StringUtils.getPhotoExtensionbyPath(photos.getCurrentPhoto().Path));
}
}).show();
......@@ -180,6 +157,7 @@ public class PhotoActivity extends AppCompatActivity {
case R.id.Modify:
break;
case R.id.details:
<<<<<<< HEAD
/****DATA****/
Calendar cl = Calendar.getInstance();
......@@ -189,6 +167,13 @@ public class PhotoActivity extends AppCompatActivity {
SimpleDateFormat s = new SimpleDateFormat("dd/mm/yyyy HH:MM");// //new DateFormat();
date = s.format(new Time(Long.valueOf(photos.getCurrentPhoto().DateTaken)));
Photo f = photos.getCurrentPhoto();
=======
Photo f = photos.getCurrentPhoto();
String date = "", size = "", resolution = "";
SimpleDateFormat s = new SimpleDateFormat("dd/mm/yyyy HH:MM");
date = s.format(new Time(Long.valueOf(f.DateTaken)));
>>>>>>> refs/remotes/DNLDsht/master
String[] projection = new String[]{
MediaStore.Images.Media.SIZE,
MediaStore.Images.Media.HEIGHT,
......@@ -207,6 +192,7 @@ public class PhotoActivity extends AppCompatActivity {
resolution += "x" + cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.HEIGHT));
}
cursor.close();
<<<<<<< HEAD
/**GET COLOR**/
/*
SharedPreferences SP;
......@@ -226,6 +212,17 @@ public class PhotoActivity extends AppCompatActivity {
+ "\nFormat: " + photos.getCurrentPhoto().MIME
+ "\nDate: " + date)
.positiveText("OK")
=======
new MaterialDialog.Builder(this)
.title("Photo Details")
.content("Path: \t" + photos.getCurrentPhoto().Path
+ "\nSize: \t" + size
+ "\nResolution: \t" + resolution
+ "\nType: \t" + photos.getCurrentPhoto().MIME
+ "\nDate: \t" + date)
.positiveText("DONE")
>>>>>>> refs/remotes/DNLDsht/master
.show();
break;
......
......@@ -30,7 +30,14 @@ public class StringUtils {
public static String getPhotoNamebyPath(String path) {
String b[] = path.split("/");
return b[b.length - 1];
String fi = b[b.length - 1];
return fi.substring(0, fi.indexOf('.'));
}
public static String getPhotoExtensionbyPath(String path) {
String b[] = path.split("/");
String fi = b[b.length - 1];
return fi.substring(fi.indexOf('.'), fi.length());
}
public static String getPhotoPathByFolderPathAndName(String folderPath, String name) {
......
This diff is collapsed.
<?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="wrap_content"
android:layout_height="120dp"
android:layout_margin="2dp"
>
<ImageView
......@@ -37,8 +35,7 @@
<ImageView
android:id="@+id/pic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="120dp"
android:scaleType="center"
android:layout_height="match_parent"
android:scaleType="centerCrop"
/>
</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