diff --git a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/HelperToxNotification.java b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/HelperToxNotification.java
index 3cc9f40a8..2214b7c76 100644
--- a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/HelperToxNotification.java
+++ b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/HelperToxNotification.java
@@ -36,8 +36,10 @@
import static com.zoffcc.applications.trifa.MainActivity.context_s;
import static com.zoffcc.applications.trifa.MainActivity.nmn3;
import static com.zoffcc.applications.trifa.MainActivity.notification_view;
+import static com.zoffcc.applications.trifa.TRIFAGlobals.CONNECTION_STATUS_MANUAL_LOGOUT;
import static com.zoffcc.applications.trifa.TRIFAGlobals.TOX_SERVICE_NOTIFICATION_TEXT_COLOR;
import static com.zoffcc.applications.trifa.TRIFAGlobals.bootstrapping;
+import static com.zoffcc.applications.trifa.TrifaToxService.manually_logged_out;
public class HelperToxNotification
{
@@ -190,158 +192,189 @@ static void tox_notification_change(Context c, NotificationManager nmn2, int a_T
}
PendingIntent pendingIntent = PendingIntent.getActivity(c, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);
- if (bootstrapping)
+ if ((manually_logged_out) || (a_TOXCONNECTION == CONNECTION_STATUS_MANUAL_LOGOUT))
{
- Log.i(TrifaToxService.TAG, "change_notification_fg:bootstrapping=true");
- notification_view.setImageViewResource(R.id.image, R.drawable.circle_orange);
+ // HINT: manually logged out
+ notification_view.setImageViewResource(R.id.image, R.drawable.circle_red);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setSmallIcon(R.drawable.circle_orange_notification);
+ b_new.setSmallIcon(R.drawable.circle_manuallyoffline_notification);
}
else
{
- b.setSmallIcon(R.drawable.circle_orange_notification);
+ b.setSmallIcon(R.drawable.circle_manuallyoffline_notification);
}
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setColor(Color.parseColor("#ffce00"));
+ b_new.setColor(Color.parseColor("#ff0000"));
}
else
{
- b.setColor(Color.parseColor("#ffce00"));
+ b.setColor(Color.parseColor("#ff0000"));
}
}
- if (PREF__orbot_enabled)
- {
- notification_view.setTextViewText(R.id.title, "Tox Service: " + "Bootstrapping [Tor Proxy]" + " " + message);
- }
- else
- {
- notification_view.setTextViewText(R.id.title, "Tox Service: " + "Bootstrapping" + " " + message);
- }
+ notification_view.setTextViewText(R.id.title, "Tox Service: " + "OFFLINE manually");
}
else
{
- Log.i(TrifaToxService.TAG, "change_notification_fg:bootstrapping=FALSE");
-
- if (a_TOXCONNECTION == 0)
+ if (bootstrapping)
{
- notification_view.setImageViewResource(R.id.image, R.drawable.circle_red);
+ Log.i(TrifaToxService.TAG, "change_notification_fg:bootstrapping=true");
+ notification_view.setImageViewResource(R.id.image, R.drawable.circle_orange);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setSmallIcon(R.drawable.circle_red_notification);
+ b_new.setSmallIcon(R.drawable.circle_orange_notification);
}
else
{
- b.setSmallIcon(R.drawable.circle_red_notification);
+ b.setSmallIcon(R.drawable.circle_orange_notification);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setColor(Color.parseColor("#ff0000"));
+ b_new.setColor(Color.parseColor("#ffce00"));
}
else
{
- b.setColor(Color.parseColor("#ff0000"));
+ b.setColor(Color.parseColor("#ffce00"));
}
}
if (PREF__orbot_enabled)
{
notification_view.setTextViewText(R.id.title,
- "Tox Service: " + "OFFLINE [Tor Proxy]" + " " + message);
+ "Tox Service: " + "Bootstrapping [Tor Proxy]" + " " + message);
}
else
{
- notification_view.setTextViewText(R.id.title,
- "Tox Service: " + "OFFLINE" + " " + message);
+ notification_view.setTextViewText(R.id.title, "Tox Service: " + "Bootstrapping" + " " + message);
}
}
else
{
- if (PREF__orbot_enabled)
+ Log.i(TrifaToxService.TAG, "change_notification_fg:bootstrapping=FALSE");
+ if (a_TOXCONNECTION == 0)
{
- notification_view.setImageViewResource(R.id.image, R.drawable.circle_torproxy);
+ notification_view.setImageViewResource(R.id.image, R.drawable.circle_red);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setSmallIcon(R.drawable.circle_torproxy_notification);
+ b_new.setSmallIcon(R.drawable.circle_red_notification);
}
else
{
- b.setSmallIcon(R.drawable.circle_torproxy_notification);
+ b.setSmallIcon(R.drawable.circle_red_notification);
}
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setColor(Color.parseColor("#7c16ae"));
+ b_new.setColor(Color.parseColor("#ff0000"));
}
else
{
- b.setColor(Color.parseColor("#7c16ae"));
+ b.setColor(Color.parseColor("#ff0000"));
}
}
- notification_view.setTextViewText(R.id.title, "Tox Service: " + "ONLINE [Tor Proxy]" + " " + message);
+ if (PREF__orbot_enabled)
+ {
+ notification_view.setTextViewText(R.id.title,
+ "Tox Service: " + "OFFLINE [Tor Proxy]" + " " + message);
+ }
+ else
+ {
+ notification_view.setTextViewText(R.id.title, "Tox Service: " + "OFFLINE" + " " + message);
+ }
}
else
{
- if (a_TOXCONNECTION == 1)
+ if (PREF__orbot_enabled)
{
- notification_view.setImageViewResource(R.id.image, R.drawable.circle_green);
+ notification_view.setImageViewResource(R.id.image, R.drawable.circle_torproxy);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setSmallIcon(R.drawable.circle_green_notification);
+ b_new.setSmallIcon(R.drawable.circle_torproxy_notification);
}
else
{
- b.setSmallIcon(R.drawable.circle_green_notification);
+ b.setSmallIcon(R.drawable.circle_torproxy_notification);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setColor(Color.parseColor("#04b431"));
+ b_new.setColor(Color.parseColor("#7c16ae"));
}
else
{
- b.setColor(Color.parseColor("#04b431"));
+ b.setColor(Color.parseColor("#7c16ae"));
}
}
- notification_view.setTextViewText(R.id.title, "Tox Service: " + "ONLINE [TCP]" + " " + message);
- // get_network_connections();
+ notification_view.setTextViewText(R.id.title,
+ "Tox Service: " + "ONLINE [Tor Proxy]" + " " + message);
}
- else // if (a_TOXCONNECTION__f == 2)
+ else
{
- notification_view.setImageViewResource(R.id.image, R.drawable.circle_green);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
- {
- b_new.setSmallIcon(R.drawable.circle_green_notification);
- }
- else
+ if (a_TOXCONNECTION == 1)
{
- b.setSmallIcon(R.drawable.circle_green_notification);
+ notification_view.setImageViewResource(R.id.image, R.drawable.circle_green);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ {
+ b_new.setSmallIcon(R.drawable.circle_green_notification);
+ }
+ else
+ {
+ b.setSmallIcon(R.drawable.circle_green_notification);
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ {
+ b_new.setColor(Color.parseColor("#04b431"));
+ }
+ else
+ {
+ b.setColor(Color.parseColor("#04b431"));
+ }
+ }
+ notification_view.setTextViewText(R.id.title,
+ "Tox Service: " + "ONLINE [TCP]" + " " + message);
+ // get_network_connections();
}
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ else // if (a_TOXCONNECTION__f == 2)
{
+ notification_view.setImageViewResource(R.id.image, R.drawable.circle_green);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
- b_new.setColor(Color.parseColor("#04b431"));
+ b_new.setSmallIcon(R.drawable.circle_green_notification);
}
else
{
- b.setColor(Color.parseColor("#04b431"));
+ b.setSmallIcon(R.drawable.circle_green_notification);
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ {
+ b_new.setColor(Color.parseColor("#04b431"));
+ }
+ else
+ {
+ b.setColor(Color.parseColor("#04b431"));
+ }
}
+ notification_view.setTextViewText(R.id.title,
+ "Tox Service: " + "ONLINE [UDP]" + " " + message);
+ // get_network_connections();
}
- notification_view.setTextViewText(R.id.title, "Tox Service: " + "ONLINE [UDP]" + " " + message);
- // get_network_connections();
}
}
}
}
+
notification_view.setTextViewText(R.id.text, "");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
diff --git a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java
index a767d25ca..3ea2b2986 100644
--- a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java
+++ b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java
@@ -203,9 +203,11 @@
import static com.zoffcc.applications.trifa.HelperRelay.is_any_relay;
import static com.zoffcc.applications.trifa.HelperRelay.own_push_token_load;
import static com.zoffcc.applications.trifa.HelperRelay.send_pushtoken_to_relay;
+import static com.zoffcc.applications.trifa.HelperToxNotification.tox_notification_change_wrapper;
import static com.zoffcc.applications.trifa.MessageListActivity.ml_friend_typing;
import static com.zoffcc.applications.trifa.TRIFAGlobals.AVATAR_INCOMING_MAX_BYTE_SIZE;
import static com.zoffcc.applications.trifa.TRIFAGlobals.CONFERENCE_ID_LENGTH;
+import static com.zoffcc.applications.trifa.TRIFAGlobals.CONNECTION_STATUS_MANUAL_LOGOUT;
import static com.zoffcc.applications.trifa.TRIFAGlobals.CONTROL_PROXY_MESSAGE_TYPE.CONTROL_PROXY_MESSAGE_TYPE_PROXY_PUBKEY_FOR_FRIEND;
import static com.zoffcc.applications.trifa.TRIFAGlobals.CONTROL_PROXY_MESSAGE_TYPE.CONTROL_PROXY_MESSAGE_TYPE_PUSH_URL_FOR_FRIEND;
import static com.zoffcc.applications.trifa.TRIFAGlobals.DELETE_SQL_AND_VFS_ON_ERROR;
@@ -297,6 +299,7 @@
import static com.zoffcc.applications.trifa.ToxVars.TOX_USER_STATUS.TOX_USER_STATUS_NONE;
import static com.zoffcc.applications.trifa.TrifaToxService.TOX_SERVICE_STARTED;
import static com.zoffcc.applications.trifa.TrifaToxService.is_tox_started;
+import static com.zoffcc.applications.trifa.TrifaToxService.manually_logged_out;
import static com.zoffcc.applications.trifa.TrifaToxService.orma;
import static com.zoffcc.applications.trifa.TrifaToxService.resend_old_messages;
import static com.zoffcc.applications.trifa.TrifaToxService.resend_v3_messages;
@@ -1378,7 +1381,7 @@ public void onNothingSelected(AdapterView> parentView)
PrimaryDrawerItem item2 = new PrimaryDrawerItem().withIdentifier(2).withName(
R.string.MainActivity_settings).withIcon(GoogleMaterial.Icon.gmd_settings);
PrimaryDrawerItem item3 = new PrimaryDrawerItem().withIdentifier(3).withName(
- R.string.MainActivity_logout_login).withIcon(GoogleMaterial.Icon.gmd_refresh);
+ R.string.MainActivity_manually_logged_out_false).withIcon(GoogleMaterial.Icon.gmd_refresh);
PrimaryDrawerItem item4 = new PrimaryDrawerItem().withIdentifier(4).withName(
R.string.MainActivity_maint).withIcon(GoogleMaterial.Icon.gmd_build);
PrimaryDrawerItem item5 = new PrimaryDrawerItem().withIdentifier(5).withName(
@@ -1461,10 +1464,79 @@ else if (position == 4)
if (is_tox_started)
{
global_stop_tox();
+ manually_logged_out = true;
+ try
+ {
+ final Thread t = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(50);
+ Log.i(TAG, "connection_status: manual logout");
+ tox_notification_change_wrapper(CONNECTION_STATUS_MANUAL_LOGOUT, "");
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ };
+ t.start();
+ }
+ catch(Exception e)
+ {
+ }
+
+ try
+ {
+ PrimaryDrawerItem manual_logout_item = new PrimaryDrawerItem().withIdentifier(3).withName(R.string.MainActivity_manually_logged_out_true).withIcon(
+ GoogleMaterial.Icon.gmd_refresh);
+ main_drawer.updateItemAtPosition(manual_logout_item, 4);
+ }
+ catch(Exception e)
+ {
+ }
}
else
{
global_start_tox();
+ manually_logged_out = false;
+ try
+ {
+ final Thread t = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(50);
+ Log.i(TAG, "connection_status: manual activate");
+ tox_notification_change_wrapper(tox_self_get_connection_status(), "");
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ };
+ t.start();
+ }
+ catch(Exception e)
+ {
+ }
+
+ try
+ {
+ PrimaryDrawerItem manual_logout_item = new PrimaryDrawerItem().withIdentifier(3).
+ withName(R.string.MainActivity_manually_logged_out_false).
+ withIcon(GoogleMaterial.Icon.gmd_refresh);
+ main_drawer.updateItemAtPosition(manual_logout_item, 4);
+ }
+ catch(Exception e)
+ {
+ }
}
}
catch (Exception e)
@@ -1568,6 +1640,7 @@ else if (position == 10)
return true;
}
}).build();
+
// DrawerLayout drawer_layout = (DrawerLayout) findViewById(R.id.material_drawer_layout);
// ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawer_layout, toolbar, R.string.faw_envelope_open, R.string.faw_envelope_open);
//
@@ -4518,7 +4591,7 @@ static void android_tox_callback_self_connection_status_cb_method(int a_TOX_CONN
// -- notification ------------------
// -- notification ------------------
- HelperToxNotification.tox_notification_change_wrapper(a_TOX_CONNECTION, "");
+ tox_notification_change_wrapper(a_TOX_CONNECTION, "");
// -- notification ------------------
// -- notification ------------------
}
diff --git a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TRIFAGlobals.java b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TRIFAGlobals.java
index 456210d40..3f2c48253 100644
--- a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TRIFAGlobals.java
+++ b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TRIFAGlobals.java
@@ -157,6 +157,8 @@ public class TRIFAGlobals
static final String MESSAGE_PAGING_SHOW_OLDER_HASH = "00000000000000001";
static final String MESSAGE_PAGING_SHOW_NEWER_HASH = "00000000000000002";
+ static final int CONNECTION_STATUS_MANUAL_LOGOUT = 99;
+
static int VIDEO_FRAME_RATE_OUTGOING = 0;
static long last_video_frame_sent = -1;
static int count_video_frame_sent = 0;
diff --git a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TrifaToxService.java b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TrifaToxService.java
index 1bbde0c09..a53574f85 100644
--- a/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TrifaToxService.java
+++ b/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/TrifaToxService.java
@@ -186,6 +186,7 @@ public class TrifaToxService extends Service
static OrmaDatabase orma = null;
static VirtualFileSystem vfs = null;
static boolean is_tox_started = false;
+ static boolean manually_logged_out = false;
static boolean global_toxid_text_set = false;
static boolean TOX_SERVICE_STARTED = false;
static Thread trifa_service_thread = null;
diff --git a/android-refimpl-app/app/src/main/res/drawable/circle_manuallyoffline_notification.xml b/android-refimpl-app/app/src/main/res/drawable/circle_manuallyoffline_notification.xml
new file mode 100644
index 000000000..8ff3910c9
--- /dev/null
+++ b/android-refimpl-app/app/src/main/res/drawable/circle_manuallyoffline_notification.xml
@@ -0,0 +1,37 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
diff --git a/android-refimpl-app/app/src/main/res/values/strings.xml b/android-refimpl-app/app/src/main/res/values/strings.xml
index 5f3ac917a..f81f19410 100644
--- a/android-refimpl-app/app/src/main/res/values/strings.xml
+++ b/android-refimpl-app/app/src/main/res/values/strings.xml
@@ -380,6 +380,8 @@
Profile
Settings
Logout/Login
+ activate
+ log out
Join Info Group
Maintenance
About