|
|
@@ -7,8 +7,12 @@ import android.graphics.Color; |
|
|
|
import android.graphics.drawable.ColorDrawable; |
|
|
|
import android.os.Build; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.util.Log; |
|
|
|
import android.view.Gravity; |
|
|
|
import android.view.Window; |
|
|
|
import android.view.WindowManager; |
|
|
|
import android.widget.FrameLayout; |
|
|
|
import android.widget.ImageView; |
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
import androidx.annotation.Nullable; |
|
|
@@ -30,15 +34,58 @@ import io.flutter.plugins.GeneratedPluginRegistrant; |
|
|
|
|
|
|
|
public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommNativable { |
|
|
|
|
|
|
|
FrameLayout view; |
|
|
|
|
|
|
|
FrameLayout launchImageFrame; |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
|
|
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
configureWindowForTransparency(); |
|
|
|
configureStatusBarForFullscreenFlutterExperience(); |
|
|
|
|
|
|
|
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 |
|
|
@@ -92,7 +139,7 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN |
|
|
|
Map map = new HashMap(); |
|
|
|
map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); |
|
|
|
// 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("token", "123465"); |
|
|
|
return map; |
|
|
@@ -103,16 +150,23 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void initSuccess() { |
|
|
|
Log.d("----------------","----------------------清除启动页---------------"); |
|
|
|
removeLaunchView(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onDestroy() { |
|
|
|
super.onDestroy(); |
|
|
|
ZhiyingFlutterCommNative.getInstance().unregist(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onConfigurationChanged(Configuration newConfig) { |
|
|
|
super.onConfigurationChanged(newConfig); |
|
|
|
|
|
|
|
if (newConfig.fontScale != 1){ |
|
|
|
if (newConfig.fontScale != 1) { |
|
|
|
getResources(); |
|
|
|
}//非默认值 |
|
|
|
} |
|
|
|