Skip to content

Commit

Permalink
TouchGestures: Make Navbar follow system theme color
Browse files Browse the repository at this point in the history
Signed-off-by: AnierinB <[email protected]>
  • Loading branch information
Nico60 authored and AshutoshSundresh committed Apr 11, 2021
1 parent 8e4be52 commit d492e00
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 The ShapeShiftOS Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<resources>
<color name="primary_color">@*android:color/notification_material_background_color</color>
</resources>
11 changes: 11 additions & 0 deletions src/com/android/touch/gestures/TouchscreenGestureSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.UserHandle;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;

import android.preference.PreferenceActivity;
import androidx.preference.ListPreference;
Expand Down Expand Up @@ -82,6 +85,14 @@ public static class MainSettingsFragment extends PreferenceFragment {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {

Resources res = getResources();
Window win = getActivity().getWindow();

win.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
win.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
win.setNavigationBarColor(res.getColor(R.color.primary_color));
win.setNavigationBarDividerColor(res.getColor(R.color.primary_color));

setPreferencesFromResource(R.xml.touchscreen_gesture_settings, rootKey);

actionBar = getActivity().getActionBar();
Expand Down

0 comments on commit d492e00

Please sign in to comment.