|
@@ -12,6 +12,7 @@ import android.os.Bundle;
|
|
import android.provider.Settings;
|
|
import android.provider.Settings;
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.view.ViewTreeObserver;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
@@ -24,6 +25,7 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
|
|
import com.google.android.material.appbar.AppBarLayout;
|
|
import com.google.android.material.appbar.AppBarLayout;
|
|
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
|
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
|
import com.google.android.material.snackbar.Snackbar;
|
|
import com.google.android.material.snackbar.Snackbar;
|
|
|
|
+import com.luck.picture.lib.utils.BitmapUtils;
|
|
import com.makeramen.roundedimageview.RoundedImageView;
|
|
import com.makeramen.roundedimageview.RoundedImageView;
|
|
|
|
|
|
import org.telegram.cricdit.base.BaseTabActivity;
|
|
import org.telegram.cricdit.base.BaseTabActivity;
|
|
@@ -32,6 +34,8 @@ import org.telegram.cricdit.config.Constants;
|
|
import org.telegram.cricdit.utils.AppInfoUtils;
|
|
import org.telegram.cricdit.utils.AppInfoUtils;
|
|
import org.telegram.cricdit.utils.Base64Utils;
|
|
import org.telegram.cricdit.utils.Base64Utils;
|
|
import org.telegram.cricdit.utils.ColorUtil;
|
|
import org.telegram.cricdit.utils.ColorUtil;
|
|
|
|
+import org.telegram.cricdit.utils.DrawableUtil;
|
|
|
|
+import org.telegram.cricdit.utils.NumberUtils;
|
|
import org.telegram.cricdit.view.CommonItemView;
|
|
import org.telegram.cricdit.view.CommonItemView;
|
|
import org.telegram.cricdit.view.RoundImageView;
|
|
import org.telegram.cricdit.view.RoundImageView;
|
|
import org.telegram.messenger.AndroidUtilities;
|
|
import org.telegram.messenger.AndroidUtilities;
|
|
@@ -68,12 +72,13 @@ public class MeActivity extends BaseTabActivity {
|
|
private ImageView mIvProfile;
|
|
private ImageView mIvProfile;
|
|
private ImageView mIvAvatar;
|
|
private ImageView mIvAvatar;
|
|
private FrameLayout mAvatarContainer;
|
|
private FrameLayout mAvatarContainer;
|
|
-// private RoundedImageView mAvatarImg;
|
|
|
|
|
|
+ private RoundedImageView mAvatarImg;
|
|
|
|
+ private float mHeightOffset;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected int getLayoutResId() {
|
|
protected int getLayoutResId() {
|
|
- return R.layout.activity_me;
|
|
|
|
|
|
+ return R.layout.activity_me3;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -90,53 +95,61 @@ public class MeActivity extends BaseTabActivity {
|
|
protected void initView(View view) {
|
|
protected void initView(View view) {
|
|
TextView nickname = view.findViewById(R.id.me_tv_nickname);
|
|
TextView nickname = view.findViewById(R.id.me_tv_nickname);
|
|
TextView username = view.findViewById(R.id.me_tv_username);
|
|
TextView username = view.findViewById(R.id.me_tv_username);
|
|
-// ImageView avatar = view.findViewById(R.id.me_tv_avatar);
|
|
|
|
|
|
|
|
mAvatarContainer = view.findViewById(R.id.me_fl_avatar_container);
|
|
mAvatarContainer = view.findViewById(R.id.me_fl_avatar_container);
|
|
-// LinearLayout homePageContainer = view.findViewById(R.id.me_homepage_container);
|
|
|
|
|
|
+ LinearLayout homePageContainer = view.findViewById(R.id.me_homepage_container);
|
|
LinearLayout profileContainer = view.findViewById(R.id.me_tv_profile_container);
|
|
LinearLayout profileContainer = view.findViewById(R.id.me_tv_profile_container);
|
|
// homePageContainer.setBackgroundColor(ColorUtil.COLOR_BLUE);
|
|
// homePageContainer.setBackgroundColor(ColorUtil.COLOR_BLUE);
|
|
|
|
+ homePageContainer.setBackgroundColor(ColorUtil.COLOR_WHITE);
|
|
|
|
|
|
mIvQRcode = view.findViewById(R.id.me_iv_qrcode);
|
|
mIvQRcode = view.findViewById(R.id.me_iv_qrcode);
|
|
mIvProfile = view.findViewById(R.id.me_iv_profile);
|
|
mIvProfile = view.findViewById(R.id.me_iv_profile);
|
|
-// mAvatarImg = view.findViewById(R.id.me_tv_avatar);
|
|
|
|
|
|
+ mAvatarImg = view.findViewById(R.id.me_tv_avatar);
|
|
|
|
+
|
|
|
|
+ mIvQRcode.setImageDrawable(DrawableUtil.resToDrawable(getContext(), R.drawable.msg_qrcode, ColorUtil.COLOR_BLACK));
|
|
|
|
+ mIvProfile.setImageDrawable(DrawableUtil.resToDrawable(getContext(), R.drawable.msg_edit, ColorUtil.COLOR_BLACK));
|
|
|
|
|
|
|
|
|
|
CollapsingToolbarLayout toolbarLayout = view.findViewById(R.id.toolbar_layout);
|
|
CollapsingToolbarLayout toolbarLayout = view.findViewById(R.id.toolbar_layout);
|
|
- toolbarLayout.setContentScrimColor(ColorUtil.COLOR_BLUE);
|
|
|
|
|
|
+// toolbarLayout.setContentScrimColor(ColorUtil.COLOR_BLUE);
|
|
|
|
+ toolbarLayout.setContentScrimColor(ColorUtil.COLOR_WHITE);
|
|
|
|
|
|
AppBarLayout appBarLayout = view.findViewById(R.id.me_app_bar);
|
|
AppBarLayout appBarLayout = view.findViewById(R.id.me_app_bar);
|
|
|
|
+ Toolbar toolbar = view.findViewById(R.id.me_toolbar);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ profileContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onGlobalLayout() {
|
|
|
|
+ profileContainer.setPivotX(0);
|
|
|
|
+ profileContainer.setPivotY(profileContainer.getHeight() / 2f);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
|
|
|
|
+
|
|
|
|
+ float totalScrollRange = appBarLayout1.getTotalScrollRange();
|
|
|
|
+ float i = Math.abs(verticalOffset) / totalScrollRange;
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ float offset = 1 - (0.2f * (i));
|
|
|
|
+ profileContainer.setScaleX(offset);
|
|
|
|
+ profileContainer.setScaleY(offset);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
-// profileContainer
|
|
|
|
-
|
|
|
|
-// appBarLayout.addOnOffsetChangedListener(new AppBarLayout.BaseOnOffsetChangedListener() {
|
|
|
|
-// @Override
|
|
|
|
-// public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
|
|
-//
|
|
|
|
-// float totalScrollRange = appBarLayout.getTotalScrollRange();
|
|
|
|
-// float i = Math.abs(verticalOffset) / totalScrollRange;
|
|
|
|
-// if (i<0.5) {
|
|
|
|
-// profileContainer.setScaleX((1 - i)/2f);
|
|
|
|
-// profileContainer.setScaleY((1 - i)/2f);
|
|
|
|
-//// profileContainer.setTranslationY(i);
|
|
|
|
-// }
|
|
|
|
-// System.out.println("weqrqwerqwerrwee " + i);
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
|
|
|
|
UserConfig userConfig = UserConfig.getInstance(currentAccount);
|
|
UserConfig userConfig = UserConfig.getInstance(currentAccount);
|
|
TLRPC.User currentUser = userConfig.getCurrentUser();
|
|
TLRPC.User currentUser = userConfig.getCurrentUser();
|
|
|
|
|
|
-// BackupImageView backupImageView = new BackupImageView(getContext());
|
|
|
|
-// backupImageView.setForUserOrChat(currentUser, new AvatarDrawable(currentUser));
|
|
|
|
-// Bitmap bitmap = backupImageView.getImageReceiver().getBitmap();
|
|
|
|
-// mAvatarImg.setImageBitmap(bitmap);
|
|
|
|
|
|
+ BackupImageView backupImageView = new BackupImageView(getContext());
|
|
|
|
+ backupImageView.setForUserOrChat(currentUser, new AvatarDrawable(currentUser));
|
|
|
|
+ Bitmap bitmap = backupImageView.getImageReceiver().getBitmap();
|
|
|
|
+ mAvatarImg.setImageBitmap(bitmap);
|
|
|
|
|
|
mIvAvatar = view.findViewById(R.id.me_iv_avatar);
|
|
mIvAvatar = view.findViewById(R.id.me_iv_avatar);
|
|
- mIvAvatar.setBackgroundColor(ColorUtil.COLOR_BLUE);
|
|
|
|
|
|
+// mIvAvatar.setBackgroundColor(ColorUtil.COLOR_BLUE);
|
|
|
|
+ mIvAvatar.setBackgroundColor(ColorUtil.COLOR_WHITE);
|
|
mAvatarContainer.setVisibility(View.GONE);
|
|
mAvatarContainer.setVisibility(View.GONE);
|
|
|
|
|
|
if (userConfig.isClientActivated()) {
|
|
if (userConfig.isClientActivated()) {
|
|
@@ -164,8 +177,21 @@ public class MeActivity extends BaseTabActivity {
|
|
username.setText(!TextUtils.isEmpty(currentUser.username) ? "@" + currentUser.username : "");
|
|
username.setText(!TextUtils.isEmpty(currentUser.username) ? "@" + currentUser.username : "");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ TextView postNum = view.findViewById(R.id.me_profile_post_num);
|
|
|
|
+
|
|
|
|
+ TextView followingNum = view.findViewById(R.id.me_profile_following_num);
|
|
|
|
+
|
|
|
|
+ TextView followerNum = view.findViewById(R.id.me_profile_follower_num);
|
|
|
|
+
|
|
|
|
+ postNum.setText(NumberUtils.amountConversionToInt(3546));
|
|
|
|
+
|
|
|
|
+ followingNum.setText(NumberUtils.amountConversionToInt(169));
|
|
|
|
+
|
|
|
|
+ followerNum.setText(NumberUtils.amountConversionToInt(1564504));
|
|
|
|
+
|
|
initItem(view);
|
|
initItem(view);
|
|
- initListener();
|
|
|
|
|
|
+ initListener(view);
|
|
}
|
|
}
|
|
|
|
|
|
private void initItem(View view) {
|
|
private void initItem(View view) {
|
|
@@ -207,7 +233,7 @@ public class MeActivity extends BaseTabActivity {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private void initListener() {
|
|
|
|
|
|
+ private void initListener(View view) {
|
|
|
|
|
|
mIvQRcode.setOnClickListener(v -> {
|
|
mIvQRcode.setOnClickListener(v -> {
|
|
Bundle args = new Bundle();
|
|
Bundle args = new Bundle();
|
|
@@ -283,7 +309,7 @@ public class MeActivity extends BaseTabActivity {
|
|
});
|
|
});
|
|
|
|
|
|
mCommonPrivacy.setOnClickListener(v -> {
|
|
mCommonPrivacy.setOnClickListener(v -> {
|
|
- presentFragment(new WebviewActivity(Constants.WEB_URL_PRIVACY_POLICY + System.currentTimeMillis(), LocaleController.getString(R.string.CdPrivacyPolicy)));
|
|
|
|
|
|
+ presentFragment(new WebviewActivity(Constants.WEB_URL_PRIVACY_POLICY + System.currentTimeMillis(), ""));
|
|
});
|
|
});
|
|
|
|
|
|
mCommonVersion.setOnClickListener(v -> {
|
|
mCommonVersion.setOnClickListener(v -> {
|
|
@@ -292,7 +318,24 @@ public class MeActivity extends BaseTabActivity {
|
|
});
|
|
});
|
|
|
|
|
|
mCommonAboutUs.setOnClickListener(v -> {
|
|
mCommonAboutUs.setOnClickListener(v -> {
|
|
- presentFragment(new WebviewActivity(Constants.WEB_URL_ABOUT_US + System.currentTimeMillis(), LocaleController.getString(R.string.CdAboutUs)));
|
|
|
|
|
|
+ presentFragment(new WebviewActivity(Constants.WEB_URL_ABOUT_US + System.currentTimeMillis(), ""));
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ view.findViewById(R.id.me_profile_post_container).setOnClickListener(v -> {
|
|
|
|
+ //跳转动态列表
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ view.findViewById(R.id.me_profile_following_container).setOnClickListener(v -> {
|
|
|
|
+ //跳转关注列表
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ view.findViewById(R.id.me_profile_follower_container).setOnClickListener(v -> {
|
|
|
|
+ //跳转被关注列表
|
|
|
|
+
|
|
|
|
+
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
@@ -323,9 +366,14 @@ public class MeActivity extends BaseTabActivity {
|
|
actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_actionBarWhiteSelector), false);
|
|
actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_actionBarWhiteSelector), false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // @Override
|
|
|
|
+// public boolean isLightStatusBar() {
|
|
|
|
+// int color = ColorUtil.COLOR_BLUE;
|
|
|
|
+// return ColorUtils.calculateLuminance(color) > 0.7f;
|
|
|
|
+// }
|
|
@Override
|
|
@Override
|
|
public boolean isLightStatusBar() {
|
|
public boolean isLightStatusBar() {
|
|
- int color = ColorUtil.COLOR_BLUE;
|
|
|
|
|
|
+ int color = ColorUtil.COLOR_WHITE;
|
|
return ColorUtils.calculateLuminance(color) > 0.7f;
|
|
return ColorUtils.calculateLuminance(color) > 0.7f;
|
|
}
|
|
}
|
|
}
|
|
}
|