Merge "Print UI tweaks as per UX request." into klp-dev
This commit is contained in:
@@ -38,25 +38,30 @@
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dip"
|
||||
android:src="@*android:drawable/ic_grayedout_printer"
|
||||
android:contentDescription="@string/print_no_printers_found">
|
||||
android:contentDescription="@string/print_searching_for_printers">
|
||||
</ImageView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:text="@string/print_no_printers_found">
|
||||
android:text="@string/print_searching_for_printers">
|
||||
</TextView>
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
style="@android:style/Widget.Holo.ProgressBar.Horizontal">
|
||||
</ProgressBar>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<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] -->
|
||||
<string name="print_no_printers_found">No printers found</string>
|
||||
<string name="print_searching_for_printers">Searching for printers</string>
|
||||
|
||||
<!-- Notifications -->
|
||||
|
||||
|
||||
@@ -1613,7 +1613,6 @@ public class PrintJobConfigActivity extends Activity {
|
||||
mCopiesEditText = (EditText) findViewById(R.id.copies_edittext);
|
||||
mCopiesEditText.setText(MIN_COPIES_STRING);
|
||||
mCopiesEditText.addTextChangedListener(mCopiesTextWatcher);
|
||||
mCopiesEditText.selectAll();
|
||||
if (!TextUtils.equals(mCopiesEditText.getText(), MIN_COPIES_STRING)) {
|
||||
mIgnoreNextCopiesChange = true;
|
||||
}
|
||||
@@ -1622,6 +1621,7 @@ public class PrintJobConfigActivity extends Activity {
|
||||
|
||||
// Destination.
|
||||
mDestinationSpinner = (Spinner) findViewById(R.id.destination_spinner);
|
||||
mDestinationSpinner.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
mDestinationSpinner.setAdapter(mDestinationSpinnerAdapter);
|
||||
mDestinationSpinner.setOnItemSelectedListener(mOnItemSelectedListener);
|
||||
if (mDestinationSpinnerAdapter.getCount() > 0 && mController.hasStarted()) {
|
||||
@@ -1954,7 +1954,6 @@ public class PrintJobConfigActivity extends Activity {
|
||||
&& TextUtils.isEmpty(mCopiesEditText.getText())) {
|
||||
mIgnoreNextCopiesChange = true;
|
||||
mCopiesEditText.setText(String.valueOf(MIN_COPIES));
|
||||
mCopiesEditText.selectAll();
|
||||
mCopiesEditText.requestFocus();
|
||||
}
|
||||
|
||||
@@ -2151,6 +2150,8 @@ public class PrintJobConfigActivity extends Activity {
|
||||
R.layout.printer_dropdown_item, parent, false);
|
||||
}
|
||||
|
||||
convertView.getLayoutParams().width = mDestinationSpinner.getWidth();
|
||||
|
||||
CharSequence title = null;
|
||||
CharSequence subtitle = null;
|
||||
Drawable icon = null;
|
||||
|
||||
@@ -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.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.print.PrintManager;
|
||||
@@ -53,6 +54,7 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.TextView;
|
||||
@@ -357,11 +359,12 @@ public final class SelectPrinterFragment extends ListFragment {
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = getActivity().getLayoutInflater().inflate(
|
||||
R.layout.spinner_dropdown_item, parent, false);
|
||||
R.layout.printer_dropdown_item, parent, false);
|
||||
}
|
||||
|
||||
CharSequence title = null;
|
||||
CharSequence subtitle = null;
|
||||
Drawable icon = null;
|
||||
|
||||
PrinterInfo printer = (PrinterInfo) getItem(position);
|
||||
title = printer.getName();
|
||||
@@ -370,6 +373,7 @@ public final class SelectPrinterFragment extends ListFragment {
|
||||
PackageInfo packageInfo = pm.getPackageInfo(printer.getId()
|
||||
.getServiceName().getPackageName(), 0);
|
||||
subtitle = packageInfo.applicationInfo.loadLabel(pm);
|
||||
icon = packageInfo.applicationInfo.loadIcon(pm);
|
||||
} catch (NameNotFoundException nnfe) {
|
||||
/* ignore */
|
||||
}
|
||||
@@ -386,6 +390,15 @@ public final class SelectPrinterFragment extends ListFragment {
|
||||
subtitleView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
ImageView iconView = (ImageView) convertView.findViewById(R.id.icon);
|
||||
if (icon != null) {
|
||||
iconView.setImageDrawable(icon);
|
||||
iconView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iconView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user