Browse Source

Editorview popup style fix, styles optimization

uploads
Ezerous 6 years ago
parent
commit
9ce58ef482
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 5
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  2. 4
      app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java
  3. 3
      app/src/main/res/layout/editor_view_color_picker.xml
  4. 32
      app/src/main/res/values-v21/styles.xml
  5. 12
      app/src/main/res/values/styles.xml

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

@ -305,9 +305,7 @@ public abstract class BaseActivity extends AppCompatActivity {
.withSelectionListEnabledForSingleProfile(false) .withSelectionListEnabledForSingleProfile(false)
.withHeaderBackground(R.color.primary) .withHeaderBackground(R.color.primary)
.addProfiles(profileDrawerItem) .addProfiles(profileDrawerItem)
.withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() { .withOnAccountHeaderListener((view, profile, currentProfile) -> {
@Override
public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
if (sessionManager.isLoggedIn()) { if (sessionManager.isLoggedIn()) {
Intent intent = new Intent(BaseActivity.this, ProfileActivity.class); Intent intent = new Intent(BaseActivity.this, ProfileActivity.class);
Bundle extras = new Bundle(); Bundle extras = new Bundle();
@ -324,7 +322,6 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
return true; return true;
}
}) })
.build(); .build();

4
app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java

@ -13,6 +13,7 @@ import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
@ -134,7 +135,8 @@ public class EditorView extends LinearLayout {
colors.append(R.id.lime_green, "limegreen"); colors.append(R.id.lime_green, "limegreen");
findViewById(R.id.text_color_button).setOnClickListener(view -> { 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.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT); popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
popupWindow.setFocusable(true); popupWindow.setFocusable(true);

3
app/src/main/res/layout/editor_view_color_picker.xml

@ -2,7 +2,8 @@
<ScrollView <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:background="@color/card_background">
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"

32
app/src/main/res/values-v21/styles.xml

@ -1,38 +1,10 @@
<resources> <resources>
<style name="AppTheme" parent="BaseAppTheme">
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="android:textColorPrimary">@color/primary_text</item>
<item name="android:textColorSecondary">@color/secondary_text</item>
<item name="android:windowBackground">@color/primary</item>
<item name="cardBackgroundColor">@color/card_background</item>
<item name="colorControlNormal">@color/iron</item>
<item name="colorControlActivated">@color/white</item>
<item name="colorControlHighlight">@color/white</item>
<item name="android:textColorHint">@color/iron</item>
<item name="colorButtonNormal">@color/primary</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<item name="android:windowContentTransitions">true</item> <item name="android:windowContentTransitions">true</item>
</style> </style>
<style name="AppTheme.NoActionBar"> <style name="AppTheme.NoActionBar" parent="BaseAppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
</style> </style>
<style name="AppTheme.PreferenceTheme" parent="AppTheme.NoActionBar">
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="colorControlActivated">@color/accent</item>
</style>
<style name="LightBackgroundColoredButton" parent="Widget.AppCompat.ImageButton">
<item name="android:colorButtonNormal">@color/primary_light</item>
</style>
</resources> </resources>

12
app/src/main/res/values/styles.xml

@ -1,7 +1,6 @@
<resources> <resources>
<!-- Base Theme to also be inherited in v21 -->
<!-- Dark application theme. --> <style name="BaseAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/primary</item> <item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item> <item name="colorAccent">@color/accent</item>
@ -21,11 +20,16 @@
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item> <item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
</style> </style>
<style name="AppTheme.NoActionBar"> <!-- Dark application theme. -->
<style name="AppTheme" parent="BaseAppTheme"/>
<style name="BaseAppTheme.NoActionBar">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="AppTheme.NoActionBar" parent="BaseAppTheme.NoActionBar"/>
<style name="AppTheme.PreferenceTheme" parent="AppTheme.NoActionBar"> <style name="AppTheme.PreferenceTheme" parent="AppTheme.NoActionBar">
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="colorControlActivated">@color/accent</item> <item name="colorControlActivated">@color/accent</item>

Loading…
Cancel
Save