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

Commit d1c1b815 authored by Nishith  Khanna's avatar Nishith Khanna Committed by Jonathan Klee
Browse files

Retheme the app so that it matches our Settings app

parent 2f26dbe7
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ package org.microg.gms.ui
import android.content.Context
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.widget.Switch
import androidx.appcompat.widget.SwitchCompat
import androidx.core.content.res.TypedArrayUtils
import androidx.preference.PreferenceViewHolder
@@ -36,7 +37,7 @@ class SwitchBarPreference : TwoStatePreference {
        super.onBindViewHolder(holder)
        holder.isDividerAllowedBelow = false
        holder.isDividerAllowedAbove = false
        val switch = holder.findViewById(R.id.switch_widget) as SwitchCompat
        val switch = holder.findViewById(R.id.switch_widget) as Switch
        switch.setOnCheckedChangeListener(null)
        switch.isChecked = isChecked
        switch.setOnCheckedChangeListener { view, isChecked ->
@@ -46,17 +47,5 @@ class SwitchBarPreference : TwoStatePreference {
            }
            this.isChecked = isChecked
        }
        val frame = if (frameId == 0) null else holder.findViewById(frameId)
        val backgroundView = frame ?: holder.itemView
        val (backgroundDrawable, backgroundColorAttribute) = when {
            !isEnabled -> Pair(backgroundDisabled, androidx.appcompat.R.attr.colorControlHighlight)
            isChecked -> Pair(backgroundOn, androidx.appcompat.R.attr.colorControlActivated)
            else -> Pair(backgroundOff, androidx.appcompat.R.attr.colorButtonNormal)
        }
        if (backgroundDrawable != null) {
            backgroundView.setBackgroundDrawable(backgroundDrawable)
        } else {
            backgroundView.setBackgroundColorAttribute(backgroundColorAttribute)
        }
    }
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="?android:attr/colorControlHighlight">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/e_switchbar_color"/>
            <corners android:radius="28dp"/>
        </shape>
    </item>
</ripple>
+39 −27
Original line number Diff line number Diff line
@@ -7,36 +7,48 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingTop="16dp"
    android:paddingBottom="16dp"
    android:orientation="horizontal"
    android:paddingStart="?attr/listPreferredItemPaddingStart"
    android:paddingLeft="?attr/listPreferredItemPaddingLeft"
    android:paddingEnd="?attr/listPreferredItemPaddingEnd"
    android:paddingRight="?attr/listPreferredItemPaddingRight"
    tools:background="?attr/colorControlActivated">
    >

    <LinearLayout
        android:id="@+id/bg"
        android:minHeight="72dp"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:paddingStart="20dp"
        android:paddingEnd="20dp"
        android:background="@drawable/switchbar">

        <TextView
            android:id="@android:id/title"
        android:layout_width="0dp"
            android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_marginEnd="24dp"
            android:layout_marginVertical="24dp"
            android:textSize="20sp"
            android:ellipsize="end"
        android:maxLines="2"
        android:paddingStart="56dp"
        android:paddingLeft="56dp"
        android:textAppearance="?attr/textAppearanceListItem"
        android:textColor="@android:color/white"
        tools:text="Enabled" />
            android:textColor="?android:attr/textColorPrimary"
            android:hyphenationFrequency="normalFast"
            android:lineBreakWordStyle="phrase"
            android:visibility="visible"
            android:fontFamily="@*android:string/config_headlineFontFamily"
            android:textAppearance="?android:attr/textAppearanceListItem"
            style="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title.Inverse" />

    <androidx.appcompat.widget.SwitchCompat
        <Switch
            android:id="@+id/switch_widget"
            android:layout_width="wrap_content"
        android:layout_height="wrap_content"
            android:layout_height="48dp"
            android:layout_gravity="center_vertical"
        android:background="@null"
        app:thumbTint="@android:color/white"
        app:trackTint="@android:color/darker_gray"
        tools:checked="true" />
            android:focusable="false"
            android:clickable="false" />
    </LinearLayout>
</LinearLayout>
+9 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ SPDX-FileCopyrightText: 2020, microG Project Team
  ~ SPDX-License-Identifier: Apache-2.0
  -->

<resources>
    <color name="e_switchbar_color">#272727</color>
</resources>
+9 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ SPDX-FileCopyrightText: 2020, microG Project Team
  ~ SPDX-License-Identifier: Apache-2.0
  -->

<resources>
    <color name="e_switchbar_color">#f1f0f3</color>
</resources>
Loading