@@ -112,9 +112,9 @@ android { | |||||
// 智夜生活 | // 智夜生活 | ||||
zhiying { | zhiying { | ||||
applicationId "cn.zhios.zhiying" | applicationId "cn.zhios.zhiying" | ||||
versionCode 24 | |||||
versionCode 25 | |||||
dimension "app" | dimension "app" | ||||
versionName '1.2.4' | |||||
versionName '1.2.5' | |||||
// 签名信息 | // 签名信息 | ||||
signingConfig signingConfigs.zhiying | signingConfig signingConfigs.zhiying | ||||
} | } | ||||
@@ -7,8 +7,12 @@ import android.graphics.Color; | |||||
import android.graphics.drawable.ColorDrawable; | import android.graphics.drawable.ColorDrawable; | ||||
import android.os.Build; | import android.os.Build; | ||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.util.Log; | |||||
import android.view.Gravity; | |||||
import android.view.Window; | import android.view.Window; | ||||
import android.view.WindowManager; | import android.view.WindowManager; | ||||
import android.widget.FrameLayout; | |||||
import android.widget.ImageView; | |||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||
@@ -30,15 +34,58 @@ import io.flutter.plugins.GeneratedPluginRegistrant; | |||||
public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommNativable { | public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommNativable { | ||||
FrameLayout view; | |||||
FrameLayout launchImageFrame; | |||||
@Override | @Override | ||||
protected void onCreate(@Nullable Bundle savedInstanceState) { | protected void onCreate(@Nullable Bundle savedInstanceState) { | ||||
super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
configureWindowForTransparency(); | configureWindowForTransparency(); | ||||
configureStatusBarForFullscreenFlutterExperience(); | configureStatusBarForFullscreenFlutterExperience(); | ||||
MobLink.setRestoreSceneListener(new MoblinkPlugin.SceneListener()); | MobLink.setRestoreSceneListener(new MoblinkPlugin.SceneListener()); | ||||
addLaunchView(); | |||||
} | |||||
///添加启动页 | |||||
void addLaunchView() { | |||||
view = (FrameLayout) this.getWindow().getDecorView(); | |||||
launchImageFrame = new FrameLayout(this); | |||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); | |||||
params.gravity = Gravity.CENTER; | |||||
launchImageFrame.setLayoutParams(params); | |||||
ImageView launchImageView = new ImageView(this); | |||||
FrameLayout.LayoutParams b_p = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); | |||||
b_p.gravity = Gravity.CENTER_HORIZONTAL; | |||||
launchImageView.setScaleType(ImageView.ScaleType.FIT_XY); | |||||
launchImageView.setLayoutParams(b_p); | |||||
launchImageView.setImageResource(R.mipmap.start); | |||||
launchImageFrame.addView(launchImageView, b_p); | |||||
view.addView(launchImageFrame, params); | |||||
} | |||||
///移除启动页 | |||||
void removeLaunchView() { | |||||
if(view!=null&&launchImageFrame!=null){ | |||||
Log.d("----------------","----------------------清除启动页---------------"); | |||||
view.removeView(launchImageFrame); | |||||
} | |||||
launchImageFrame=null; | |||||
view=null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -92,7 +139,7 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN | |||||
Map map = new HashMap(); | Map map = new HashMap(); | ||||
map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); | map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); | ||||
// map.put("domain", "http://192.168.0.113:5000"); | // map.put("domain", "http://192.168.0.113:5000"); | ||||
map.put("master_id", "123456"); | |||||
map.put("master_id", "ios_review"); | |||||
map.put("secret_key", "123456"); | map.put("secret_key", "123456"); | ||||
// map.put("token", "123465"); | // map.put("token", "123465"); | ||||
return map; | return map; | ||||
@@ -103,16 +150,23 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN | |||||
return; | return; | ||||
} | } | ||||
@Override | |||||
public void initSuccess() { | |||||
Log.d("----------------","----------------------清除启动页---------------"); | |||||
removeLaunchView(); | |||||
} | |||||
@Override | @Override | ||||
protected void onDestroy() { | protected void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
ZhiyingFlutterCommNative.getInstance().unregist(); | ZhiyingFlutterCommNative.getInstance().unregist(); | ||||
} | } | ||||
@Override | @Override | ||||
public void onConfigurationChanged(Configuration newConfig) { | public void onConfigurationChanged(Configuration newConfig) { | ||||
super.onConfigurationChanged(newConfig); | super.onConfigurationChanged(newConfig); | ||||
if (newConfig.fontScale != 1){ | |||||
if (newConfig.fontScale != 1) { | |||||
getResources(); | getResources(); | ||||
}//非默认值 | }//非默认值 | ||||
} | } | ||||
@@ -1,4 +1,4 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
<resources> | <resources> | ||||
<string name="app_name">智莺生活_内测版</string> | |||||
<string name="app_name">智莺生活</string> | |||||
</resources> | </resources> |
@@ -7,16 +7,11 @@ | |||||
<!--这个是预先设置的背景图片--> | <!--这个是预先设置的背景图片--> | ||||
<item name="android:windowBackground">@mipmap/start</item> | <item name="android:windowBackground">@mipmap/start</item> | ||||
<!--设置过渡效果,禁用窗口的预览动画--> | <!--设置过渡效果,禁用窗口的预览动画--> | ||||
<item name="android:windowDisablePreview">true</item> | |||||
<item name="android:windowNoTitle">true</item> | |||||
<item name="android:windowDisablePreview">false</item> | |||||
<item name="android:statusBarColor">@android:color/transparent</item> | <item name="android:statusBarColor">@android:color/transparent</item> | ||||
<item name="android:navigationBarColor">@android:color/transparent</item> | <item name="android:navigationBarColor">@android:color/transparent</item> | ||||
<item name="windowActionBar">false</item> | |||||
<item name="windowNoTitle">true</item> | <item name="windowNoTitle">true</item> | ||||
<item name="android:fullBackupOnly">true</item> | |||||
<item name="android:screenOrientation">portrait</item> | |||||
<item name="android:windowSoftInputMode">stateHidden</item> | |||||
<item name="android:configChanges">orientation|keyboardHidden|screenSize</item> | |||||
</style> | </style> | ||||
@@ -32,13 +27,7 @@ | |||||
<item name="android:windowDisablePreview">true</item> | <item name="android:windowDisablePreview">true</item> | ||||
<item name="android:windowNoTitle">true</item> | <item name="android:windowNoTitle">true</item> | ||||
<item name="android:statusBarColor">@android:color/transparent</item> | <item name="android:statusBarColor">@android:color/transparent</item> | ||||
<item name="android:navigationBarColor">@android:color/transparent</item> | |||||
<item name="windowActionBar">false</item> | |||||
<item name="windowNoTitle">true</item> | |||||
<item name="android:fullBackupOnly">true</item> | |||||
<item name="android:screenOrientation">portrait</item> | |||||
<item name="android:windowSoftInputMode">stateHidden</item> | |||||
<item name="android:configChanges">orientation|keyboardHidden|screenSize</item> | |||||
</style> | </style> | ||||
</resources> | </resources> |
@@ -71,10 +71,14 @@ class _MyAppState extends State<MyApp> { | |||||
], | ], | ||||
child: MaterialApp( | child: MaterialApp( | ||||
builder: (context,child){ | builder: (context,child){ | ||||
MediaQuery.of(context).copyWith(textScaleFactor: 1); | |||||
return child; | |||||
return MediaQuery( | |||||
//设置文字大小不随系统设置改变 | |||||
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), | |||||
child: child, | |||||
); | |||||
}, | }, | ||||
theme: ThemeData( | theme: ThemeData( | ||||
fontFamily: 'PingFang', | |||||
primaryColor: HexColor.fromHex('#FF4242'), | primaryColor: HexColor.fromHex('#FF4242'), | ||||
accentColor: HexColor.fromHex('#FF4242'), | accentColor: HexColor.fromHex('#FF4242'), | ||||
), | ), | ||||
@@ -52,17 +52,9 @@ flutter: | |||||
# "family" key with the font family name, and a "fonts" key with a | # "family" key with the font family name, and a "fonts" key with a | ||||
# list giving the asset and other descriptors for the font. For | # list giving the asset and other descriptors for the font. For | ||||
# example: | # example: | ||||
# fonts: | |||||
# - family: Schyler | |||||
# fonts: | |||||
# - asset: fonts/Schyler-Regular.ttf | |||||
# - asset: fonts/Schyler-Italic.ttf | |||||
# style: italic | |||||
# - family: Trajan Pro | |||||
# fonts: | |||||
# - asset: fonts/TrajanPro.ttf | |||||
# - asset: fonts/TrajanPro_Bold.ttf | |||||
# weight: 700 | |||||
# | |||||
fonts: | |||||
- family: PingFang | |||||
fonts: | |||||
- asset: assets/fonts/PingFang.otf | |||||
# For details regarding fonts from package dependencies, | # For details regarding fonts from package dependencies, | ||||
# see https://flutter.dev/custom-fonts/#from-packages | # see https://flutter.dev/custom-fonts/#from-packages |
@@ -55,7 +55,10 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin { | |||||
Logger.debug('ConnectivityResult.wifi'); | Logger.debug('ConnectivityResult.wifi'); | ||||
print('ConnectivityResult.wifi'); | print('ConnectivityResult.wifi'); | ||||
Application.init().then((_) async { | Application.init().then((_) async { | ||||
NativeUtil.notifyInitSuccess(); | |||||
Timer(Duration(milliseconds: 300), (){ | |||||
NativeUtil.notifyInitSuccess(); | |||||
}); | |||||
PackageInfo packageInfo = await PackageInfo.fromPlatform(); | PackageInfo packageInfo = await PackageInfo.fromPlatform(); | ||||
String versionNumber = await SharedPreferencesUtil.getStringValue(Constants.versionNumber); | String versionNumber = await SharedPreferencesUtil.getStringValue(Constants.versionNumber); | ||||
@@ -134,11 +137,11 @@ class _LaunchPageState extends State<LaunchPage> with TickerProviderStateMixin { | |||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return Container( | return Container( | ||||
color: Colors.white, | color: Colors.white, | ||||
child: Image.asset( | |||||
'assets/images/launch_image/launch_image.png', | |||||
package: 'zhiying_base_widget', | |||||
fit: BoxFit.fill, | |||||
), | |||||
// child: Image.asset( | |||||
// 'assets/images/launch_image/launch_image.png', | |||||
// package: 'zhiying_base_widget', | |||||
// fit: BoxFit.fill, | |||||
// ), | |||||
); | ); | ||||
} | } | ||||
} | } |