When unselecting items, the toolbar briefly says
'0 items selected' before it reverts back to the
non-action mode toolbar which feels janky at best.
To mitigate this, just set a blank title to the action
mode toolbar when item count is 0, to facilitate the
smoothness of the transition to non-action mode toolbar.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
I know we decided to ditch the idea of shutting up "Exception
thrown with empty param" warnings but this pesters me too
much and we can instead just treat this as a weird future proofing
thing if and when we end up needing the exception messages.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
In AppCompat based preferences, this#getContext returns an
object of android.view.ContextThemeWrapper class from where
we can safely extract a reference to our parent activity.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This is an activity, so it does not join the fragment backstack, but
instead piles on top
SettingsActivity
| -> MainActivity
| -> EditorFragment
| -> DetailFragment
| -> ListFragment
Without overriding the back button in the toolbar, it simply
kills the entire state on MainActivity and causes it to reload.
By calling finish() on the activity when home is pressed from the
item menu we can silently make it die without affecting any underlying
states held by MainActivity and instead return to the exact fragment
we launched settings from.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
AppCompat is the preferred way to go for any app targetting
a wider range of SDKs.
Replace all activities and fragments with their AppCompat
variants and fixup method calls to use support variants.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This is insane, but it appears to be working. We essentially store
things in a separate class for editing, and then commit it back at a
given time.
This business with onViewStateRestored in both TunnelEditorFragment and
in TunnelDetailFragment is buggy and likely wrong.
In general TunnelEditorFragment should probably be rewritten. The
relationship with the changed name is not clear.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This synchronizes the OS's connection state with ours, such as when the
user disconnects using the system UI.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This sucks, but it works with mobile networks. Later we can do something
sophisticated like we do with wg-quick.c, but not now.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Since the amount of mind numbing boiler plate has been increased, this
must be the proper way to do things.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>