diff --git a/.gradle/7.3.3/checksums/checksums.lock b/.gradle/7.3.3/checksums/checksums.lock index b5343b5..98162f1 100644 Binary files a/.gradle/7.3.3/checksums/checksums.lock and b/.gradle/7.3.3/checksums/checksums.lock differ diff --git a/.gradle/7.3.3/checksums/md5-checksums.bin b/.gradle/7.3.3/checksums/md5-checksums.bin index ffec7a6..7c7a300 100644 Binary files a/.gradle/7.3.3/checksums/md5-checksums.bin and b/.gradle/7.3.3/checksums/md5-checksums.bin differ diff --git a/.gradle/7.3.3/checksums/sha1-checksums.bin b/.gradle/7.3.3/checksums/sha1-checksums.bin index 0570de6..5913c5f 100644 Binary files a/.gradle/7.3.3/checksums/sha1-checksums.bin and b/.gradle/7.3.3/checksums/sha1-checksums.bin differ diff --git a/.gradle/7.3.3/executionHistory/executionHistory.bin b/.gradle/7.3.3/executionHistory/executionHistory.bin index f76f62f..4b93a99 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.bin and b/.gradle/7.3.3/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.3.3/executionHistory/executionHistory.lock b/.gradle/7.3.3/executionHistory/executionHistory.lock index ed9a04c..971f9ae 100644 Binary files a/.gradle/7.3.3/executionHistory/executionHistory.lock and b/.gradle/7.3.3/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.bin b/.gradle/7.3.3/fileHashes/fileHashes.bin index 152380b..6540ece 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.bin and b/.gradle/7.3.3/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.3.3/fileHashes/fileHashes.lock b/.gradle/7.3.3/fileHashes/fileHashes.lock index e7eb780..7127f86 100644 Binary files a/.gradle/7.3.3/fileHashes/fileHashes.lock and b/.gradle/7.3.3/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin index b059cbf..6dfd8ff 100644 Binary files a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin and b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 66422e2..6e3819b 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 669f3f3..5937df8 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index b319919..942cf27 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/app/build.gradle b/app/build.gradle index c77daee..5a3e9d5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -68,6 +68,7 @@ android { dependencies { + implementation 'com.luolc:emoji-rain:0.1.1' implementation 'me.zhanghai.android.fastscroll:library:1.1.8' // 语种切换框架:https://github.com/getActivity/MultiLanguages implementation 'com.github.getActivity:MultiLanguages:8.0' diff --git a/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt b/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt index 679b68a..509bd12 100644 --- a/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/EditUserInfoActivity.kt @@ -2,6 +2,7 @@ package com.coldmint.rust.pro import android.content.Intent import android.graphics.BitmapFactory +import android.graphics.Color import android.net.Uri import android.os.Bundle import android.os.Environment @@ -31,9 +32,12 @@ import com.coldmint.rust.pro.databinding.ActivityEditModInfoBinding import com.coldmint.rust.pro.databinding.ActivityEditUserInfoBinding import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.GlobalMethod +import com.flask.colorpicker.ColorPickerView +import com.flask.colorpicker.builder.ColorPickerDialogBuilder import com.google.android.material.snackbar.Snackbar import com.yalantis.ucrop.UCrop import java.io.File +import java.lang.System.out class EditUserInfoActivity : BaseActivity() { lateinit var userId: String @@ -84,8 +88,11 @@ class EditUserInfoActivity : BaseActivity() { viewBinding.signatureView.setText(introduce) val gender = t.data.gender if (gender < 0) { - viewBinding.updateSpinner.setSelection(1) + viewBinding.sexView.setText(item[1]) + } else { + viewBinding.sexView.setText(item[0]) } + viewBinding.sexView.setSimpleItems(R.array.gender_entries) viewBinding.button.isVisible = true } else { viewBinding.progressBar.isVisible = false @@ -104,6 +111,29 @@ class EditUserInfoActivity : BaseActivity() { } private fun initAction() { + viewBinding.changeColorButton.setOnClickListener { + ColorPickerDialogBuilder + .with(this) + .setTitle(getString(R.string.choose_color)) + .initialColor(Color.WHITE) + .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER) + .density(12) + .setOnColorSelectedListener { + //toast("onColorSelected: 0x" + Integer.toHexString(selectedColor)); + } + .setPositiveButton(R.string.dialog_ok) { dialog, selectedColor, allColors -> + GlobalMethod.temColor = selectedColor + if (iconLink != null) { + Glide.with(this@EditUserInfoActivity) + .load(iconLink) + .apply(GlobalMethod.getRequestOptions(true, !GlobalMethod.isActive)) + .into(viewBinding.iconView) + } + } + .setNegativeButton(R.string.dialog_cancel) { dialog, which -> } + .build() + .show() + } viewBinding.userNameView.addTextChangedListener(object : TextWatcher { override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { @@ -234,8 +264,7 @@ class EditUserInfoActivity : BaseActivity() { getString(R.string.edit_function) -> { val userName = viewBinding.userNameView.text.toString() val introduce = viewBinding.signatureView.text.toString() - val genderPosition = viewBinding.updateSpinner.selectedItemPosition - val genderValue = item[genderPosition] + val genderValue = viewBinding.sexView.text.toString() val boy = getString(R.string.boy) if (!checkUserName(userName)) { return@setOnClickListener @@ -248,13 +277,7 @@ class EditUserInfoActivity : BaseActivity() { } else { -1 } - viewBinding.button.text = getString(R.string.request_data) - viewBinding.button.setBackgroundColor( - GlobalMethod.getThemeColor( - this, - R.attr.colorPrimaryVariant - ) - ) + viewBinding.button.hide() val token = AppSettings.getInstance(this).getValue(AppSettings.Setting.Token, "") User.updateSpaceInfo( @@ -269,22 +292,7 @@ class EditUserInfoActivity : BaseActivity() { Thread { Glide.get(this@EditUserInfoActivity).clearDiskCache() runOnUiThread { - viewBinding.button.text = - getString(R.string.edit_function) - viewBinding.button.setBackgroundColor( - GlobalMethod.getColorPrimary( - this@EditUserInfoActivity - ) - ) Glide.get(this@EditUserInfoActivity).clearMemory() -// MaterialDialog(this@EditUserInfoActivity).show { -// title(R.string.edit_function).message(R.string.restart_to_take_effect) -// .cancelable(false) -// .positiveButton(R.string.dialog_ok) -// .positiveButton { -// finish() -// } -// } finish() } }.start() @@ -292,12 +300,7 @@ class EditUserInfoActivity : BaseActivity() { finish() } } else { - viewBinding.button.text = getString(R.string.edit_function) - viewBinding.button.setBackgroundColor( - GlobalMethod.getColorPrimary( - this@EditUserInfoActivity - ) - ) + viewBinding.button.show() val data = t.data if (data != null && ServerConfiguration.isEvent(data)) { when (data) { @@ -320,12 +323,7 @@ class EditUserInfoActivity : BaseActivity() { } override fun onFailure(e: Exception) { - viewBinding.button.text = getString(R.string.edit_function) - viewBinding.button.setBackgroundColor( - GlobalMethod.getColorPrimary( - this@EditUserInfoActivity - ) - ) + viewBinding.button.show() showInternetError(viewBinding.button, e) } @@ -400,7 +398,7 @@ class EditUserInfoActivity : BaseActivity() { val temLink = ServerConfiguration.getRealLink(link) iconLink = temLink Glide.with(this@EditUserInfoActivity) - .load(temLink).apply(GlobalMethod.getRequestOptions(true)) + .load(temLink).apply(GlobalMethod.getRequestOptions(true, !GlobalMethod.isActive)) .into(viewBinding.iconView) } @@ -414,7 +412,7 @@ class EditUserInfoActivity : BaseActivity() { val temLink = ServerConfiguration.getRealLink(link) coverLink = temLink Glide.with(this@EditUserInfoActivity) - .load(temLink).apply(GlobalMethod.getRequestOptions()) + .load(temLink).apply(GlobalMethod.getRequestOptions(grayscale = !GlobalMethod.isActive)) .into(viewBinding.coverView) } diff --git a/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt b/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt index 19b1108..47e3b05 100644 --- a/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/MainActivity.kt @@ -93,7 +93,13 @@ class MainActivity : BaseActivity() { viewBinding.navaiagtion.setupWithNavController(navController) viewBinding.navaiagtion.addHeaderView(headLayout.root) //actionbar动画 - val actionToggle = ActionBarDrawerToggle(this,viewBinding.drawerlayout,viewBinding.toolbar,R.string.app_name,R.string.app_name) + val actionToggle = ActionBarDrawerToggle( + this, + viewBinding.drawerlayout, + viewBinding.toolbar, + R.string.app_name, + R.string.app_name + ) viewBinding.drawerlayout.addDrawerListener(actionToggle) actionToggle.syncState() } @@ -581,8 +587,6 @@ class MainActivity : BaseActivity() { override fun onCreateOptionsMenu(menu: Menu): Boolean { val inflater = menuInflater inflater.inflate(R.menu.menu_main, menu) -// val searchView = menu.findItem(R.id.app_bar_search).actionView as SearchView -// initSearchItem(searchView) return true } @@ -608,12 +612,14 @@ class MainActivity : BaseActivity() { */ fun observeStartViewModel() { startViewModel.userLiveData.observe(this) { + headLayout.nameView.text = it.data.userName headLayout.emailView.text = it.data.email val headIcon = it.data.headIcon if (headIcon != null) { Glide.with(this).load(ServerConfiguration.getRealLink(headIcon)) - .apply(GlobalMethod.getRequestOptions(true)).into(headLayout.imageView) + .apply(GlobalMethod.getRequestOptions(true, !it.data.activation)) + .into(headLayout.imageView) } val account = it.data.account headLayout.root.setOnClickListener { diff --git a/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt b/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt index 652cb64..114588c 100644 --- a/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/UserHomePageActivity.kt @@ -5,6 +5,7 @@ import android.app.ActivityOptions import android.content.Context import android.content.Intent import android.graphics.Color +import android.graphics.drawable.Drawable import android.os.Bundle import android.view.Gravity import android.view.View @@ -82,7 +83,17 @@ class UserHomePageActivity : BaseActivity() { openUserList(userId, false) } initButton() - +// val dlist = ArrayList() +// for (i in 1..30) { +//// dlist.add(getDrawable(R.drawable.emoji_2_3)!!) +// dlist.add(getDrawable(R.drawable.emoji_1_3)!!) +// } +// viewBinding.bubbleView.setDrawableList(dlist) +// viewBinding.bubbleView.startAnimation(5000, 5000,30) + viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_1_3) + viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_2_3) + viewBinding.emojiRainLayout.addEmoji(R.drawable.emoji_3_3) + viewBinding.emojiRainLayout.startDropping() } diff --git a/app/src/main/java/com/coldmint/rust/pro/tool/GlobalMethod.kt b/app/src/main/java/com/coldmint/rust/pro/tool/GlobalMethod.kt index 281f306..374a8e4 100644 --- a/app/src/main/java/com/coldmint/rust/pro/tool/GlobalMethod.kt +++ b/app/src/main/java/com/coldmint/rust/pro/tool/GlobalMethod.kt @@ -1,45 +1,36 @@ package com.coldmint.rust.pro.tool import android.Manifest -import android.app.Activity -import android.os.Environment -import android.content.pm.PackageManager -import android.content.pm.PackageInfo -import android.content.Intent -import android.util.TypedValue -import com.coldmint.rust.pro.tool.GlobalMethod -import com.coldmint.rust.pro.R -import android.widget.TextView import android.content.ClipData import android.content.ClipboardManager import android.content.Context -import com.google.android.material.snackbar.Snackbar -import android.graphics.drawable.Drawable import android.content.res.ColorStateList +import android.graphics.Bitmap +import android.graphics.Color import android.graphics.Paint -import android.net.Uri +import android.graphics.drawable.Drawable import android.os.Build -import android.provider.Settings +import android.util.TypedValue import android.view.View +import android.widget.TextView import android.widget.Toast import androidx.core.graphics.drawable.DrawableCompat import androidx.fragment.app.FragmentActivity import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.bottomsheets.BottomSheet -import com.bumptech.glide.Glide +import com.bumptech.glide.load.MultiTransformation import com.bumptech.glide.request.RequestOptions import com.coldmint.rust.core.dataBean.mod.WebModUpdateLogData import com.coldmint.rust.core.interfaces.ApiCallBack import com.coldmint.rust.core.web.ServerConfiguration import com.coldmint.rust.core.web.WebMod -import com.coldmint.rust.pro.MainActivity +import com.coldmint.rust.pro.R +import com.flask.colorpicker.ColorPickerView +import com.flask.colorpicker.builder.ColorPickerDialogBuilder +import com.google.android.material.snackbar.Snackbar import com.permissionx.guolindev.PermissionX -import java.io.File -import java.io.FileInputStream -import java.io.IOException -import java.math.BigInteger -import java.security.MessageDigest -import java.security.NoSuchAlgorithmException +import jp.wasabeef.glide.transformations.* +import jp.wasabeef.glide.transformations.internal.Utils /*全局方法类*/ object GlobalMethod { @@ -51,18 +42,33 @@ object GlobalMethod { const val DEFAULT_GAME_PACKAGE = "com.corrodinggames.rts" const val DEBUG_SIGN = "963dfd616924b27f9247a35e45bc130a" const val RELEASE_SIGN = "5320b24894fe7ed449842a81a2dfceda" + var temColor = Color.RED /** * 获取Glide请求设置 * @return RequestOptions */ - fun getRequestOptions(circleCrop: Boolean = false): RequestOptions { - val requestOptions = if (circleCrop) { - RequestOptions.circleCropTransform() - } else { - RequestOptions().placeholder(R.drawable.image).error(R.drawable.image_not_supported) + fun getRequestOptions(circleCrop: Boolean = false, grayscale: Boolean = false): RequestOptions { + //变换列表 + val transformations = ArrayList() + if (circleCrop) { + transformations.add(CropCircleWithBorderTransformation(Utils.toDp(4), temColor)) } + if (grayscale) { + transformations.add(GrayscaleTransformation()) + } + //请求设置 + val requestOptions = if (transformations.isNotEmpty()) { + val multi = MultiTransformation( + transformations + ) + RequestOptions.bitmapTransform(multi) + } else { + RequestOptions() + } + requestOptions.placeholder(R.drawable.image) + .error(R.drawable.image_not_supported) return requestOptions } diff --git a/app/src/main/res/drawable/ic_outline_save_24.xml b/app/src/main/res/drawable/ic_outline_save_24.xml new file mode 100644 index 0000000..714549a --- /dev/null +++ b/app/src/main/res/drawable/ic_outline_save_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/save.xml b/app/src/main/res/drawable/save.xml deleted file mode 100644 index f98922f..0000000 --- a/app/src/main/res/drawable/save.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/activity_edit_user_info.xml b/app/src/main/res/layout/activity_edit_user_info.xml index faaeee6..86b37eb 100644 --- a/app/src/main/res/layout/activity_edit_user_info.xml +++ b/app/src/main/res/layout/activity_edit_user_info.xml @@ -25,6 +25,7 @@ android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" + android:visibility="gone" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> @@ -52,7 +53,7 @@ android:layout_marginLeft="16dp" android:layout_marginTop="8dp" android:layout_marginRight="16dp" - android:visibility="gone" + android:visibility="visible" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> @@ -121,7 +122,24 @@ - + + + + + + + @@ -129,18 +147,23 @@ + android:layout_centerVertical="true" + android:text="@string/profile_picture_box_color" /> - - + android:layout_alignParentEnd="true" + android:text="@string/choose_color" /> + + + -