Commit 67b41649 authored by Donald's avatar Donald

gifs rendered differently

close #465
parent 61e658b0
......@@ -80,12 +80,13 @@ dependencies {
implementation "com.android.support:palette-v7:$supportVersion"
implementation "com.android.support:customtabs:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
//todo update exoplayer
implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'
// utils
implementation 'com.github.bumptech.glide:glide:4.2.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
implementation 'com.koushikdutta.ion:ion:2.1.7'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
implementation 'com.github.Commit451:bypasses:1.0.4'
implementation 'com.jakewharton:butterknife:8.8.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
......@@ -111,7 +112,6 @@ dependencies {
implementation 'com.github.jetradarmobile:desertplaceholder:1.1.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.yalantis:ucrop:1.5.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.github.HoraApps:Liz:-SNAPSHOT'
......
......@@ -118,11 +118,9 @@ public class MainActivity extends SharedMediaActivity {
intent.putExtra("position", position);
startActivity(intent);
} catch (Exception e) {
intent.setAction(SingleMediaActivity.ACTION_OPEN_ALBUM_LAZY);
intent.putExtra("media", media.get(position));
startActivity(intent);
Toast.makeText(MainActivity.this, "dio cane", Toast.LENGTH_SHORT).show();
}
} else {
......
......@@ -165,7 +165,7 @@ public class SingleMediaActivity extends SharedMediaActivity {
.filter(media -> MediaFilter.getFilter(album.filterMode()).accept(media) && !media.equals(m))
.subscribe(ma -> {
int i = Collections.binarySearch(
list, ma, MediaComparators.getComparator(album.settings.getSortingMode(), album.settings.getSortingOrder()));
list, ma, MediaComparators.getComparator(album.settings));
if (i < 0) i = ~i;
list.add(i, ma);
},
......@@ -174,8 +174,9 @@ public class SingleMediaActivity extends SharedMediaActivity {
},
() -> {
int i = Collections.binarySearch(
list, m, MediaComparators.getComparator(album.settings.getSortingMode(), album.settings.getSortingOrder()));
list, m, MediaComparators.getComparator(album.settings));
if (i < 0) i = ~i;
list.add(i, m);
media.clear();
media.addAll(list);
......
......@@ -16,7 +16,6 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.koushikdutta.ion.Ion;
import com.mikepenz.community_material_typeface_library.CommunityMaterial;
import com.mikepenz.iconics.view.IconicsImageView;
......@@ -183,29 +182,22 @@ public class MediaAdapter extends ThemedAdapter<MediaAdapter.ViewHolder> {
holder.icon.setVisibility(View.GONE);
holder.layout.setBackgroundColor(getThemeHelper().getPrimaryColor());
if (f.isGif()) {
Ion.with(holder.imageView.getContext())
.load(f.getPath())
.intoImageView(holder.imageView);
holder.gifIcon.setVisibility(View.VISIBLE);
} else {
holder.gifIcon.setVisibility(f.isGif() ? View.VISIBLE : View.GONE);
RequestOptions options = new RequestOptions()
.signature(f.getSignature())
.format(DecodeFormat.PREFER_ARGB_8888)
.centerCrop()
.placeholder(placeholder)
//.animate(R.anim.fade_in)//TODO:DONT WORK WELL
.diskCacheStrategy(DiskCacheStrategy.RESOURCE);
Glide.with(holder.imageView.getContext())
.load(f.getUri())
.apply(options)
.thumbnail(0.5f)
.into(holder.imageView);
holder.gifIcon.setVisibility(View.GONE);
}
RequestOptions options = new RequestOptions()
.signature(f.getSignature())
.format(DecodeFormat.PREFER_RGB_565)
.centerCrop()
.placeholder(placeholder)
//.animate(R.anim.fade_in)//TODO:DONT WORK WELL
.diskCacheStrategy(DiskCacheStrategy.RESOURCE);
Glide.with(holder.imageView.getContext())
.load(f.getUri())
.apply(options)
.thumbnail(0.5f)
.into(holder.imageView);
if(f.isVideo()) {
holder.icon.setVisibility(View.VISIBLE);
......
package org.horaapps.leafpic.data.sort;
import org.horaapps.leafpic.data.AlbumSettings;
import org.horaapps.leafpic.data.Media;
import org.horaapps.leafpic.util.NumericComparator;
......@@ -11,6 +12,9 @@ import java.util.Comparator;
public class MediaComparators {
public static Comparator<Media> getComparator(AlbumSettings settings) {
return getComparator(settings.getSortingMode(), settings.getSortingOrder());
}
public static Comparator<Media> getComparator(SortingMode sortingMode, SortingOrder sortingOrder) {
return sortingOrder == SortingOrder.ASCENDING
? getComparator(sortingMode) : reverse(getComparator(sortingMode));
......
......@@ -6,12 +6,11 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.chrisbanes.photoview.PhotoView;
import com.koushikdutta.ion.Ion;
import org.horaapps.leafpic.activities.SingleMediaActivity;
import org.horaapps.leafpic.data.Media;
import pl.droidsonroids.gif.GifImageView;
/**
* Created by dnld on 18/02/16.
*/
......@@ -37,12 +36,8 @@ public class GifFragment extends Fragment {
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
PhotoView photoView = new PhotoView(container.getContext());
Ion.with(getContext())
.load(gif.getPath())
.intoImageView(photoView);
GifImageView photoView = new GifImageView(container.getContext());
photoView.setImageURI(gif.getUri());
photoView.setOnClickListener(view -> ((SingleMediaActivity) getActivity()).toggleSystemUI());
return photoView;
}
......
......@@ -8,7 +8,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......@@ -16,7 +16,7 @@ buildscript {
}
project.ext {
supportVersion = "26.1.0"
supportVersion = "27.0.1"
sdkVersion = 26
buildToolsVersion = '26.0.2'
}
......
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