+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical">
-
- <!-- Divider -->
- <ImageView
- android:id="@+id/divider"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:src="@drawable/nav_divider"
- android:contentDescription="@null"
- />
-
- <!-- Details button -->
- <ImageView
- android:id="@+id/deviceDetails"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:padding="8dip"
- android:background="?android:attr/selectableItemBackground"
- android:src="@drawable/ic_settings_accent"
- android:contentDescription="@string/wifi_display_details" />
-
-</LinearLayout>
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.TwoTargetPreference;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
}
};
- private class RoutePreference extends Preference
+ private class RoutePreference extends TwoTargetPreference
implements Preference.OnPreferenceClickListener {
private final MediaRouter.RouteInfo mRoute;
implements View.OnClickListener {
private final WifiDisplay mDisplay;
+ @Override
+ protected int getSecondTargetResId() {
+ return R.layout.preference_widget_gear;
+ }
+
public WifiDisplayRoutePreference(Context context, MediaRouter.RouteInfo route,
WifiDisplay display) {
super(context, route);
-
mDisplay = display;
- setWidgetLayoutResource(R.layout.wifi_display_preference);
}
@Override
- public void onBindViewHolder(PreferenceViewHolder view) {
- super.onBindViewHolder(view);
+ public void onBindViewHolder(PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
- ImageView deviceDetails = (ImageView) view.findViewById(R.id.deviceDetails);
- if (deviceDetails != null) {
- deviceDetails.setOnClickListener(this);
+ final ImageView gear = (ImageView) holder.findViewById(R.id.settings_button);
+ if (gear != null) {
+ gear.setOnClickListener(this);
if (!isEnabled()) {
TypedValue value = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.disabledAlpha,
value, true);
- deviceDetails.setImageAlpha((int) (value.getFloat() * 255));
- deviceDetails.setEnabled(true); // always allow button to be pressed
+ gear.setImageAlpha((int) (value.getFloat() * 255));
+ gear.setEnabled(true); // always allow button to be pressed
}
}
}