improved, but still rudimentary, hotspot handling in swap
My previous merge request fdroid/fdroidclient!78 was based on one broken assumption: `WIFI_STATE_UNKNOWN` means that the hotspot is active. Apparently, that's not always the case. Also, sometimes when the hotspot is active, its `WIFI_STATE_DISABLED`. Even worse, there is no broadcast message sent on final config of the hotspot. There is only a `WIFI_STATE_DISABLING` from turning off the wifi, but then never a broadcast for `WIFI_STATE_UNKNOWN` and/or `WIFI_STATE_DISABLED`. But I found some tricks that seem to work for now. We'll need to use your library, @mvdan, to really get good support of hotspots.
This also includes some basic UI tweaks to represent the hotspot mode in the swap wifi screen.
See merge request !79
Removes trailing slashes from URLs, replaces multiple consecutive forward
slashes in the path with a single slash. Canonicalizes the URL.
If the URL is invalid, display a message to the user and don't let it get
added.
NOTE: This does *not* normalize existing URLs in the database.
Previously it would only compare the details of a new repo to existing
ones if the new repo came via an intent. Now it does it whenever you
change the text in the new repo dialog (shouldn't be too much of a
performance hit, it isn't doing very much).
The things it (still) doesn't do is:
* verify that the url looks like a url
* sanitize the newly input uri and compare it to sanitized saved repos
The second point means that you can end up with:
http://10.0.1.50/ and
http://10.0.1.50
both in the list. I'm going to log an issue for this, because it should
be fixed, but doesn't need to hold this up.
This is really just a placeholder, there is lots of work to be done here.
Really, this screen should have the SSID of the hotspot, but we need to use
a private API to get that. Coming soon...
The icon is free software from:
https://commons.wikimedia.org/wiki/File:Wifi.svg
There was some confusion about the "SD Card" portion of the string.
Sometimes it will not store on the SD card, e.g. if the SD card is
not mounted, or inaccessible to F-Droid.
Change some "defaultValue"s
Key "theme": I also use the dark version of F-Droid but I think the most users would prefer the light version. This is also standard in the
most used apps on Android, I think, see GApps, Flym, K-9, Telegram, ...
Key "localRepoBonjour": I never used this function and I think it's better, if the user manually activates it when he wants to use it.
Key "localRepoHttps": I see no reason why it should not use https over http, it's better of security view, I think.
Key "cacheDownloaded": The most smartphones today have enough storage available to allow to enable this function. This would decrease the
traffic on both sides, as the user does not have to download a app and the F-Droid server does not have to send it multiple
times.
This is somehow related to #221, I think.
See merge request !67
Use custom code rather than "Locale.forLanguageTag" (which is android-21
specific). Also fixed the actual setting of the language, by modifying
the code in FDroidApp to respect the country code (rather than just the
language code).
Android's lint will give warnings for all strings that are not translatable
or translated. Some strings like repo name/description and language codes
should never be translated. Here's how to officially mark as "do not
translate":
* for individual strings, include: translatable="false"
* for the entire file, name it: donottranslate.xml
http://tools.android.com/recent/non-translatablestringshttps://code.google.com/p/android/issues/detail?id=75163
Key "theme": I also use the dark version of F-Droid but I think the most users would prefer the light version. This is also standard in the
most used apps on Android, I think, see GApps, Flym, K-9, Telegram, ...
Key "localRepoBonjour": I never used this function and I think it's better, if the user manually activates it when he wants to use it.
Key "localRepoHttps": I see no reason why it should not use https over http, it's better of security view, I think.
Key "cacheDownloaded": The most smartphones today have enough storage available to allow to enable this function. This would decrease the
traffic on both sides, as the user does not have to download a app and the F-Droid server does not have to send it multiple
times.
Also changed the way locales are loaded. Now it deals well with language
codes that are followed by country codes (e.g. "en-US" rather than just
"en").
Change client language from the app options (#155)
Bug: ActionBar Language does not change.
Edit: To make it more clear, you have to restart the app manually for the action bar language to be changed.
See merge request !65
It does this by sending a HTTP POST request to /request-swap on the
swap server. That listens for a POST to this path, and responds by
popping open a confirmation message to the user on the server device.
For some reasono specify different layout-v* directories to inflate
views based on the android version is not working as desired.
Previously there was a "layout", "layout-land" and "layout-v11" dir.
Only "layout" and "layout-v11" had the "select_local_apps_list_item.xml"
layout in them, the "layout-v11" version did _not_ have a checkbox,
whereas the other vanilla one did.
This worked on a android-16 emulator. It would correctly pick up the
view from "layout-v11". However, on a android-19 device, android-19
emulator, android-21 device and android-21 emulator, they all picked
up the view from the "layout" dir - with checkbox and all.
I couldn't figure out for the life of my why this was happening, so
I started to figure out which one it _would_ work with. I added
a layout-v* for every single version, and in each, put a text view
telling me which version it was. That way, viewing the list of apps to
swap, the list would inflate a view, and tell me which layout-v* dir it
inflated it from. It worked for layout-v17 and higher, but was unable
to inflate layouts from layout-v11 to layout-v16. So I deleted all
except layout-v17, and it now works for android-16, 19 and 21 as per my
tests.
* Provide CheckBox for selected items
Newer API's highlight the background using the "activated" state. Older
APIs need this to be implemented differently, so there are now checkboxes
on the left of the list view items to provide this functionality.
* Clean up IDE warnings
Diamond operator for generics, remove unused imports and unused method.
* Adapter class created for installed apps
Cleaned up the code to do with binding views to the adapter in this view.
Previously it made quite a few assumptions about the structure of the layout,
e.g. "layout.getParent().getParent() is a LinearLayout", which would cause
crashes if the layout changed slightly.
* Cleaned up text alignment styles for API < 17.
API v17 has a textAlignment style, wherease previous verisons rely on
the "gravity" property. This change includes gravity="center" where there
was previously only textAlignment="center".
* Fragments get added properly on 2.3 device.
For some reason, when adding the fragment to android.R.id.content, it
wouldn't work on my 2.3 device. This change includes a (almost) empty
activity layout with a single FrameLayout. The fragments are added to
this rather than "content", and it works better. It is not perfect - it
still adds the fargments behind the action bar, and so the action bar
appears blue. But at least they are there :)
* Added translatable strings where constants were used before.
Not related to v2.3 support, but stil important for a stable release,
that is fully translated.
This was present in the old local repo implementation, and the skeleton
code for implementing it was copied to the swap fragment. The only change
neccesary was to add a search button to the menu and make it have a
SearchView as its action view.
Shows an expandable notification on devices that support it (4.1+
I believe). The support library does most of the job of handling
incompatibilities between platforms.
Previously, a few people have been confused by an empty list when they first
open F-Droid (e.g. if they are not connected to the internet, and repos didn't
update). This provides some feedback so that there is never a blank screen.
Fixes Issue #34.