Loading packages/PrintSpooler/res/layout/select_printer_activity.xml +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ </ImageView> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" Loading @@ -56,6 +57,7 @@ </TextView> <ProgressBar android:id="@+id/progress_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:indeterminate="true" Loading packages/PrintSpooler/res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -83,9 +83,12 @@ <!-- Title for the alert dialog for selecting a print service. [CHAR LIMIT=50] --> <string name="choose_print_service">Choose print service</string> <!-- Title for the prompt shown as a placeholder if no printers are found while searching. [CHAR LIMIT=50] --> <!-- Title for the prompt shown as a placeholder if no printers are found while not searching. [CHAR LIMIT=50] --> <string name="print_searching_for_printers">Searching for printers</string> <!-- Title for the prompt shown as a placeholder if there are no printers while searching. [CHAR LIMIT=50] --> <string name="print_no_printers">No printers found</string> <!-- Notifications --> <!-- Template for the notificaiton label for a printing print job. [CHAR LIMIT=25] --> Loading packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java +34 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.database.DataSetObserver; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; Loading Loading @@ -94,7 +95,21 @@ public final class SelectPrinterFragment extends ListFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setListAdapter(new DestinationAdapter()); final DestinationAdapter adapter = new DestinationAdapter(); adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { if (adapter.getCount() <= 0) { updateEmptyView(adapter); } } @Override public void onInvalidated() { updateEmptyView(adapter); } }); setListAdapter(adapter); View emptyView = getActivity().findViewById(R.id.empty_print_state); getListView().setEmptyView(emptyView); } Loading Loading @@ -214,6 +229,18 @@ public final class SelectPrinterFragment extends ListFragment { transaction.commit(); } public void updateEmptyView(DestinationAdapter adapter) { TextView titleView = (TextView) getActivity().findViewById(R.id.title); View progressBar = getActivity().findViewById(R.id.progress_bar); if (adapter.getUnfilteredCount() <= 0) { titleView.setText(R.string.print_searching_for_printers); progressBar.setVisibility(View.VISIBLE); } else { titleView.setText(R.string.print_no_printers); progressBar.setVisibility(View.GONE); } } public static class AddPrinterAlertDialogFragment extends DialogFragment { private String mAddPrintServiceItem; Loading Loading @@ -339,6 +366,12 @@ public final class SelectPrinterFragment extends ListFragment { }; } public int getUnfilteredCount() { synchronized (mLock) { return mPrinters.size(); } } @Override public int getCount() { synchronized (mLock) { Loading Loading
packages/PrintSpooler/res/layout/select_printer_activity.xml +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ </ImageView> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" Loading @@ -56,6 +57,7 @@ </TextView> <ProgressBar android:id="@+id/progress_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:indeterminate="true" Loading
packages/PrintSpooler/res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -83,9 +83,12 @@ <!-- Title for the alert dialog for selecting a print service. [CHAR LIMIT=50] --> <string name="choose_print_service">Choose print service</string> <!-- Title for the prompt shown as a placeholder if no printers are found while searching. [CHAR LIMIT=50] --> <!-- Title for the prompt shown as a placeholder if no printers are found while not searching. [CHAR LIMIT=50] --> <string name="print_searching_for_printers">Searching for printers</string> <!-- Title for the prompt shown as a placeholder if there are no printers while searching. [CHAR LIMIT=50] --> <string name="print_no_printers">No printers found</string> <!-- Notifications --> <!-- Template for the notificaiton label for a printing print job. [CHAR LIMIT=25] --> Loading
packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java +34 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.database.DataSetObserver; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; Loading Loading @@ -94,7 +95,21 @@ public final class SelectPrinterFragment extends ListFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setListAdapter(new DestinationAdapter()); final DestinationAdapter adapter = new DestinationAdapter(); adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { if (adapter.getCount() <= 0) { updateEmptyView(adapter); } } @Override public void onInvalidated() { updateEmptyView(adapter); } }); setListAdapter(adapter); View emptyView = getActivity().findViewById(R.id.empty_print_state); getListView().setEmptyView(emptyView); } Loading Loading @@ -214,6 +229,18 @@ public final class SelectPrinterFragment extends ListFragment { transaction.commit(); } public void updateEmptyView(DestinationAdapter adapter) { TextView titleView = (TextView) getActivity().findViewById(R.id.title); View progressBar = getActivity().findViewById(R.id.progress_bar); if (adapter.getUnfilteredCount() <= 0) { titleView.setText(R.string.print_searching_for_printers); progressBar.setVisibility(View.VISIBLE); } else { titleView.setText(R.string.print_no_printers); progressBar.setVisibility(View.GONE); } } public static class AddPrinterAlertDialogFragment extends DialogFragment { private String mAddPrintServiceItem; Loading Loading @@ -339,6 +366,12 @@ public final class SelectPrinterFragment extends ListFragment { }; } public int getUnfilteredCount() { synchronized (mLock) { return mPrinters.size(); } } @Override public int getCount() { synchronized (mLock) { Loading