Lottie anim does not play to the end. How to fix? - animation

I have such lottie anim
https://dropmefiles.com/uweF8
You can check it on Lottie preview web site
https://lottiefiles.com/preview
In preview this file is working well
But if you will try to add this anim to the project like this
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.airbnb.lottie.LottieAnimationView
android:id="#+id/animation_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:lottie_autoPlay="true"
app:lottie_loop="false"
app:lottie_rawRes="#raw/heart"
app:lottie_scale="1.2"
tools:background="#color/black_30_alpha"
tools:layout_height="200dp"
tools:layout_width="match_parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
So you will have such result
And you can see that the animation does not meet the end.
What am I doing wrong?
I have tried to add this line in the code
mAnimHeart.setMaxProgress(1f);
But the result is the same

This has been fixed in Lottie 3.0
https://github.com/airbnb/lottie-android/issues/1034

In official Lottie app last frame of this json file is same as yours. So it looks like something wrong with that file. Maybe Lottie team doesn't add support for some features on android. Or maybe it is just bug. You can open issue on thier github repository.

Related

How to create/design custom bottom navigation bar in xamarin android and connect it to xamarin.forms

I want to use Tabbed Page with bottom tabs. I want to make custom bottom bar in android and use it or inflate it in TabbedPageRenderer. Is this possible? Can anyone help me?
I want to use something like this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="#+id/bottomtab.navarea" android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="fill"
android:layout_weight="1" />
<android.support.design.widget.BottomNavigationView android:id="#+id/bottomtab.tabbar" android:theme="#style/Widget.Design.BottomNavigationView" android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
And then in my TabbedPageRenderer I want to use this layout for only the design of bottom bar.
Like you can access Toolbar and Tabbar from android. Similarly I want to access or create Bottombar.

Can I have a transparent background in my desktop application made with openfl

I'd like to know if there is a way to set the main Application window background to be transparent so that you can see all the other applications behind it when building for macOS and Windows using openfl
My project file looks like this.
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta title="DeskClock" package="com.sample.deskclock" version="1.0.0" company="Company Name" />
<app main="Main" path="Export" file="DeskClock" />
<window hardware="true" allow-shaders="true" require-shaders="true" depth-buffer="false" stencil-buffer="false" />
<window
background="0x00000000"
fullscreen="false"
resizable="false"
borderless="true"
vsync="true"/>
<window always-on-top="true" />
<source path="Source" />
<haxelib name="openfl" />
<assets path="Assets" rename="assets" />
</project>
and my main file looks like this.
It's possible if your targeting Air Desktop, however there is a performance hit and not sure if you can use Stage GPU stuff.
I'm not sure about the windows cpp target.
You are doing fine, the simplest to use transparency looks like this:
<window background="null" color-depth="32" />
OpenFL uses 16-bit color on OpenGL by default, with no alpha, so color-depth is important to allow a transparent background.
This will work on HTML5, I tested on Linux, and I don't believe the X11 window created by SDL is transparent, even when the borders are hidden. It is possible that there may need to be more work on creating the native window, depending on the platform. macOS or Windows might work with the above.

Xamarin forms iOS, How to customize navigation bar?

I am working with one project where we already customized actionbar for android in such a way:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="5dp"
android:paddingTop="5dip"
android:paddingBottom="5dip">
<ImageView
android:id="#+id/ImgSmallC"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="#drawable/smallC"
android:background="#drawable/back"
android:paddingRight="10dip"
android:paddingLeft="10dip"
android:layout_marginRight="25dp" />
<FrameLayout
android:id="#+id/LayoutProvider"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toRightOf="#id/ImgSmallC">
<TextView
android:id="#+id/txtProvider"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textSize="20dip"
android:textColor="#c6c6c6"
android:paddingRight="35dip"
android:paddingLeft="10dip"
android:background="#drawable/back"
android:text="Test"
android:layout_gravity="right"
android:gravity="center_vertical" />
<ImageView
android:id="#+id/imgArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/dropdown"
android:layout_marginRight="5dp"
android:layout_gravity="center_vertical|right" />
</FrameLayout>
</RelativeLayout>
Here is defined image which is in the center and text which is merged with image , so they both looks like button. Also I implemented some logic in C# code, where we used this .axml file as a layout:
LayoutInflater inflater = (LayoutInflater)ActionBar.ThemedContext.GetSystemService(LayoutInflaterService);
View customActionBarView = inflater.Inflate(Resource.Layout.actionbar_custom_view_done, null);
How can I to do same with iOS project? As I understand iOS doesn't have .axml files , because they are specific android file. I tried to find documentation examples , how to write custom layout for iOS navigation bar, but unfortunately I didn't found anything. And I want to use that iOS layout same as I mentioned in C# code logic for android.
UINavigationController aka Navigation allows very little customisation in iOS
You can find the detailed documentation our website here: https://developer.xamarin.com/recipes/ios/content_controls/navigation_controller/

Xamarin android - mvvmcross binding button image property

I am new to mvvmcross. In my xamarin android app, I want to change a buttons background image when the user clicks on it. I am not sure how this binding can be done. Can some one help me please.
You can bind any background image with DrawableId and DrawableName:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
local:MvxBind="DrawableId TheIntOfTheResource; Click SomeCommand" />
In SomeCommand you can change the id of TheIntOfTheResource which you bind to, so the image gets changed.

Disable switching from app to homescreen android wear

I am running a android wear fullscreen app and after a certain time, the watch switches from app screen to the home screen (shows time). Is there any way to shop the switching. Thanks.
I assume by switches from app screen to home screen you mean that the watch goes to sleep / dims the screen.
Well you can prevent this by adding the android:keepScreenOn attribute to your layout-file.
For example:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
...
</FrameLayout>
Alternatively you can add the flag in your Java-Code as well:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Note: Per default every wear-app will be closed as soon as the screen gets dimmed. A few weaks ago there has been a post on StackOverflow discussing the topic "Long Running Apps on Android Wear". You can find it here along with a pretty neat solution.

Resources