Sometimes the print button not enabled and an accessibility fix.
1. Sometimes the print button is not enabled after selecting a printer from the all printers activity. This was happening after a printer was selected, we had to do a layout due to changed print attributes (because of the new printer's capabilities), and the content did not change. In this case we did not call the updateUi function which enables the print button after layout is completed. 2. The accessibility code in the all printers activity was not checking whether accessibility is on and doing some unnecessary work - not sending events though but still. Further, the delayed runnable that was doing the accessibilty announcements was not removed when the activity was paused. bug:10983508 Change-Id: Ib263116a3e21e4c75a25aa051cecbd9194417319
This commit is contained in:
committed by
Svetoslav Ganov
parent
a18661d592
commit
ebec46847d
@@ -456,6 +456,7 @@ public class PrintJobConfigActivity extends Activity {
|
||||
// Then update the print jobs's pages as we will not do a write
|
||||
// and we usually update the pages in the write complete callback.
|
||||
updatePrintJobPages(mDocument.pages, mRequestedPages);
|
||||
mEditor.updateUi();
|
||||
if (mEditor.isDone()) {
|
||||
requestCreatePdfFileOrFinish();
|
||||
}
|
||||
|
||||
@@ -167,6 +167,14 @@ public final class SelectPrinterFragment extends ListFragment {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (mAnnounceFilterResult != null) {
|
||||
mAnnounceFilterResult.remove();
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView list, View view, int position, long id) {
|
||||
PrinterInfo printer = (PrinterInfo) list.getAdapter().getItem(position);
|
||||
@@ -266,11 +274,13 @@ public final class SelectPrinterFragment extends ListFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void announceSearchResult() {
|
||||
if (mAnnounceFilterResult == null) {
|
||||
mAnnounceFilterResult = new AnnounceFilterResult();
|
||||
private void announceSearchResultIfNeeded() {
|
||||
if (AccessibilityManager.getInstance(getActivity()).isEnabled()) {
|
||||
if (mAnnounceFilterResult == null) {
|
||||
mAnnounceFilterResult = new AnnounceFilterResult();
|
||||
}
|
||||
mAnnounceFilterResult.post();
|
||||
}
|
||||
mAnnounceFilterResult.post();
|
||||
}
|
||||
|
||||
public static class AddPrinterAlertDialogFragment extends DialogFragment {
|
||||
@@ -397,7 +407,7 @@ public final class SelectPrinterFragment extends ListFragment {
|
||||
resultCountChanged = (oldPrinterCount != mFilteredPrinters.size());
|
||||
}
|
||||
if (resultCountChanged) {
|
||||
announceSearchResult();
|
||||
announceSearchResultIfNeeded();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user