Skip to content

Commit

Permalink
Merge pull request #634 from LoxiaLiSA/master
Browse files Browse the repository at this point in the history
comments
  • Loading branch information
CeuiLiSA authored Aug 12, 2024
2 parents 30cdcda + 5958390 commit c35f757
Show file tree
Hide file tree
Showing 172 changed files with 6,156 additions and 204 deletions.
26 changes: 14 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'kotlin-parcelize'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'org.jmailen.kotlinter'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'androidx.navigation.safeargs.kotlin'

android {
compileSdk 34
Expand All @@ -15,8 +15,8 @@ android {
applicationId "ceui.lisa.pixiv"
minSdkVersion 21
targetSdkVersion 34
versionCode 288
versionName "4.1.1"
versionCode 292
versionName "4.1.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

javaCompileOptions {
Expand Down Expand Up @@ -73,6 +73,9 @@ android {
}

namespace 'ceui.lisa'
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
}

dependencies {
Expand Down Expand Up @@ -110,9 +113,9 @@ dependencies {
implementation(project(":processor")) // 2
kapt(project(":processor")) // 3

implementation 'com.github.bumptech.glide:glide:4.14.2'
kapt 'com.github.bumptech.glide:compiler:4.14.2'
implementation ('com.github.bumptech.glide:okhttp3-integration:4.14.1'){
implementation 'com.github.bumptech.glide:glide:4.16.0'
kapt 'com.github.bumptech.glide:compiler:4.16.0'
implementation ('com.github.bumptech.glide:okhttp3-integration:4.16.0'){
exclude group: 'glide-parent'
}

Expand All @@ -121,11 +124,8 @@ dependencies {
def refresh_version = "2.0.6"
implementation "io.github.scwang90:refresh-layout-kernel:$refresh_version" //核心必须依赖
implementation "io.github.scwang90:refresh-header-classics:$refresh_version" //经典刷新头
implementation "io.github.scwang90:refresh-header-radar:$refresh_version" //雷达刷新头
implementation "io.github.scwang90:refresh-header-falsify:$refresh_version" //虚拟刷新头
implementation "io.github.scwang90:refresh-header-material:$refresh_version" //谷歌刷新头
implementation "io.github.scwang90:refresh-header-two-level:$refresh_version" //二级刷新头
implementation "io.github.scwang90:refresh-footer-ball:$refresh_version" //球脉冲加载
implementation "io.github.scwang90:refresh-footer-classics:$refresh_version" //经典加载

// okhttp3系列组件版本最高到 4.4.1,参看 RubySSLSocketFactory
Expand Down Expand Up @@ -162,6 +162,8 @@ dependencies {
implementation 'com.effective.android:panelSwitchHelper-androidx:1.3.13'
implementation 'com.makeramen:roundedimageview:2.3.0'

implementation 'io.github.csdn-mobile:RoundView:1.8.0'


implementation 'com.github.liujingxing.rxhttp:rxhttp:2.7.3'
// okhttp3系列组件版本最高到 4.4.1,参看 RubySSLSocketFactory
Expand All @@ -178,7 +180,7 @@ dependencies {
implementation project(path: ':progressmanager')
implementation project(path: ':flowlayout-lib')
implementation 'com.waynejo:androidndkgif:0.3.3'
implementation 'com.tencent:mmkv-static:1.2.12'
implementation 'com.tencent:mmkv-static:1.3.9'
implementation 'com.github.tbruyelle:rxpermissions:0.12'

implementation 'androidx.webkit:webkit:1.11.0'
Expand All @@ -195,9 +197,9 @@ dependencies {
implementation 'org.honorato.multistatetogglebutton:multistatetogglebutton:0.2.2'
implementation "io.noties.markwon:core:4.6.2"
// Java language implementation
implementation("androidx.activity:activity-ktx:1.8.1")
implementation("androidx.activity:activity-ktx:1.9.1")

implementation("io.github.panpf.zoomimage:zoomimage-view-sketch:1.1.0-alpha04")
implementation("io.github.panpf.zoomimage:zoomimage-view-sketch:1.1.0-alpha05")

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
android:theme="@style/AppTheme"
tools:ignore="UnusedAttribute">
<activity
android:name="ceui.loxia.test.ListActivity"
android:exported="false" />
android:name="ceui.pixiv.ui.common.HomeActivity"
android:exported="false"
android:label="@string/title_activity_home" />

<provider
android:name="androidx.core.content.FileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.viewpager.widget.ViewPager
import ceui.lisa.R
import ceui.lisa.databinding.ActivityImageDetailBinding
import ceui.lisa.download.IllustDownload
import ceui.lisa.fragments.FragmentImageDetail
import ceui.lisa.fragments.FragmentImageDetail.Companion.newInstance
import ceui.lisa.fragments.FragmentLocalImageDetail
import ceui.lisa.helper.PageTransformerHelper
Expand Down Expand Up @@ -118,7 +119,7 @@ class ImageDetailActivity : BaseActivity<ActivityImageDetailBinding?>() {
supportFragmentManager
) {
override fun getItem(i: Int): Fragment {
return FragmentLocalImageDetail.newInstance(localIllust!![i])
return newInstance(localIllust!![i])
}

override fun getCount(): Int {
Expand Down
38 changes: 22 additions & 16 deletions app/src/main/java/ceui/lisa/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import ceui.lisa.utils.ReverseImage;
import ceui.lisa.utils.ReverseWebviewCallback;
import ceui.lisa.view.DrawerLayoutViewPager;
import ceui.pixiv.ui.common.HomeActivity;
import ceui.pixiv.session.SessionManager;

import static ceui.lisa.R.id.nav_gallery;
import static ceui.lisa.R.id.nav_slideshow;
Expand Down Expand Up @@ -218,23 +220,27 @@ public int getCount() {

@Override
protected void initData() {
if (sUserModel != null && sUserModel.getUser() != null && sUserModel.getUser().isIs_login()) {
if (Common.isAndroidQ()) {
initFragment();
// startActivity(new Intent(this, ListActivity.class));
if (SessionManager.INSTANCE.isLoggedIn()) {
if (Dev.isDev && false) {
startActivity(new Intent(this, HomeActivity.class));
} else {
new RxPermissions(mActivity)
.requestEachCombined(
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
.subscribe(permission -> {
if (permission.granted) {
initFragment();
} else {
Common.showToast(mActivity.getString(R.string.access_denied));
finish();
}
});
if (Common.isAndroidQ()) {
initFragment();
// startActivity(new Intent(this, ListActivity.class));
} else {
new RxPermissions(mActivity)
.requestEachCombined(
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
.subscribe(permission -> {
if (permission.granted) {
initFragment();
} else {
Common.showToast(mActivity.getString(R.string.access_denied));
finish();
}
});
}
}
} else {
Intent intent = new Intent(mContext, TemplateActivity.class);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/ceui/lisa/activities/OutWakeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import ceui.lisa.utils.Local;
import ceui.lisa.utils.Params;
import ceui.lisa.utils.PixivOperate;
import ceui.loxia.AccountResponse;
import ceui.pixiv.session.SessionManager;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

Expand Down Expand Up @@ -209,6 +211,7 @@ public void success(UserModel userModel) {

userModel.getUser().setIs_login(true);
Local.saveUser(userModel);
SessionManager.INSTANCE.updateSession(userModel);

UserEntity userEntity = new UserEntity();
userEntity.setLoginTime(System.currentTimeMillis());
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/ceui/lisa/activities/Shaft.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import ceui.lisa.view.MyDeliveryHeader;
import ceui.lisa.viewmodel.AppLevelViewModel;
import ceui.loxia.ServicesProvider;
import ceui.pixiv.session.SessionManager;
import me.jessyan.progressmanager.ProgressManager;
import okhttp3.OkHttpClient;

Expand Down Expand Up @@ -97,6 +98,8 @@ public void onCreate() {

sSettings = Local.getSettings();

SessionManager.INSTANCE.load();

updateTheme();

ThemeHelper.applyTheme(null, sSettings.getThemeType());
Expand Down
51 changes: 44 additions & 7 deletions app/src/main/java/ceui/lisa/activities/TemplateActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@
import ceui.lisa.helper.BackHandlerHelper;
import ceui.lisa.models.IllustsBean;
import ceui.lisa.models.NovelBean;
import ceui.lisa.models.UserBean;
import ceui.lisa.models.UserModel;
import ceui.lisa.models.UserPreviewsBean;
import ceui.lisa.utils.Local;
import ceui.lisa.utils.Params;
import ceui.lisa.utils.ReverseResult;
import ceui.loxia.ObjectPool;
import ceui.loxia.ObjectType;
import ceui.loxia.flag.FlagDescFragment;
import ceui.loxia.flag.FlagReasonFragment;
import ceui.pixiv.ui.comments.CommentsFragment;

public class TemplateActivity extends BaseActivity<ActivityFragmentBinding> implements ColorPickerDialogListener {

Expand Down Expand Up @@ -133,13 +138,7 @@ protected Fragment createNewFragment() {
Uri imageUri = intent.getParcelableExtra(Params.REVERSE_SEARCH_IMAGE_URI);
return FragmentWebView.newInstance(result.getTitle(), result.getUrl(), result.getResponseBody(), result.getMime(), result.getEncoding(), result.getHistory_url(), imageUri);
case "相关评论": {
String title = intent.getStringExtra(Params.ILLUST_TITLE);
int workId = intent.getIntExtra(Params.ILLUST_ID, 0);
if(workId == 0){
workId = intent.getIntExtra(Params.NOVEL_ID, 0);
return FragmentComment.newNovelInstance(workId, title);
}
return FragmentComment.newIllustInstance(workId, title);
return getCommentsFragment(intent);
}
case "账号管理":
return new FragmentLocalUsers();
Expand Down Expand Up @@ -267,6 +266,44 @@ protected Fragment createNewFragment() {
return null;
}


private CommentsFragment getCommentsFragment(Intent intent) {
int workId = intent.getIntExtra(Params.ILLUST_ID, 0);

if (workId == 0) {
workId = intent.getIntExtra(Params.NOVEL_ID, 0);
NovelBean hit = ObjectPool.INSTANCE.getNovel(workId).getValue();
int illustArthurId = getArthurIdFromNovel(hit);
return CommentsFragment.Companion.newInstance(workId, illustArthurId, ObjectType.NOVEL);
} else {
IllustsBean hit = ObjectPool.INSTANCE.getIllust(workId).getValue();
int illustArthurId = getArthurIdFromIllust(hit);
return CommentsFragment.Companion.newInstance(workId, illustArthurId, ObjectType.ILLUST);
}
}

// Helper method to extract Arthur ID from NovelBean
private int getArthurIdFromNovel(NovelBean hit) {
if (hit != null) {
UserBean user = hit.getUser();
if (user != null) {
return user.getId();
}
}
return 0;
}

// Helper method to extract Arthur ID from IllustsBean
private int getArthurIdFromIllust(IllustsBean hit) {
if (hit != null) {
UserBean user = hit.getUser();
if (user != null) {
return user.getId();
}
}
return 0;
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (childFragment instanceof FragmentWebView) {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/ceui/lisa/fragments/FragmentIllust.kt
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,17 @@ class FragmentIllust : SwipeFragment<FragmentIllustBinding>() {
.listener(object : RequestListener<Bitmap?> {
override fun onLoadFailed(
e: GlideException?,
model: Any,
model: Any?,
target: Target<Bitmap?>,
isFirstResource: Boolean
): Boolean {
return false
}

override fun onResourceReady(
resource: Bitmap?,
resource: Bitmap,
model: Any,
target: Target<Bitmap?>,
target: Target<Bitmap?>?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/ceui/lisa/fragments/FragmentImageDetail.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.viewModels
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import ceui.lisa.R
Expand Down Expand Up @@ -31,6 +32,13 @@ import java.io.File
class ImageFileViewModel : ViewModel() {
val fileLiveData = MutableLiveData<File>()
var isHighQualityImageLoaded: Boolean = false
val progressLiveData = MutableLiveData<Int>()
val isFullscreenMode = MutableLiveData(false)

fun toggleFullscreen() {
val current = isFullscreenMode.value ?: false
isFullscreenMode.value = !current
}
}


Expand Down
Loading

0 comments on commit c35f757

Please sign in to comment.