Browse Source

Minor fixes

e.g. Avoid showing consent dialog more than once
pull/61/merge
Ezerous 6 years ago
parent
commit
ee8e57fbc3
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  2. 8
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  3. 5
      app/src/main/res/layout/activity_board_sub_board_row.xml
  4. 7
      app/src/main/res/layout/activity_board_topic_row.xml

1
app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java

@ -79,6 +79,7 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
startActivity(intent);
finish();
overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
return; //Avoid executing the code below
}
//Initialize drawer

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

@ -99,6 +99,7 @@ public abstract class BaseActivity extends AppCompatActivity {
private MainActivity mainActivity;
private boolean isMainActivity;
private boolean isUserConsentDialogShown; //Needed because sometimes onResume is being called twice
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -128,9 +129,11 @@ public abstract class BaseActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
updateDrawer();
if (!sharedPreferences.getBoolean(getString(R.string.user_consent_shared_preference_key), false))
if (!sharedPreferences.getBoolean(getString(R.string.user_consent_shared_preference_key), false) && !isUserConsentDialogShown){
isUserConsentDialogShown=true;
showUserConsentDialog();
}
}
@Override
protected void onPause() {
@ -389,7 +392,7 @@ public abstract class BaseActivity extends AppCompatActivity {
if (!sessionManager.isLoggedIn()) //When logged out or if user is guest
startLoginActivity();
else
new LogoutTask().execute();
new LogoutTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); //Avoid delays between onPreExecute() and doInBackground()
} else if (drawerItem.equals(ABOUT_ID)) {
if (!(BaseActivity.this instanceof AboutActivity)) {
Intent intent = new Intent(BaseActivity.this, AboutActivity.class);
@ -496,6 +499,7 @@ public abstract class BaseActivity extends AppCompatActivity {
if (mainActivity != null)
mainActivity.updateTabs();
progressDialog.dismiss();
//TODO: Redirect to Main only for some Activities (e.g. Topic, Board, Downloads)
//if (BaseActivity.this instanceof TopicActivity){
Intent intent = new Intent(BaseActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

5
app/src/main/res/layout/activity_board_sub_board_row.xml

@ -20,8 +20,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
@ -30,7 +28,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:paddingBottom="2dp"
android:paddingTop="5dp"
android:paddingBottom="7dp"
android:text="@string/child_board_title"
android:textColor="@color/accent"
android:textSize="22sp" />

7
app/src/main/res/layout/activity_board_topic_row.xml

@ -15,8 +15,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
@ -27,6 +25,8 @@
android:text="@string/fa_circle"
android:textColor="@color/accent"
android:visibility="invisible"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_marginEnd="6dp"
android:textSize="9sp"
tools:ignore="SmallSp" />
@ -37,7 +37,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:paddingBottom="2dp"
android:paddingTop="5dp"
android:paddingBottom="7dp"
android:text="@string/topic_subject"
android:textColor="@color/primary_text"
android:textSize="18sp" />

Loading…
Cancel
Save