Skip to content

Commit

Permalink
Merge pull request #623 from LoxiaLiSA/master
Browse files Browse the repository at this point in the history
update implementation
  • Loading branch information
CeuiLiSA authored Jul 28, 2024
2 parents 100022c + bff3090 commit 69192c5
Show file tree
Hide file tree
Showing 22 changed files with 124 additions and 119 deletions.
22 changes: 11 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ apply plugin: 'org.jmailen.kotlinter'
apply plugin: "androidx.navigation.safeargs"

android {
compileSdkVersion 33
compileSdk 34

defaultConfig {
applicationId "ceui.lisa.pixiv"
minSdkVersion 21
targetSdkVersion 33
versionCode 284
targetSdkVersion 34
versionCode 286
versionName "4.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down Expand Up @@ -50,8 +50,8 @@ android {

compileOptions {
coreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

sourceSets {
Expand All @@ -76,22 +76,22 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'com.google.android.material:material:1.12.0'

//=============== lifecycle
def lifecycle_version = '2.5.1'
def lifecycle_version = '2.8.4'

implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"



//=============== Navigation
def nav_version = "2.5.3"
def nav_version = "2.7.7"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

Expand Down Expand Up @@ -182,7 +182,7 @@ dependencies {
implementation 'com.tencent:mmkv-static:1.2.12'
implementation 'com.github.tbruyelle:rxpermissions:0.12'

implementation 'androidx.webkit:webkit:1.6.0'
implementation 'androidx.webkit:webkit:1.11.0'

implementation 'com.hjq:toast:8.8'

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ceui/lisa/activities/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
if (hideStatusBar()) {
BarUtils.transparentStatusBar(this);
} else {
getWindow().setStatusBarColor(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary));
getWindow().setStatusBarColor(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary));
}
try {
baseBind = DataBindingUtil.setContentView(mActivity, mLayoutID);
Expand Down
135 changes: 59 additions & 76 deletions app/src/main/java/ceui/lisa/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import ceui.lisa.utils.ReverseWebviewCallback;
import ceui.lisa.view.DrawerLayoutViewPager;

import static ceui.lisa.R.id.nav_gallery;
import static ceui.lisa.R.id.nav_slideshow;
import static ceui.lisa.activities.Shaft.sUserModel;

/**
Expand Down Expand Up @@ -253,82 +255,63 @@ public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();

Intent intent = null;
switch (id) {
case R.id.nav_gallery:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "下载管理");
intent.putExtra("hideStatusBar", false);
break;
case R.id.nav_slideshow:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "浏览记录");
break;
case R.id.nav_manage:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "设置");
break;
case R.id.nav_share:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "关于软件");
break;
case R.id.main_page:
intent = new Intent(mContext, UserActivity.class);
intent.putExtra(Params.USER_ID, sUserModel.getUser().getId());
break;
case R.id.nav_reverse:
selectPhoto();
break;
case R.id.nav_new_work:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "最新作品");
intent.putExtra("hideStatusBar", false);
break;
case R.id.muted_list:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "标签屏蔽记录");
break;
case R.id.nav_feature:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "精华列");
break;
case R.id.nav_fans:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "粉丝");
break;
case R.id.illust_star:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "我的插画收藏");
intent.putExtra("hideStatusBar", false);
break;
case R.id.novel_star:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "我的小说收藏");
intent.putExtra("hideStatusBar", false);
break;
case R.id.watchlist:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "追更列表");
intent.putExtra("hideStatusBar", false);
break;
case R.id.novel_markers:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "小说书签");
intent.putExtra("hideStatusBar", false);
break;
case R.id.follow_user:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "我的关注");
intent.putExtra("hideStatusBar", false);
break;
case R.id.new_work:
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接");
intent.putExtra(Params.URL, "https://www.pixiv.net/upload.php");
intent.putExtra(Params.TITLE, getString(R.string.string_444));
intent.putExtra(Params.PREFER_PRESERVE, true);
break;
default:
break;
if (id == nav_gallery) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "下载管理");
intent.putExtra("hideStatusBar", false);
} else if (id == nav_slideshow) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "浏览记录");
} else if (id == R.id.nav_manage) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "设置");
} else if (id == R.id.nav_share) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "关于软件");
} else if (id == R.id.main_page) {
intent = new Intent(mContext, UserActivity.class);
intent.putExtra(Params.USER_ID, sUserModel.getUser().getId());
} else if (id == R.id.nav_reverse) {
selectPhoto();
} else if (id == R.id.nav_new_work) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "最新作品");
intent.putExtra("hideStatusBar", false);
} else if (id == R.id.muted_list) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "标签屏蔽记录");
} else if (id == R.id.nav_feature) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "精华列");
} else if (id == R.id.nav_fans) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "粉丝");
} else if (id == R.id.illust_star) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "我的插画收藏");
intent.putExtra("hideStatusBar", false);
} else if (id == R.id.novel_star) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "我的小说收藏");
intent.putExtra("hideStatusBar", false);
} else if (id == R.id.watchlist) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "追更列表");
intent.putExtra("hideStatusBar", false);
} else if (id == R.id.novel_markers) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "小说书签");
intent.putExtra("hideStatusBar", false);
} else if (id == R.id.follow_user) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "我的关注");
intent.putExtra("hideStatusBar", false);
} else if (id == R.id.new_work) {
intent = new Intent(mContext, TemplateActivity.class);
intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接");
intent.putExtra(Params.URL, "https://www.pixiv.net/upload.php");
intent.putExtra(Params.TITLE, getString(R.string.string_444));
intent.putExtra(Params.PREFER_PRESERVE, true);
}
if (intent != null) {
startActivity(intent);
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ceui/lisa/activities/RankActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void initView() {
baseBind.toolbarTitle.setText(mContext.getString(R.string.ranking_illust));
dataType = getIntent().getStringExtra("dataType");
queryDate = getIntent().getStringExtra("date");
baseBind.viewPager.setPageTransformer(true, new DrawerTransformer());
// baseBind.viewPager.setPageTransformer(true, new DrawerTransformer());

final String[] CHINESE_TITLES = new String[]{
mContext.getString(R.string.daily_rank),
Expand Down Expand Up @@ -173,7 +173,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
start.set(2008, 0, 1);
dpd.setMinDate(start);
dpd.setMaxDate(now);
dpd.setAccentColor(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary));
dpd.setAccentColor(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary));
dpd.setThemeDark(mContext.getResources().getBoolean(R.bool.is_night_mode));
dpd.show(getSupportFragmentManager(), "DatePickerDialog");
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void initLayout() {

@Override
public void bindData(ListTrendingtag.TrendTagsBean target, ViewHolder<RecySearchHintBinding> bindView, int position) {
SpannableString string = matcherSearchText(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary),
SpannableString string = matcherSearchText(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary),
target.getName(), mKeyword);
bindView.baseBind.titleText.setText(string);
if (!TextUtils.isEmpty(target.getTranslated_name()) && !target.getTranslated_name().equals(target.getName())) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ceui/lisa/dialogs/MuteDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public View getView(FlowLayout parent, int position, TagsBean o) {
@Override
public void onSelected(int position, View view) {
super.onSelected(position, view);
((TextView) view).setTextColor(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary));
((TextView) view).setTextColor(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary));
view.setBackgroundResource(R.drawable.tag_stroke_checked_bg);
selected.add(mIllust.getTags().get(position));
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ceui/lisa/fragments/FragmentComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ public void initView() {
alertDialog.show();
alertDialog
.getButton(AlertDialog.BUTTON_POSITIVE)
.setTextColor(R.attr.colorPrimary);
.setTextColor(androidx.appcompat.R.attr.colorPrimary);
alertDialog
.getButton(AlertDialog.BUTTON_NEGATIVE)
.setTextColor(R.attr.colorPrimary);
.setTextColor(androidx.appcompat.R.attr.colorPrimary);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public void onClick(View v) {
start.set(now.get(Calendar.YEAR) - 100, 0, 1);
dpd.setMinDate(start);
dpd.setMaxDate(now);
dpd.setAccentColor(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary));
dpd.setAccentColor(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary));
dpd.setThemeDark(mContext.getResources().getBoolean(R.bool.is_night_mode));
dpd.show(getParentFragmentManager(), "DatePickerDialog");
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ceui/lisa/fragments/FragmentFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
});*/
baseBind.restrictionToggle.setElements(PixivSearchParamUtil.R18_RESTRICTION_NAME);
baseBind.restrictionToggle.setColors(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary), getResources().getColor(R.color.fragment_center));
baseBind.restrictionToggle.setColors(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary), getResources().getColor(R.color.fragment_center));
baseBind.restrictionToggle.setValue(0);
baseBind.restrictionToggle.setOnValueChangedListener(new ToggleButton.OnValueChangedListener() {
@Override
Expand Down Expand Up @@ -217,7 +217,7 @@ public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayO
start.set(1970, 0, 1);
dpd.setMinDate(start);
dpd.setMaxDate(now);
dpd.setAccentColor(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary));
dpd.setAccentColor(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary));
dpd.setThemeDark(mContext.getResources().getBoolean(R.bool.is_night_mode));
dpd.show(getParentFragmentManager(), "DatePickerDialog");
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ceui/lisa/fragments/FragmentIllust.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class FragmentIllust : SwipeFragment<FragmentIllustBinding>() {
}

override fun updateDrawState(ds: TextPaint) {
ds.color = Common.resolveThemeAttribute(mContext, R.attr.colorPrimary)
ds.color = Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary)
}
}
val spannableString: SpannableString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void initLayout() {
@Override
public void initView() {
Wave wave = new Wave();
wave.setColor(R.attr.colorPrimary);
wave.setColor(androidx.appcompat.R.attr.colorPrimary);
baseBind.progress.setIndeterminateDrawable(wave);
baseBind.recyclerView.addItemDecoration(new
LinearItemHorizontalDecoration(DensityUtil.dp2px(8.0f)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private void loadImage() {
.into(baseBind.bgImage);
break;
case Configuration.UI_MODE_NIGHT_YES:
baseBind.bgImage.setImageResource(R.color.black);
baseBind.bgImage.setImageResource(R.color.black_to_grey);
break;
}

Expand Down Expand Up @@ -194,7 +194,7 @@ public void onClick(View widget) {

@Override
public void updateDrawState(TextPaint ds) {
ds.setColor(Common.resolveThemeAttribute(mContext, R.attr.colorPrimary));
ds.setColor(Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary));
}
};
SpannableString spannableString;
Expand Down Expand Up @@ -366,7 +366,7 @@ public void onClick(View v) {
baseBind.userName.setText(illust.getUser().getName());

SpannableString sizeString = new SpannableString(getString(R.string.string_193, illust.getWidth(), illust.getHeight()));
int currentPrimaryColorId = Common.resolveThemeAttribute(mContext, R.attr.colorPrimary);
int currentPrimaryColorId = Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary);
sizeString.setSpan(new ForegroundColorSpan(currentPrimaryColorId),
sizeString.length()-illust.getSize().length(), sizeString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
baseBind.illustPx.setText(sizeString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void loadImage() {
.into(baseBind.bgImage);
break;
case Configuration.UI_MODE_NIGHT_YES:
baseBind.bgImage.setImageResource(R.color.black);
baseBind.bgImage.setImageResource(R.color.black_to_grey);
break;
}

Expand Down Expand Up @@ -475,7 +475,7 @@ public void onClick(View v) {
baseBind.userName.setText(illust.getUser().getName());

SpannableString sizeString = new SpannableString(getString(R.string.string_193, illust.getWidth(), illust.getHeight()));
int currentPrimaryColorId = Common.resolveThemeAttribute(mContext, R.attr.colorPrimary);
int currentPrimaryColorId = Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary);
sizeString.setSpan(new ForegroundColorSpan(currentPrimaryColorId),
sizeString.length()-illust.getSize().length(), sizeString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
baseBind.illustPx.setText(sizeString);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ceui/lisa/fragments/FragmentWebView.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public void onResume() {
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
WebView.HitTestResult result = mWebView.getHitTestResult();
mIntentUrl = result.getExtra();
menu.setHeaderView(new ContextMenuTitleView(mContext, mIntentUrl, Common.resolveThemeAttribute(mContext, R.attr.colorPrimary)));
menu.setHeaderView(new ContextMenuTitleView(mContext, mIntentUrl, Common.resolveThemeAttribute(mContext, androidx.appcompat.R.attr.colorPrimary)));

if (result.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE) {
mIntentUrl = result.getExtra();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ceui/lisa/page/ConstantPageInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ public class ConstantPageInfo {
/**
* 默认字体颜色
*/
public static int textColor = R.color.black;
public static int textColor = R.color.black_to_grey;
}
Loading

0 comments on commit 69192c5

Please sign in to comment.