mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Merge pull request #123 from OHermesJunior/media-exit-anim
Make exit animation follow slide direction on media activities.
This commit is contained in:
commit
268ea4f9d8
@ -36,6 +36,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.thefuntasty.hauler.DragDirection;
|
||||
import com.thefuntasty.hauler.HaulerView;
|
||||
|
||||
import java.io.File;
|
||||
@ -117,7 +118,11 @@ public class ViewGIFActivity extends AppCompatActivity {
|
||||
actionBar.setHomeAsUpIndicator(upArrow);
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor)));
|
||||
|
||||
mHaulerView.setOnDragDismissedListener(dragDirection -> finish());
|
||||
mHaulerView.setOnDragDismissedListener(dragDirection -> {
|
||||
int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
|
||||
finish();
|
||||
overridePendingTransition(0, slide);
|
||||
});
|
||||
|
||||
glide = Glide.with(this);
|
||||
|
||||
|
@ -43,6 +43,7 @@ import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.thefuntasty.hauler.DragDirection;
|
||||
import com.thefuntasty.hauler.HaulerView;
|
||||
|
||||
import java.io.File;
|
||||
@ -138,7 +139,11 @@ public class ViewImageActivity extends AppCompatActivity implements SetAsWallpap
|
||||
setTitle("");
|
||||
}
|
||||
|
||||
mHaulerView.setOnDragDismissedListener(dragDirection -> finish());
|
||||
mHaulerView.setOnDragDismissedListener(dragDirection -> {
|
||||
int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
|
||||
finish();
|
||||
overridePendingTransition(0, slide);
|
||||
});
|
||||
|
||||
mLoadErrorLinearLayout.setOnClickListener(view -> {
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
@ -237,7 +242,7 @@ public class ViewImageActivity extends AppCompatActivity implements SetAsWallpap
|
||||
@Override
|
||||
public void saveSuccess(File imageFile) {
|
||||
Uri uri = FileProvider.getUriForFile(ViewImageActivity.this,
|
||||
BuildConfig.APPLICATION_ID + ".provider",imageFile);
|
||||
BuildConfig.APPLICATION_ID + ".provider", imageFile);
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
|
@ -32,6 +32,7 @@ import androidx.viewpager.widget.ViewPager;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.thefuntasty.hauler.DragDirection;
|
||||
import com.thefuntasty.hauler.HaulerView;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@ -140,7 +141,11 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
|
||||
images = savedInstanceState.getParcelableArrayList(IMGUR_IMAGES_STATE);
|
||||
}
|
||||
|
||||
haulerView.setOnDragDismissedListener(dragDirection -> finish());
|
||||
haulerView.setOnDragDismissedListener(dragDirection -> {
|
||||
int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
|
||||
finish();
|
||||
overridePendingTransition(0, slide);
|
||||
});
|
||||
|
||||
if (images == null) {
|
||||
fetchImgurMedia(imgurId);
|
||||
@ -447,6 +452,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
|
||||
|
||||
interface ParseImgurImagesAsyncTaskListener {
|
||||
void success(ArrayList<ImgurMedia> images);
|
||||
|
||||
void failed();
|
||||
}
|
||||
|
||||
@ -501,6 +507,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
|
||||
|
||||
interface ParseImgurImageAsyncTaskListener {
|
||||
void success(ImgurMedia image);
|
||||
|
||||
void failed();
|
||||
}
|
||||
|
||||
@ -541,4 +548,4 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.thefuntasty.hauler.DragDirection;
|
||||
import com.thefuntasty.hauler.HaulerView;
|
||||
|
||||
import java.io.File;
|
||||
@ -160,7 +161,11 @@ public class ViewVideoActivity extends AppCompatActivity {
|
||||
params.rightMargin = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
|
||||
haulerView.setOnDragDismissedListener(dragDirection -> finish());
|
||||
haulerView.setOnDragDismissedListener(dragDirection -> {
|
||||
int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
|
||||
finish();
|
||||
overridePendingTransition(0, slide);
|
||||
});
|
||||
|
||||
Intent intent = getIntent();
|
||||
mVideoUri = intent.getData();
|
||||
|
12
app/src/main/res/anim/slide_out_down.xml
Normal file
12
app/src/main/res/anim/slide_out_down.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromYDelta="0"
|
||||
android:toYDelta="+50%p" />
|
||||
<alpha
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
12
app/src/main/res/anim/slide_out_up.xml
Normal file
12
app/src/main/res/anim/slide_out_up.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromYDelta="0"
|
||||
android:toYDelta="-50%p" />
|
||||
<alpha
|
||||
android:duration="@android:integer/config_shortAnimTime"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
Loading…
Reference in New Issue
Block a user