[mobile] force status bar transparent

pull/137/head
FongMi 3 years ago
parent 86ad1150f7
commit 1dfc616871
  1. 1
      app/src/main/res/layout/activity_crash.xml
  2. 5
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/DetailActivity.java
  3. 13
      app/src/mobile/java/com/fongmi/android/tv/ui/base/BaseActivity.java
  4. 1
      app/src/mobile/res/layout/activity_collect.xml
  5. 1
      app/src/mobile/res/layout/activity_history.xml
  6. 1
      app/src/mobile/res/layout/activity_keep.xml
  7. 3
      app/src/mobile/res/layout/activity_main.xml
  8. 1
      app/src/mobile/res/layout/activity_vod.xml

@ -2,7 +2,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:gravity="center"
android:orientation="vertical">

@ -204,6 +204,11 @@ public class DetailActivity extends BaseActivity implements Clock.Callback, Cust
return getCallingActivity() != null && getCallingActivity().getShortClassName().contains(CollectActivity.class.getSimpleName());
}
@Override
protected boolean hackStatusBar() {
return false;
}
@Override
protected ViewBinding getBinding() {
return mBinding = ActivityDetailBinding.inflate(getLayoutInflater());

@ -1,9 +1,11 @@
package com.fongmi.android.tv.ui.base;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewbinding.ViewBinding;
@ -28,6 +30,7 @@ public abstract class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (hackStatusBar()) hackStatusBar(this);
setContentView(getBinding().getRoot());
EventBus.getDefault().register(this);
setWall();
@ -39,6 +42,10 @@ public abstract class BaseActivity extends AppCompatActivity {
return this;
}
protected boolean hackStatusBar() {
return true;
}
protected boolean customWall() {
return true;
}
@ -68,6 +75,12 @@ public abstract class BaseActivity extends AppCompatActivity {
}
}
private void hackStatusBar(Activity activity) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRefreshEvent(RefreshEvent event) {
if (event.getType() != RefreshEvent.Type.WALL) return;

@ -5,7 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout

@ -3,7 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout

@ -3,7 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout

@ -2,8 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
android:layout_height="match_parent">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container"

@ -3,7 +3,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<TextView

Loading…
Cancel
Save