* Merge branch 'Fix718'
Merged fixes for issues #718, added functionality for all the file versioning types in the app UI.
* Basic theme is working
* GOt dialog working with setREsult.
* Addressed issues raised and fixed orientation change bug.
Adressed issues radied by nutomic:
- Changed the String concatenation so it uses String.format.
- Made members variables private that were not previously private by mistake.
- Changed name from FolderPathTextView to FolderPathTextViewFragment.
- Fixed typo in NumberPickerFragment
- Now uses TImeUnit for time conversion
- Changed from DialogFragment to a dialog themed Activity inorder to have correct themeing.
About the orientation change bug. When the dialog themed activity was open and the orientation was changed, it would cause the background activity(The FolderActivity) to
recreate itself. In the process of recreating itself it would reset the mFolder variable and then reinitialise it in the OnApiChange listener. However the result from the
Dialog was returned before the mFolder had been reinitialised and was still null, so inbetween the result being returned and the mFolder variable being reinitialised the new file versioning
configuration had to be stored and then applied to the mFolder variable in the onApiChange listener. The file versioning configuration is temporarily stored in the mVersioning variable which is
an instance of Folder.versioning.
This error only occurred when using an Activity as a dialog and using the startActivityForResult method for initialisling the activity. Before when using a dialogfragment and an interface to callback to
the parent activity, everything happend in the correct order.
* Fixed versioning dialog lag.
The initial updateFragmentView() is called in onCreate() and the
fragment is only updated when a new file versioning type is selected.
* Removed FolderPathTextViewFragment
The fragment is removed, and a helper method has been added to FolderPickerActivity to create an intent
to the the FolderPickerActivity for result.
* increased folder button size
* increased folder button size
* code formatting
* init
* added copy
* get name from content provider
* implemented file sharing, multiple sharing and display name getter
* putting everything in order
* cancel button added
* ignore existing files, translation, styling
* fixed file copy
* Updated UI, moved copy to background, fixed content:// copying
* Fixed possible crash when displayName == null
* Fixed lint issues, removed ru translations
* Fixed plural params
* Escaped quotes to display them in Toast
* Changed spinner design to material one
* Changed copy code, moved credits to code, fixed members naming
* Fallback to id if label is not set
* Added doc for some methods
* Removed try-catch as there are no exceptions here
* Removed try-catch as there are no exceptions here
* Fixed general exception type
* Removed ShareActivity from recents
* Moved style to appropriate place
* Small fixes for toString()
* Moved credits from comment to javadoc of the class
MainActivity: Moved binding-functions to onPause() and onResume() so that the SyncThingService is only bound to the activity if the activity is active.
New class AppConfigReceiver:
Support start and stop of the SyncThingService
- restarting a running service again should not be an issue
- stop service only if "always run in background"-mode is disabled. Otherwise show a notification indicating this.
Instrumentation-tests:
- Added tests for AppConfigReceiver
- Extended MockContext to also consume stopService commands.
- testGetReadableTransferRate: Apparently the return-values have changed a bit. Adjusted the asserts to the current return-values.
SycthingService:
Added code for thread-safety in case the service still starting when it should be stopped. Then PollWebGuiAvailableTaskImpl is active and waits for the Synthing-API to become active. So that and onDestroy have to be synchronized.
Added a stopSelf() in PollWebGuiAvailableTaskImpl.onPostExecute() in case mStopScheduled was active.
Commented my change in the javadoc at onDestroy. Put a reference to that comment to .onPostExecution()