am be74fb8d: am 43b8946f: am d9f156dd: Coalescing multiple print job notifications (Settings)

* commit 'be74fb8d729828642cce0514e1043c290e8ceea0':
  Coalescing multiple print job notifications (Settings)
This commit is contained in:
Svetoslav
2013-10-10 10:24:35 -07:00
committed by Android Git Automerger
4 changed files with 27 additions and 31 deletions

View File

@@ -1210,6 +1210,21 @@
android:resource="@id/print_settings" />
</activity>
<activity android:name="Settings$PrintJobSettingsActivity"
android:label="@string/print_print_job"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings$PrintSettingsActivity">
<intent-filter>
<action android:name="android.settings.ACTION_PRINT_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="printjob" android:pathPattern="*" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.print.PrintJobSettingsFragment" />
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
android:resource="@id/print_settings" />
</activity>
<!-- Keep compatibility with old shortcuts. -->
<activity-alias android:name="DevelopmentSettings"
android:exported="true"

View File

@@ -81,6 +81,7 @@ import com.android.settings.inputmethod.UserDictionaryList;
import com.android.settings.location.LocationSettings;
import com.android.settings.nfc.AndroidBeam;
import com.android.settings.nfc.PaymentSettings;
import com.android.settings.print.PrintJobSettingsFragment;
import com.android.settings.print.PrintServiceSettingsFragment;
import com.android.settings.print.PrintSettingsFragment;
import com.android.settings.tts.TextToSpeechSettings;
@@ -350,6 +351,7 @@ public class Settings extends PreferenceActivity
NotificationAccessSettings.class.getName(),
ManageAccountsSettings.class.getName(),
PrintSettingsFragment.class.getName(),
PrintJobSettingsFragment.class.getName(),
TrustedCredentialsSettings.class.getName(),
PaymentSettings.class.getName(),
KeyboardLayoutPickerFragment.class.getName()
@@ -1114,4 +1116,5 @@ public class Settings extends PreferenceActivity
public static class TrustedCredentialsSettingsActivity extends Settings { /* empty */ }
public static class PaymentSettingsActivity extends Settings { /* empty */ }
public static class PrintSettingsActivity extends Settings { /* empty */ }
public static class PrintJobSettingsActivity extends Settings { /* empty */ }
}

View File

@@ -19,6 +19,7 @@ package com.android.settings.print;
import android.app.ActivityManager;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.print.PrintJob;
@@ -45,6 +46,8 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
private static final int MENU_ITEM_ID_CANCEL = 1;
private static final int MENU_ITEM_ID_RESTART = 2;
private static final String EXTRA_PRINT_JOB_ID = "EXTRA_PRINT_JOB_ID";
private static final String PRINT_JOB_PREFERENCE = "print_job_preference";
private static final String PRINT_JOB_MESSAGE_PREFERENCE = "print_job_message_preference";
@@ -53,7 +56,7 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
private final PrintJobStateChangeListener mPrintJobStateChangeListener =
new PrintJobStateChangeListener() {
@Override
public void onPrintJobsStateChanged(PrintJobId printJobId) {
public void onPrintJobStateChanged(PrintJobId printJobId) {
updateUi();
}
};
@@ -141,8 +144,8 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
}
private void processArguments() {
mPrintJobId = (PrintJobId) getArguments().getParcelable(
PrintSettingsFragment.EXTRA_PRINT_JOB_ID);
String printJobId = getArguments().getString(EXTRA_PRINT_JOB_ID);
mPrintJobId = PrintJobId.unflattenFromString(printJobId);
if (mPrintJobId == null) {
finish();
}

View File

@@ -112,8 +112,6 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
private PrintJobsController mPrintJobsController;
private String mPrintJobPreferenceToActivate;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -268,19 +266,6 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
if (prereference != null) {
prereference.performClick(getPreferenceScreen());
}
} else {
String printJobId = getArguments().getString(EXTRA_PRINT_JOB_ID);
if (printJobId != null) {
getArguments().remove(EXTRA_PRINT_JOB_ID);
Preference preference = findPreference(printJobId);
if (preference != null) {
preference.performClick(getPreferenceScreen());
} else {
// The preference not being present may mean the the print job
// loader has not completed so make a note and wait for the load.
mPrintJobPreferenceToActivate = printJobId;
}
}
}
}
@@ -427,20 +412,10 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
}
Bundle extras = preference.getExtras();
extras.putParcelable(EXTRA_PRINT_JOB_ID, printJob.getId());
extras.putString(EXTRA_PRINT_JOB_ID, printJob.getId().flattenToString());
mActivePrintJobsCategory.addPreference(preference);
}
// If were waiting for creating a preference for a print
// job so we can start it - do that.
if (mPrintJobPreferenceToActivate != null) {
Preference preference = findPreference(mPrintJobPreferenceToActivate);
mPrintJobPreferenceToActivate = null;
if (preference != null) {
preference.performClick(getPreferenceScreen());
}
}
}
}
@@ -454,7 +429,7 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
private static final String LOG_TAG = "PrintJobsLoader";
private static final boolean DEBUG = true;
private static final boolean DEBUG = false;
private List <PrintJobInfo> mPrintJobs = new ArrayList<PrintJobInfo>();
@@ -489,7 +464,7 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
if (mPrintJobStateChangeListener == null) {
mPrintJobStateChangeListener = new PrintJobStateChangeListener() {
@Override
public void onPrintJobsStateChanged(PrintJobId printJobId) {
public void onPrintJobStateChanged(PrintJobId printJobId) {
onForceLoad();
}
};