Android App development of social start page

Start page include the following:

  1. The start page full screen
  2. Delayed entry Home
  3. Depending on the logic is guided into the home or login page or pages
  4. Liu screen adaptation

Start page full screen

Reference: the Android three ways provided Activity fullscreen

styles.xml file in the values ​​Contents Add AppThemeFull style

    <!--Full Style Activity -->
    <style name="AppThemeFull" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">true</item>
    </style>

Use AppThemeFull styles AndroidManifest.xml file

        <activity
            android:name=".ui.IndexActivity"
            android:theme="@style/AppThemeFull">
...

Delayed entry Home

private static final int SKIP_MAIN = 1000;

    private Handler mHandler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message message) {
            switch (message.what) {
                case SKIP_MAIN:
                    startMain();
                    break;
            }
            return false;
        }
    });

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_index);
        mHandler.sendEmptyMessageDelayed(SKIP_MAIN, 2 * 1000);
    }

After the logical start page

 /**
     * 进入主页
     */
    private void startMain() {
        //1.判断App是否第一次启动 install - first run
        boolean isFirstApp = SpUtils.getInstance().getBoolean(Constants.SP_IS_FIRST_APP, true);
        Intent intent = new Intent();
        if (isFirstApp) {
            //跳转到引导页
            intent.setClass(this, GuideActivity.class);
            //非第一次启动
            SpUtils.getInstance().putBoolean(Constants.SP_IS_FIRST_APP, false);
        } else {
            //2.如果非第一次启动,判断是否曾经登录过
            String token = SpUtils.getInstance().getString(Constants.SP_TOKEN, "");
            if (TextUtils.isEmpty(token)) {
                 //跳转到登录页
                 intent.setClass(this, LoginActivity.class);
            } else {
                //跳转到主页
                intent.setClass(this, MainActivity.class);
            }
        }
        startActivity(intent);
        finish();
    }

Liu screen adaptation

Reference:
Android bangs screen adaptation Raiders

Google Android screen notch support

Full screen adaptation vivo application guide
OPPO concave screen adaptation Description
Millet Full screen instructions and virtual key adaptation
millet bangs screen drop screen

Published 446 original articles · won praise 67 · views 240 000 +

Guess you like

Origin blog.csdn.net/hongxue8888/article/details/104735703