This commit is contained in:
h4h13 2018-09-23 15:34:43 +05:30
parent a8dfe106bb
commit 3d7ba2afc6
193 changed files with 3667 additions and 2662 deletions

View file

@ -2,20 +2,23 @@ package code.name.monkey.retromusic.views;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.os.Build;
import android.os.Bundle;
import android.view.ViewGroup;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.widget.FrameLayout;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.ui.activities.base.AbsThemeActivity;
import code.name.monkey.retromusic.util.PreferenceUtil;
/**
@ -41,14 +44,38 @@ public class RoundedBottomSheetDialogFragment extends BottomSheetDialogFragment
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
BottomSheetDialog dialog = (BottomSheetDialog) getDialog();
FrameLayout bottomSheet = (FrameLayout) dialog.findViewById(R.id.design_bottom_sheet);
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
//behavior.setPeekHeight(0);
}
});
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AbsThemeActivity absThemeActivity = (AbsThemeActivity) getActivity();
if (absThemeActivity != null) {
absThemeActivity.setLightNavigationBar(true);
}
//noinspection ConstantConditions
return new BottomSheetDialog(getContext(), getTheme());
}
@Override
public void onStart() {
super.onStart();
if (getDialog() != null && getDialog().getWindow() != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Window window = getDialog().getWindow();
window.findViewById(com.google.android.material.R.id.container).setFitsSystemWindows(false);
// dark navigation bar icons
View decorView = window.getDecorView();
if (!ATHUtil.isWindowBackgroundDark(getContext()))
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
}
}