图片颜色调整

This commit is contained in:
xingxing
2018-07-04 22:23:47 +08:00
parent f86499f2ac
commit bc16e2d21d
35 changed files with 134 additions and 38 deletions

View File

@@ -46,7 +46,6 @@
<activity
android:name=".ui.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:label="@string/app_name" />
<activity android:name=".ui.SignInActivity" android:screenOrientation="portrait" />
<activity

View File

@@ -8,11 +8,9 @@ import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import org.houxg.leamonax.R;
import org.houxg.leamonax.utils.SharedPreferenceUtils;
import org.houxg.leamonax.utils.SkinCompatUtils;
import org.houxg.leamonax.utils.StatusBarUtils;
import static org.houxg.leamonax.ui.Navigation.SP_THEME_NIGHT;
public class BaseActivity extends AppCompatActivity {
private Toolbar mToolbar;
@@ -29,16 +27,22 @@ public class BaseActivity extends AppCompatActivity {
if (toolbar != null) {
mToolbar = toolbar;
setSupportActionBar(toolbar);
toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
toolbar.setTitleTextColor(ContextCompat.getColor(this, SkinCompatUtils.isThemeNight() ? R.color.primary_text_light_night : R.color.black));
toolbar.setTitle(getTitle());
ActionBar actionBar = getSupportActionBar();
if (actionBar != null && hasBackArrow) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white);
actionBar.setHomeAsUpIndicator(SkinCompatUtils.isThemeNight() ? R.drawable.ic_arrow_back_white : R.drawable.ic_arrow_back_black);
}
}
}
public void updateTitleTextColorByTheme() {
if (mToolbar != null) {
mToolbar.setTitleTextColor(ContextCompat.getColor(this, SkinCompatUtils.isThemeNight() ? R.color.primary_text_light_night : R.color.black));
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
@@ -53,8 +57,7 @@ public class BaseActivity extends AppCompatActivity {
*/
protected void setStatusBarColor() {
int id;
boolean result = SharedPreferenceUtils.read(SharedPreferenceUtils.LEANOTE, SP_THEME_NIGHT, false);
if (result) {
if (SkinCompatUtils.isThemeNight()) {
id = R.color.colorPrimary_night;
} else {
id = R.color.colorPrimary;

View File

@@ -28,6 +28,7 @@ import org.houxg.leamonax.model.Notebook;
import org.houxg.leamonax.model.SyncEvent;
import org.houxg.leamonax.ui.edit.NoteEditActivity;
import org.houxg.leamonax.utils.NetworkUtils;
import org.houxg.leamonax.utils.SkinCompatUtils;
import org.houxg.leamonax.utils.StatusBarUtils;
import org.houxg.leamonax.utils.StatusBarViewHacker;
import org.houxg.leamonax.utils.ToastUtils;
@@ -69,7 +70,7 @@ public class MainActivity extends BaseActivity implements Navigation.Callback {
StatusBarViewHacker.fixStatusBarBackgroundColor(this);
initToolBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_white);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_nav);
CrashReport.setUserId(Account.getCurrent().getUserId());
mNavigation = new Navigation(this);
@@ -111,7 +112,7 @@ public class MainActivity extends BaseActivity implements Navigation.Callback {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
getMenuInflater().inflate(SkinCompatUtils.isThemeNight() ? R.menu.main_night : R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}

View File

@@ -39,6 +39,7 @@ import org.houxg.leamonax.service.NotebookService;
import org.houxg.leamonax.utils.DisplayUtils;
import org.houxg.leamonax.utils.OpenUtils;
import org.houxg.leamonax.utils.SharedPreferenceUtils;
import org.houxg.leamonax.utils.SkinCompatUtils;
import org.houxg.leamonax.utils.StatusBarUtils;
import org.houxg.leamonax.utils.StatusBarViewHacker;
import org.houxg.leamonax.utils.ToastUtils;
@@ -551,7 +552,7 @@ public class Navigation {
@OnClick(R.id.rl_theme)
void clickedTheme(final View view) {
boolean result = SharedPreferenceUtils.read(SharedPreferenceUtils.LEANOTE, SP_THEME_NIGHT, false);
boolean result = SkinCompatUtils.isThemeNight();
SharedPreferenceUtils.write(SharedPreferenceUtils.LEANOTE, SP_THEME_NIGHT, !result);
SkinCompatManager.SkinLoaderListener skinLoaderListener = new SkinCompatManager.SkinLoaderListener() {
@@ -569,6 +570,10 @@ public class Navigation {
StatusBarViewHacker.fixStatusBarBackgroundColor(mActivity);
}
});
if (mActivity instanceof BaseActivity) {
((BaseActivity)mActivity).updateTitleTextColorByTheme();
}
mActivity.invalidateOptionsMenu();
}
@Override
@@ -576,9 +581,9 @@ public class Navigation {
}
};
if (!SharedPreferenceUtils.read(SharedPreferenceUtils.LEANOTE, SP_THEME_NIGHT, false)) {
if (!SkinCompatUtils.isThemeNight()) {
mThemeIv.setImageResource(R.drawable.ic_theme_night);
SkinCompatManager.getInstance().loadSkin("", skinLoaderListener, SkinCompatManager.SKIN_LOADER_STRATEGY_NONE);
SkinCompatManager.getInstance().loadSkin("", skinLoaderListener, SkinCompatManager.SKIN_LOADER_STRATEGY_NONE);//reset
} else {
mThemeIv.setImageResource(R.drawable.ic_theme_daily);
SkinCompatManager.getInstance().loadSkin("night", skinLoaderListener, SkinCompatManager.SKIN_LOADER_STRATEGY_BUILD_IN);

View File

@@ -28,6 +28,7 @@ import org.houxg.leamonax.utils.ActionModeHandler;
import org.houxg.leamonax.utils.CollectionUtils;
import org.houxg.leamonax.utils.NetworkUtils;
import org.houxg.leamonax.utils.SharedPreferenceUtils;
import org.houxg.leamonax.utils.SkinCompatUtils;
import org.houxg.leamonax.utils.ToastUtils;
import org.houxg.leamonax.widget.NoteList;
import org.houxg.leamonax.widget.SelectPopupWindow;
@@ -82,7 +83,7 @@ public class NoteFragment extends Fragment implements NoteAdapter.NoteAdapterLis
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.note, menu);
inflater.inflate(SkinCompatUtils.isThemeNight() ? R.menu.note_night : R.menu.note, menu);
}
@Override

View File

@@ -0,0 +1,9 @@
package org.houxg.leamonax.utils;
import static org.houxg.leamonax.ui.Navigation.SP_THEME_NIGHT;
public class SkinCompatUtils {
public static boolean isThemeNight() {
return SharedPreferenceUtils.read(SharedPreferenceUtils.LEANOTE, SP_THEME_NIGHT, false);
}
}

View File

@@ -6,7 +6,6 @@ import android.view.View;
import org.houxg.leamonax.R;
import static org.houxg.leamonax.ui.Navigation.SP_THEME_NIGHT;
import static org.houxg.leamonax.utils.StatusBarUtils.FAKE_STATUS_BAR_VIEW_ID;
public class StatusBarViewHacker {
@@ -14,8 +13,7 @@ public class StatusBarViewHacker {
View fakeStatusBarView = activity.findViewById(FAKE_STATUS_BAR_VIEW_ID);
if (fakeStatusBarView != null) {
int id;
boolean result = SharedPreferenceUtils.read(SharedPreferenceUtils.LEANOTE, SP_THEME_NIGHT, false);
if (result) {
if (SkinCompatUtils.isThemeNight()) {
id = R.color.colorPrimary_night;
} else {
id = R.color.colorPrimary;

View File

@@ -16,13 +16,12 @@ import android.widget.TextView;
import org.houxg.leamonax.R;
import org.houxg.leamonax.utils.DisplayUtils;
import org.houxg.leamonax.utils.SharedPreferenceUtils;
import org.houxg.leamonax.utils.SkinCompatUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.houxg.leamonax.ui.Navigation.SP_THEME_NIGHT;
public class SelectPopupWindow extends ListPopupWindow{
public static final String SP_SORT_TYPE = "sp_sort_type";
private Context mContext;
@@ -54,8 +53,7 @@ public class SelectPopupWindow extends ListPopupWindow{
setAnchorView(anchorView);
setOverlapAnchor(true);
setModal(true);
boolean result = SharedPreferenceUtils.read(SharedPreferenceUtils.LEANOTE, SP_THEME_NIGHT, false);
if (result) {
if (SkinCompatUtils.isThemeNight()) {
setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.white_night));
} else {
setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.white));

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_search_white"
android:title="@string/search"
app:showAsAction="always"/>
</menu>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_view_type"
android:icon="@drawable/ic_view_type_white"
android:title="@string/view_type"
app:showAsAction="always"/>
<item
android:id="@+id/action_view_more"
android:icon="@drawable/ic_more_vert_white"
app:showAsAction="always"
android:title="" />
</menu>

View File

@@ -1,27 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary_night">#3b3b3b</color>
<!--<color name="colorPrimaryDark">#616161</color>-->
<color name="colorAccent_night">#3b3b3b</color>
<color name="window_background_night">#373737</color>
<color name="colorPrimary_night">#151618</color>
<color name="colorPrimaryDark_night">#151618</color>
<color name="colorAccent_night">#151618</color>
<color name="window_background_night">#111214</color>
<color name="toolbar_night">#3b3b3b</color>
<color name="menu_text_night">#373737</color>
<color name="toolbar_night">#151618</color>
<color name="menu_text_night">#111214</color>
<!--<color name="drawer_divider_night">#E0E0E0</color>-->
<!--<color name="drawer_divider_light_night">#BDBDBD</color>-->
<color name="drawer_divider_night">#2b2b2b</color>
<color name="drawer_divider2_night">#00000000</color>
<color name="drawer_divider_light_night">#E0E0E0</color>
<!--<color name="primary_text_light">#de000000</color>-->
<!--<color name="secondary_text_light">#8a000000</color>-->
<!--<color name="hint_text_light">#61000000</color>-->
<color name="primary_text_light_night">#7f8182</color>
<color name="secondary_text_light_night">#a07f8182</color>
<color name="hint_text_light_night">#807f8182</color>
<!--<color name="divider_light">#1f000000</color>-->
<color name="navigation_night">#3b3b3b</color>
<color name="navigation_night">#111214</color>
<!--<color name="transparent">#00000000</color>-->
<color name="white_night">#373737</color>
<color name="white_night">#111214</color>
<color name="white_alpha_night">#c7000000</color>
<!--<color name="black">#000</color>-->
<!--<color name="lightGray">#EEEEEE</color>-->
<color name="cardview_light_background_night">#FF424242</color>
</resources>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<drawable name="white_night">#373737</drawable>
<drawable name="white_night">#111214</drawable>
<drawable name="colorPrimary_night">#3b3b3b</drawable>
</resources>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="1024.0" android:viewportHeight="1024.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#AF000000" android:pathData="M853.3,554.7 L341.3,554.7 576,789.3 512,853.3 170.7,512 512,170.7 576,234.7 341.3,469.3 853.3,469.3 853.3,554.7Z" />
</vector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="1024.0" android:viewportHeight="1024.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#8fffffff" android:pathData="M853.3,554.7 L341.3,554.7 576,789.3 512,853.3 170.7,512 512,170.7 576,234.7 341.3,469.3 853.3,469.3 853.3,554.7Z" />
</vector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#AF000000" android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z" />
</vector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="24.0dip" android:width="24.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#8fffffff" android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z" />
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#AF000000" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#8FFFFFFF" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#AF000000"
android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#8FFFFFFF"
android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z"/>
</vector>

View File

@@ -37,7 +37,7 @@
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_margin="16dp"
app:srcCompat="@drawable/ic_edit_white" />
android:src="@drawable/ic_edit_white" />
</RelativeLayout>
</LinearLayout>

View File

@@ -24,6 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/secondary_text_light"
tools:text="test@leanote.com"/>
<TextView

View File

@@ -17,6 +17,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/add_account"
android:textColor="@color/primary_text_light"
android:textSize="14sp" />
</LinearLayout>

View File

@@ -2,6 +2,8 @@
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardBackgroundColor="@color/cardview_light_background"
android:layout_height="wrap_content">
<LinearLayout
@@ -65,7 +67,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/drawer_divider" />
android:background="@color/drawer_divider2" />
<LinearLayout
android:layout_width="match_parent"

View File

@@ -19,6 +19,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="36dp"
android:textColor="@color/secondary_text_light"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:textAppearance="?android:attr/textAppearanceListItemSmall" />

View File

@@ -4,7 +4,7 @@
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_search"
android:icon="@drawable/ic_search_black"
android:title="@string/search"
app:showAsAction="always"/>
</menu>

View File

@@ -4,13 +4,13 @@
<item
android:id="@+id/action_view_type"
android:icon="@drawable/ic_view_type"
android:icon="@drawable/ic_view_type_black"
android:title="@string/view_type"
app:showAsAction="always"/>
<item
android:id="@+id/action_view_more"
android:icon="@drawable/ic_menu_more"
android:icon="@drawable/ic_more_vert_black"
app:showAsAction="always"
android:title="" />
</menu>

View File

@@ -8,6 +8,7 @@
<color name="toolbar">#1d89b7</color>
<color name="menu_text">#FAFAFA</color>
<color name="drawer_divider">#BDBDBD</color>
<color name="drawer_divider2">#BDBDBD</color>
<color name="drawer_divider_light">#E0E0E0</color>
<color name="primary_text_light">#de000000</color>
@@ -20,4 +21,5 @@
<color name="white_alpha">#00000000</color>
<color name="black">#000</color>
<color name="lightGray">#EEEEEE</color>
<color name="cardview_light_background">#FFFFFFFF</color>
</resources>