東川印記

一本東川,笑看爭龍斗虎;寰茫兦者,度橫佰昧人生。

Android N 分屏适配

2020年7月24日星期五




看起来还可以。。。。
package dc.test.surname.tao;

import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.annotation.Nullable;
import dc.android.common.activity.BaseActivity;
import dc.android.common.utils.AutoMarginUtils;
import dc.test.surname.Logger;
import dc.test.surname.R;

/**
 * 分屏适配
 *
 * @author senrsl
 * @ClassName: TaoActiviy
 * @Package: dc.test.surname.tao
 * @CreateTime: 2020/7/24 11:07 AM
 */
public class TaoActivity extends BaseActivity {

    private final String TAG = getClass().getSimpleName();

    public static void start(Context context) {
        Intent starter = new Intent(context, TaoActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Logger.w(TAG, "onCreate()", savedInstanceState);
        AutoMarginUtils.setSize(this, true, 720, 1280);
        setContentView(R.layout.activity_tao);
        AutoMarginUtils.auto(this);
    }

    @Override
    protected void onStart() {
        super.onStart();
        Logger.w(TAG, "onStart()");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Logger.w(TAG, "onResume()");
    }


    @Override
    protected void onPause() {
        super.onPause();
        Logger.w(TAG, "onPause()");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Logger.w(TAG, "onStop()");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Logger.w(TAG, "onRestart()");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Logger.w(TAG, "onDestroy()");
    }


    @Override
    public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
        super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
        Logger.w(TAG, "onMultiWindowModeChanged() from Activity", isInMultiWindowMode, newConfig);
    }

    @Override
    public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
        super.onMultiWindowModeChanged(isInMultiWindowMode);
        Logger.w(TAG, "onMultiWindowModeChanged() from FragmentActivity", isInMultiWindowMode);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Logger.w(TAG, "onConfigurationChanged()", newConfig);
    }

    /*
    首次打开
    07-24 11:20:50.051 1348-7032/? I/ActivityTaskManager: START u0 {cmp=dc.test.surname/.tao.TaoActivity} from uid 10258
    07-24 11:20:50.080 14791-14791/dc.test.surname I/System.out: TaoActivity   onCreate() null
    07-24 11:20:50.085 14791-14791/dc.test.surname I/System.out: TaoActivity   onStart()
    07-24 11:20:50.087 14791-14791/dc.test.surname I/System.out: TaoActivity   onResume()
     */

    /*
    回桌面 / 上划多应用预览
    07-24 11:21:44.139 14791-14791/dc.test.surname I/System.out: TaoActivity   onPause()
    07-24 11:21:44.162 14791-14791/dc.test.surname I/System.out: TaoActivity   onStop()
     */

    /*
    从桌面回来 / 从上划多应用预览回来
    07-24 11:22:05.090 14791-14791/dc.test.surname I/System.out: TaoActivity   onRestart()
    07-24 11:22:05.095 14791-14791/dc.test.surname I/System.out: TaoActivity   onStart()
    07-24 11:22:05.097 14791-14791/dc.test.surname I/System.out: TaoActivity   onResume()
     */

    /*
    关闭页面
    07-24 11:22:37.787 14791-14791/dc.test.surname I/System.out: TaoActivity   onPause()
    07-24 11:22:38.214 14791-14791/dc.test.surname I/System.out: TaoActivity   onStop()
    07-24 11:22:38.215 14791-14791/dc.test.surname I/System.out: TaoActivity   onDestroy()
     */

    /*
    竖屏, 分割画面,自动缩到最上面
    07-24 11:25:58.690 14791-14791/dc.test.surname I/System.out: TaoActivity   onDestroy()
    07-24 11:25:58.701 14791-14791/dc.test.surname I/System.out: TaoActivity   onCreate() Bundle[{android:viewHierarchyState=Bundle[{android:views={16908290=android.view.AbsSavedState$1@6d56d2e, 2131230729=android.view.AbsSavedState$1@6d56d2e, 2131230740=android.view.AbsSavedState$1@6d56d2e}, android:Panels={0=com.android.internal.policy.PhoneWindow$PanelFeatureState$SavedState@b4cfb78}}], android:lastAutofillId=1073741823, android:fragments=android.app.FragmentManagerState@b35d251}]
    07-24 11:25:58.706 14791-14791/dc.test.surname I/System.out: TaoActivity   onStart()
    07-24 11:25:58.709 14791-14791/dc.test.surname I/System.out: TaoActivity   onResume()
    07-24 11:25:58.712 14791-14791/dc.test.surname I/System.out: TaoActivity   onMultiWindowModeChanged() from FragmentActivity   true
    07-24 11:25:58.713 14791-14791/dc.test.surname I/System.out: TaoActivity   onMultiWindowModeChanged() from Activity   true   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w392dp h386dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1145) mAppBounds=Rect(0, 0 - 1080, 1145) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.585}
    07-24 11:25:58.730 14791-14791/dc.test.surname I/System.out: TaoActivity   onPause()

    下面选了一个应用,二分屏幕
    07-24 11:27:37.839 14791-14791/dc.test.surname I/System.out: TaoActivity   onResume()

    拖动二分边界

    可能1
    07-24 11:45:14.184 18486-18486/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w392dp h220dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 690) mAppBounds=Rect(0, 0 - 1080, 690) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.63}

    可能2
    07-24 11:45:49.432 18486-18486/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w392dp h552dp 440dpi nrml hdr widecg port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1601) mAppBounds=Rect(0, 0 - 1080, 1601) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.220}
    07-24 11:45:49.435 1348-1997/? W/WindowManager: Attempted to set replacing window on app token with no contentToken{40c41ba ActivityRecord{10d52e5 u0 dc.test.surname/.tao.TaoActivity t84}}
    07-24 11:45:49.436 18486-18486/dc.test.surname I/System.out: TaoActivity   onPause()
    07-24 11:45:49.437 18486-18486/dc.test.surname I/System.out: TaoActivity   onStop()
    07-24 11:45:49.438 18486-18486/dc.test.surname I/System.out: TaoActivity   onDestroy()
    07-24 11:45:49.454 18486-18486/dc.test.surname I/System.out: TaoActivity   onCreate() Bundle[{android:viewHierarchyState=Bundle[{android:views={16908290=android.view.AbsSavedState$1@bfc4b32, 2131230729=android.view.AbsSavedState$1@bfc4b32, 2131230740=android.view.AbsSavedState$1@bfc4b32}, android:Panels={0=com.android.internal.policy.PhoneWindow$PanelFeatureState$SavedState@524ddd7}}], android:lastAutofillId=1073741823, android:fragments=android.app.FragmentManagerState@79426c4}]
    07-24 11:45:49.470 18486-18486/dc.test.surname I/System.out: TaoActivity   onStart()
    07-24 11:45:49.481 18486-18486/dc.test.surname I/System.out: TaoActivity   onResume()
     */

    /*
    竖屏切横屏
    07-24 11:50:50.898 18486-18486/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w409dp h346dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1126, 1080) mAppBounds=Rect(0, 0 - 1126, 1036) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_90} s.967}

    切回竖屏
    07-24 11:51:11.951 18486-18486/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w392dp h386dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1145) mAppBounds=Rect(0, 0 - 1080, 1145) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.971}
     */

    /*
    横屏拖动

     */

    /*
    横屏拖动 退出

    07-24 11:52:51.205 18486-18486/dc.test.surname I/System.out: TaoActivity   onPause()
    07-24 11:52:51.206 18486-18486/dc.test.surname I/System.out: TaoActivity   onStop()
    07-24 11:52:51.212 18486-18486/dc.test.surname I/System.out: TaoActivity   onDestroy()
    07-24 11:52:51.235 18486-18486/dc.test.surname I/System.out: TaoActivity   onCreate() Bundle[{android:viewHierarchyState=Bundle[{android:views={16908290=android.view.AbsSavedState$1@bfc4b32, 2131230729=android.view.AbsSavedState$1@bfc4b32, 2131230740=android.view.AbsSavedState$1@bfc4b32}, android:Panels={0=com.android.internal.policy.PhoneWindow$PanelFeatureState$SavedState@a6f17f9}}], android:lastAutofillId=1073741823, android:fragments=android.app.FragmentManagerState@e31433e}]
    07-24 11:52:51.253 18486-18486/dc.test.surname I/System.out: TaoActivity   onStart()
    07-24 11:52:51.263 18486-18486/dc.test.surname I/System.out: TaoActivity   onResume()
    07-24 11:52:51.542 18486-18486/dc.test.surname I/System.out: TaoActivity   onMultiWindowModeChanged() from FragmentActivity   false
    TaoActivity    onMultiWindowModeChanged() from Activity   false  {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w829dp h346dp 440dpi nrml long hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2280, 1080) mAppBounds=Rect(0, 0 - 2280, 1036) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_90} s.2789}
     */

    /*
    配置 android:configChanges="screenLayout|screenSize|smallestScreenSize|orientation"

    竖屏, 分割画面,自动缩到最上面
    07-24 14:45:58.406 29775-29775/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w392dp h386dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1145) mAppBounds=Rect(0, 0 - 1080, 1145) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.121}
    07-24 14:45:58.407 29775-29775/dc.test.surname I/System.out: TaoActivity   onRestart()
    07-24 14:45:58.408 29775-29775/dc.test.surname I/System.out: TaoActivity   onStart()
    TaoActivity    onResume()
    07-24 14:45:58.409 29775-29775/dc.test.surname I/System.out: TaoActivity   onMultiWindowModeChanged() from FragmentActivity   true
    TaoActivity    onMultiWindowModeChanged() from Activity   true   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w392dp h386dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1145) mAppBounds=Rect(0, 0 - 1080, 1145) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.121}
    07-24 14:45:58.445 29775-29775/dc.test.surname I/System.out: TaoActivity   onPause()

    下面选了一个应用,二分屏幕
    07-24 14:47:06.200 29775-29775/dc.test.surname I/System.out: TaoActivity   onResume()


    拖动
    07-24 14:47:44.234 29775-29775/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w392dp h552dp 440dpi nrml hdr widecg port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1601) mAppBounds=Rect(0, 0 - 1080, 1601) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.192}


    竖屏切横屏
    07-24 14:48:51.079 29775-29775/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w829dp h346dp 440dpi nrml long hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2280, 1080) mAppBounds=Rect(0, 0 - 2280, 1036) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_270} s.321}

    横屏分屏,自动缩到左边
    07-24 14:49:22.297 29775-29775/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w409dp h346dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1126, 1080) mAppBounds=Rect(0, 0 - 1126, 1036) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_270} s.326}
    07-24 14:49:22.301 29775-29775/dc.test.surname I/System.out: TaoActivity   onRestart()
    07-24 14:49:22.302 29775-29775/dc.test.surname I/System.out: TaoActivity   onStart()
    07-24 14:49:22.303 29775-29775/dc.test.surname I/System.out: TaoActivity   onResume()
    07-24 14:49:22.304 29775-29775/dc.test.surname I/System.out: TaoActivity   onMultiWindowModeChanged() from FragmentActivity   true
        TaoActivity    onMultiWindowModeChanged() from Activity   true   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w409dp h346dp 440dpi smll hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1126, 1080) mAppBounds=Rect(0, 0 - 1126, 1036) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_270} s.326}
    07-24 14:49:22.337 29775-29775/dc.test.surname I/System.out: TaoActivity   onPause()

    右边选个应用,二分屏幕
    07-24 14:50:29.022 29775-29775/dc.test.surname I/System.out: TaoActivity   onResume()

    拖动退出分屏
    07-24 14:50:40.283 29775-29775/dc.test.surname I/System.out: TaoActivity   onConfigurationChanged()   {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w829dp h346dp 440dpi nrml long hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2280, 1080) mAppBounds=Rect(0, 0 - 2280, 1036) mWindowingMode=split-screen-primary mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_270} s.376}
    07-24 14:50:40.333 29775-29775/dc.test.surname I/System.out: TaoActivity   onMultiWindowModeChanged() from FragmentActivity   false
    TaoActivity    onMultiWindowModeChanged() from Activity   false  {1.0 454mcc12mnc [zh_HK] ldltr sw392dp w829dp h346dp 440dpi nrml long hdr widecg land finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 2280, 1080) mAppBounds=Rect(0, 0 - 2280, 1036) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_270} s.381}
     */

}




--
senRsl
2020年07月24日14:54:17

没有评论 :

发表评论