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,72 +17,86 @@
|
|||||||
app:contentInsetEnd="0dp"
|
app:contentInsetEnd="0dp"
|
||||||
android:background="@color/pizzalemon_dark_green">
|
android:background="@color/pizzalemon_dark_green">
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
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="match_parent">
|
android:layout_height="?android:attr/actionBarSize">
|
||||||
|
|
||||||
<ImageView
|
<RelativeLayout
|
||||||
android:id="@+id/hamburgerIcon"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="?android:attr/actionBarSize"
|
android:layout_height="match_parent">
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
|
||||||
android:padding="20dp"
|
<ImageView
|
||||||
android:layout_centerVertical="true"
|
android:id="@+id/hamburgerIcon"
|
||||||
android:src="@drawable/ic_hamburger_menu"
|
android:layout_width="?android:attr/actionBarSize"
|
||||||
android:tint="@color/white"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/ic_hamburger_menu"
|
||||||
|
android:tint="@color/white"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/closeIcon"
|
||||||
|
android:layout_width="?android:attr/actionBarSize"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/ic_cancel"
|
||||||
|
android:tint="@color/white"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/backIcon"
|
||||||
|
android:layout_width="?android:attr/actionBarSize"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/ic_back"
|
||||||
|
android:tint="@color/white"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbarTitleTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
fontPath="fonts/Quicksand-Bold.ttf"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="?android:attr/actionBarSize"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/pizzalemon_logo" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="2dp"
|
||||||
|
android:background="@drawable/shadow"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/closeIcon"
|
|
||||||
android:layout_width="?android:attr/actionBarSize"
|
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
|
||||||
android:padding="20dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:src="@drawable/ic_cancel"
|
|
||||||
android:tint="@color/white"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/backIcon"
|
|
||||||
android:layout_width="?android:attr/actionBarSize"
|
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
|
||||||
android:padding="20dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:src="@drawable/ic_back"
|
|
||||||
android:tint="@color/white"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/toolbarTitleTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
fontPath="fonts/Quicksand-Bold.ttf"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="?android:attr/actionBarSize"
|
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:padding="12dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:src="@drawable/pizzalemon_logo" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:background="@drawable/shadow"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|||||||
Reference in New Issue
Block a user