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. 35
      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

35
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();

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.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);

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

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

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

@ -1,38 +1,10 @@
<resources>
<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>
<style name="AppTheme" parent="BaseAppTheme">
<item name="android:windowContentTransitions">true</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<style name="AppTheme.NoActionBar" parent="BaseAppTheme.NoActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</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>

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

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

Loading…
Cancel
Save