Skip to content

Commit

Permalink
Merge pull request #672 from LoxiaLiSA/master
Browse files Browse the repository at this point in the history
aa
  • Loading branch information
CeuiLiSA authored Dec 23, 2024
2 parents b7298f0 + c1a526c commit 8e41ec2
Show file tree
Hide file tree
Showing 122 changed files with 1,800 additions and 1,417 deletions.
34 changes: 15 additions & 19 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "ceui.lisa.pixiv"
minSdkVersion 21
targetSdkVersion 34
versionCode 300
versionName "4.1.5"
versionCode 324
versionName "4.2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

javaCompileOptions {
Expand Down Expand Up @@ -81,21 +81,21 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'com.google.android.material:material:1.12.0'

//=============== lifecycle
def lifecycle_version = '2.8.4'
def lifecycle_version = '2.8.7'

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



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

Expand All @@ -114,14 +114,12 @@ dependencies {
kapt(project(":processor")) // 3

implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'com.github.bumptech.glide:okhttp3-integration: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'
}

implementation 'com.github.lzyzsd:circleprogress:1.2.1'

def refresh_version = "2.0.6"
def refresh_version = "2.1.0"
implementation "io.github.scwang90:refresh-layout-kernel:$refresh_version" //核心必须依赖
implementation "io.github.scwang90:refresh-header-classics:$refresh_version" //经典刷新头
implementation "io.github.scwang90:refresh-header-falsify:$refresh_version" //虚拟刷新头
Expand Down Expand Up @@ -150,8 +148,8 @@ dependencies {
implementation 'com.github.skydoves:transformationlayout:1.1.1'
implementation 'com.blankj:utilcodex:1.31.1'
implementation 'com.safframework.log:saf-logginginterceptor:1.6.0'
implementation 'com.google.firebase:firebase-analytics:22.1.0'
implementation 'com.google.firebase:firebase-crashlytics:19.0.3'
implementation 'com.google.firebase:firebase-analytics:22.1.2'
implementation 'com.google.firebase:firebase-crashlytics:19.2.1'

implementation 'com.afollestad:drag-select-recyclerview:2.4.0'

Expand All @@ -175,7 +173,7 @@ dependencies {
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava3:2.2.1'

def lottieVersion = "3.4.0"
def lottieVersion = "3.4.1"
implementation "com.airbnb.android:lottie:$lottieVersion"

implementation 'xyz.zpayh:hdimageview:3.0.2'
Expand All @@ -187,29 +185,27 @@ dependencies {
implementation 'com.tencent:mmkv-static:1.3.9'
implementation 'com.github.tbruyelle:rxpermissions:0.12'

implementation 'androidx.webkit:webkit:1.11.0'
implementation 'androidx.webkit:webkit:1.12.1'
implementation 'org.jsoup:jsoup:1.18.1'

implementation 'com.hjq:toast:8.8'
implementation 'com.jakewharton.timber:timber:5.0.1'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation "androidx.documentfile:documentfile:1.0.1"
implementation 'com.billy.android:smart-swipe:1.1.2'
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.9.1")
implementation("androidx.activity:activity-ktx:1.9.3")
implementation("com.google.android.flexbox:flexbox:3.0.0")

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

implementation("me.zhanghai.android.fastscroll:library:1.2.0")

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

configurations {
all*.exclude group: 'com.android.support', module: 'support-v13'
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/ceui/lisa/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public boolean hideStatusBar() {

@Override
protected void initView() {
Dev.isDev = Shaft.getMMKV().decodeBool(Params.USE_DEBUG, false);
Dev.isDev = false;
baseBind.drawerLayout.setScrimColor(Color.TRANSPARENT);
baseBind.navView.setNavigationItemSelectedListener(this);
userHead = baseBind.navView.getHeaderView(0).findViewById(R.id.user_head);
Expand Down Expand Up @@ -227,6 +227,7 @@ protected void initData() {
}
if (Dev.isDev) {
startActivity(new Intent(this, HomeActivity.class));
finish();
} else {
if (Common.isAndroidQ()) {
initFragment();
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/ceui/lisa/activities/Shaft.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.tencent.mmkv.MMKV;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import ceui.lisa.R;
import ceui.lisa.feature.HostManager;
import ceui.lisa.helper.ShortcutHelper;
Expand All @@ -37,6 +39,8 @@
import ceui.pixiv.session.SessionManager;
import me.jessyan.progressmanager.ProgressManager;
import okhttp3.OkHttpClient;
import timber.log.Timber;
import timber.log.Timber.DebugTree;

import static ceui.lisa.utils.Local.LOCAL_DATA;
/**
Expand Down Expand Up @@ -90,6 +94,8 @@ public void onCreate() {

sPreferences = getSharedPreferences(LOCAL_DATA, Context.MODE_PRIVATE);

Timber.plant(new Timber.DebugTree());

MMKV.initialize(this);

sUserModel = Local.getUser();
Expand Down Expand Up @@ -182,6 +188,23 @@ private void updateTheme() {
}
}

public static String getThemeColor() {
int current = Shaft.sSettings.getThemeIndex();
return switch (current) {
case 0 -> "#686bdd";
case 1 -> "#56baec";
case 2 -> "#008BF3";
case 3 -> "#03d0bf";
case 4 -> "#fee65e";
case 5 -> "#fe83a2";
case 6 -> "#F44336";
case 7 -> "#673AB7";
case 8 -> "#4CAF50";
case 9 -> "#E91E63";
default -> "#686bdd";
};
}

@Override
public void unbindService(ServiceConnection conn) {
try {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/ceui/lisa/activities/UActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import timber.log.Timber

class UActivity : BaseActivity<ActivityNewUserBinding>(), Display<UserDetailResponse> {
private var userId = 0
Expand Down Expand Up @@ -291,7 +292,7 @@ fun FragmentActivity.unfollowUser(sender: ProgressTextButton, userId: Int) {
ObjectPool.unFollowUser(userId.toLong())
Common.showToast(getString(R.string.cancel_like))
} catch (ex: Exception) {
ex.printStackTrace()
Timber.e(ex)
Common.showToast(ex.message)
} finally {
sender.hideProgress()
Expand Down
10 changes: 3 additions & 7 deletions app/src/main/java/ceui/lisa/feature/HostManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,8 @@ private static class SingletonHolder {
}

public void init() {
if (Dev.isDev) {
host = "210.140.139.132";
updateHost();
} else {
host = randomHost();
updateHost();
}
host = randomHost();
updateHost();
}

/**
Expand All @@ -63,6 +58,7 @@ private String randomHost() {
"210.140.139.138"
};
return already[Common.flatRandom(already.length)];

}

private void updateHost() {
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/java/ceui/lisa/fragments/FragmentImageDetail.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.viewModels
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.lifecycleScope
import ceui.lisa.R
import ceui.lisa.activities.Shaft
import ceui.lisa.databinding.FragmentImageDetailBinding
import ceui.lisa.download.IllustDownload
import ceui.lisa.models.IllustsBean
import ceui.lisa.utils.Params
import ceui.pixiv.ui.common.setUpFullScreen
import ceui.pixiv.ui.common.setUpWithTaskStatus
import ceui.pixiv.ui.task.NamedUrl
import ceui.pixiv.ui.task.TaskPool
import ceui.pixiv.ui.works.ToggleToolnarViewModel
import ceui.refactor.setOnClick
import com.github.panpf.sketch.loadImage
import kotlinx.coroutines.launch

class FragmentImageDetail : BaseFragment<FragmentImageDetailBinding?>() {
private var mIllustsBean: IllustsBean? = null
Expand Down Expand Up @@ -64,7 +59,7 @@ class FragmentImageDetail : BaseFragment<FragmentImageDetailBinding?>() {

if (imageUrl?.isNotEmpty() == true) {
val task = TaskPool.getLoadTask(NamedUrl("", imageUrl), requireActivity())
task.file.observe(viewLifecycleOwner) { file ->
task.result.observe(viewLifecycleOwner) { file ->
baseBind.image.loadImage(file)
}
baseBind.progressCircular.setUpWithTaskStatus(task.status, viewLifecycleOwner)
Expand Down
110 changes: 7 additions & 103 deletions app/src/main/java/ceui/lisa/fragments/FragmentLogin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,44 +66,19 @@ class FragmentLogin : BaseFragment<ActivityLoginBinding>() {
startActivity(intent)
return@OnMenuItemClickListener true
} else if (item.itemId == R.id.action_import) {
if (Dev.isDev) {
performLogin(SAMPLE_USER_TOKEN)
val userJson = ClipBoardUtils.getClipboardContent(mContext)
if (userJson != null && !TextUtils.isEmpty(userJson)
&& userJson.contains(Params.USER_KEY)
) {
performLogin(userJson)
} else {
val userJson = ClipBoardUtils.getClipboardContent(mContext)
if (userJson != null && !TextUtils.isEmpty(userJson)
&& userJson.contains(Params.USER_KEY)
) {
performLogin(userJson)
} else {
Common.showToast("剪贴板无用户信息", 3)
}
Common.showToast("剪贴板无用户信息", 3)
}
return@OnMenuItemClickListener true
}
false
})
setTitle()
baseBind.title.setOnClickListener {
if (mHitCountDown > 0) {
mHitCountDown--
if (mHitCountDown == 0) {
showDialog()
} else if (mHitCountDown > 0 && mHitCountDown < TAPS_TO_BE_A_DEVELOPER - 2) {
if (mHitToast != null) {
mHitToast?.cancel()
}
mHitToast = Toast.makeText(
mActivity, String.format(
Locale.getDefault(),
"点击%d次切换版本", mHitCountDown
), Toast.LENGTH_SHORT
)
mHitToast?.show()
}
} else {
showDialog()
}
}
baseBind.title.text = getString(R.string.app_name)
baseBind.login.setOnClickListener {
checkAndNext {
openProxyHint {
Expand Down Expand Up @@ -195,32 +170,6 @@ class FragmentLogin : BaseFragment<ActivityLoginBinding>() {
qmuiDialog.show()
}

private fun setTitle() {
if (Shaft.getMMKV().decodeBool(Params.USE_DEBUG, false)) {
baseBind.title.text = "Shaft(测试版)"
} else {
baseBind.title.text = "Shaft"
}
}

private fun showDialog() {
val builder = AlertDialog.Builder(mContext)
val titles = arrayOf("使用正式版", "使用测试版")
builder.setItems(titles) { dialog, which ->
if (which == 0) {
Shaft.getMMKV().encode(Params.USE_DEBUG, false)
Dev.isDev = false
} else if (which == 1) {
Shaft.getMMKV().encode(Params.USE_DEBUG, true)
Dev.isDev = true
}
mHitCountDown = TAPS_TO_BE_A_DEVELOPER
setTitle()
}
val alertDialog = builder.create()
alertDialog.show()
}

override fun initData() {
if (Shaft.getMMKV().decodeBool(Params.SHOW_DIALOG, true)) {
Common.createDialog(mContext)
Expand Down Expand Up @@ -315,48 +264,3 @@ fun SpannableString.setLinkSpan(text: String, hideUnderLine: Boolean = true, col
)
}
}

private const val SAMPLE_USER_TOKEN = """{
"access_token": "kj_cDCmlXxdvRkUQ8LfgfyQoprxq6MEBDAW5A41uqb0",
"expires_in": 3600,
"token_type": "bearer",
"scope": "",
"refresh_token": "C6tnl4ByWwOkfmckPJsJPf_Ra-MO_-TW_Q1bH1g2a38",
"user": {
"profile_image_urls": {
"px_16x16": "https:\/\/i.pximg.net\/user-profile\/img\/2018\/12\/22\/16\/00\/30\/15159182_1e25c44944b0130e7fc9cbf22db96844_16.jpg",
"px_50x50": "https:\/\/i.pximg.net\/user-profile\/img\/2018\/12\/22\/16\/00\/30\/15159182_1e25c44944b0130e7fc9cbf22db96844_50.jpg",
"px_170x170": "https:\/\/i.pximg.net\/user-profile\/img\/2018\/12\/22\/16\/00\/30\/15159182_1e25c44944b0130e7fc9cbf22db96844_170.jpg"
},
"id": "31660292",
"name": "meppoi",
"account": "meppoi",
"mail_address": "863043461@qq.com",
"is_premium": false,
"x_restrict": 0,
"is_mail_authorized": true,
"require_policy_agreement": false
},
"response": {
"access_token": "kj_cDCmlXxdvRkUQ8LfgfyQoprxq6MEBDAW5A41uqb0",
"expires_in": 3600,
"token_type": "bearer",
"scope": "",
"refresh_token": "C6tnl4ByWwOkfmckPJsJPf_Ra-MO_-TW_Q1bH1g2a38",
"user": {
"profile_image_urls": {
"px_16x16": "https:\/\/i.pximg.net\/user-profile\/img\/2018\/12\/22\/16\/00\/30\/15159182_1e25c44944b0130e7fc9cbf22db96844_16.jpg",
"px_50x50": "https:\/\/i.pximg.net\/user-profile\/img\/2018\/12\/22\/16\/00\/30\/15159182_1e25c44944b0130e7fc9cbf22db96844_50.jpg",
"px_170x170": "https:\/\/i.pximg.net\/user-profile\/img\/2018\/12\/22\/16\/00\/30\/15159182_1e25c44944b0130e7fc9cbf22db96844_170.jpg"
},
"id": "31660292",
"name": "meppoi",
"account": "meppoi",
"mail_address": "863043461@qq.com",
"is_premium": false,
"x_restrict": 0,
"is_mail_authorized": true,
"require_policy_agreement": false
}
}
}"""
Loading

0 comments on commit 8e41ec2

Please sign in to comment.