From 982674828fdb5ea8f8cf25fb9af0cb11050a325b Mon Sep 17 00:00:00 2001 From: LoxiaLiSA Date: Tue, 11 Oct 2022 15:25:27 +0800 Subject: [PATCH 1/8] aa --- .idea/gradle.xml | 2 +- .../ceui/lisa/fragments/FragmentLogin.java | 282 ---------------- .../java/ceui/lisa/fragments/FragmentLogin.kt | 313 ++++++++++++++++++ .../main/java/ceui/lisa/utils/Settings.java | 2 +- .../main/res/drawable-hdpi/terms_checked.png | Bin 0 -> 1780 bytes .../main/res/drawable-mdpi/terms_checked.png | Bin 0 -> 1023 bytes .../main/res/drawable-xhdpi/terms_checked.png | Bin 0 -> 2607 bytes .../res/drawable-xxhdpi/terms_checked.png | Bin 0 -> 4689 bytes .../res/drawable-xxxhdpi/terms_checked.png | Bin 0 -> 6973 bytes app/src/main/res/drawable/ic_checkbox_off.xml | 14 + app/src/main/res/drawable/terms_checkbox.xml | 9 + app/src/main/res/layout/activity_login.xml | 50 ++- app/src/main/res/values/colors.xml | 24 ++ app/src/main/res/values/strings.xml | 4 + 14 files changed, 415 insertions(+), 285 deletions(-) delete mode 100644 app/src/main/java/ceui/lisa/fragments/FragmentLogin.java create mode 100644 app/src/main/java/ceui/lisa/fragments/FragmentLogin.kt create mode 100644 app/src/main/res/drawable-hdpi/terms_checked.png create mode 100644 app/src/main/res/drawable-mdpi/terms_checked.png create mode 100644 app/src/main/res/drawable-xhdpi/terms_checked.png create mode 100644 app/src/main/res/drawable-xxhdpi/terms_checked.png create mode 100644 app/src/main/res/drawable-xxxhdpi/terms_checked.png create mode 100644 app/src/main/res/drawable/ic_checkbox_off.xml create mode 100644 app/src/main/res/drawable/terms_checkbox.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 24cfd1027..d20d41162 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -7,6 +7,7 @@ - diff --git a/app/src/main/java/ceui/lisa/fragments/FragmentLogin.java b/app/src/main/java/ceui/lisa/fragments/FragmentLogin.java deleted file mode 100644 index 58826ad35..000000000 --- a/app/src/main/java/ceui/lisa/fragments/FragmentLogin.java +++ /dev/null @@ -1,282 +0,0 @@ -package ceui.lisa.fragments; - -import android.content.DialogInterface; -import android.content.Intent; -import android.text.TextUtils; -import android.view.MenuItem; -import android.view.View; -import android.view.Window; -import android.widget.Toast; - -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.widget.Toolbar; - -import com.facebook.rebound.SimpleSpringListener; -import com.facebook.rebound.Spring; -import com.facebook.rebound.SpringConfig; -import com.facebook.rebound.SpringSystem; -import com.qmuiteam.qmui.skin.QMUISkinManager; -import com.qmuiteam.qmui.widget.dialog.QMUIDialog; -import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; - -import java.util.Locale; - -import ceui.lisa.R; -import ceui.lisa.activities.MainActivity; -import ceui.lisa.activities.Shaft; -import ceui.lisa.activities.TemplateActivity; -import ceui.lisa.database.AppDatabase; -import ceui.lisa.database.UserEntity; -import ceui.lisa.databinding.ActivityLoginBinding; -import ceui.lisa.feature.HostManager; -import ceui.lisa.interfaces.FeedBack; -import ceui.lisa.models.UserModel; -import ceui.lisa.utils.ClipBoardUtils; -import ceui.lisa.utils.Common; -import ceui.lisa.utils.Dev; -import ceui.lisa.utils.Local; -import ceui.lisa.utils.Params; - -public class FragmentLogin extends BaseFragment { - - public static final String IOS_CLIENT_ID = "KzEZED7aC0vird8jWyHM38mXjNTY"; - public static final String IOS_CLIENT_SECRET = "W9JZoJe00qPvJsiyCGT3CCtC6ZUtdpKpzMbNlUGP"; - - public static final String CLIENT_ID = "MOBrBDS8blbauoSck0ZfDbtuzpyT"; - public static final String CLIENT_SECRET = "lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj"; - public static final String DEVICE_TOKEN = "pixiv"; - public static final String TYPE_PASSWORD = "password"; - public static final String REFRESH_TOKEN = "refresh_token"; - public static final String AUTH_CODE = "authorization_code"; - public static final String CALL_BACK = "https://app-api.pixiv.net/web/v1/users/auth/pixiv/callback"; - private static final String SIGN_TOKEN = "Bearer l-f9qZ0ZyqSwRyZs8-MymbtWBbSxmCu1pmbOlyisou8"; - private static final String SIGN_REF = "pixiv_android_app_provisional_account"; - - private static final String LOGIN_HEAD = "https://app-api.pixiv.net/web/v1/login?code_challenge="; - private static final String LOGIN_END = "&code_challenge_method=S256&client=pixiv-android"; - - private static final String SIGN_HEAD = "https://app-api.pixiv.net/web/v1/provisional-accounts/create?code_challenge="; - private static final String SIGN_END = "&code_challenge_method=S256&client=pixiv-android"; - private static final int TAPS_TO_BE_A_DEVELOPER = 7; - private final SpringSystem springSystem = SpringSystem.create(); - private Spring rotate; - private int mHitCountDown;// - private Toast mHitToast; - - @Override - public void onResume() { - super.onResume(); - mHitCountDown = TAPS_TO_BE_A_DEVELOPER; - } - - @Override - public void initLayout() { - mLayoutID = R.layout.activity_login; - } - - @Override - public void initView() { - baseBind.toolbar.setPadding(0, Shaft.statusHeight, 0, 0); - baseBind.toolbar.inflateMenu(R.menu.login_menu); - baseBind.toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - if (item.getItemId() == R.id.action_settings) { - Intent intent = new Intent(mContext, TemplateActivity.class); - intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "设置"); - startActivity(intent); - return true; - } else if (item.getItemId() == R.id.action_import) { - String userJson = ClipBoardUtils.getClipboardContent(mContext); - if (userJson != null - && !TextUtils.isEmpty(userJson) - && userJson.contains(Params.USER_KEY)) { - Common.showToast("导入成功", 2); - UserModel exportUser = Shaft.sGson.fromJson(userJson, UserModel.class); - Local.saveUser(exportUser); - Dev.refreshUser = true; - Shaft.sUserModel = exportUser; - - UserEntity userEntity = new UserEntity(); - userEntity.setLoginTime(System.currentTimeMillis()); - userEntity.setUserID(exportUser.getUser().getId()); - userEntity.setUserGson(Shaft.sGson.toJson(Local.getUser())); - AppDatabase.getAppDatabase(mContext).downloadDao().insertUser(userEntity); - - Intent intent = new Intent(mContext, MainActivity.class); - MainActivity.newInstance(intent, mContext); - mActivity.finish(); - } else { - Common.showToast("剪贴板无用户信息", 3); - } - return true; - } - return false; - } - }); - setTitle(); - baseBind.title.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - 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.login.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - openProxyHint(() -> { - String url = LOGIN_HEAD + HostManager.get().getPkce().getChallenge() + LOGIN_END; - Intent intent = new Intent(mContext, TemplateActivity.class); - intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接"); - intent.putExtra(Params.URL, url); - intent.putExtra(Params.TITLE, getString(R.string.now_login)); - intent.putExtra(Params.PREFER_PRESERVE, true); - startActivity(intent); - }); - } - }); - - baseBind.sign.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - openProxyHint(() -> { - String url = SIGN_HEAD + HostManager.get().getPkce().getChallenge() + SIGN_END; - Intent intent = new Intent(mContext, TemplateActivity.class); - intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接"); - intent.putExtra(Params.URL, url); - intent.putExtra(Params.TITLE, getString(R.string.now_sign)); - intent.putExtra(Params.PREFER_PRESERVE, true); - startActivity(intent); - }); - } - }); - baseBind.hasNoAccount.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - showSignCard(); - } - }); - baseBind.goToLogin.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - showLoginCard(); - } - }); - } - - private void openProxyHint(FeedBack feedBack) { - QMUIDialog qmuiDialog = new QMUIDialog.MessageDialogBuilder(mContext) - .setTitle(mContext.getString(R.string.string_143)) - .setMessage(mContext.getString(R.string.string_360)) - .setSkinManager(QMUISkinManager.defaultInstance(mContext)) - .addAction(mContext.getString(R.string.cancel), new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - dialog.dismiss(); - } - }) - .addAction(mContext.getString(R.string.string_361), new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - feedBack.doSomething(); - dialog.dismiss(); - } - }) - .create(); - Window window = qmuiDialog.getWindow(); - if (window != null) { - window.setWindowAnimations(R.style.dialog_animation_scale); - } - qmuiDialog.show(); - } - - private void setTitle() { - if (Shaft.getMMKV().decodeBool(Params.USE_DEBUG, false)) { - baseBind.title.setText("Shaft(测试版)"); - } else { - baseBind.title.setText("Shaft"); - } - } - - private void showDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(mContext); - String[] titles = new String[]{"使用正式版", "使用测试版"}; - builder.setItems(titles, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int 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(); - } - }); - AlertDialog alertDialog = builder.create(); - alertDialog.show(); - } - - @Override - protected void initData() { - if (Shaft.getMMKV().decodeBool(Params.SHOW_DIALOG, true)) { - Common.createDialog(mContext); - } - rotate = springSystem.createSpring(); - rotate.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(15, 8)); - } - - public void showSignCard() { - baseBind.fragmentLogin.setVisibility(View.INVISIBLE); - baseBind.fragmentSign.setVisibility(View.VISIBLE); - rotate.setCurrentValue(0); - baseBind.fragmentSign.setCameraDistance(80000.0f); - rotate.addListener(new SimpleSpringListener() { - @Override - public void onSpringUpdate(Spring spring) { - baseBind.fragmentSign.setRotationY((float) spring.getCurrentValue()); - } - - @Override - public void onSpringAtRest(Spring spring) { - - } - }); - rotate.setEndValue(360.0f); - } - - public void showLoginCard() { - baseBind.fragmentSign.setVisibility(View.INVISIBLE); - baseBind.fragmentLogin.setVisibility(View.VISIBLE); - rotate.setCurrentValue(0); - baseBind.fragmentLogin.setCameraDistance(80000.0f); - rotate.addListener(new SimpleSpringListener() { - @Override - public void onSpringUpdate(Spring spring) { - baseBind.fragmentLogin.setRotationY((float) spring.getCurrentValue()); - } - - @Override - public void onSpringAtRest(Spring spring) { - - } - }); - rotate.setEndValue(360.0f); - } -} diff --git a/app/src/main/java/ceui/lisa/fragments/FragmentLogin.kt b/app/src/main/java/ceui/lisa/fragments/FragmentLogin.kt new file mode 100644 index 000000000..7833ec378 --- /dev/null +++ b/app/src/main/java/ceui/lisa/fragments/FragmentLogin.kt @@ -0,0 +1,313 @@ +package ceui.lisa.fragments + +import android.content.Intent +import android.text.SpannableString +import android.text.Spanned +import android.text.TextPaint +import android.text.TextUtils +import android.text.method.LinkMovementMethod +import android.text.style.ClickableSpan +import android.view.View +import android.widget.Toast +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.widget.Toolbar +import androidx.fragment.app.viewModels +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import androidx.lifecycle.lifecycleScope +import ceui.lisa.R +import ceui.lisa.fragments.BaseFragment +import com.facebook.rebound.SpringSystem +import com.facebook.rebound.Spring +import ceui.lisa.fragments.FragmentLogin +import ceui.lisa.activities.Shaft +import ceui.lisa.activities.TemplateActivity +import ceui.lisa.models.UserModel +import ceui.lisa.database.UserEntity +import ceui.lisa.database.AppDatabase +import ceui.lisa.activities.MainActivity +import ceui.lisa.databinding.ActivityLoginBinding +import ceui.lisa.interfaces.FeedBack +import ceui.lisa.feature.HostManager +import ceui.lisa.utils.* +import com.qmuiteam.qmui.widget.dialog.QMUIDialog +import com.qmuiteam.qmui.widget.dialog.QMUIDialog.MessageDialogBuilder +import com.qmuiteam.qmui.skin.QMUISkinManager +import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction +import com.facebook.rebound.SpringConfig +import com.facebook.rebound.SimpleSpringListener +import kotlinx.coroutines.launch +import java.util.* + +class LandingViewModel : ViewModel() { + + val isChecked = MutableLiveData(false) +} + +class FragmentLogin : BaseFragment() { + + private val viewModel: LandingViewModel by viewModels() + private val springSystem = SpringSystem.create() + private var rotate: Spring? = null + private var mHitCountDown // + = 0 + private var mHitToast: Toast? = null + override fun onResume() { + super.onResume() + mHitCountDown = TAPS_TO_BE_A_DEVELOPER + } + + public override fun initLayout() { + mLayoutID = R.layout.activity_login + } + + public override fun initView() { + baseBind.toolbar.setPadding(0, Shaft.statusHeight, 0, 0) + baseBind.toolbar.inflateMenu(R.menu.login_menu) + baseBind.toolbar.setOnMenuItemClickListener(Toolbar.OnMenuItemClickListener { item -> + if (item.itemId == R.id.action_settings) { + val intent = Intent(mContext, TemplateActivity::class.java) + intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "设置") + startActivity(intent) + return@OnMenuItemClickListener true + } else if (item.itemId == R.id.action_import) { + val userJson = ClipBoardUtils.getClipboardContent(mContext) + if (userJson != null && !TextUtils.isEmpty(userJson) + && userJson.contains(Params.USER_KEY) + ) { + Common.showToast("导入成功", 2) + val exportUser = Shaft.sGson.fromJson(userJson, UserModel::class.java) + Local.saveUser(exportUser) + Dev.refreshUser = true + Shaft.sUserModel = exportUser + val userEntity = UserEntity() + userEntity.loginTime = System.currentTimeMillis() + userEntity.userID = exportUser.user.id + userEntity.userGson = Shaft.sGson.toJson(Local.getUser()) + AppDatabase.getAppDatabase(mContext).downloadDao().insertUser(userEntity) + val intent = Intent(mContext, MainActivity::class.java) + MainActivity.newInstance(intent, mContext) + mActivity.finish() + } else { + 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.login.setOnClickListener { + checkAndNext { + openProxyHint { + val url = LOGIN_HEAD + HostManager.get().pkce.challenge + LOGIN_END + val intent = Intent(mContext, TemplateActivity::class.java) + intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接") + intent.putExtra(Params.URL, url) + intent.putExtra(Params.TITLE, getString(R.string.now_login)) + intent.putExtra(Params.PREFER_PRESERVE, true) + startActivity(intent) + } + } + } + baseBind.sign.setOnClickListener { + checkAndNext { + openProxyHint { + val url = SIGN_HEAD + HostManager.get().pkce.challenge + SIGN_END + val intent = Intent(mContext, TemplateActivity::class.java) + intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接") + intent.putExtra(Params.URL, url) + intent.putExtra(Params.TITLE, getString(R.string.now_sign)) + intent.putExtra(Params.PREFER_PRESERVE, true) + startActivity(intent) + } + } + } + baseBind.hasNoAccount.setOnClickListener { showSignCard() } + baseBind.goToLogin.setOnClickListener { showLoginCard() } + baseBind.firstText.movementMethod = LinkMovementMethod.getInstance() + val matchTOS = getString(R.string.terms_of_service) + val matchPP = getString(R.string.privacy_policy) + val terms = String.format(getString(R.string.landing_terms_base), matchTOS, matchPP) + baseBind.firstText.text = SpannableString(terms).apply { + this.setLinkSpan(matchTOS, hideUnderLine = false) { + val intent = Intent(mContext, TemplateActivity::class.java) + intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接") + intent.putExtra(Params.URL, "https://www.pixiv.net/terms/?page=term&appname=pixiv_ios") + intent.putExtra(Params.TITLE, getString(R.string.pixiv_use_detail)) + startActivity(intent) + } + this.setLinkSpan(matchPP, hideUnderLine = false) { + val intent = Intent(mContext, TemplateActivity::class.java) + intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "网页链接") + intent.putExtra(Params.URL,"https://www.pixiv.net/terms/?page=privacy&appname=pixiv_ios") + intent.putExtra(Params.TITLE, getString(R.string.privacy)) + startActivity(intent) + } + } + viewModel.isChecked.observe(this) { + baseBind.checkboxOne.isSelected = it + } + + baseBind.checkboxOne.setOnClickListener { + val res = viewModel.isChecked.value ?: false + viewModel.isChecked.value = !res + } + } + + private fun openProxyHint(feedBack: FeedBack) { + val qmuiDialog = MessageDialogBuilder(mContext) + .setTitle(mContext.getString(R.string.string_143)) + .setMessage(mContext.getString(R.string.string_360)) + .setSkinManager(QMUISkinManager.defaultInstance(mContext)) + .addAction(mContext.getString(R.string.cancel)) { dialog, index -> dialog.dismiss() } + .addAction(mContext.getString(R.string.string_361)) { dialog, index -> + feedBack.doSomething() + dialog.dismiss() + } + .create() + val window = qmuiDialog.window + window?.setWindowAnimations(R.style.dialog_animation_scale) + 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) + } + rotate = springSystem.createSpring() + rotate?.springConfig = SpringConfig.fromOrigamiTensionAndFriction(15.0, 8.0) + } + + private fun checkAndNext(block: ()->Unit) { + if (viewModel.isChecked.value == true) { + block() + } else { + Toast.makeText(requireContext(), getString(R.string.read_agreement), Toast.LENGTH_SHORT).show() + } + } + + private fun showSignCard() { + baseBind.fragmentLogin.visibility = View.INVISIBLE + baseBind.fragmentSign.visibility = View.VISIBLE + rotate?.currentValue = 0.0 + baseBind.fragmentSign.cameraDistance = 80000.0f + rotate?.addListener(object : SimpleSpringListener() { + override fun onSpringUpdate(spring: Spring) { + baseBind.fragmentSign.rotationY = spring.currentValue.toFloat() + } + + override fun onSpringAtRest(spring: Spring) {} + }) + rotate?.endValue = 360.0 + } + + private fun showLoginCard() { + baseBind.fragmentSign.visibility = View.INVISIBLE + baseBind.fragmentLogin.visibility = View.VISIBLE + rotate?.currentValue = 0.0 + baseBind.fragmentLogin.cameraDistance = 80000.0f + rotate?.addListener(object : SimpleSpringListener() { + override fun onSpringUpdate(spring: Spring) { + baseBind.fragmentLogin.rotationY = spring.currentValue.toFloat() + } + + override fun onSpringAtRest(spring: Spring) {} + }) + rotate?.endValue = 360.0 + } + + companion object { + const val IOS_CLIENT_ID = "KzEZED7aC0vird8jWyHM38mXjNTY" + const val IOS_CLIENT_SECRET = "W9JZoJe00qPvJsiyCGT3CCtC6ZUtdpKpzMbNlUGP" + const val CLIENT_ID = "MOBrBDS8blbauoSck0ZfDbtuzpyT" + const val CLIENT_SECRET = "lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj" + const val DEVICE_TOKEN = "pixiv" + const val TYPE_PASSWORD = "password" + const val REFRESH_TOKEN = "refresh_token" + const val AUTH_CODE = "authorization_code" + const val CALL_BACK = "https://app-api.pixiv.net/web/v1/users/auth/pixiv/callback" + private const val SIGN_TOKEN = "Bearer l-f9qZ0ZyqSwRyZs8-MymbtWBbSxmCu1pmbOlyisou8" + private const val SIGN_REF = "pixiv_android_app_provisional_account" + private const val LOGIN_HEAD = "https://app-api.pixiv.net/web/v1/login?code_challenge=" + private const val LOGIN_END = "&code_challenge_method=S256&client=pixiv-android" + private const val SIGN_HEAD = + "https://app-api.pixiv.net/web/v1/provisional-accounts/create?code_challenge=" + private const val SIGN_END = "&code_challenge_method=S256&client=pixiv-android" + private const val TAPS_TO_BE_A_DEVELOPER = 7 + } +} + +fun SpannableString.setLinkSpan(text: String, hideUnderLine: Boolean = true, color:Int? = null, action: () -> Unit) { + val textIndex = this.indexOf(text) + if (textIndex >= 0) { + setSpan( + object : ClickableSpan() { + override fun onClick(widget: View) { + action() + } + + override fun updateDrawState(ds: TextPaint) { + color?.let { + ds.linkColor = it + } + if (hideUnderLine) { + ds.color = ds.linkColor + ds.isUnderlineText = false + } else { + super.updateDrawState(ds) + } + } + }, + textIndex, + textIndex + text.length, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/ceui/lisa/utils/Settings.java b/app/src/main/java/ceui/lisa/utils/Settings.java index 6a78756a7..e37e97aa6 100644 --- a/app/src/main/java/ceui/lisa/utils/Settings.java +++ b/app/src/main/java/ceui/lisa/utils/Settings.java @@ -83,7 +83,7 @@ public void setCurrentProgress(long currentProgress) { private boolean deleteStarIllust = false; //是否自动添加DNS,true开启直连 false自行代理 - private boolean autoFuckChina = true; + private boolean autoFuckChina = false; private boolean relatedIllustNoLimit = true; diff --git a/app/src/main/res/drawable-hdpi/terms_checked.png b/app/src/main/res/drawable-hdpi/terms_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..3cd79c1ce7d3e3f7ccdc6aaac2f6ba03c94f6fb3 GIT binary patch literal 1780 zcmVPx#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR918=wOK1ONa40RR918vp{mgFZ>}Qkx2MNA_!7J#D^l2sJb?-q3MOrs7BLH zwaThsp#mVXOXSN>PG`H#BUS>fW<6gu>BW50`p3NyscJLEK z055M@b*Ei&#sRC;X+-~Kzgbg|IyjNSi5Dl?J4tmRl@!bu61rvct?w~;QsKlpE6&;K z>%*UzRIm4u9L-Uu26fD*NB?i4D8PZLnmq|4zH-fcbH*ETZNzFsA&cz`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Csp{kYVga+>LK9q01cV_o*_U+#_ zsx)B%QNy5ePGFvd_~T0!F8s#e(nlh=>+ShJy>;ZbM~BZ}L}DnWM@+?UZF01vP$a%4 z>?P9nBc~$NHOm&Q5g0XbxN*hYIbZwn6OVlVp1WqvrENbi`;50!aADt?rAw9r=Fyvg zF|WLReCxKMcMogim>`w0^D|zobNgpbpSpB%6TF;!bKnWWdCuReH;u4`eq@@G>#66M#NlR>yj8E|`4_XL?EwiMqI{b9| z?w9{{_WVsjT@SN)b9r=Z_=O#NHg`i9L%;>8r7}rc5RnCbDOvlJ-B@NbZ!#`$;(h=r zpGAd(LITq#ODj{5Hp!$+r~28>-CGX)`_!(R8K3-qv?#CqV&|Ss7mCr#EC~e>+2tC8 zoi39vOc!v$H||Sujn@u?K-Hu}VllR>o4 z6}jeDyY_85dGX3Q+yDqWhLvu-4D9&4WMyKNM^6TOQ9Jsny;6)a#!qk+s~PzSarMw! zI?C_129O3!yBps)wD09N-uk0*QVU?>z4pG^u=n8R!)J$20)Q;)M_G(V@kWngEBQR30M#7&+7rFJb! zSV7A!%y@tSA{NzxlG)VFxjcd?6Yq!@~Vhn-59maOX7?rD#d0J_Q=e{x7?>jJ0%O8|HDFKC|vCPg=`n-ozr zjbl!5lOQn5SlAlkU!AoT3+$H0L5Zo7ENVHA%K+9RWey{85yr)qy|s#Dm;l;qqprzd zILl!}6JbQTsR2X1@>}nWA3HZ+K^VZom%Y^C;NKlBE_|3N`lc*;UMEcLvy~e1W{VQo z3zaa0lg7uyQKSe~M=_N&jOwV+VFRy^n7IiUjgf#sSW^8ZlJGBtId%0y9DLk;45ZDs zeC{+T8WAuZg~V9GjzAm#wgki3=9h_D%lM`!8d2MZBOl R?lS-Y002ovPDHLkV1l&m!fOBk literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/terms_checked.png b/app/src/main/res/drawable-xxhdpi/terms_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..ff5960aa6b91abd668b945728067b151e2c310aa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Vf7|UPAaOqw*3^2tsuVo%tZmxiKGLq%!q*m!30p}F)yl~_qe>CfGAU& zq9U16UqxY^i%)nGCFvlJ&!i2v3-iRMu z&Cvz(*Ke14%;7$y0WEkU5D`-=$G%$w#DIvVqzSYwkos<>X5WV!BM&f!fLaX-aJ@x{ zp%kD{N(EmlPaqXILrB*Urvgg-gau5zMpj!%&?_^3aHZ?Bng*25ncvC5iNvZz#9oF8 zDPd~w2`WmimX#D>bWWsXN!d0X>zZw7NqzN9a}4Fe@cMBYpoBqKgo$q@*?mN#RKFsd z1u9$!+6v$lo$O5jEeDXQ-2zC}cgjQB3@`w~x$Xrp_A#8XG)5l~=cfTmqShEFg}{{9 zj~MyAU&2r0S{E*UW56eiBjo_=%+xT_#pF}_ouVX5$FD~v%VMG$A)It*Y}v$8h-oLwcLA>A3OgI2L`QG TUD}g*00000NkvXXu0mjfZ|%;` literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/terms_checked.png b/app/src/main/res/drawable-xxxhdpi/terms_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..4d89b40a5fc201e84fb6e0f4bcde772ee0add682 GIT binary patch literal 6973 zcmV-D8^Yv?P)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91NT34%1ONa40RR91NB{r;0FW_8?*ITAr%6OXRCod1oN2IJ#d(I$Hgm5w zBv~jD0wfk8FbHf>5RhfCh#dli*p!3qn5t}*id{+N2XXQ%mCBF&b1IeC2~erTcEyGe z6N*4$3b1jE(1wHnfsoiFVM%~iBwe)JduQe>d7tl`p4&5bN5a@{Y37{Mr%!i(Z@=Ht zefmxqjFILRPfc$&rYz5jVnrB*i;5sz5QgEbA}o4?AWVWHh{kyQ=jT=!cE@43uHG~7%%Sjx6QgxD9O=f~V%zkA^yHmEQT(=m5E#GAsTd5x@S!Qm zv~L^=FB=BbFo0$^)?eO=l5dC|3k;Stdm}&5*p{DYzL_6y9nIhC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3vV0USU9}Pl8@3UV&5SNa{YK zgc;b%JNf6XjOkSMJatl^F-vW6ZS4V0rBbH;YX20N{7-dw)u?(h=_+}E_TxhO{TvF_^eZR{+ndHqfaJ5On^AP$CaoG_pIMANtbz$+eJJNX z=Eh;C>Y`3#jP5%I)Ang#4I(2u7?}9N1Z>Qv@Z&;KgT0}CB8Fc<84sWK{jq>D0VGHp zED2{qR-ie-M>;w%93Z2C;sfIbtlhcEpCCIJfQ4bAD%xJ;wER4d|7V@9f9(|lm*E}T ze}YxzId$=hv`-xv?F^lq22iLD<`_8TFTbSvp`|O zkvI9JQ%d7|jZ>+9l0Wk1H#Pdt1O{yE)((0_%)bc9;xPF==AD!LnZW-C{D}Vc1sXC0 P00000NkvXXu0mjf7K7xG literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/ic_checkbox_off.xml b/app/src/main/res/drawable/ic_checkbox_off.xml new file mode 100644 index 000000000..04877df99 --- /dev/null +++ b/app/src/main/res/drawable/ic_checkbox_off.xml @@ -0,0 +1,14 @@ + + + diff --git a/app/src/main/res/drawable/terms_checkbox.xml b/app/src/main/res/drawable/terms_checkbox.xml new file mode 100644 index 000000000..602478971 --- /dev/null +++ b/app/src/main/res/drawable/terms_checkbox.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 205cd694e..d2a83d994 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -1,6 +1,7 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> @@ -215,6 +216,53 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 0686378ff..50e839c9d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -109,5 +109,29 @@ #ff445b #eaeaea + #FFFFFFFF + #0AFFFFFF + #14FFFFFF + #1AFFFFFF + #33FFFFFF + #1FFFFFFF + #26FFFFFF + #40FFFFFF + #4CFFFFFF + #66FFFFFF + #80FFFFFF + #99FFFFFF + #CCFFFFFF + #D9FFFFFF + #000000 + #1A000000 + #4C000000 + #66000000 + #80000000 + #99000000 + #CC000000 + #E6000000 + #F3000000 + #14000000 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8d0f54edd..3cca4b57e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -643,4 +643,8 @@ 插画二级详情保持屏幕常亮 下载限制类型 不自动下载 + 服务条款 + 隐私政策 + 欢迎使用!继续即表示你同意 Shaft 的 %s 并且确认已阅读我们的 %s. + 请先阅读协议 From 65105ee2fc36d124af1aa70e05153aced059b00a Mon Sep 17 00:00:00 2001 From: LoxiaLiSA Date: Fri, 17 Feb 2023 11:52:41 +0800 Subject: [PATCH 2/8] gradle update --- app/build.gradle | 25 +++++++++++--------- app/src/main/AndroidManifest.xml | 3 +-- build.gradle | 14 +++++++---- flowlayout-lib/build.gradle | 7 +++--- flowlayout-lib/src/main/AndroidManifest.xml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- models/build.gradle | 7 +++--- models/src/main/AndroidManifest.xml | 3 +-- progressmanager/build.gradle | 9 ++++--- progressmanager/src/main/AndroidManifest.xml | 4 +--- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f37ab3082..38960e9f0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,12 +8,12 @@ apply plugin: 'org.jmailen.kotlinter' apply plugin: "androidx.navigation.safeargs" android { - compileSdkVersion 31 + compileSdkVersion 33 defaultConfig { applicationId "ceui.lisa.pixiv" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 33 versionCode 221 versionName "3.2.21" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -64,11 +64,14 @@ android { buildFeatures { dataBinding true } - packagingOptions { - exclude 'META-INF/MANIFEST.MF' + resources { + excludes += ['META-INF/MANIFEST.MF'] + } } + namespace 'ceui.lisa' + // lintOptions { // checkReleaseBuilds false // // Or, if you prefer, you can continue to check for errors in release builds, @@ -91,11 +94,11 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' //=============== lifecycle - def lifecycle_version = '2.4.0' + def lifecycle_version = '2.5.1' implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" @@ -103,14 +106,14 @@ dependencies { //=============== Navigation - def nav_version = "2.3.5" + def nav_version = "2.5.3" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$kotlin_version" api 'com.squareup.retrofit2:retrofit:2.9.0' api 'com.squareup.retrofit2:converter-gson:2.9.0' @@ -155,8 +158,8 @@ dependencies { implementation 'com.github.skydoves:transformationlayout:1.1.1' implementation 'com.blankj:utilcodex:1.31.0' implementation 'com.safframework.log:saf-logginginterceptor:1.6.0' - implementation 'com.google.firebase:firebase-analytics:20.0.2' - implementation 'com.google.firebase:firebase-crashlytics:18.2.7' + implementation 'com.google.firebase:firebase-analytics:21.2.0' + implementation 'com.google.firebase:firebase-crashlytics:18.3.5' implementation 'com.afollestad:drag-select-recyclerview:2.4.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e1f16edcd..f339a95e0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,7 @@ + xmlns:tools="http://schemas.android.com/tools"> + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fdbc8533d..cede541c4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip diff --git a/models/build.gradle b/models/build.gradle index 5f99e95d1..0b66ea514 100644 --- a/models/build.gradle +++ b/models/build.gradle @@ -2,13 +2,11 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 30 + compileSdkVersion 33 defaultConfig { minSdkVersion 21 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" + targetSdkVersion 33 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' @@ -26,6 +24,7 @@ android { sourceCompatibility = '1.8' targetCompatibility = '1.8' } + namespace 'ceui.lisa.models' } dependencies { diff --git a/models/src/main/AndroidManifest.xml b/models/src/main/AndroidManifest.xml index 0734e7c26..94cbbcfc3 100644 --- a/models/src/main/AndroidManifest.xml +++ b/models/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/progressmanager/build.gradle b/progressmanager/build.gradle index 75809b58f..40b6a3d3a 100644 --- a/progressmanager/build.gradle +++ b/progressmanager/build.gradle @@ -1,13 +1,11 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 30 + compileSdkVersion 33 defaultConfig { minSdkVersion 21 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" + targetSdkVersion 33 testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' @@ -18,10 +16,11 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - lintOptions { + lint { abortOnError false warning 'InvalidPackage' } + namespace 'me.jessyan.progressmanager' } dependencies { diff --git a/progressmanager/src/main/AndroidManifest.xml b/progressmanager/src/main/AndroidManifest.xml index c383391e4..a2f47b605 100644 --- a/progressmanager/src/main/AndroidManifest.xml +++ b/progressmanager/src/main/AndroidManifest.xml @@ -1,4 +1,2 @@ - + From ff805a7e6c42d2f3b62bcf5fca4934f9aa0e7b03 Mon Sep 17 00:00:00 2001 From: LoxiaLiSA Date: Sun, 19 Feb 2023 20:55:31 +0800 Subject: [PATCH 3/8] aa --- .idea/gradle.xml | 2 +- app/build.gradle | 4 ++ app/src/main/AndroidManifest.xml | 71 +++++++++---------- .../ceui/lisa/activities/MainActivity.java | 10 +-- app/src/main/java/ceui/loxia/ObjectPool.kt | 4 ++ .../main/java/ceui/loxia/test/ItemFragment.kt | 34 +++++++++ .../main/java/ceui/loxia/test/ListActivity.kt | 12 ++++ .../loxia/test/MyItemRecyclerViewAdapter.kt | 48 +++++++++++++ .../test/placeholder/PlaceholderContent.kt | 57 +++++++++++++++ app/src/main/res/layout/activity_list.xml | 10 +++ app/src/main/res/layout/fragment_item.xml | 20 ++++++ .../main/res/layout/fragment_item_list2.xml | 13 ++++ app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/strings.xml | 2 +- build.gradle | 1 + 15 files changed, 245 insertions(+), 44 deletions(-) create mode 100644 app/src/main/java/ceui/loxia/ObjectPool.kt create mode 100644 app/src/main/java/ceui/loxia/test/ItemFragment.kt create mode 100644 app/src/main/java/ceui/loxia/test/ListActivity.kt create mode 100644 app/src/main/java/ceui/loxia/test/MyItemRecyclerViewAdapter.kt create mode 100644 app/src/main/java/ceui/loxia/test/placeholder/PlaceholderContent.kt create mode 100644 app/src/main/res/layout/activity_list.xml create mode 100644 app/src/main/res/layout/fragment_item.xml create mode 100644 app/src/main/res/layout/fragment_item_list2.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml index d20d41162..e145b66b7 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -7,7 +7,7 @@ \ No newline at end of file diff --git a/app/src/main/java/ceui/lisa/activities/MainActivity.java b/app/src/main/java/ceui/lisa/activities/MainActivity.java index 2d037a20a..1dc26f15c 100644 --- a/app/src/main/java/ceui/lisa/activities/MainActivity.java +++ b/app/src/main/java/ceui/lisa/activities/MainActivity.java @@ -49,6 +49,7 @@ import ceui.lisa.utils.ReverseImage; import ceui.lisa.utils.ReverseWebviewCallback; import ceui.lisa.view.DrawerLayoutViewPager; +import ceui.loxia.test.ListActivity; import static ceui.lisa.activities.Shaft.sUserModel; @@ -235,10 +236,11 @@ protected void initData() { }); } } else { - Intent intent = new Intent(mContext, TemplateActivity.class); - intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "登录注册"); - startActivity(intent); - finish(); +// Intent intent = new Intent(mContext, TemplateActivity.class); +// intent.putExtra(TemplateActivity.EXTRA_FRAGMENT, "登录注册"); +// startActivity(intent); +// finish(); + startActivity(new Intent(this, ListActivity.class)); } } diff --git a/app/src/main/java/ceui/loxia/ObjectPool.kt b/app/src/main/java/ceui/loxia/ObjectPool.kt new file mode 100644 index 000000000..768357c84 --- /dev/null +++ b/app/src/main/java/ceui/loxia/ObjectPool.kt @@ -0,0 +1,4 @@ +package ceui.loxia + +class ObjectPool { +} \ No newline at end of file diff --git a/app/src/main/java/ceui/loxia/test/ItemFragment.kt b/app/src/main/java/ceui/loxia/test/ItemFragment.kt new file mode 100644 index 000000000..b90b0725b --- /dev/null +++ b/app/src/main/java/ceui/loxia/test/ItemFragment.kt @@ -0,0 +1,34 @@ +package ceui.loxia.test + +import android.os.Bundle +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import ceui.lisa.R +import ceui.loxia.test.placeholder.PlaceholderContent + +/** + * A fragment representing a list of Items. + */ +class ItemFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val view = inflater.inflate(R.layout.fragment_item_list2, container, false) + + // Set the adapter + if (view is RecyclerView) { + with(view) { + layoutManager = LinearLayoutManager(context) + adapter = MyItemRecyclerViewAdapter(PlaceholderContent.ITEMS) + } + } + return view + } +} \ No newline at end of file diff --git a/app/src/main/java/ceui/loxia/test/ListActivity.kt b/app/src/main/java/ceui/loxia/test/ListActivity.kt new file mode 100644 index 000000000..4b90c7cf1 --- /dev/null +++ b/app/src/main/java/ceui/loxia/test/ListActivity.kt @@ -0,0 +1,12 @@ +package ceui.loxia.test + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import ceui.lisa.R + +class ListActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_list) + } +} \ No newline at end of file diff --git a/app/src/main/java/ceui/loxia/test/MyItemRecyclerViewAdapter.kt b/app/src/main/java/ceui/loxia/test/MyItemRecyclerViewAdapter.kt new file mode 100644 index 000000000..8c4f2c5d3 --- /dev/null +++ b/app/src/main/java/ceui/loxia/test/MyItemRecyclerViewAdapter.kt @@ -0,0 +1,48 @@ +package ceui.loxia.test + +import androidx.recyclerview.widget.RecyclerView +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import ceui.lisa.R +import ceui.lisa.databinding.FragmentItemBinding + +import ceui.loxia.test.placeholder.PlaceholderContent.PlaceholderItem + +/** + * [RecyclerView.Adapter] that can display a [PlaceholderItem]. + * TODO: Replace the implementation with code for your data type. + */ +class MyItemRecyclerViewAdapter( + private val values: List +) : RecyclerView.Adapter() { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + return ViewHolder( + FragmentItemBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + ) + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + val item = values[position] + holder.idView.text = item.id + holder.contentView.text = item.content + } + + override fun getItemCount(): Int = values.size + + inner class ViewHolder(binding: FragmentItemBinding) : RecyclerView.ViewHolder(binding.root) { + val idView: TextView = binding.itemNumber + val contentView: TextView = binding.content + + override fun toString(): String { + return super.toString() + " '" + contentView.text + "'" + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/ceui/loxia/test/placeholder/PlaceholderContent.kt b/app/src/main/java/ceui/loxia/test/placeholder/PlaceholderContent.kt new file mode 100644 index 000000000..86dc54331 --- /dev/null +++ b/app/src/main/java/ceui/loxia/test/placeholder/PlaceholderContent.kt @@ -0,0 +1,57 @@ +package ceui.loxia.test.placeholder + +import java.util.ArrayList +import java.util.HashMap + +/** + * Helper class for providing sample content for user interfaces created by + * Android template wizards. + * + * TODO: Replace all uses of this class before publishing your app. + */ +object PlaceholderContent { + + /** + * An array of sample (placeholder) items. + */ + val ITEMS: MutableList = ArrayList() + + /** + * A map of sample (placeholder) items, by ID. + */ + val ITEM_MAP: MutableMap = HashMap() + + private val COUNT = 100 + + init { + // Add some sample items. + for (i in 1..COUNT) { + addItem(createPlaceholderItem(i)) + } + } + + private fun addItem(item: PlaceholderItem) { + ITEMS.add(item) + ITEM_MAP.put(item.id, item) + } + + private fun createPlaceholderItem(position: Int): PlaceholderItem { + return PlaceholderItem(position.toString(), "Item " + position, makeDetails(position)) + } + + private fun makeDetails(position: Int): String { + val builder = StringBuilder() + builder.append("Details about Item: ").append(position) + for (i in 0..position - 1) { + builder.append("\nMore details information here.") + } + return builder.toString() + } + + /** + * A placeholder item representing a piece of content. + */ + data class PlaceholderItem(val id: String, val content: String, val details: String) { + override fun toString(): String = content + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_list.xml b/app/src/main/res/layout/activity_list.xml new file mode 100644 index 000000000..2ad140883 --- /dev/null +++ b/app/src/main/res/layout/activity_list.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_item.xml b/app/src/main/res/layout/fragment_item.xml new file mode 100644 index 000000000..18775687a --- /dev/null +++ b/app/src/main/res/layout/fragment_item.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_item_list2.xml b/app/src/main/res/layout/fragment_item_list2.xml new file mode 100644 index 000000000..a76155fb8 --- /dev/null +++ b/app/src/main/res/layout/fragment_item_list2.xml @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 0919468d7..c994556a8 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -17,4 +17,5 @@ 160dp 96dp 20dp + 16dp \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2dbc38a01..408b9bf98 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -581,7 +581,7 @@ 公开 私人 作品二级详情翻页模式 - + 文本 关键词 收藏作品时展示关联作品 diff --git a/build.gradle b/build.gradle index d4736932d..3ed21e637 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,7 @@ buildscript { plugins { id "com.github.ben-manes.versions" version "0.41.0" + id 'org.jetbrains.kotlin.android' version '1.8.0' apply false } allprojects { From 9f08f0cceb61c64715ffdc25fd095ce9415cfe9d Mon Sep 17 00:00:00 2001 From: LoxiaLiSA Date: Mon, 20 Feb 2023 12:28:09 +0800 Subject: [PATCH 4/8] core code --- .idea/gradle.xml | 1 - .../ceui/lisa/activities/MainActivity.java | 9 +- .../main/java/ceui/loxia/test/ItemFragment.kt | 37 ++--- .../loxia/test/MyItemRecyclerViewAdapter.kt | 48 ------ .../test/placeholder/PlaceholderContent.kt | 57 ------- .../main/java/ceui/refactor/CommonAdapter.kt | 141 ++++++++++++++++++ .../refactor/FragmentViewBindingDelegate.kt | 112 ++++++++++++++ app/src/main/java/ceui/refactor/KUtils.kt | 56 +++++++ .../java/ceui/refactor/ViewHolderMapping.kt | 43 ++++++ .../main/res/animator/button_press_alpha.xml | 24 +++ app/src/main/res/layout/cell_none.xml | 12 ++ app/src/main/res/layout/fragment_item.xml | 20 --- .../main/res/layout/fragment_item_aaaa.xml | 28 ++++ .../main/res/layout/fragment_item_bbbb.xml | 28 ++++ .../main/res/layout/fragment_item_list2.xml | 2 +- 15 files changed, 468 insertions(+), 150 deletions(-) delete mode 100644 app/src/main/java/ceui/loxia/test/MyItemRecyclerViewAdapter.kt delete mode 100644 app/src/main/java/ceui/loxia/test/placeholder/PlaceholderContent.kt create mode 100644 app/src/main/java/ceui/refactor/CommonAdapter.kt create mode 100644 app/src/main/java/ceui/refactor/FragmentViewBindingDelegate.kt create mode 100644 app/src/main/java/ceui/refactor/KUtils.kt create mode 100644 app/src/main/java/ceui/refactor/ViewHolderMapping.kt create mode 100644 app/src/main/res/animator/button_press_alpha.xml create mode 100644 app/src/main/res/layout/cell_none.xml delete mode 100644 app/src/main/res/layout/fragment_item.xml create mode 100644 app/src/main/res/layout/fragment_item_aaaa.xml create mode 100644 app/src/main/res/layout/fragment_item_bbbb.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml index e145b66b7..150fd8ef3 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -7,7 +7,6 @@ - + diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 431e63e9d..173ff871f 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -36,7 +36,7 @@ - @@ -350,7 +350,7 @@ - + diff --git a/app/src/main/res/layout/fragment_base_list.xml b/app/src/main/res/layout/fragment_base_list.xml index 28924d9e2..f3a4b9722 100644 --- a/app/src/main/res/layout/fragment_base_list.xml +++ b/app/src/main/res/layout/fragment_base_list.xml @@ -40,7 +40,7 @@ - - + - - + - + - + diff --git a/app/src/main/res/layout/fragment_edit_file.xml b/app/src/main/res/layout/fragment_edit_file.xml index d72225d38..488cb48d1 100644 --- a/app/src/main/res/layout/fragment_edit_file.xml +++ b/app/src/main/res/layout/fragment_edit_file.xml @@ -16,7 +16,7 @@ android:id="@+id/toolbar" layout="@layout/toolbar_layout" /> - - + - - + - - + - @@ -19,7 +19,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - + diff --git a/app/src/main/res/layout/fragment_item_list2.xml b/app/src/main/res/layout/fragment_item_list2.xml deleted file mode 100644 index 9130ba902..000000000 --- a/app/src/main/res/layout/fragment_item_list2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_local_user.xml b/app/src/main/res/layout/fragment_local_user.xml index 964e4c45b..2640ea226 100644 --- a/app/src/main/res/layout/fragment_local_user.xml +++ b/app/src/main/res/layout/fragment_local_user.xml @@ -14,7 +14,7 @@ android:id="@+id/toolbar" layout="@layout/toolbar_layout" /> - - + - - + - - + - @@ -225,7 +225,7 @@ - + diff --git a/app/src/main/res/layout/fragment_new_right.xml b/app/src/main/res/layout/fragment_new_right.xml index 161be41d4..4bf44a964 100644 --- a/app/src/main/res/layout/fragment_new_right.xml +++ b/app/src/main/res/layout/fragment_new_right.xml @@ -161,7 +161,7 @@ - @@ -171,7 +171,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - + diff --git a/app/src/main/res/layout/fragment_novel_series.xml b/app/src/main/res/layout/fragment_novel_series.xml index a312e229e..2382c80e9 100644 --- a/app/src/main/res/layout/fragment_novel_series.xml +++ b/app/src/main/res/layout/fragment_novel_series.xml @@ -12,7 +12,7 @@ - - + diff --git a/app/src/main/res/layout/fragment_pivision_horizontal.xml b/app/src/main/res/layout/fragment_pivision_horizontal.xml index a052310e5..2c1ad8066 100644 --- a/app/src/main/res/layout/fragment_pivision_horizontal.xml +++ b/app/src/main/res/layout/fragment_pivision_horizontal.xml @@ -50,7 +50,7 @@ - - + - - + - @@ -1182,7 +1182,7 @@ - + diff --git a/app/src/main/res/layout/fragment_single_illust.xml b/app/src/main/res/layout/fragment_single_illust.xml index dddfbf36d..881bc1cd2 100644 --- a/app/src/main/res/layout/fragment_single_illust.xml +++ b/app/src/main/res/layout/fragment_single_illust.xml @@ -21,7 +21,7 @@ android:scaleType="centerCrop" /> - @@ -352,7 +352,7 @@ - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_ugora.xml b/app/src/main/res/layout/fragment_ugora.xml index 0f249353f..253aea070 100644 --- a/app/src/main/res/layout/fragment_ugora.xml +++ b/app/src/main/res/layout/fragment_ugora.xml @@ -21,7 +21,7 @@ android:scaleType="centerCrop" /> - @@ -334,7 +334,7 @@ - + - - + - @@ -23,7 +23,7 @@ android:layout_height="match_parent"> - + - - + diff --git a/app/src/main/res/layout/fragment_user_right.xml b/app/src/main/res/layout/fragment_user_right.xml index bef45fec8..1b9dd982c 100644 --- a/app/src/main/res/layout/fragment_user_right.xml +++ b/app/src/main/res/layout/fragment_user_right.xml @@ -6,7 +6,7 @@ - @@ -230,6 +230,6 @@ - + diff --git a/app/src/main/res/layout/fragment_work_space.xml b/app/src/main/res/layout/fragment_work_space.xml index a5e39abff..6c28ba33a 100644 --- a/app/src/main/res/layout/fragment_work_space.xml +++ b/app/src/main/res/layout/fragment_work_space.xml @@ -13,7 +13,7 @@ android:id="@+id/toolbar" layout="@layout/toolbar_layout"/> - - + + + + + + + + + + + + + + + + + + +