Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

Commit

Permalink
Change colorEdgeEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
seven332 committed Oct 25, 2018
1 parent ed8c818 commit 3f71a97
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
7 changes: 2 additions & 5 deletions app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.hippo.android.resource.AttrResources;
import com.hippo.ehviewer.AppConfig;
import com.hippo.ehviewer.BuildConfig;
Expand Down Expand Up @@ -77,7 +76,6 @@
import com.hippo.yorozuya.SimpleAnimatorListener;
import com.hippo.yorozuya.SimpleHandler;
import com.hippo.yorozuya.ViewUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -295,20 +293,19 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mGLRootView = (GLRootView) ViewUtils.$$(this, R.id.gl_root_view);
mGalleryAdapter = new GalleryAdapter(mGLRootView, mGalleryProvider);
Resources resources = getResources();
int primaryColor = ResourcesUtils.getAttrColor(this, R.attr.colorPrimary);
mGalleryView = new GalleryView.Builder(this, mGalleryAdapter)
.setListener(this)
.setLayoutMode(Settings.getReadingDirection())
.setScaleMode(Settings.getPageScaling())
.setStartPosition(Settings.getStartPosition())
.setStartPage(startPage)
.setBackgroundColor(AttrResources.getAttrColor(this, android.R.attr.colorBackground))
.setEdgeColor(primaryColor & 0xffffff | 0x33000000)
.setEdgeColor(AttrResources.getAttrColor(this, R.attr.colorEdgeEffect) & 0xffffff | 0x33000000)
.setPagerInterval(Settings.getShowPageInterval() ? resources.getDimensionPixelOffset(R.dimen.gallery_pager_interval) : 0)
.setScrollInterval(Settings.getShowPageInterval() ? resources.getDimensionPixelOffset(R.dimen.gallery_scroll_interval) : 0)
.setPageMinHeight(resources.getDimensionPixelOffset(R.dimen.gallery_page_min_height))
.setPageInfoInterval(resources.getDimensionPixelOffset(R.dimen.gallery_page_info_interval))
.setProgressColor(primaryColor)
.setProgressColor(ResourcesUtils.getAttrColor(this, R.attr.colorPrimary))
.setProgressSize(resources.getDimensionPixelOffset(R.dimen.gallery_progress_size))
.setPageTextColor(AttrResources.getAttrColor(this, android.R.attr.textColorSecondary))
.setPageTextSize(resources.getDimensionPixelOffset(R.dimen.gallery_page_text_size))
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/values-v21/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@

<resources>

<style name="AppTheme" parent="BaseTheme">
<item name="android:colorEdgeEffect">?attr/colorEdgeEffect</item>
</style>

<style name="AppTheme.Dark" parent="BaseTheme.Dark">
<item name="android:colorEdgeEffect">?attr/colorEdgeEffect</item>
</style>

<style name="AppTheme.Black" parent="BaseTheme.Black">
<item name="android:colorEdgeEffect">?attr/colorEdgeEffect</item>
</style>

<style name="AppTheme.NoActionBar.Translucent">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<resources>

<declare-styleable name="Theme">
<attr name="colorEdgeEffect" format="color"/>

<attr name="dividerColor" format="color"/>
<attr name="toolbarColor" format="color"/>

Expand Down
18 changes: 15 additions & 3 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
<!-- ========== -->
<!-- Base Theme -->
<!-- ========== -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="BaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="actionBarStyle">@style/ActionBarStyle</item>

<item name="colorEdgeEffect">@color/colorPrimary</item>
<item name="dividerColor">@color/divider_light</item>
<item name="toolbarColor">@color/colorPrimary</item>
<item name="textColorThemePrimary">@color/colorPrimary</item>
Expand Down Expand Up @@ -53,6 +54,9 @@
<item name="galleryDetailDivider">@drawable/divider_gallery_detail_light</item>
</style>

<style name="AppTheme" parent="BaseTheme">
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
Expand All @@ -63,7 +67,7 @@
<!-- =============== -->
<!-- Base Dark Theme -->
<!-- =============== -->
<style name="AppTheme.Dark" parent="Theme.AppCompat">
<style name="BaseTheme.Dark" parent="Theme.AppCompat">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/grey_900</item>
<item name="colorAccent">@color/colorPrimary</item>
Expand All @@ -74,6 +78,7 @@
<item name="android:colorBackground">@color/grey_850</item>
<item name="colorBackgroundFloating">@color/grey_850</item>

<item name="colorEdgeEffect">@color/grey_500</item>
<item name="dividerColor">@color/divider_dark</item>
<item name="toolbarColor">?android:attr/colorBackground</item>
<item name="textColorThemePrimary">?android:attr/textColorSecondary</item>
Expand Down Expand Up @@ -101,6 +106,9 @@
<item name="galleryDetailDivider">@drawable/divider_gallery_detail_dark</item>
</style>

<style name="AppTheme.Dark" parent="BaseTheme.Dark">
</style>

<style name="AppTheme.Dark.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
Expand All @@ -111,7 +119,7 @@
<!-- =============== -->
<!-- Base Black Theme -->
<!-- =============== -->
<style name="AppTheme.Black" parent="Theme.AppCompat">
<style name="BaseTheme.Black" parent="Theme.AppCompat">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@android:color/black</item>
<item name="colorAccent">@color/colorPrimary</item>
Expand All @@ -124,6 +132,7 @@

<item name="android:textColorPrimary">@color/primary_text_material_black</item>

<item name="colorEdgeEffect">@color/grey_500</item>
<item name="dividerColor">@color/divider_dark</item>
<item name="toolbarColor">@android:color/black</item>
<item name="textColorThemePrimary">?android:attr/textColorSecondary</item>
Expand Down Expand Up @@ -151,6 +160,9 @@
<item name="galleryDetailDivider">@drawable/divider_gallery_detail_dark</item>
</style>

<style name="AppTheme.Black" parent="BaseTheme.Black">
</style>

<style name="AppTheme.Black.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
Expand Down

0 comments on commit 3f71a97

Please sign in to comment.