Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢冠章
flutter_boost_1.22.4
Commits
a5aeb476
Commit
a5aeb476
authored
Oct 17, 2019
by
yangwu.jia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solve the black screen problem when the page switch
parent
247cfe16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
example/android/app/src/main/AndroidManifest.xml
example/android/app/src/main/AndroidManifest.xml
+5
-1
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterFragmentPageActivity.java
...fish/flutterboostexample/FlutterFragmentPageActivity.java
+39
-1
No files found.
example/android/app/src/main/AndroidManifest.xml
View file @
a5aeb476
...
...
@@ -44,12 +44,16 @@
<meta-data
android:name=
"io.flutter.embedding.android.SplashScreenDrawable"
android:resource=
"@drawable/page_loading"
/>
</activity>
<activity
android:name=
".FlutterFragmentPageActivity"
android:theme=
"@style/Theme.AppCompat"
android:configChanges=
"orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated=
"true"
android:windowSoftInputMode=
"adjustResize"
/>
android:windowSoftInputMode=
"adjustResize"
>
<meta-data
android:name=
"io.flutter.embedding.android.SplashScreenDrawable"
android:resource=
"@drawable/page_loading"
/>
</activity>
<activity
android:name=
".NativePageActivity"
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/FlutterFragmentPageActivity.java
View file @
a5aeb476
package
com.taobao.idlefish.flutterboostexample
;
import
android.content.pm.ActivityInfo
;
import
android.content.pm.PackageManager
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
...
...
@@ -9,10 +12,15 @@ import android.support.v7.app.AppCompatActivity;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
com.idlefish.flutterboost.containers.NewFlutterFragment
;
import
io.flutter.embedding.android.DrawableSplashScreen
;
import
io.flutter.embedding.android.SplashScreen
;
import
io.flutter.embedding.android.SplashScreenProvider
;
import
io.flutter.plugin.platform.PlatformPlugin
;
public
class
FlutterFragmentPageActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
public
class
FlutterFragmentPageActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
,
SplashScreenProvider
{
protected
static
final
String
SPLASH_SCREEN_META_DATA_KEY
=
"io.flutter.embedding.android.SplashScreenDrawable"
;
private
NewFlutterFragment
mFragment
;
...
...
@@ -86,4 +94,34 @@ public class FlutterFragmentPageActivity extends AppCompatActivity implements Vi
super
.
onResume
();
mTab1
.
performClick
();
}
@Nullable
@Override
public
SplashScreen
provideSplashScreen
()
{
Drawable
manifestSplashDrawable
=
getSplashScreenFromManifest
();
if
(
manifestSplashDrawable
!=
null
)
{
return
new
DrawableSplashScreen
(
manifestSplashDrawable
,
ImageView
.
ScaleType
.
CENTER
,
500L
);
}
else
{
return
null
;
}
}
private
Drawable
getSplashScreenFromManifest
()
{
try
{
ActivityInfo
activityInfo
=
getPackageManager
().
getActivityInfo
(
getComponentName
(),
PackageManager
.
GET_META_DATA
|
PackageManager
.
GET_ACTIVITIES
);
Bundle
metadata
=
activityInfo
.
metaData
;
Integer
splashScreenId
=
metadata
!=
null
?
metadata
.
getInt
(
SPLASH_SCREEN_META_DATA_KEY
)
:
null
;
return
splashScreenId
!=
null
?
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
LOLLIPOP
?
getResources
().
getDrawable
(
splashScreenId
,
getTheme
())
:
getResources
().
getDrawable
(
splashScreenId
)
:
null
;
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
// This is never expected to happen.
return
null
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment