Merge "Misc fixes"
This commit is contained in:
committed by
Android (Google) Code Review
commit
a8855922c9
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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;
|
||||
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class CopyablePreference extends Preference {
|
||||
|
||||
public CopyablePreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CopyablePreference(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
holder.setDividerAllowedAbove(true);
|
||||
holder.setDividerAllowedBelow(true);
|
||||
holder.itemView.setLongClickable(true);
|
||||
holder.itemView.setOnLongClickListener(new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
copyPreference(getContext(), CopyablePreference.this);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public CharSequence getCopyableText() {
|
||||
return getSummary();
|
||||
}
|
||||
|
||||
public static void copyPreference(Context context, CopyablePreference pref) {
|
||||
ClipboardManager cm =
|
||||
(ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setText(pref.getCopyableText());
|
||||
Toast.makeText(context, com.android.internal.R.string.text_copied, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
}
|
@@ -16,8 +16,11 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import android.app.*;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.INotificationManager;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.IntentSender;
|
||||
@@ -26,7 +29,12 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.*;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.service.notification.NotificationListenerService;
|
||||
import android.service.notification.NotificationListenerService.Ranking;
|
||||
import android.service.notification.NotificationListenerService.RankingMap;
|
||||
@@ -45,13 +53,15 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.CopyablePreference;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.Utils;
|
||||
|
||||
import java.lang.StringBuilder;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class NotificationStation extends SettingsPreferenceFragment {
|
||||
private static final String TAG = NotificationStation.class.getSimpleName();
|
||||
@@ -533,7 +543,7 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class HistoricalNotificationPreference extends CopyablePreference {
|
||||
private static class HistoricalNotificationPreference extends Preference {
|
||||
private final HistoricalNotificationInfo mInfo;
|
||||
|
||||
public HistoricalNotificationPreference(Context context, HistoricalNotificationInfo info) {
|
||||
@@ -573,14 +583,6 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
||||
row.itemView.setAlpha(mInfo.active ? 1.0f : 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getCopyableText() {
|
||||
return new SpannableStringBuilder(mInfo.title)
|
||||
.append(" [").append(new Date(mInfo.timestamp).toString())
|
||||
.append("]\n").append(mInfo.pkgname)
|
||||
.append("\n").append(mInfo.extra);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performClick() {
|
||||
// Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
|
||||
|
@@ -166,7 +166,7 @@ public final class SearchIndexableResources {
|
||||
R.drawable.ic_settings_notifications);
|
||||
addIndex(SystemDashboardFragment.class, NO_DATA_RES_ID, R.drawable.ic_settings_about);
|
||||
addIndex(StorageDashboardFragment.class, NO_DATA_RES_ID, R.drawable.ic_settings_storage);
|
||||
addIndex(ConnectedDeviceDashboardFragment.class, NO_DATA_RES_ID, R.drawable.ic_bt_laptop);
|
||||
addIndex(ConnectedDeviceDashboardFragment.class, NO_DATA_RES_ID, R.drawable.ic_devices_other);
|
||||
addIndex(EnterprisePrivacySettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_about);
|
||||
addIndex(PaymentSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_nfc_payment);
|
||||
addIndex(
|
||||
|
Reference in New Issue
Block a user