UI调整
This commit is contained in:
@@ -33,7 +33,7 @@ class HomePlayAdapter : BaseMultiItemQuickAdapter<HomeRoomInfo, BaseViewHolder>(
|
||||
item.itemType == HomeRoomInfo.TYPE_BROADCAST
|
||||
) {
|
||||
helper.setText(R.id.tv_room_title, item.title)
|
||||
helper.setVisible(R.id.iv_room_tag, !TextUtils.isEmptyText(item.tagPict))
|
||||
helper.setGone(R.id.iv_room_tag, !TextUtils.isEmptyText(item.tagPict))
|
||||
ImageLoadUtilsV2.loadImage(helper.getView(R.id.iv_room_tag), item.tagPict)
|
||||
helper.setText(R.id.tv_online_number, "${item.onlineNum}")
|
||||
val tvMgName = helper.getView<TextView>(R.id.tv_mg_name)
|
||||
|
@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.app.avroom.activity.AVRoomActivity
|
||||
import com.nnbc123.app.avroom.adapter.RoomVPAdapter
|
||||
@@ -263,6 +264,23 @@ class RecommendFragment : BaseFragment(),
|
||||
mBinding.viewPager.adapter =
|
||||
RoomVPAdapter(childFragmentManager, mFragmentsBottom)
|
||||
ViewPagerHelper.bind(mBinding.magicIndicator, mBinding.viewPager)
|
||||
mBinding.viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
||||
override fun onPageScrolled(
|
||||
position: Int,
|
||||
positionOffset: Float,
|
||||
positionOffsetPixels: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onPageSelected(position: Int) {
|
||||
mBinding.tvNewRefresh.isVisible = position == 0
|
||||
mBinding.tvNewFilter.isVisible = position == 0
|
||||
}
|
||||
|
||||
override fun onPageScrollStateChanged(state: Int) {
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
private fun initSingleAnchor() {
|
||||
|
@@ -167,6 +167,7 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
IMFriendModel.get().addCloseTipsAccount(sessionId);
|
||||
tipsLayout.setVisibility(View.GONE);
|
||||
});
|
||||
ivAttention = (ImageView) findViewById(R.id.iv_attention);
|
||||
// 单聊特例话数据,包括个人信息,黑名单
|
||||
addBlackList();
|
||||
requestBuddyInfo();
|
||||
@@ -254,6 +255,10 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void requestBuddyInfo() {
|
||||
|
||||
if (SystemUidUtil.isSystemUid(sessionId)){
|
||||
ivAttention.setVisibility(View.GONE);
|
||||
}
|
||||
getNickFromSession();
|
||||
// 如果有个人信息可以获取
|
||||
UserModel.get().getUserInfo(Long.valueOf(sessionId)).subscribe(new Consumer<UserInfo>() {
|
||||
@@ -277,9 +282,7 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
}
|
||||
tvToolbarTitle.setText(builder);
|
||||
tvToolbarTitle.setVisibility(View.VISIBLE);
|
||||
|
||||
ivAttention = (ImageView) findViewById(R.id.iv_attention);
|
||||
if (AuthModel.get().getCurrentUid() != userInfo.getUid()) {
|
||||
if (AuthModel.get().getCurrentUid() != userInfo.getUid() && !SystemUidUtil.isSystemUid(sessionId)) {
|
||||
PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), userInfo.getUid()).subscribe();
|
||||
}
|
||||
buddyUserInfo = userInfo;
|
||||
|
@@ -51,6 +51,16 @@ public class MsgViewHolderContent extends MsgViewHolderBase implements View.OnCl
|
||||
ivNewTag = findViewById(R.id.iv_new_tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int leftBackground() {
|
||||
return com.netease.nim.uikit.R.drawable.bg_nim_water_drop_other_no_padding;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int rightBackground() {
|
||||
return com.netease.nim.uikit.R.drawable.bg_nim_water_drop_self_no_padding;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindContentView() {
|
||||
NoticeAttachment attachment = (NoticeAttachment) message.getAttachment();
|
||||
|
@@ -78,9 +78,9 @@ public abstract class RecentViewHolder extends RecyclerViewHolder<BaseQuickAdapt
|
||||
|
||||
protected void updateBackground(BaseViewHolder holder, RecentContact recent, int position) {
|
||||
if ((recent.getTag() & RecentContactsFragment.RECENT_TAG_STICKY) == 0) {
|
||||
holder.getConvertView().setBackgroundResource(R.drawable.bg_nim_msg_touch);
|
||||
} else {
|
||||
holder.getConvertView().setBackgroundResource(R.drawable.nim_recent_contact_sticky_selecter);
|
||||
} else {
|
||||
holder.getConvertView().setBackgroundResource(R.drawable.bg_nim_msg_touch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,10 +25,19 @@ public class DialogWebViewActivity extends CommonWebViewActivity {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void start(Context context, String url, int height) {
|
||||
Intent intent = new Intent(context, DialogWebViewActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
intent.putExtra("height", height);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight / 3 * 2);
|
||||
getWindow().setLayout(
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
getIntent().getIntExtra("height", ScreenUtil.screenHeight / 3 * 2));
|
||||
getWindow().setGravity(Gravity.BOTTOM);
|
||||
showTitleBar = getIntent().getBooleanExtra("showTitleBar", true);
|
||||
if (!showTitleBar) {
|
||||
|
@@ -580,7 +580,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
return imageView;
|
||||
}
|
||||
});
|
||||
pagerViewVip.setPlayDelay(5000);
|
||||
pagerViewVip.setPlayDelay(3000);
|
||||
}
|
||||
|
||||
private void showLoadingAnimation() {
|
||||
|
@@ -429,7 +429,7 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
|
||||
return imageView;
|
||||
}
|
||||
});
|
||||
pagerViewVip.setPlayDelay(5000);
|
||||
pagerViewVip.setPlayDelay(3000);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
|
10
app/src/main/res/drawable/bg_msg_page.xml
Normal file
10
app/src/main/res/drawable/bg_msg_page.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:startColor="@color/white"
|
||||
android:endColor="#ffdcf6ff"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
</shape>
|
@@ -10,9 +10,17 @@
|
||||
android:id="@+id/main_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/main_tab_layout"
|
||||
app:layout_constraintBottom_toTopOf="@id/view_line"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_line"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:background="#F4F4F6"
|
||||
app:layout_constraintBottom_toTopOf="@id/main_tab_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.nnbc123.app.ui.widget.MainTabLayout
|
||||
android:id="@+id/main_tab_layout"
|
||||
@@ -28,8 +36,8 @@
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/dp_drag_layout_bg_width"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/main_tab_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.nnbc123.app.common.widget.DragLayout
|
||||
@@ -59,10 +67,9 @@
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@color/black"
|
||||
app:riv_corner_radius="7dp"
|
||||
android:alpha="0.1"
|
||||
/>
|
||||
android:src="@color/black"
|
||||
app:riv_corner_radius="7dp" />
|
||||
|
||||
<com.nnbc123.app.ui.widget.LivingIconView
|
||||
android:id="@+id/liv_user"
|
||||
|
@@ -100,7 +100,7 @@
|
||||
android:layout_marginTop="100dp"
|
||||
android:gravity="center"
|
||||
android:text="开启青少年模式"
|
||||
android:background="@drawable/bg_common_cancel"
|
||||
android:background="@drawable/bg_common_confirm"
|
||||
android:textColor="@color/text_normal_282828"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
@@ -137,7 +137,6 @@
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/text_normal_282828"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_vip_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginStart="0dp"
|
||||
|
@@ -200,11 +200,28 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.nnbc123.app.ui.widget.TopRoundLinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/ll_tab_type">
|
||||
|
||||
<com.github.mmin18.widget.RealtimeBlurView
|
||||
android:id="@+id/realtime_blur_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:realtimeBlurRadius="25dp"
|
||||
app:realtimeDownsampleFactor="4"
|
||||
app:realtimeOverlayColor="#e0161722" />
|
||||
|
||||
</com.nnbc123.app.ui.widget.TopRoundLinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_tab_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_dialog_room_operation"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="18dp"
|
||||
android:paddingTop="10dp"
|
||||
@@ -265,7 +282,6 @@
|
||||
android:id="@+id/line_tab_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:background="#181B2C"
|
||||
android:src="@color/white_transparent_5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -275,7 +291,6 @@
|
||||
android:id="@+id/rl_avatars"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#181B2C"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/line_tab_type">
|
||||
@@ -337,8 +352,7 @@
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="66dp"
|
||||
android:layout_height="35dp"
|
||||
android:background="@drawable/bg_send_all_gift">
|
||||
android:layout_height="35dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_select_all"
|
||||
@@ -361,23 +375,10 @@
|
||||
android:layout_height="1px"
|
||||
android:layout_below="@id/ll_avatar_list"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="#181B2C"
|
||||
android:src="@color/white_transparent_5" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.github.mmin18.widget.RealtimeBlurView
|
||||
android:id="@+id/realtime_blur_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/layout_recharge"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/ll_tabs"
|
||||
app:realtimeBlurRadius="25dp"
|
||||
app:realtimeDownsampleFactor="4"
|
||||
app:realtimeOverlayColor="#e0161722" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/ll_tabs"
|
||||
android:layout_width="0dp"
|
||||
@@ -548,7 +549,6 @@
|
||||
android:id="@+id/layout_recharge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:background="#161722"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_gift_message">
|
||||
|
@@ -3,14 +3,14 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_normal_1c1b22"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/bg_me_page"
|
||||
android:background="@drawable/bg_msg_page"
|
||||
app:layout_constraintDimensionRatio="750:250"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@@ -11,6 +11,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
android:paddingTop="54dp">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
|
@@ -89,6 +89,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_goneMarginStart="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_room_tag"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_room_title">
|
||||
|
@@ -8,6 +8,10 @@
|
||||
android:id="@+id/layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingTop="13dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingBottom="13dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
@@ -187,7 +187,7 @@
|
||||
|
||||
<com.netease.nim.uikit.common.ui.draggablebubbles.BubbleView
|
||||
android:id="@+id/unread_number_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_18"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_below="@id/tv_nickname"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
@@ -32,6 +32,7 @@ import com.nnbc123.app.community.dynamic.view.DynamicDetailActivity;
|
||||
import com.nnbc123.app.community.publish.view.PublishActivity;
|
||||
import com.nnbc123.app.home.activity.CommunityNoticeAct;
|
||||
import com.nnbc123.app.home.adapter.MainMagicIndicatorAdapter;
|
||||
import com.nnbc123.app.miniworld.activity.AllTopicActivity;
|
||||
import com.nnbc123.app.miniworld.activity.TopicMainActivity;
|
||||
import com.nnbc123.app.miniworld.adapter.RecommendTopicListAdapter;
|
||||
import com.nnbc123.app.miniworld.listener.DoubleClickCheckListener;
|
||||
@@ -98,7 +99,8 @@ public class SquareFragment extends BaseFragment implements MainMagicIndicatorAd
|
||||
FrameLayout flContactList;
|
||||
@BindView(R.id.msg_number)
|
||||
View tvCommunityUnread;
|
||||
|
||||
@BindView(R.id.tv_title_topic)
|
||||
View tvTitleTopic;
|
||||
Unbinder unbinder;
|
||||
private RecommendTopicListAdapter mRecommendTopicAdapter;
|
||||
|
||||
@@ -159,7 +161,7 @@ public class SquareFragment extends BaseFragment implements MainMagicIndicatorAd
|
||||
commonNavigator.setAdapter(magicIndicatorAdapter);
|
||||
magicIndicator.setNavigator(commonNavigator);
|
||||
ViewPagerHelper.bind(magicIndicator, viewPager);
|
||||
viewPager.setCurrentItem(TAB_TYPE_RECOMMEND);
|
||||
viewPager.setCurrentItem(0);
|
||||
initRecyclerView();
|
||||
MiniWorldModel.getInstance().getCategoryMiniWorldList("0", 1, 500)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
@@ -167,6 +169,10 @@ public class SquareFragment extends BaseFragment implements MainMagicIndicatorAd
|
||||
.subscribe((miniWorldInfos, throwable) -> {
|
||||
mRecommendTopicAdapter.setNewData(miniWorldInfos);
|
||||
});
|
||||
tvTitleTopic.setOnClickListener(v -> {
|
||||
AllTopicActivity.start(getActivity(), 0);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_normal_1c1b22"
|
||||
android:background="@color/white"
|
||||
android:paddingTop="54dp">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
@@ -30,17 +30,31 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title_topic"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:drawableEnd="@drawable/arrow_right_more_room"
|
||||
android:text="@string/recommend_topic"
|
||||
android:textColor="@color/text_normal_282828"
|
||||
android:textSize="@dimen/sp_13"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_topic"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
app:layout_constraintDimensionRatio="345:74"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title_topic" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -75,8 +89,8 @@
|
||||
android:id="@+id/msg_number"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="8dp"
|
||||
android:background="@drawable/shape_red_ff7162_corner"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:background="@drawable/shape_red_ff7162_corner"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:text="123"
|
||||
|
@@ -178,7 +178,10 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
|
||||
//do nothing
|
||||
break;
|
||||
case R.id.ll_get_key:
|
||||
DialogWebViewActivity.start(this, UriProvider.getBoxKey());
|
||||
DialogWebViewActivity.start(
|
||||
this,
|
||||
UriProvider.getBoxKey(),
|
||||
ScreenUtil.screenWidth * 1200 / 750);
|
||||
break;
|
||||
case R.id.tv_get_key:
|
||||
hideFragmentContainer();
|
||||
|
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
|
||||
<corners android:bottomLeftRadius="16dp"
|
||||
android:bottomRightRadius="16dp"
|
||||
android:topLeftRadius="4dp"
|
||||
android:topRightRadius="16dp"/>
|
||||
|
||||
<solid android:color="@color/white"/>
|
||||
|
||||
</shape>
|
13
nim_uikit/res/drawable/bg_nim_water_drop_self_no_padding.xml
Normal file
13
nim_uikit/res/drawable/bg_nim_water_drop_self_no_padding.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<padding
|
||||
android:left="15dp"
|
||||
android:top="13dp"
|
||||
android:right="15dp"
|
||||
android:bottom="13dp" />
|
||||
|
||||
<solid android:color="#FFFCEBCA"/>
|
||||
|
||||
</shape>
|
@@ -49,12 +49,11 @@ public class BubbleView extends AppCompatTextView {
|
||||
setTextColor(ContextCompat.getColor(getContext(), R.color.white));
|
||||
setTextSize(10);
|
||||
GradientDrawable gradientDrawable = new GradientDrawable();
|
||||
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
gradientDrawable.setShape(GradientDrawable.OVAL);
|
||||
// gradientDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
gradientDrawable.setCornerRadius(ScreenUtil.dip2px(20));
|
||||
gradientDrawable.setColor(Color.parseColor("#FF3B30"));
|
||||
setBackground(gradientDrawable);
|
||||
setPadding(ScreenUtil.dip2px(4), ScreenUtil.dip2px(1), ScreenUtil.dip2px(4), ScreenUtil.dip2px(1));
|
||||
setGravity(Gravity.CENTER);
|
||||
// TextViewCompat.setAutoSizeTextTypeWithDefaults(this,TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM);
|
||||
// TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(this,
|
||||
@@ -74,38 +73,22 @@ public class BubbleView extends AppCompatTextView {
|
||||
* @param num
|
||||
*/
|
||||
public void setNumText(int num) {
|
||||
// num += 100;
|
||||
if (num < 1) {
|
||||
setVisibility(GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
setVisibility(VISIBLE);
|
||||
String numStr;
|
||||
if (num > 99) {
|
||||
numStr = "99+";
|
||||
numStr = "99";
|
||||
} else {
|
||||
numStr = String.valueOf(num);
|
||||
}
|
||||
getPaint().getTextBounds(numStr, 0, numStr.length(), textRect);
|
||||
int width = textRect.width() + getPaddingStart() + getPaddingEnd();
|
||||
int height = textRect.height() + getPaddingTop() + getPaddingBottom();
|
||||
ViewGroup.LayoutParams lp = getLayoutParams();
|
||||
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// if (num < 10) {
|
||||
// int size = Math.max(width, height);
|
||||
//// lp.width = size;
|
||||
//// lp.height = size;
|
||||
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// } else {
|
||||
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// }
|
||||
|
||||
lp.width = ScreenUtil.dip2px(18);
|
||||
lp.height = ScreenUtil.dip2px(18);
|
||||
setLayoutParams(lp);
|
||||
setText(numStr);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user