Settings tweaks

Change-Id: I68829fa8e49534d4635a008c94dced3c7ab6f4b1
Fixes: 27834471
Fixes: 27834626
Fixes: 27567838
Fixes: 27834676
This commit is contained in:
Jason Monk
2016-04-08 14:54:17 -04:00
parent 27fedfc2fa
commit c19eb986f3
10 changed files with 84 additions and 13 deletions

View File

@@ -27,7 +27,7 @@
android:orientation="vertical"
android:paddingStart="16dp"
android:background="?android:attr/colorAccent"
android:elevation="3dp"
android:elevation="2dp"
android:clickable="true">
<LinearLayout

View File

@@ -23,11 +23,6 @@
android:background="@color/card_background"
android:importantForAccessibility="noHideDescendants">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />
<TextView android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@@ -16,4 +16,4 @@
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="10dp" />
android:layout_height="6dp" />

View File

@@ -125,4 +125,6 @@
<color name="seek_bar_preference_preview_text">#fff</color>
<color name="usage_graph_dots">#B0BEC5</color>
</resources>

View File

@@ -34,7 +34,7 @@
android:enabled="false"
android:selectable="true" />
<PreferenceCategory
<com.android.settings.DividedCategory
android:key="recent_location_requests"
android:title="@string/location_category_recent_location_requests" />

View File

@@ -17,6 +17,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="manage_assist">
<com.android.settings.applications.DefaultAssistPreference
@@ -40,8 +41,9 @@
android:title="@string/voice_input_settings_title"
/>
<Preference
<com.android.settings.DividerPreference
android:summary="@string/assist_footer"
android:selectable="false"/>
android:selectable="false"
settings:allowDividerAbove="true" />
</PreferenceScreen>

View File

@@ -15,6 +15,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/wifi_configure_titlebar">
<Preference
@@ -40,10 +41,11 @@
android:summary="@string/wifi_automatically_connect_summary"
android:dialogTitle="@string/wifi_select_assistant_dialog_title" />
<Preference
<com.android.settings.DividerPreference
android:key="mac_address"
android:title="@string/wifi_advanced_mac_address_title"
android:layout="@layout/wifi_advance_layout" />
android:layout="@layout/wifi_advance_layout"
settings:allowDividerAbove="true" />
<Preference
android:key="current_ip_address"

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2016 The Android Open Source 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.
*/
package com.android.settings.dashboard;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.State;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import com.android.settings.R;
public class DashboardDecorator extends RecyclerView.ItemDecoration {
private final Context mContext;
private final Drawable mDivider;
public DashboardDecorator(Context context) {
mContext = context;
TypedValue value = new TypedValue();
mContext.getTheme().resolveAttribute(android.R.attr.listDivider, value, true);
mDivider = mContext.getDrawable(value.resourceId);
}
@Override
public void onDrawOver(Canvas c, RecyclerView parent, State state) {
final int childCount = parent.getChildCount();
final int width = parent.getWidth();
final int bottom = parent.getBottom();
for (int i = 1; i < childCount; i++) {
final View child = parent.getChildAt(i);
final ViewHolder holder = parent.getChildViewHolder(child);
if (holder.getItemViewType() == R.layout.dashboard_category) {
if (parent.getChildViewHolder(parent.getChildAt(i - 1)).getItemViewType()
!= R.layout.dashboard_tile) {
continue;
}
} else if (holder.getItemViewType() != R.layout.condition_card) {
continue;
}
int top = getChildTop(child);
mDivider.setBounds(0, top, width, top + mDivider.getIntrinsicHeight());
mDivider.draw(c);
}
}
private int getChildTop(View child) {
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
return child.getTop() + params.topMargin + Math.round(ViewCompat.getTranslationY(child));
}
}

View File

@@ -139,7 +139,7 @@ public class DashboardSummary extends InstrumentedFragment
}
mDashboard.setLayoutManager(mLayoutManager);
mDashboard.setHasFixedSize(true);
mDashboard.addItemDecoration(new DashboardDecorator(getContext()));
mAdapter = new DashboardAdapter(getContext());
mAdapter.setSuggestions(mSuggestionParser);
mDashboard.setAdapter(mAdapter);

View File

@@ -76,6 +76,7 @@ public class BatteryHistoryPreference extends Preference {
((TextView) view.findViewById(R.id.charge)).setText(mBatteryInfo.batteryPercentString);
((TextView) view.findViewById(R.id.estimation)).setText(mBatteryInfo.remainingLabel);
UsageView usageView = (UsageView) view.findViewById(R.id.battery_usage);
usageView.findViewById(R.id.label_group).setAlpha(.7f);
mBatteryInfo.bindHistory(usageView);
}
}