fix top space
This commit is contained in:
@@ -34,7 +34,6 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void setContentView(int layoutResID) {
|
public void setContentView(int layoutResID) {
|
||||||
super.setContentView(layoutResID);
|
super.setContentView(layoutResID);
|
||||||
applyToInsentForStatusBar();
|
|
||||||
if (layoutResID != R.layout.activity_main){
|
if (layoutResID != R.layout.activity_main){
|
||||||
applyToInsentForNavigationBar();
|
applyToInsentForNavigationBar();
|
||||||
}
|
}
|
||||||
@@ -87,7 +86,7 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(0, systemBars.top, 0, systemBars.bottom);
|
v.setPadding(0, 0, 0, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -69,10 +69,5 @@ public class DisplayHelper {
|
|||||||
}
|
}
|
||||||
return NavMode.UNKNOWN;
|
return NavMode.UNKNOWN;
|
||||||
}
|
}
|
||||||
public static void changeStatusColor() {
|
|
||||||
Window window = BaseActivity.currentActivity.getWindow();
|
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
||||||
window.setStatusBarColor(ContextCompat.getColor(BaseActivity.currentActivity, R.color.pizzalemon_dark_green));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ package ch.pizzalemon.android.view;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -90,6 +93,10 @@ public class AppToolbar extends Toolbar {
|
|||||||
toolbarTitleTextView.setText(title);
|
toolbarTitleTextView.setText(title);
|
||||||
toolbarTitleTextView.setVisibility(VISIBLE);
|
toolbarTitleTextView.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
FrameLayout spacerViewForStatusBar = rootView.findViewById(R.id.spacerViewForStatusBar);
|
||||||
|
spacerViewForStatusBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Toolbar getToolbar() {
|
public Toolbar getToolbar() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:ignore="MissingPrefix"
|
tools:ignore="MissingPrefix"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="wrap_content"
|
||||||
android:contentInsetLeft="0dp"
|
android:contentInsetLeft="0dp"
|
||||||
android:contentInsetStart="0dp"
|
android:contentInsetStart="0dp"
|
||||||
app:contentInsetLeft="0dp"
|
app:contentInsetLeft="0dp"
|
||||||
@@ -17,9 +17,21 @@
|
|||||||
app:contentInsetEnd="0dp"
|
app:contentInsetEnd="0dp"
|
||||||
android:background="@color/pizzalemon_dark_green">
|
android:background="@color/pizzalemon_dark_green">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/spacerViewForStatusBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="?android:attr/actionBarSize">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -85,4 +97,6 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|||||||
Reference in New Issue
Block a user