Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a8b6dd2 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Merge branch 'handle-nougat-branch' into 'master'

Make code & resources compliant with API 25

See merge request e/apps/GmsCore!39
parents 53359eaf 8b8da15b
Loading
Loading
Loading
Loading
Loading
+20 −6
Original line number Diff line number Diff line
package org.microg.tools.ui;

import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.ViewGroup;
@@ -19,14 +20,12 @@ public abstract class AbstractSettingsActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
        if (showHomeAsUp && getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setHomeButtonEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);

            getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_back);
        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1) {
            onCreateNougat();
        } else {
            onCreateOthersApi();
        }

        switchBar = findViewById(R.id.switch_bar);

        customBarContainer = findViewById(R.id.custom_bar);
@@ -39,6 +38,21 @@ public abstract class AbstractSettingsActivity extends AppCompatActivity {
                .commit();
    }

    private void onCreateNougat() {
        if (showHomeAsUp) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    private void onCreateOthersApi() {
        if (showHomeAsUp && getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            getSupportActionBar().setHomeButtonEnabled(true);
            getSupportActionBar().setDisplayShowHomeEnabled(true);
            getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_back);
        }
    }

    public void setCustomBarLayout(int layout) {
        customBarLayout = layout;
        if (customBarContainer != null) {
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2013-2022 microG Project Team
  ~
  ~ 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="settings_theme_primary">#222222</color>
    <color name="settings_theme_primary_dark">#000000</color>
    <color name="settings_theme_accent">#077fff</color>
    <color name="settings_text_appbar">#ffffff</color>
    <color name="switchbar_background_color">#ff37474f</color>
    <color name="switch_accent_color">#ff7fcac3</color>
    <color name="primary_text_color">#ffffff</color>
</resources>
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2013-2022 microG Project Team
  ~
  ~ 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>
    <style name="AppTheme" parent="AppTheme.Base" />
    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar" >
        <item name="colorAccent">@color/settings_theme_accent</item>
    </style>
</resources>
+58 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2013-2022 microG Project Team
  ~
  ~ 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>
    <style name="customOverFlow">
        <item name="android:src">@lineageos.platform:drawable/ic_menu</item>
        <item name="tint">@color/settings_theme_accent</item>
        <item name="android:paddingRight">10dp</item>
        <item name="android:foreground">?android:attr/selectableItemBackground</item>
    </style>


    <style name="AppTheme" parent="AppTheme.Base"/>

    <style name="AppTheme.Base" parent="Theme.AppCompat.DayNight">
        <item name="colorPrimary">@color/login_blue_theme_primary</item>
        <item name="colorPrimaryDark">@color/login_blue_theme_primary_dark</item>
        <item name="colorAccent">@color/login_blue_theme_accent</item>
        <item name="android:textColorPrimary">@color/primary_text_color</item>
        <item name="android:textColorSecondary">@color/secondary_text_color</item>
        <item name="android:textColorPrimaryInverse">@color/view_on_accent_color</item>
        <item name="android:windowBackground">@color/background_color</item>
        <item name="colorControlActivated">@color/settings_theme_accent</item>
        <item name="colorButtonNormal">@color/color_default_blue2</item>
        <item name="colorControlHighlight">@color/color_default_gray2</item>
        <item name="actionOverflowButtonStyle">@style/customOverFlow</item>
        <item name="homeAsUpIndicator">@drawable/ic_arrow_back</item>
        <item name="android:homeAsUpIndicator">@drawable/ic_arrow_back</item>
        <item name="actionBarTheme">@style/customToolbarTheme</item>
        <item name="android:popupBackground">@color/foreground_color</item>
        <item name="android:divider">@color/divider_color</item>
    </style>

    <style name="Theme.LoginBlue" parent="AppTheme">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>

    <style name="customToolbarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
        <item name="colorControlNormal">@color/settings_theme_accent</item>
        <item name="android:textColorPrimary">@color/primary_text_color</item>
        <item name="android:textColorSecondary">@color/secondary_text_color</item>
        <item name="android:popupBackground">?android:attr/popupBackground</item>
    </style>
</resources>