This commit is contained in:
18401019693 2022-07-25 14:06:35 +08:00
parent 47030425cd
commit 1007e2ab20
14 changed files with 58 additions and 121 deletions

View File

@ -73,6 +73,7 @@ dependencies {
api "androidx.constraintlayout:constraintlayout:2.1.4" api "androidx.constraintlayout:constraintlayout:2.1.4"
// To use constraintlayout in compose // To use constraintlayout in compose
api "androidx.constraintlayout:constraintlayout-compose:1.0.1" api "androidx.constraintlayout:constraintlayout-compose:1.0.1"
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.0'
api files('../libs/commons-io-1.4.jar') api files('../libs/commons-io-1.4.jar')
//okHttp网络请求 //okHttp网络请求
api rootProject.ext.dependencies["okhttp"] api rootProject.ext.dependencies["okhttp"]
@ -150,10 +151,10 @@ dependencies {
//im //im
api 'com.tencent.imsdk:imsdk-plus:5.4.666' api 'com.tencent.imsdk:imsdk-plus:5.4.666'
api 'com.google.code.gson:gson:2.8.8' api 'com.google.code.gson:gson:2.8.8'
api 'cn.rongcloud.sdk:rtc_lib:5.2.0' // api 'cn.rongcloud.sdk:rtc_lib:5.2.3.2' //
// 5.1.2 // 5.1.2
api 'cn.rongcloud.sdk:im_lib:5.1.3.10' // api 'cn.rongcloud.sdk:im_lib:5.2.3.2' //
api 'cn.rongcloud.sdk:im_kit:5.1.3.10' // UI api 'cn.rongcloud.sdk:im_kit:5.2.3.2' // UI
api 'com.facebook.android:facebook-login:8.2.0' api 'com.facebook.android:facebook-login:8.2.0'
api 'com.facebook.android:facebook-android-sdk:[5,6)' api 'com.facebook.android:facebook-android-sdk:[5,6)'

View File

@ -83,6 +83,7 @@ public class MessageIMManager {
* 获取系统消息有未读数展示红点 * 获取系统消息有未读数展示红点
*/ */
public void getSystemMessages() { public void getSystemMessages() {
systemNumber=0;
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
HttpClient.getInstance().get("Message.getLists", "getImUserInfo") HttpClient.getInstance().get("Message.getLists", "getImUserInfo")
.params("uid", userInfo.getId()) .params("uid", userInfo.getId())
@ -102,12 +103,10 @@ public class MessageIMManager {
//未读消息不为空并且大于0 //未读消息不为空并且大于0
try { try {
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
systemNumber = Integer.parseInt(number); systemNumber = Integer.parseInt(number)+systemNumber;
} else {
systemNumber = 0;
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
systemNumber = 0; systemNumber =systemNumber+ 0;
} }
} }
//发送通知 //发送通知
@ -146,6 +145,7 @@ public class MessageIMManager {
* 获取系统消息有未读数展示红点 * 获取系统消息有未读数展示红点
*/ */
public void getSystemMessages(SystemMessagesHttpCallback callback) { public void getSystemMessages(SystemMessagesHttpCallback callback) {
systemNumber=0;
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
HttpClient.getInstance().get("Message.getLists", "getImUserInfo") HttpClient.getInstance().get("Message.getLists", "getImUserInfo")
.params("uid", userInfo.getId()) .params("uid", userInfo.getId())
@ -168,12 +168,10 @@ public class MessageIMManager {
//未读消息不为空并且大于0 //未读消息不为空并且大于0
try { try {
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) { if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
systemNumber = Integer.parseInt(number); systemNumber = Integer.parseInt(number)+systemNumber;
} else {
systemNumber = 0;
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
systemNumber = 0; systemNumber = systemNumber+0;
} }
} }
//发送通知 //发送通知

View File

@ -29,20 +29,21 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
super.onBindViewHolder(holder, position); super.onBindViewHolder(holder, position);
Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection(); Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection();
Message.SentStatus sentStatus = mDataList.get(position).getMessage().getSentStatus();
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt); ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
readReceipt.setVisibility(View.GONE);
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new); ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
if (!mDataList.get(position).getMessage().getSenderUserId().equals(mDataList.get(position).getTargetId())) { if (messageDirection==Message.MessageDirection.SEND){
if (sentStatus.equals(Message.SentStatus.READ)) { readReceiptNew.setVisibility(View.VISIBLE);
}else {
readReceiptNew.setVisibility(View.GONE);
}
if (readReceipt.getVisibility()==View.VISIBLE) {
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read); readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read);
} else { } else {
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread); readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread);
} }
} else { if (readReceipt!=null){
readReceipt.setVisibility(View.GONE); readReceipt.setVisibility(View.GONE);
} }
holder.getConvertView().setOnTouchListener(new View.OnTouchListener() { holder.getConvertView().setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {

View File

@ -78,24 +78,8 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
inputPanelView.findViewById(R.id.lt_photo_button).setOnClickListener(this); inputPanelView.findViewById(R.id.lt_photo_button).setOnClickListener(this);
inputPanelView.findViewById(R.id.lt_choospic_button).setOnClickListener(this); inputPanelView.findViewById(R.id.lt_choospic_button).setOnClickListener(this);
inputPanelView.findViewById(R.id.lt_video_button).setOnClickListener(this); inputPanelView.findViewById(R.id.lt_video_button).setOnClickListener(this);
// editBtn.setOnFocusChangeListener(focusChangeListener);
} }
// //输入框焦点监听事件
// View.OnFocusChangeListener focusChangeListener = new OnFocusChangeListener() {
// @Override
// public void onFocusChange(View v, boolean hasFocus) {
// if (!hasFocus&& pluginList.getVisibility()==GONE) {
// //失去焦点
// InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
// imm.showSoftInput(editBtn, InputMethodManager.SHOW_FORCED);
// imm.hideSoftInputFromWindow(editBtn.getWindowToken(), 0); //强制隐藏键盘
// } else {
// pluginList.setVisibility(GONE);
// }
// }
// };
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int id = v.getId(); int id = v.getId();

View File

@ -16,6 +16,7 @@ import android.widget.TextView;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePoint; import com.yunbao.common.event.UpdateTablePoint;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
@ -355,11 +356,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
} }
//红点(直播页面) //消息中心
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void onUpdateFieldEvent(UpdateTablePoint updateTablePoint) { public void onMessageIMEvent(MessageIMEvent event) {
//判断消息中心红点是否已经展示如果已经展示并且未读消息大于0则不再执行之后的逻辑 //判断消息中心红点是否已经展示如果已经展示并且未读消息大于0则不再执行之后的逻辑
int number = updateTablePoint.getPoint(); int number = event.getNumber();
if (v_msg_redpoint.getVisibility() == View.VISIBLE && number > 0) return; if (v_msg_redpoint.getVisibility() == View.VISIBLE && number > 0) return;
if (number > 0) { if (number > 0) {
v_msg_redpoint.setVisibility(View.VISIBLE); v_msg_redpoint.setVisibility(View.VISIBLE);

View File

@ -62,12 +62,6 @@
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:layout_marginEnd="4dp" /> android:layout_marginEnd="4dp" />
<View
android:id="@+id/rc_margin"
android:layout_width="1dp"
android:layout_height="1dp"
android:visibility="gone"
android:layout_marginStart="15dp" />
<TextView <TextView
android:id="@+id/rc_conversation_content" android:id="@+id/rc_conversation_content"

View File

@ -12,6 +12,7 @@ import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
@ -214,8 +215,16 @@ public class LoginActivity extends AbsActivity {
onLoginSuccess(code, msg, info); onLoginSuccess(code, msg, info);
} }
}); });
hideKeyboard(mEditPwd);
}
/**
* 强隐键盘
* @param view
*/
private void hideKeyboard(View view) {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
//登录即代表同意服务和隐私条款 //登录即代表同意服务和隐私条款
private void forwardTip() { private void forwardTip() {
WebViewActivity.forward(mContext, HtmlConfig.LOGIN_PRIVCAY); WebViewActivity.forward(mContext, HtmlConfig.LOGIN_PRIVCAY);

View File

@ -18,6 +18,7 @@ import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
@ -365,7 +366,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//融云直播间聊天 //融云直播间聊天
Message msg = Message.obtain(); Message msg = Message.obtain();
msg.what = Constants.SOCKET_WHAT_BROADCAST; msg.what = Constants.SOCKET_WHAT_BROADCAST;
if (!"".equals(message.getContent()) && message.getContent() != null) { if (message.getContent() instanceof TextMessage && !"".equals(message.getContent()) && message.getContent() != null) {
TextMessage content = (TextMessage) message.getContent(); TextMessage content = (TextMessage) message.getContent();
if (content.getContent().contains("_method_")) { if (content.getContent().contains("_method_")) {
msg.obj = content.getContent(); msg.obj = content.getContent();
@ -377,7 +378,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
return false; return false;
} }
}); });
} }

View File

@ -65,7 +65,7 @@ public class PDLiveConversationListActivity extends AbsActivity {
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
mContext = this; mContext = this;
initView(); initView();
initData();
} }
/** /**
@ -175,6 +175,7 @@ public class PDLiveConversationListActivity extends AbsActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
initData();
} }
@Override @Override
@ -185,6 +186,8 @@ public class PDLiveConversationListActivity extends AbsActivity {
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
conversationListFragment.onStop();
} }
@Override @Override

View File

@ -7,7 +7,6 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.Toast;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -15,7 +14,6 @@ import com.blankj.utilcode.util.GsonUtils;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.manager.InstructorRemarkManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.activity.PDLIiveChatActivity; import com.yunbao.live.activity.PDLIiveChatActivity;
import com.yunbao.live.activity.PDLiveConversationActivity; import com.yunbao.live.activity.PDLiveConversationActivity;
import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.bean.SearchUserBean;
@ -107,10 +105,9 @@ public class ConversationIMListManager {
* @param targetId 用户id * @param targetId 用户id
*/ */
public void jumpConversation(Activity context, String targetId) { public void jumpConversation(Activity context, String targetId) {
// RouteUtils.registerActivity(RouteUtils.RongActivityType.ConversationActivity, PDLiveConversationActivity.class); if (context instanceof PDLIiveChatActivity) {
// Intent intent = new Intent(context, PDLiveConversationActivity.class); context.finish();
// intent.putExtra(RouteUtils.TARGET_ID, targetId); }
// context.startActivity(intent);
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE; Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
RouteUtils.routeToConversationActivity(context, type, targetId, null); RouteUtils.routeToConversationActivity(context, type, targetId, null);
} }
@ -124,7 +121,7 @@ public class ConversationIMListManager {
CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() { CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0&&!TextUtils.equals("__system__",userId)) { if (code == 0 && info.length > 0 && !TextUtils.equals("__system__", userId)) {
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class); SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
String userNiceName = ""; String userNiceName = "";
@ -159,6 +156,9 @@ public class ConversationIMListManager {
return false; return false;
} }
/**
* 长按时间
*/
@Override @Override
public boolean onConversationLongClick(Context context, View view, BaseUiConversation baseUiConversation) { public boolean onConversationLongClick(Context context, View view, BaseUiConversation baseUiConversation) {
new ConversationPopuwWindow((Activity) context) new ConversationPopuwWindow((Activity) context)
@ -167,9 +167,14 @@ public class ConversationIMListManager {
return true; return true;
} }
/**
* 点击
* @return
*/
@Override @Override
public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) { public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) {
return false; jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId());
return true;
} }
}; };

View File

@ -38,23 +38,16 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) { public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) {
//根据业务需要自定义处理 //根据业务需要自定义处理
super.bindViewHolder(holder, uiConversation, position, list, listener); super.bindViewHolder(holder, uiConversation, position, list, listener);
if (list.size() > 0) { ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_read_receipt_new);
Message.SentStatus sentStatus = list.get(position).mCore.getSentStatus(); if (uiConversation.mCore.getLatestMessageDirection()==Message.MessageDirection.SEND) {
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_read_receipt_new); Message.SentStatus sentStatus = uiConversation.mCore.getSentStatus();
View rcMargin = holder.itemView.findViewById(com.yunbao.live.R.id.rc_margin);
if (TextUtils.equals(list.get(position).mCore.getSenderUserId(), list.get(position).mCore.getTargetId())) {
readReceipt.setVisibility(View.GONE);
rcMargin.setVisibility(View.VISIBLE);
}
if (sentStatus == Message.SentStatus.READ) { if (sentStatus == Message.SentStatus.READ) {
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_read); readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_read);
} else { } else {
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_unread); readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_unread);
} }
}else {
readReceipt.setVisibility(View.GONE);
} }
} }
} }

View File

@ -211,48 +211,6 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
} }
return new_data; return new_data;
// if (select == 0) {
// JSONObject obj = JSON.parseObject(info[0]);
// mBannerList = JSON.parseArray(obj.getString("slide"), BannerBean.class);
// List<LiveBean> old_data = JSON.parseArray(obj.getString("list"), LiveBean.class);
// new_data = new ArrayList<>();
// if (old_data != null) {
// for (int j = 0; j < old_data.size(); j++) {
// new_data.add(old_data.get(j));
// if (j == 3) {
// LiveBean liveBean = new LiveBean();
// liveBean.setIsTop("1");
// new_data.add(liveBean);
// }
// }
// }
// if (!isHave) {
// if (new_data.size() > 5) {
// new_data.remove(5);
// }
// } else {
// if (mWeekListBean != null) {
// if (new_data.size() > 5) {
// new_data.get(5).setmWeekList(mWeekListBean);
// }
// }
// }
// return new_data;
// } else {
// List<LiveBean> old_data = JSON.parseArray(Arrays.toString(info), LiveBean.class);
// new_data = new ArrayList<>();
// for (int j = 0; j < old_data.size(); j++) {
// new_data.add(old_data.get(j));
// if (j == 3) {
// LiveBean liveBean = new LiveBean();
// liveBean.setIsTop("1");
// new_data.add(liveBean);
// }
// }
// return new_data;
// }
// }
} }
@Override @Override
@ -286,11 +244,9 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
} }
}); });
// if (headView != null) {
mClassRecyclerViewTop = (RecyclerView) findViewById(R.id.classRecyclerView_top); mClassRecyclerViewTop = (RecyclerView) findViewById(R.id.classRecyclerView_top);
mClassRecyclerViewTop.setHasFixedSize(true); mClassRecyclerViewTop.setHasFixedSize(true);
mClassRecyclerViewTop.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); mClassRecyclerViewTop.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
// }
ConfigBean configBean = CommonAppConfig.getInstance().getConfig(); ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
if (configBean != null) { if (configBean != null) {
List<LiveClassBean> list = configBean.getLiveClass(); List<LiveClassBean> list = configBean.getLiveClass();

View File

@ -1,12 +1,10 @@
package com.yunbao.main.views; package com.yunbao.main.views;
import android.content.Context; import android.content.Context;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import com.yunbao.common.HtmlConfig;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -59,15 +57,11 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
} else if (position == 1) { } else if (position == 1) {
mainHomeLiveViewHolder = new MainHomeLiveViewHolder(mContext, parent); mainHomeLiveViewHolder = new MainHomeLiveViewHolder(mContext, parent);
vh = mainHomeLiveViewHolder; vh = mainHomeLiveViewHolder;
} } else if (position == 2) {
else if (position == 2) {
mainHomeRecomLiveViewHolder = new MainHomeRecomLiveViewHolder(mContext, parent); mainHomeRecomLiveViewHolder = new MainHomeRecomLiveViewHolder(mContext, parent);
vh = mainHomeRecomLiveViewHolder; vh = mainHomeRecomLiveViewHolder;
} }
// else if (position == 3) {
// mCsdViewHolder = new MainHomeCsdViewHolder(mContext, parent);
// vh = mCsdViewHolder;
// }
if (vh == null) { if (vh == null) {
return; return;
} }

View File

@ -45,7 +45,6 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginTop="@dimen/rc_margin_size_30" android:layout_marginTop="@dimen/rc_margin_size_30"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:background="@drawable/rc_selector_item_unread"
android:drawableStart="@drawable/rc_unread_msg_arrow" android:drawableStart="@drawable/rc_unread_msg_arrow"
android:drawablePadding="10dp" android:drawablePadding="10dp"
android:gravity="center|left" android:gravity="center|left"
@ -67,7 +66,6 @@
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginTop="@dimen/rc_margin_size_80" android:layout_marginTop="@dimen/rc_margin_size_80"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:background="@drawable/rc_selector_item_unread"
android:drawableStart="@drawable/rc_unread_msg_arrow" android:drawableStart="@drawable/rc_unread_msg_arrow"
android:drawablePadding="10dp" android:drawablePadding="10dp"
android:gravity="center|left" android:gravity="center|left"