Circular reveal on activity with fragment - android

I have problem with circular reveal on my fragment. Whenever I call my reveal, it starts a new Activity and then inside onCreateView in fragment, it calls my reveal.
It works, but there is one glitch – as I start a new Activity, everything turns white. The Activity's background is white and covers data under it. Is it possible to show this data and not overlay it with this white background? Or should I make some kind of mask, animate it, and at the end start Activity?

I had the same issue and resolved it by using a transparent activity. To make your Activity transparent, use this code.
Theme Definition in styles.xml
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:windowBackground">#android:color/transparent</item>
</style>
Activity Definition in AndroidManifest.xml
<activity
android:name=".ui.CircularRevealActivity"
android:theme="#style/Theme.Transparent"
android:launchMode="singleTask"
/>
For a full answer on how to use a circular reveal animation on an activity, you can check this link.

Related

Not able to set transparent background for Popup Window Activity

I am following this particular example to create a popup window activity but when I click on a button to open this activity, the background is not semi-transparent as mentioned in the example. I am new to android kotlin development so I am not able to figure this out on my own. Let me know what I am doing wrong.
EDIT: This link tells a different method but working fine.
You can customize the translucent theme of your activity, in your "AndroidManifest.xml" file.
<activity
android:name=".ui.PopUpWindow"
android:theme="#style/AppTheme_translucent" />
and in your "styles.xml" file.
<style name="AppTheme_translucent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowBackground">#color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
</style>
I travel the code and did not see setContentView() method for PopupWindow activity. Please set content view for the activity by calling the method inside PopupWindow's onCreate()

Activity Dialog with black screen around

I have a problem with closing my Activity. I'm want to start activity by alarm. I've done that alarm start my activity, but I want to make it a dialog, so I set theme of that activity to android:Theme.Holo.Dialog.NoActionBar but I looks like this:
http://i.stack.imgur.com/rlfx1.png
I've also tried adding:
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">#android:style/Animation.Translucent</item>
<item name="android:windowBackground">#android:color/transparent</item>
But I makes transparent not elements that I want to, it looks like that
http://i.stack.imgur.com/BfvDL.png
Is there way to fix this, or do you have any diferent ideas to make this heppen.
Thanks

Shared element transition with Dialog Activity

I put together a very simple app that uses shared element transitions when starting an activity with Dialog theme (source code on github).
I got the following result:
As you can see there are 2 problems with the transition/animation:
The animation is only visible in the area of the dialog activity so it clips and looks ugly.
There is no transition/animation when I tap outside the activity to
go back.
How can I fix these problems? Any help would be appreciated.
EDIT: After Quanturium's answer I did the following things to get it working:
Use the following theme instead of a Dialog theme:
<style name="AppTheme.Transparent" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
Use a CardView as the background for Dialog look and for rounded corners and shadows.
Call finishAfterTransition(); when user taps outside the CardView.
Now it looks like this (code), the CardView needs refining to better match the Dialog, but it's working at least.:
An activity transition works like this. When you start your second activity, it is displayed on top of your first one with a transparent background. The shared elements are positioned the same way they are on the first activity and then animated to the correct position specified on the second activity.
In your case you are using android:theme="#style/Theme.AppCompat.Dialog" which mean the size of the second activity's drawing area is smaller than the one from the first activity. This explains the clipping and the no transition when clicking outside.
What you want to do is get rid of that theme, and implement your own layout with a dark background / shadow in order to be able to execute your smooth transition.

How to display transparent activity on the another activity without removing previous activity

How to display transparent activity on the another activity without removing previous activity ?
I am able to create transparent activity but when i trying to push it using intent , the previous activity gets removed. I want my transparent activity on the top of previous activity.
Thanks!
declare your activity in manifest like this
<activity android:name=".yourActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
and add a transperent background to your layout
like this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background = "any tranparent image name" >
</RelativeLayout>
Edit:
i think you are using this to open your transparent activity it finish your previous activity
Intent intent =new Intent(mContext,yourNewActivity.class);
startActivity(intent);
finish();
remove finish from here then your new activity in on top of previous activity like this
Intent intent =new Intent(mContext,yourNewActivity.class);
startActivity(intent);
Hope help..
For the AppCompat style, you can use the following code in your styles.xml, and the add that in your manifest.
styles.xml
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="colorPrimaryDark">#android:color/transparent</item>
</style>
Manifest
<activity android:name=".HomeActivity"
android:theme="#style/Theme.Transparent" />
I don't know why would you want that, but maybe a Custom dialog can do what you are looking for.
EDIT: This question has been answered before: How do I create a transparent Activity on Android?
I don't want to be rude, but I think you should do more research from your part. Also, can you post some code to see what exactly are you trying out, it also shows that you are trying something.

Start Activity with an animation

I am trying to start an activity with a custom transition animation. The only way I have found out so far to do this (without using onPendingTransition() in the previous activity) is to use a custom theme on the activity and define either activityOpenEnterAnimation, taskOpenEnterAnimation, windowEnterAnimation or windowAnimationStyle to set the animation. But, none of these attributes are working for me. Some experimentation yielded the following results-
If I set the windowAnimationStyle attribute to some custom style which defines values for activityOpenEnterAnimation, taskOpenEnterAnimation, windowEnterAnimation or windowAnimationStyle I can get rid of the default transition animation occurring at the start of the activity. It doesn't show the transition animation using the actual value specified but at least the default animation is not shown.
According to the reference doc here,
I should be able to define an animation at the start of the activity using activityOpenEnterAnimation. But no success so far.
Any ideas?
I am using this in a current project of mine, it is basically pretty simple. You define a new animation style in your styles.xml, like this:
<!-- just defines top layer "Animation" -->
<style name="Animation" />
<!-- the animations must have been defined in your "anim" folder, of course -->
<style name="Animation.MyAwesomeAnimation" parent="android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">#anim/myawesomeanimation_enter</item>
<item name="android:activityOpenExitAnimation">#anim/hold_long</item>
<item name="android:activityCloseEnterAnimation">#anim/hold_long</item>
<item name="android:activityCloseExitAnimation">#anim/myawesomeanimation_exit</item>
</style>
Then set this style in a theme (themes.xml):
<style name="Theme.MyAwesomeTheme" parent="Theme.Default">
<item name="android:windowAnimationStyle">#style/Animation.MyAwesomeAnimation</item>
</style>
And then you can simply set these themes to every activity you like in your AndroidManifest.xml:
<activity
android:name=".MyAwesomeActivity"
android:theme="#style/Theme.MyAwesomeTheme" />
Now I wish you big fun with activity animations! :-D

Categories

Resources