From 93a1f7c2f5d4c4bd2234e2f821c0f0172dbb87a1 Mon Sep 17 00:00:00 2001 From: Thodoris Tyrovouzis Date: Sat, 11 Jul 2020 21:59:29 +0300 Subject: [PATCH] fixes: - remove orange color when user is mentioned in inbox - fix bug where user could not press back on CreatePMActivity - Fix toolbar text of CreatePMActivity --- .../activities/create_pm/CreatePMActivity.java | 17 +++++++++-------- .../create_topic/CreateTopicActivity.java | 9 ++++++--- .../mthmmy/activities/inbox/InboxAdapter.java | 6 ++++-- app/src/main/res/layout/activity_create_pm.xml | 2 +- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java index 90017dda..0b3d07cc 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/create_pm/CreatePMActivity.java @@ -50,13 +50,15 @@ public class CreatePMActivity extends BaseActivity implements ExternalAsyncTask. //Initialize toolbar toolbar = findViewById(R.id.toolbar); - toolbar.setTitle("Create topic"); + toolbar.setTitle("Create PM"); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } + createDrawer(); + progressBar = findViewById(R.id.progressBar); emojiKeyboard = findViewById(R.id.emoji_keyboard); @@ -69,10 +71,6 @@ public class CreatePMActivity extends BaseActivity implements ExternalAsyncTask. contentEditor.setEmojiKeyboard(emojiKeyboard); emojiKeyboard.registerEmojiInputField(contentEditor); contentEditor.setOnSubmitListener(v -> { - if (TextUtils.isEmpty(subjectInput.getEditText().getText())) { - subjectInput.setError("Required"); - return; - } if (TextUtils.isEmpty(contentEditor.getText())) { contentEditor.setError("Required"); return; @@ -97,11 +95,14 @@ public class CreatePMActivity extends BaseActivity implements ExternalAsyncTask. @Override public void onBackPressed() { - if (emojiKeyboard.getVisibility() == View.VISIBLE) { + if (drawer.isDrawerOpen()) { + drawer.closeDrawer(); + return; + } else if (emojiKeyboard.getVisibility() == View.VISIBLE) { emojiKeyboard.setVisibility(View.GONE); - } else { - super.onBackPressed(); + return; } + super.onBackPressed(); } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java index ec661962..16f50755 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/create_topic/CreateTopicActivity.java @@ -83,11 +83,14 @@ public class CreateTopicActivity extends BaseActivity implements NewTopicTask.Ne } @Override public void onBackPressed() { - if (emojiKeyboard.getVisibility() == View.VISIBLE) { + if (drawer.isDrawerOpen()) { + drawer.closeDrawer(); + return; + } else if (emojiKeyboard.getVisibility() == View.VISIBLE) { emojiKeyboard.setVisibility(View.GONE); - } else { - super.onBackPressed(); + return; } + super.onBackPressed(); } @Override diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/inbox/InboxAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/inbox/InboxAdapter.java index 504d78c7..3bbb7348 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/inbox/InboxAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/inbox/InboxAdapter.java @@ -142,14 +142,16 @@ public class InboxAdapter extends RecyclerView.Adapter holder.stars.setVisibility(View.VISIBLE); } else holder.stars.setVisibility(View.GONE); - if (currentPM.isUserMentioned()) { + // in the context of inbox there is no point in highlighting quoted PMs + /*if (currentPM.isUserMentioned()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { holder.cardChildLinear.setBackground(context.getResources(). getDrawable(R.drawable.mention_card, null)); } else holder.cardChildLinear.setBackground(context.getResources(). getDrawable(R.drawable.mention_card)); - } else if (currentPM.getAuthorColor() == ParseHelpers.USER_COLOR_PINK) { + } else */ + if (currentPM.getAuthorColor() == ParseHelpers.USER_COLOR_PINK) { //Special card for special member of the month! if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { holder.cardChildLinear.setBackground(context.getResources(). diff --git a/app/src/main/res/layout/activity_create_pm.xml b/app/src/main/res/layout/activity_create_pm.xml index f0405463..0021e3c9 100644 --- a/app/src/main/res/layout/activity_create_pm.xml +++ b/app/src/main/res/layout/activity_create_pm.xml @@ -24,7 +24,7 @@ android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:gravity="center" - app:popupTheme="@style/ToolbarTheme"> + app:popupTheme="@style/ToolbarTheme" />