Samuel Holland
4fdb3458ec
ConfigEditFragment: Mark the persistent keepalive as optional
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:01:51 -05:00
Samuel Holland
cd868bc997
ConfigEditFragment: Add a field for the optional pre-shared key
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:01:19 -05:00
Samuel Holland
3d6109e6d9
Peer: Add a field for the optional pre-shared key
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:00:53 -05:00
Samuel Holland
881ad4fd47
ConfigActivity: Fix condition for inserting back stack entries
...
Fixes saved editor state on rotation (removing and recreating the editor
discarded changes).
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:47:12 -05:00
Samuel Holland
c0a76f87da
ConfigActivity: Save editor state across fragment instances
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:31:19 -05:00
Samuel Holland
e446870ac1
AddActivity: Update for ConfigEditFragment changes
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:31:19 -05:00
Samuel Holland
e2df9931ac
ConfigEditFragment: Save and restore editor state properly
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:31:16 -05:00
Samuel Holland
f83c84ce4e
ConfigActivity: Avoid unnecessary executePendingTransactions
...
Nothing later tries to find the list using findFragmentById().
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:22:49 -05:00
Samuel Holland
290c98a9e3
ConfigListFragment: Avoid unnecessary findViewById
...
The generated ViewDataBinding has fields for each view with an id.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:22:20 -05:00
Samuel Holland
632f3f73a2
ConfigActivity: Log state transitions
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:51:08 -05:00
Samuel Holland
b2357e58e3
Config/Interface/Peer: Make Parcelable
...
This allows saving the editor state across restarts.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:47:44 -05:00
Samuel Holland
95384851cd
Config/Interface/Peer: Fix some missed change notifications
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:43:58 -05:00
Samuel Holland
d1a5c1a72e
VpnService: Fix some edge cases in ConfigUpdater
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 18:04:45 -05:00
Samuel Holland
0e46f95668
Config/Interface: Allow copyFrom() to work on null
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 18:02:37 -05:00
Samuel Holland
d3e6b311ca
BaseConfigActivity: Remember editing state
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 18:02:16 -05:00
Samuel Holland
b1c1889c50
manifest: ConfigActivity is parent to AddActivity
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 17:57:43 -05:00
Samuel Holland
c1cdea42b6
Finish first pass of config editor fields
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 23:10:41 -05:00
Samuel Holland
3a264f7020
QuickTileService: Update the tile once on service init
...
This makes the tile show the correct info when it is first added.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 23:10:41 -05:00
Samuel Holland
353028420b
Add an adapter for binding an ObservableList to a LinearLayout
...
EditTexts do not work in ListViews.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 23:10:35 -05:00
Samuel Holland
fb919a7226
Use data binding to provide EditText input filters
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 21:48:42 -05:00
Samuel Holland
5d04714eea
ConfigAddActivity: Rename to AddActivity
...
Not everything needs to start with Config
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 01:27:29 -05:00
Samuel Holland
90cd59c866
ConfigActivity: Fix fragment state when leaving/entering app
...
Do this by making the fragment transition functions idempotent.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-21 21:25:31 -05:00
Samuel Holland
9026317b0e
Peer: Associate with a Config
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-19 18:50:35 -05:00
Samuel Holland
fbd923a060
Minor cleanups
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-19 18:48:07 -05:00
Samuel Holland
a49fe9adf5
ObservableAdapters: notify on map/list being set
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-18 23:25:40 -05:00
Samuel Holland
5b4e957122
MapAdapter: Stable IDs are based on value, not key
...
This fixes list selection to survive renaming configurations.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 08:22:19 -05:00
Samuel Holland
85fc5e7ebf
ConfigListFragment: Restore the non-FAB add menu
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 06:06:35 -05:00
Samuel Holland
416d3adda7
QuickTileService: Implement and update from VpnService
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 05:45:40 -05:00
Samuel Holland
d5d3566e6c
BaseConfigActivity: Make use of inner class's this
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 05:39:58 -05:00
Samuel Holland
27241d074e
VpnService: Use a string to remember the primary config
...
This allows simplifies the code a bit. Also, a few other minor changes.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 04:50:41 -05:00
Samuel Holland
c2189a78b9
ConfigEditFragment: Add extremely basic validation
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 03:32:01 -05:00
Samuel Holland
cb48a7be3a
Interface: Rework private key handling
...
This works much better with a data-bound UI -- no confusing erasing of
the text box, and no crashes, either!
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 03:30:06 -05:00
Samuel Holland
8bf12f3f55
VpnService: Remove extraneous call to super()
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:47:53 -05:00
Samuel Holland
44561a9cb6
ObservableArrayMapAdapter: Remove
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:44:18 -05:00
Samuel Holland
25412e0537
Convert to using the ObservableTreeMap and its adapter
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:43:15 -05:00
Samuel Holland
97149fff3f
ObservableMapAdapter: Based on an observable TreeMap
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:40:05 -05:00
Samuel Holland
5023c937ad
preferences: Control restoring enabled configs
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:37:11 -05:00
Samuel Holland
b753ae09ca
VpnService: Remember and optionally restore enabled configs
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:36:12 -05:00
Samuel Holland
08992185ec
SettingsActivity: Implement primary config setting
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:34:14 -05:00
Samuel Holland
e95b41e48b
ConfigListPreference: ListPreference for configs
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:29:55 -05:00
Samuel Holland
4ac1a2fafc
ConfigList: Denote the primary config with bold text
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:29:04 -05:00
Samuel Holland
a5e2c1c1b3
BindingAdapters: Create an adapter for textStyle
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:30:42 -05:00
Samuel Holland
eb43e49a95
VpnService: Remember and maintain the primary config
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:28:41 -05:00
Samuel Holland
8f0dcd0a32
Config: add an isPrimary property
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:26:45 -05:00
Samuel Holland
452641a0eb
Detail/Edit/ListFragment: Update the layouts
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 01:47:18 -05:00
Samuel Holland
645e263424
ConfigActivity: Inline PlaceholderFragment into the layout
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 01:43:15 -05:00
Samuel Holland
9e36e0d9c6
ConfigActivity: Make the two-pane layout more readable
...
Highlight the selected configuration, and add a border between the two
panes.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 01:38:46 -05:00
Samuel Holland
76eb65d7d5
Config: Make it Comparable
...
This will be used for future sorting.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 01:06:05 -05:00
Samuel Holland
6d2960b853
ConfigActivity: Adjust when the back arrow is shown
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 01:05:13 -05:00
Samuel Holland
73217a098a
ConfigListFragment: Implement config selection and removal
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 00:55:44 -05:00
Samuel Holland
f1d97a585a
Config: Rename function to make databinding happy
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 00:57:27 -05:00
Samuel Holland
b60536222d
VpnService: Tweaks for ConfigUpdater to fix adding
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 00:56:53 -05:00
Samuel Holland
c3203ce90a
ConfigDetailFragment: Move function to be in alphabetical order
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 00:47:58 -05:00
Samuel Holland
ebb0091ad4
ConfigActivity: Fix restoring layout on resume
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 00:46:43 -05:00
Samuel Holland
61d6b89bbe
ConfigAddActivity: Add an standalone config-creating activity
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-15 17:36:11 -05:00
Samuel Holland
e9de916d69
BaseConfigActivity: Set initial config when service available
...
This was accidentally missed earlier when adding the optimization to
omit binding the service when unnecessary.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-15 17:37:06 -05:00
Samuel Holland
7f864badb2
KeyInputFilter: Extract to its own class
...
It will be reused for entering public keys of peers.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-15 17:33:00 -05:00
Samuel Holland
2103a28f8f
ConfigActivity: Show the current config in the title
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-15 17:07:17 -05:00
Samuel Holland
cfcda8bd13
BaseConfigActivity: Move menu handling to ConfigActivity
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-15 16:08:38 -05:00
Samuel Holland
d91770a1b6
ConfigActivity: Show back arrow in single layout action bar
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-14 19:33:19 -05:00
Samuel Holland
6604be94eb
ListFragment: Don't assume the ListView is the root
...
It may share the layout with a FAB, and that requires a parent
ViewGroup.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-14 18:40:46 -05:00
Samuel Holland
e6a6605ff8
ConfigActivity: Fragments are hard; this un-breaks animations
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-14 18:32:14 -05:00
Samuel Holland
ab271e7153
ConfigActivity: Enable animations on fragment transitions
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-14 15:20:57 -05:00
Samuel Holland
83da2aa199
EditFragment: Input filters for config name and private key
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-14 13:53:58 -05:00
Samuel Holland
d5ede015cf
ConfigActivity: Avoid crash when started while locked
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-14 10:44:29 -05:00
Samuel Holland
5e55d196be
Major renaming and refactoring in activity and service
...
Apparently "configuration" is the proper term, not "profile".
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 07:24:03 -05:00
Samuel Holland
c72d30a1af
Profile: Add function to copy config from another profile
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 07:23:16 -05:00
Samuel Holland
f84d178e46
ProfileActivity: Remove unnecessary parameterization
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 06:22:31 -05:00
Samuel Holland
43500090b2
ProfileService: Rework handling of updates, again
...
Prefer updating an object instead of replacing it. This preserves the
selection in the UI list. Also make renaming atomic as it should be. Now
the only possibility for data loss is if the old file can be opened but
not written to.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 06:16:05 -05:00
Samuel Holland
dacd7457d2
ServiceClientFragment: Connect early if possible
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-10 01:11:00 -05:00
Samuel Holland
5fad89527d
ProfileList: Fix state tracking
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-10 01:10:15 -05:00
Samuel Holland
de53a1b50a
ProfileEdit: Finish writing code-behind
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-10 01:05:20 -05:00
Samuel Holland
87d3200b29
ProfileActivity: Do menus correctly
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-10 01:04:46 -05:00
Samuel Holland
d6d6f34088
ProfileFragment: Make good use of the cached profile
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-10 00:57:44 -05:00
Samuel Holland
d00480a3a5
Settings: Add empty activity
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 07:34:28 -05:00
Samuel Holland
af8e013e33
Hook up editing to the layout and menus
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 07:31:12 -05:00
Samuel Holland
c199827b58
ProfileEdit: Add empty activity/fragment
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 07:30:25 -05:00
Samuel Holland
671aae7489
ProfileActivity: Do not use onClick for menus
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 07:28:04 -05:00
Samuel Holland
7d2d9f0cb3
ProfileActivity: Also remember editing state
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 07:25:11 -05:00
Samuel Holland
2c4f605b66
ProfileFragment: Helper class to remember a fragment's profile
...
Caching the actual profile object is important when the fragment is on
an activity's back stack: when it is shown again, onCreateView will be
called with profile already set and the service already connected. In
this case, there is no later notification from which to bind the
profile, so the existing object needs to be bound there.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 07:18:31 -05:00
Samuel Holland
39ed03f758
ProfileList: Add the list fragment in code so it knows the layout
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 06:19:37 -05:00
Samuel Holland
52cdf3e7e5
ProfileActivity: Replace fragments instead of hiding
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 05:12:00 -05:00
Samuel Holland
2e3daa8913
ProfileActivity: Extract base class for fixing fragments
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 03:23:25 -05:00
Samuel Holland
529e320e3f
Interface: Correctly handle setting a null or empty key
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 02:51:54 -05:00
Samuel Holland
f0f9192aed
KeyEncoding: Clean up and reorganize to match style
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 02:51:08 -05:00
Samuel Holland
c3afe5be2c
Keypair: Convert to java-style array declarations
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 02:44:46 -05:00
Jason A. Donenfeld
f6b864d4e7
Constant time base64
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 18:22:41 +02:00
Samuel Holland
f8d8e5e23e
res: Add icons for quick settings tile
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:55:27 -05:00
Samuel Holland
99973a4b08
Profile: Add helper to check name validity
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:54:35 -05:00
Samuel Holland
c59b3e1230
Profile: Make name modifiable
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:54:12 -05:00
Samuel Holland
0685d4a159
ProfileActivity: Refactor into clean layers of functionality
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:51:38 -05:00
Samuel Holland
3076fd8c41
ProfileServiceInterface: Update for map-based collection
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 20:19:29 -05:00
Samuel Holland
01524c0dbf
ProfileService: Use a map to store profile data
...
This has no visible changes at the moment, but will allow most functions
to pass around strings instead of Profile objects, obviating the need to
implement serialization for them. It also trades some naive linear
searches for the binary search in SimpleArrayMap.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 19:55:11 -05:00
Samuel Holland
7d3e796842
ObservableArrayMapAdapter: Copy ObservableListAdapter
...
Since the conversion to a sequential list (to implement ListAdapter)
depends on the implementation detail that ObservableArrayMap is backed
by an array, we can't use the ObservableMap interface here.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 19:46:19 -05:00
Samuel Holland
2df899eae5
ProfileActivity: Add two-pane master-detail layout
...
This is designed for tablets, but for testing purposes, it is currently
enabled for all devices in landscape orientation.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 18:51:47 -05:00
Samuel Holland
2154306fcb
PlaceholderFragment: Simple fragment that shows a message
...
This is used for the detail pane when no profile is selected.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 18:48:46 -05:00
Samuel Holland
4c96e55b49
ProfileActivity: Make local variables final
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 18:43:52 -05:00
Samuel Holland
00a755f46f
ProfileActivityFragment: Fix service connection tracking
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 18:42:38 -05:00
Samuel Holland
372477d0e0
ProfileList: Load fragment programmatically
...
This is necessary to replace it with the profile detail fragment later.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07 16:55:02 -05:00
Samuel Holland
93e304ba2d
ProfileList: Extract service management into a base class
...
It will be shared with other fragments.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04 12:39:56 -05:00