Some transitions
This commit is contained in:
parent
69ee1add6e
commit
5afebc0010
|
@ -5,9 +5,12 @@ import android.app.ProgressDialog;
|
|||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.transition.Explode;
|
||||
import android.view.ActionMode;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -67,6 +70,9 @@ public class BaseActivity extends CyaneaAppCompatActivity {
|
|||
.build());
|
||||
}*/
|
||||
canShowActionMode = true;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.content.IntentFilter;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
@ -123,6 +124,10 @@ public class SlideMediaActivity extends BaseFragmentActivity implements OnDownlo
|
|||
default:
|
||||
setTheme(R.style.TransparentDark);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
ActivityCompat.postponeEnterTransition(SlideMediaActivity.this);
|
||||
|
||||
}
|
||||
setContentView(R.layout.activity_media_pager);
|
||||
|
||||
fullscreen = false;
|
||||
|
|
|
@ -16,6 +16,7 @@ package app.fedilab.android.drawers;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
|
@ -3413,7 +3414,17 @@ public class StatusListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
b.putInt("bgcolor", context.getResources().getColor(R.color.cyanea_primary_dark));
|
||||
b.putInt("position", finalPosition);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
ActivityOptions options = null;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
||||
options = ActivityOptions
|
||||
.makeSceneTransitionAnimation((Activity)context, imageView, attachment.getUrl());
|
||||
// start the new activity
|
||||
context.startActivity(intent, options.toBundle());
|
||||
}else{
|
||||
// start the new activity
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
status.setAttachmentShown(true);
|
||||
|
|
|
@ -40,6 +40,7 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
|
@ -182,12 +183,7 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
|
|||
url = attachment.getRemote_url();
|
||||
attachment.setType(type);
|
||||
}
|
||||
|
||||
if (bgColor != -1) {
|
||||
RelativeLayout media_fragment_container = rootView.findViewById(R.id.media_fragment_container);
|
||||
media_fragment_container.setBackgroundColor(bgColor);
|
||||
}
|
||||
|
||||
RelativeLayout media_fragment_container = rootView.findViewById(R.id.media_fragment_container);
|
||||
switch (type.toLowerCase()) {
|
||||
case "image":
|
||||
pbar_inf.setScaleY(1f);
|
||||
|
@ -201,8 +197,15 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
|
|||
new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull final Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
Bitmap imageCompressed = Helper.compressImageIfNeeded(resource);
|
||||
imageView.setImageBitmap(imageCompressed);
|
||||
//Bitmap imageCompressed = Helper.compressImageIfNeeded(resource);
|
||||
imageView.setImageBitmap(resource);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
imageView.setTransitionName(attachment.getUrl());
|
||||
ActivityCompat.startPostponedEnterTransition((Activity)context);
|
||||
}
|
||||
if (bgColor != -1) {
|
||||
media_fragment_container.setBackgroundColor(bgColor);
|
||||
}
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.load(url).into(
|
||||
|
@ -244,6 +247,9 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
|
|||
break;
|
||||
case "video":
|
||||
case "gifv":
|
||||
if (bgColor != -1) {
|
||||
media_fragment_container.setBackgroundColor(bgColor);
|
||||
}
|
||||
pbar_inf.setIndeterminate(false);
|
||||
pbar_inf.setScaleY(3f);
|
||||
try {
|
||||
|
@ -276,6 +282,9 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
|
|||
player.setPlayWhenReady(true);
|
||||
break;
|
||||
case "web":
|
||||
if (bgColor != -1) {
|
||||
media_fragment_container.setBackgroundColor(bgColor);
|
||||
}
|
||||
loader.setVisibility(View.GONE);
|
||||
CustomWebview webview_video = Helper.initializeWebview((Activity) context, R.id.webview_video, null);
|
||||
webview_video.setVisibility(View.VISIBLE);
|
||||
|
@ -312,6 +321,9 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
|
|||
webview_video.loadUrl(attachment.getUrl());
|
||||
break;
|
||||
case "audio":
|
||||
if (bgColor != -1) {
|
||||
media_fragment_container.setBackgroundColor(bgColor);
|
||||
}
|
||||
loader.setVisibility(View.GONE);
|
||||
content_audio.setVisibility(View.VISIBLE);
|
||||
int color = getResources().getColor(R.color.mastodonC1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<attr name="cardviewColor" type="color" />
|
||||
<attr name="iconColor" type="color" />
|
||||
|
@ -90,6 +90,7 @@
|
|||
<item name="android:popupMenuStyle">@style/Fedilab.PopupMenu.Dark</item>
|
||||
<item name="android:itemBackground">@drawable/menu_selector</item>
|
||||
<item name="popupWindowStyle">@style/Cyanea.PopupMenu.Dark</item>
|
||||
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
|
||||
</style>
|
||||
<style name="Cyanea.PopupMenu.Dark" parent="@style/Widget.AppCompat.PopupMenu">
|
||||
<item name="android:popupBackground">@color/cyanea_primary_dark_reference</item>
|
||||
|
@ -107,6 +108,7 @@
|
|||
<item name="linkColor">@color/dark_link_toot</item>
|
||||
<item name="android:popupMenuStyle">@style/Fedilab.PopupMenu.Dark</item>
|
||||
<item name="android:itemBackground">@drawable/menu_selector</item>
|
||||
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
@ -163,6 +165,7 @@
|
|||
<item name="android:itemBackground">@drawable/menu_selector</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item>
|
||||
</style>
|
||||
|
||||
<style name="TransparentBlack" parent="Theme.Cyanea.Dark">
|
||||
|
|
Loading…
Reference in New Issue