Start an activity with FLAG_SHOW_WHEN_LOCKED. The previous activity disappears and slides in again - android-activity

I lock the device screen, start the activity LockAct. LockAct starts another activity which has a SurfaceView.
If I don't add <item name="android:windowBackground">#android:color/transparent</item> to the activity with the SurfaceView, neither surfaceCreated nor surfaceChanged will be called.
If I add <item name="android:windowBackground">#android:color/transparent</item> to the activity with the SurfaceView, LockAct disappears and slides in on Android 5.0 only as shown in the video. It looks ugly.
How to prevent LockAct from disappearing and sliding in again?
What I've already tried:
ActivityOptions for LockAct
Intent intent = new Intent(getApplicationContext(), LockAct.class);
startActivity(intent, ActivityOptions.makeCustomAnimation(getApplicationContext(), 0, 0).toBundle());
android:windowAnimationStyle for LockAct
<style name="NoAnim" parent="#style/AppTheme">
<item name="android:windowAnimationStyle">#null</item>
</style>
<activity android:name="com.admin.LockAct"
android:theme="#style/NoAnim" />
android:windowEnterTransition and android:windowExitTransition for LockAct
<style name="NoAnim" parent="#style/AppTheme">
<item name="android:windowEnterTransition">#null</item>
<item name="android:windowExitTransition">#null</item>
</style>
<activity android:name="com.admin.LockAct"
android:theme="#style/NoAnim" />
Here is an archive with my sample Android app: https://www.dropbox.com/s/mc4pzqwc2o8lsej/Sample-Android-Lock.rar?dl=0

Activities are not started or finished smoothly when the device screen is locked. I noticed that on Android 5.0, but everything looks pretty good on my Samsung Galaxy S3 with CyanogenMod (Android 4.3.1). So different behavior may be on different devices and/or OS versions.
A co-worker gave me the link https://stackoverflow.com/a/23022023/1065835, and I'm going to use fragments instead of activities.

Related

How to change cursor color in html-editor-enhanced flutter

I am using html-editor-enhanced to compose.
I'm having problems synchronizing the cursor colors with the app's colors. when I focus on Editor, the default color of the cusor is green. while my app has a different color. How do I change the color of this cursor?
Hope to get help from the community.
I have found the answer to my question.
In android native. > Res>value> style.xml
add this line
<item name="android:colorControlActivated">#2F93EF</item>
Full code
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="#android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="#android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:colorControlActivated">#2F93EF</item>
</style>
</resources>

When I swipe from left to right, I don't want it to exit the wearos application in flutter

When I swipe from left to right, I don't want it to exit the wearos application (in flutter/wearos). What can I do for this?
actually, this path writes for kotlin and java in androiddevelopers but l can't see for flutter. so l wrote it for flutter. almost everything is same.
you should open styles.xml(android/app/src/main/res/values/styles.xml).Then you should write false this in Launch theme.
so it should looks like this
<style name="LaunchTheme" parent="#android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
<item name="android:windowSwipeToDismiss">false</item>
</style>

Flutter add to app Android shows white screen on startActivity

I have an app where there are some screens that are made in Flutter (add2app). I have a class called CMFlutterActivity that is a subclass of io.flutter.embedding.android.FlutterActivity. I use this class to manage the method channels, but I am not too happy with how the screen is presented, because the first Flutter frame is not available when the Activity is presented. After some research I figured there is a method in the FlutterActivity that I can override to know when the first Flutter frame is available, it is called onFlutterUiDisplayed. The problem I have is: how do I manage to only make the Activity visible after this method has been called? Has anyone solved this problem already?
I am currently starting the activity in the following manner:
startActivity(Intent(context, CMFlutterActivity::class.java))
Here are some of my configurations:
AndroidManifest.xml:
<activity
android:name=".ui.flutter.CMFlutterActivity"
android:theme="#style/AppTheme.NoFullscreen"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:stateNotNeeded="true"
android:exported="true"
/>
styles.xml:
<style name="AppTheme.NoFullscreen">
<item name="android:windowFullscreen">false</item>
</style>

how to reduce Flutter launch_background.xml display time?

I have set an image in launch_background.xml file for splash screen. it takes around 5sec to switch to next page. how to reduce display time.
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <item android:drawable="#android:color/white" />-->
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#mipmap/splash_screen" />
</item>
</layer-list>
Please suggest how to reduce display time?
I think you are running app in debug mode so it will take time. I will suggest you run the app in release mode. by running this command in terminal.
flutter run --release
By default, flutter run compiles to debug mode. Your IDE supports this mode. Android Studio, for example, provides a Run > Debug… menu option, as well as a green bug icon overlayed with a small triangle on the project page.
Read more about Flutter's build modes here

Flutter: How to hide the progress circle while login using flutter_facebook_login

I am using the flutter_facebook_login package to login the app. This method shows a login progress bar everytime I login. I want to remove that progress bar and use my own progress indicator.
How can I do that?
I already have a working progress bar and have used it. All i want is to remove the progress indicator of flutter_facebook_plugin.
I used a method where i tweaked the AndroidManifest.xml file. but it didn't work.
AndroidManifest.xml
<activity
android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#style/LaunchTheme" />
styles.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="LaunchTheme" parent="#android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:progressBarStyle">#style/InvisibleProgress</item>
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
<style name="InvisibleProgress">
<item name="android:visibility">gone</item>
</style>
</resources>
Solution for Android is available here,
works fine for Flutter plugin also
Android: How to hide progress circle in Facebook login