Browse Source

Fixes for profile online dot and logout

pull/24/head
Apostolos Fanakis 7 years ago
parent
commit
b33ac8c5d2
  1. 25
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
  2. 5
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

25
app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java

@ -217,6 +217,7 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
//Class variables //Class variables
Document profilePage; Document profilePage;
Spannable usernameSpan; Spannable usernameSpan;
Boolean isOnline = false;
protected void onPreExecute() { protected void onPreExecute() {
progressBar.setVisibility(ProgressBar.VISIBLE); progressBar.setVisibility(ProgressBar.VISIBLE);
@ -261,13 +262,17 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
usernameSpan.setSpan(new RelativeSizeSpan(0.45f) usernameSpan.setSpan(new RelativeSizeSpan(0.45f)
, 0, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); , 0, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (contentsTable.toString().contains("Online") if (contentsTable.toString().contains("Online")
|| contentsTable.toString().contains("Συνδεδεμένος")) { || contentsTable.toString().contains("Συνδεδεμένος")) {
usernameSpan.setSpan(new ForegroundColorSpan(Color.parseColor("#4CAF50")) isOnline = true;
, 0, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } else {
} else isOnline = false;
usernameSpan.setSpan(new ForegroundColorSpan(Color.GRAY) /*usernameSpan.setSpan(new ForegroundColorSpan(Color.GRAY)
, 0, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); , 0, 3, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);*/
}
usernameSpan.setSpan(new ForegroundColorSpan(Color.parseColor("#26A69A"))
, 2, usernameSpan.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
return true; return true;
} catch (SSLHandshakeException e) { } catch (SSLHandshakeException e) {
@ -290,8 +295,14 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
if (pmFAB.getVisibility() != View.GONE) pmFAB.setEnabled(true); if (pmFAB.getVisibility() != View.GONE) pmFAB.setEnabled(true);
progressBar.setVisibility(ProgressBar.INVISIBLE); progressBar.setVisibility(ProgressBar.INVISIBLE);
if (usernameSpan != null) usernameView.setText(usernameSpan); if (usernameSpan != null) {
else if (usernameView.getText() != username) usernameView.setText(username); if (isOnline) {
usernameView.setTextColor(Color.parseColor("#4CAF50"));
} else {
usernameView.setTextColor(Color.GRAY);
}
usernameView.setText(usernameSpan);
} else if (usernameView.getText() != username) usernameView.setText(username);
if (thumbnailUrl != null && !Objects.equals(thumbnailUrl, "")) if (thumbnailUrl != null && !Objects.equals(thumbnailUrl, ""))
//noinspection ConstantConditions //noinspection ConstantConditions
Picasso.with(getApplicationContext()) Picasso.with(getApplicationContext())

5
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -411,6 +411,11 @@ public abstract class BaseActivity extends AppCompatActivity {
if (mainActivity != null) if (mainActivity != null)
mainActivity.updateTabs(); mainActivity.updateTabs();
progressDialog.dismiss(); progressDialog.dismiss();
//if (BaseActivity.this instanceof TopicActivity){
Intent intent = new Intent(BaseActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
//}
} }
} }
//-----------------------------------------LOGOUT END----------------------------------------------- //-----------------------------------------LOGOUT END-----------------------------------------------

Loading…
Cancel
Save