location of the user.
Commonly the users prints on a printer that this near the user current
location. Hence if possible we want to show the user printers that he
used before and that are close to him.
Hence store the location of the previous uses of a printer and prefer
printer that are close to the user.
Unfortunately getLastLocation might not report a usable location and it
will take at least 5 seconds until the first usable location arrives. At
this time the user might have already opened the destionation spinner.
It would be unexpected for the printers to suddenly change under the
users finger. Hence it might be that we did first show the printer
without any location information and then once the location is known we
cannot update thedestination spinner anymore.
The select printer activity does not have this issue, hence in the worst
case the user has to enter this activity to select a printer and by then
the location is usually determined.
This is not ideal but better than before.
Bug: 24133609
Change-Id: Ie7d20cf3d9dd163e57903f8f6ecc0b3fd4f4374e
- Stop using deprecated APIs
- Fix all public and some internal javadoc
- Add @Decorations to public APIs
- Some minor cleanup, e.g. don't use variables with overlapping names in same scope
- remove unnecessary properties from manifest (they are set by the build
system)
Change-Id: I0ce8849a516414763fe9de76c3a18ce17d896816
info-activities
The icon is loaded from the discovery session only when it is displayed
to avoid having to store too many icons in memory.
Also the icons are not maintained in the historical printers. Only if
the printers are available nice icons are shown. A historical printer is
updated with the appropriate properties (including icon) once it becomes
available.
Bug: 24135005
Change-Id: Iec389bab514b024634be8fb5fc8928371cba8740
The status has always been there in error cases, it is now also visible
in non-error cases.
If the progress is not set, no progress bar is shown.
Bug: 24135025
Change-Id: Iea23f45d236365433c6f6739597833d236ed6d19
This is a mechanical replacement of Context.getSystemService(String)
with Context.getSystemService(Class<T>) when retrieving
InputMethodManager. Note those are bundled code. Hence we don't need
to make sure Build.VERSION.SDK_INT >= 23.
Change-Id: Icc64942ad8f11e44bf84f8d4fe476b2fdd1257f3
services
If the SelectPrinterActivity is visible it shows different emptyState
depending on if there are print services available or not. Hence the
activity has to listen to changes to the list of enabled services.
This also fixes a small syncronsation problem if two observers are
registered for the enabled print services.
Bug: 25666802
Change-Id: I79af66f25f10e66347b48ce9bb99c1657b30a8dd
* changes:
Create PrintDiscoverySession for future print services
Update printer availability when printSpooler is paused. This makes the window update syncronously when in multi-window mode.
We are not saving the state of this fragment on onSaveState,
so its Okay to loose state while confirming the transaction.
bug:25847358
Change-Id: I2f6587d528b2d8b8f24a83954cc896a6ff514996
When the configration changes there are two modes to handle it:
1. do through a onDestroy - onCreate cycle
2. declare that your activity can handle certain changed and handle them
in onConfigurationChanges
For most apps (1) is zero effort to implement, hence it is the default
behavior. You only want to do (2) if recreating your activity is
expensive.
As recreating the printActivity is expensive (and currently even
impossible) we want to handle the configuration change gracefully. There
is no code to be added as handling portrait mode / landscape mode switch
is not different from an orientation switch.
Bug: 25727559
Change-Id: Iac5b854c9dd080a4432957bc4551162dc3d480e9
The Spinner does not support a prompt, hence temporarily hijack the
first element and install an alternate view. Once the Spinner is touched
revert to the old behavior.
If we showed a prompt the views in the spinner cannot be recycled.
Bug: 24132864
Change-Id: Iaf97878f85388a8c6351e716117b16f34919ad84
print services are enabled
The add printer icon is always visible as this is used for both adding
a printer and adding addition print services
We have three different empty views now:
1. No print services
2. No printers found (not search filter set)
3. No printers found (search filter set)
Bug: 24132367
Change-Id: Ic30812b60986f1e0f023488cefc6aa901ce20824
An app might suggest certain attribute for an print job. This patch
fixes
- PrintActivity should not silently overwrite the attributes with
the default values
- Handle duplex mode in PrintAttributes similar to the other attributes.
I.e. have an "unset" value (0). This is an API change. But the only
use case for PrintAttributes was to pass them to print() and thereby
the PrintActivity. This was broken (see above), hence we are changing
and API that could have never been used.
Bug: 23629618
Change-Id: I43c25704497c799352fb806126dc93f6db4879f5
we print using it the first time.
This warning used to be shown when the print settings app was used
to enable a service.
If two warning as shown for the same print service we automcatially
dismiss all dialogs once one dialog is confirmed. Please note that
we are not confirming the printjob as it is unexpeced to have a
single click to confirm multiple print jobs.
Change-Id: I8bb0a49bac2063c1c55e2f24bd34df2c44e2df89
Bug: 24135353
PrintActivity is recreated when the language setting is changed.
As a result of the recreation mCurrentPrinter is null, which causes
a NullPointerException when onActivityResult() is called.
The issue is solved with a simple null check.
Change-Id: Ic58f0ca01577d2ec02d494739f3bc2f06240dd44