From 9ce58ef48298fd5c8b4a60ce04beace85db5d6bf Mon Sep 17 00:00:00 2001 From: Ezerous Date: Thu, 6 Sep 2018 10:47:48 +0300 Subject: [PATCH] Editorview popup style fix, styles optimization --- .../gr/thmmy/mthmmy/base/BaseActivity.java | 35 +++++++++---------- .../thmmy/mthmmy/editorview/EditorView.java | 4 ++- .../res/layout/editor_view_color_picker.xml | 3 +- app/src/main/res/values-v21/styles.xml | 32 ++--------------- app/src/main/res/values/styles.xml | 12 ++++--- 5 files changed, 31 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index 4fdd7e43..96d2008c 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -305,26 +305,23 @@ public abstract class BaseActivity extends AppCompatActivity { .withSelectionListEnabledForSingleProfile(false) .withHeaderBackground(R.color.primary) .addProfiles(profileDrawerItem) - .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() { - @Override - public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) { - if (sessionManager.isLoggedIn()) { - Intent intent = new Intent(BaseActivity.this, ProfileActivity.class); - Bundle extras = new Bundle(); - extras.putString(BUNDLE_PROFILE_URL, "https://www.thmmy.gr/smf/index.php?action=profile"); - if (!sessionManager.hasAvatar()) - extras.putString(BUNDLE_PROFILE_THUMBNAIL_URL, ""); - else - extras.putString(BUNDLE_PROFILE_THUMBNAIL_URL, sessionManager.getAvatarLink()); - extras.putString(BUNDLE_PROFILE_USERNAME, sessionManager.getUsername()); - intent.putExtras(extras); - intent.setFlags(FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - return false; - } - return true; - + .withOnAccountHeaderListener((view, profile, currentProfile) -> { + if (sessionManager.isLoggedIn()) { + Intent intent = new Intent(BaseActivity.this, ProfileActivity.class); + Bundle extras = new Bundle(); + extras.putString(BUNDLE_PROFILE_URL, "https://www.thmmy.gr/smf/index.php?action=profile"); + if (!sessionManager.hasAvatar()) + extras.putString(BUNDLE_PROFILE_THUMBNAIL_URL, ""); + else + extras.putString(BUNDLE_PROFILE_THUMBNAIL_URL, sessionManager.getAvatarLink()); + extras.putString(BUNDLE_PROFILE_USERNAME, sessionManager.getUsername()); + intent.putExtras(extras); + intent.setFlags(FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + return false; } + return true; + }) .build(); diff --git a/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java b/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java index a4ccc119..f61b709d 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java +++ b/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java @@ -13,6 +13,7 @@ import android.text.Editable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.SparseArray; +import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; @@ -134,7 +135,8 @@ public class EditorView extends LinearLayout { colors.append(R.id.lime_green, "limegreen"); findViewById(R.id.text_color_button).setOnClickListener(view -> { - PopupWindow popupWindow = new PopupWindow(view.getContext()); + Context wrapper = new ContextThemeWrapper(view.getContext(), R.style.PopupWindow); + PopupWindow popupWindow = new PopupWindow(wrapper); popupWindow.setHeight(LayoutParams.WRAP_CONTENT); popupWindow.setWidth(LayoutParams.WRAP_CONTENT); popupWindow.setFocusable(true); diff --git a/app/src/main/res/layout/editor_view_color_picker.xml b/app/src/main/res/layout/editor_view_color_picker.xml index 0ac2d71b..ced6e5f6 100644 --- a/app/src/main/res/layout/editor_view_color_picker.xml +++ b/app/src/main/res/layout/editor_view_color_picker.xml @@ -2,7 +2,8 @@ + android:layout_height="wrap_content" + android:background="@color/card_background"> - - - - - - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 78909d7b..9d79d36d 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,7 +1,6 @@ - - - - +