diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-20 18:20:05 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-22 12:36:39 +0200 |
commit | d486768d6b0664d9032605897c8f1847ef4e3a39 (patch) | |
tree | ff82a890fa6477d3c70d70ef33b8044c88fa53ff /app/src/main/java/se/leap/bitmaskclient/LogWindowWrapper.java | |
parent | 8862197a0a138f942e9c76a29aaf189f4c5141b4 (diff) |
Remove textual status.
I had a difficult moment trying to detect if the LogWindow had already
been shown after an error. Finally, I implemented a LogWindowWrapper
which contains a field for the reason it was shown, so that we can check
if the previous error is the same than the current one leading to the
avoidance of the second LogWindow. For this to work, we need to reset
that reason each time we trigger a new vpn state (i.e. each time the
user taps on the vpn icon).
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/LogWindowWrapper.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/LogWindowWrapper.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/LogWindowWrapper.java b/app/src/main/java/se/leap/bitmaskclient/LogWindowWrapper.java new file mode 100644 index 00000000..441eb28e --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/LogWindowWrapper.java @@ -0,0 +1,41 @@ +package se.leap.bitmaskclient; + +import android.content.*; + +import de.blinkt.openvpn.activities.*; + +public class LogWindowWrapper { + private static LogWindowWrapper instance; + + private static String TAG = LogWindowWrapper.class.getName(); + private Context context; + private String reason = ""; + + public LogWindowWrapper(Context context) { + this.context = context; + } + + public void showLog() { + Intent startLW = new Intent(context, LogWindow.class); + startLW.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(startLW); + } + + public static LogWindowWrapper getInstance(Context context) { + if(instance == null) + instance = new LogWindowWrapper(context); + return instance; + } + + public void clearReason() { + reason = ""; + } + + public void showedBecauseOf(String reason) { + this.reason = reason; + } + + public String reason() { + return reason; + } +} |