延迟加载我的光环 (部分问题后续处理

This commit is contained in:
juntao
2020-04-14 12:10:01 +08:00
parent e918b19e2e
commit fcd46cb2ea
6 changed files with 113 additions and 1268 deletions

View File

@ -9,14 +9,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.base.OnListClickListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.constant.Constants;
@ -37,6 +29,13 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.ButterKnife;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -145,7 +144,10 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
} else {
mCachedView = View.inflate(getContext(), getLayoutId(), null);
}
ButterKnife.bind(this, mCachedView);
if (useButterKnife()) {
ButterKnife.bind(this, mCachedView);
}
initView(mCachedView);
@ -309,4 +311,8 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
protected boolean addSyncPageObserver() {
return false;
}
protected boolean useButterKnife() {
return true;
}
}

View File

@ -14,8 +14,6 @@ import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.core.content.FileProvider;
import com.g00fy2.versioncompare.Version;
import com.gh.common.constant.Constants;
import com.gh.gamecenter.BuildConfig;
@ -38,7 +36,8 @@ import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
public class PackageUtils {

View File

@ -2,29 +2,18 @@ package com.gh.gamecenter.personal;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.fragment.BaseFragment;
import com.gh.base.fragment.BaseLazyFragment;
import com.gh.common.databind.BindingAdapters;
import com.gh.common.notifier.Notifier;
import com.gh.common.util.CheckLoginUtils;
@ -86,7 +75,16 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -97,7 +95,8 @@ import retrofit2.HttpException;
import static com.gh.gamecenter.fragment.MainWrapperFragment.INDEX_PERSONAL;
public class PersonalFragment extends BaseFragment implements Observer<ApiResponse<UserInfoEntity>> {
// TODO 转成 kotlin处理红点相关逻辑优化列表刷新方式
public class PersonalFragment extends BaseLazyFragment implements Observer<ApiResponse<UserInfoEntity>> {
@BindView(R.id.list_refresh)
SwipeRefreshLayout mListRefresh;
@ -138,13 +137,12 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
public final static String LOGIN_TAG = "login_tag"; //登入标识
public final static String LOGOUT_TAG = "logout_tag"; // 登出标识
public final static String MESSAGE_UNREAD_TAG = "message_unread_tag";
public final static String MESSAGE_READ_OVER = "MESSAGE_READ_OVER";
private final static String MESSAGE_UNREAD_TAG = "message_unread_tag";
private final static String MESSAGE_READ_OVER = "MESSAGE_READ_OVER";
private final static int REQUEST_MESSAGE = 199;
private UserInfoEntity mUserInfoEntity;
private SharedPreferences sp;
private AppDatabase mDatabase;
private UserViewModel mUserViewModel;
@ -170,7 +168,12 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
@Override
protected int getLayoutId() {
return R.layout.fragment_personal;
return R.layout.fragment_personal_stub;
}
@Override
protected boolean useButterKnife() {
return false;
}
@SuppressLint("CheckResult")
@ -178,20 +181,75 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sp = PreferenceManager.getDefaultSharedPreferences(getContext());
mDatabase = AppDatabase.getInstance(getContext());
final UserViewModel.Factory factory = new UserViewModel.Factory(getActivity().getApplication());
mUserViewModel = ViewModelProviders.of(this, factory).get(UserViewModel.class);
mUserHomeViewModel = ViewModelProviders.of(this, new UserHomeViewModel.Factory(HaloApp.getInstance().getApplication(),
UserManager.getInstance().getUserId())).get(UserHomeViewModel.class);
mUnreadViewModel = ViewModelProviders.of(this,
new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication())).get(MessageUnreadViewModel.class);
mPersonalViewModel = ViewModelProviders.of(this).get(PersonalViewModel.class);
}
@Override
public void onFragmentFirstVisible() {
super.onFragmentFirstVisible();
inflateRealView();
observeChanges();
}
private void inflateRealView() {
try {
mCachedView = ((ViewStub) (mCachedView.findViewById(R.id.stub))).inflate();
} catch (Exception e) {
e.printStackTrace();
}
ButterKnife.bind(this, mCachedView);
mPersonalFuncGroupAdapter = new PersonalFunctionGroupAdapter(requireContext());
mFuncRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
mFuncRecyclerView.setAdapter(mPersonalFuncGroupAdapter);
mFuncRecyclerView.addItemDecoration(new VerticalItemDecoration(requireContext(), 8f, false));
final UserViewModel.Factory factory = new UserViewModel.Factory(getActivity().getApplication());
mUserViewModel = ViewModelProviders.of(this, factory).get(UserViewModel.class);
int statusBarHeight = Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT ? 0 : DisplayUtils.getStatusBarHeight(getResources());
ViewGroup.LayoutParams params = toolbar.getLayoutParams();
params.height = DisplayUtils.dip2px(50) + statusBarHeight;
toolbar.setLayoutParams(params);
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
int absOffset = Math.abs(verticalOffset);
int invisibleOffset = DisplayUtils.dip2px(40F);
if (absOffset <= invisibleOffset) {
mUserIconSmall.setVisibility(View.GONE);
mPersonalUserNameSmall.setVisibility(View.GONE);
} else {
mUserIconSmall.setVisibility(View.VISIBLE);
mPersonalUserNameSmall.setVisibility(View.VISIBLE);
}
mListRefresh.setEnabled(absOffset <= 2);
});
mListRefresh.setColorSchemeColors(ContextCompat.getColor(requireContext(), R.color.theme));
mListRefresh.setProgressViewOffset(false, 0, DisplayUtils.dip2px(80) + DisplayUtils.getStatusBarHeight(requireContext().getResources()));
mListRefresh.setOnRefreshListener(() -> {
mPersonalViewModel.getHaloAddons();
if (CheckLoginUtils.isLogin()) {
mUnreadViewModel.retry();
MessageUnreadRepository.INSTANCE.loadMessageUnreadTotal();
mUserHomeViewModel.getBadgeList();
mUserHomeViewModel.availableBadges();
}
mBaseHandler.postDelayed(() -> {
mListRefresh.setRefreshing(false);
}, 2000);
MtaHelper.onEvent("我的光环_新", "下拉刷新", "下拉刷新");
});
}
private void observeChanges() {
mUserViewModel.getLoginObsUserinfo().observe(this, this);
mUserHomeViewModel = ViewModelProviders.of(this, new UserHomeViewModel.Factory(HaloApp.getInstance().getApplication(),
UserManager.getInstance().getUserId())).get(UserHomeViewModel.class);
mUserHomeViewModel.getBadges().observe(this, badgeEntities -> {
if (badgeEntities.isEmpty()) {
mPersonalBadgeTv.setText("领取徽章");
@ -201,7 +259,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
});
mUserHomeViewModel.getAvailableBadgeCount().observe(this, count -> mPersonalBadgeTips.setVisibility(count > 0 ? View.VISIBLE : View.GONE));
mPersonalViewModel = ViewModelProviders.of(this).get(PersonalViewModel.class);
mPersonalViewModel.getHaloAddData().observe(this, datas -> {
if (!datas.isEmpty()) {
mPersonalFuncGroupAdapter.setListData(datas);
@ -211,8 +268,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
});
mPersonalViewModel.getHaloAddons();
mUnreadViewModel = ViewModelProviders.of(this,
new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication())).get(MessageUnreadViewModel.class);
mUnreadViewModel.getLiveData().observe(this
, messageUnread -> {
if (messageUnread != null && messageUnread.getTotal() > 0) {
@ -256,45 +311,9 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int statusBarHeight = Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT ? 0 : DisplayUtils.getStatusBarHeight(getResources());
ViewGroup.LayoutParams params = toolbar.getLayoutParams();
params.height = DisplayUtils.dip2px(50) + statusBarHeight;
toolbar.setLayoutParams(params);
public void onFragmentResume() {
super.onFragmentResume();
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
int absOffset = Math.abs(verticalOffset);
int invisibleOffset = DisplayUtils.dip2px(40F);
if (absOffset <= invisibleOffset) {
mUserIconSmall.setVisibility(View.GONE);
mPersonalUserNameSmall.setVisibility(View.GONE);
} else {
mUserIconSmall.setVisibility(View.VISIBLE);
mPersonalUserNameSmall.setVisibility(View.VISIBLE);
}
mListRefresh.setEnabled(absOffset <= 2);
});
mListRefresh.setColorSchemeColors(ContextCompat.getColor(requireContext(), R.color.theme));
mListRefresh.setProgressViewOffset(false, 0, DisplayUtils.dip2px(80) + DisplayUtils.getStatusBarHeight(requireContext().getResources()));
mListRefresh.setOnRefreshListener(() -> {
mPersonalViewModel.getHaloAddons();
if (CheckLoginUtils.isLogin()) {
mUnreadViewModel.retry();
MessageUnreadRepository.INSTANCE.loadMessageUnreadTotal();
mUserHomeViewModel.getBadgeList();
mUserHomeViewModel.availableBadges();
}
mBaseHandler.postDelayed(() -> {
mListRefresh.setRefreshing(false);
}, 2000);
MtaHelper.onEvent("我的光环_新", "下拉刷新", "下拉刷新");
});
}
@Override
public void onResume() {
super.onResume();
if (NetworkUtils.isNetworkConnected(requireContext())) {
mUnreadViewModel.retry();
mUserHomeViewModel.getBadgeList();
@ -465,7 +484,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
}
}
private void sign() {
RetrofitManager.getInstance(getContext()).getApi()
.postSign(UserManager.getInstance().getUserId())
@ -517,13 +535,9 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
long curTime = Utils.getTime(getContext()) * 1000;
int lastSignDay = Integer.parseInt(formatDay.format(lastSignTime));
int curDay = Integer.parseInt(formatDay.format(curTime));
if (lastSignDay != curDay || curTime - lastSignTime > 24 * 60 * 60 * 1000) {
return true;
}
return false;
return lastSignDay != curDay || curTime - lastSignTime > 24 * 60 * 60 * 1000;
}
private String getSignSkipText(String text) {
return TextUtils.isEmpty(text) ? "去首页看看" : text;
}
@ -551,7 +565,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
}
}
@Override
public void onChanged(ApiResponse<UserInfoEntity> userInfoEntity) {
UserInfoEntity notifyUserInfo;
@ -583,7 +596,7 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
}
public static String getLoginEntranceByType(String loginTag) {
private static String getLoginEntranceByType(String loginTag) {
String entrance = "";
switch (loginTag) {
case "qq":

View File

@ -1,645 +0,0 @@
package com.gh.gamecenter.personal;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.fragment.BaseFragment;
import com.gh.base.fragment.WaitingDialogFragment;
import com.gh.common.databind.BindingAdapters;
import com.gh.common.notifier.Notifier;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.DirectUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.LogUtils;
import com.gh.common.util.LoginHelper;
import com.gh.common.util.MtaHelper;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.CollectionActivity;
import com.gh.gamecenter.GameDetailActivity;
import com.gh.gamecenter.HelpAndFeedbackActivity;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.MessageActivity;
import com.gh.gamecenter.NewsDetailActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.SettingActivity;
import com.gh.gamecenter.ShareGhActivity;
import com.gh.gamecenter.UserInfoActivity;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.entity.AppEntity;
import com.gh.gamecenter.entity.LoginTokenEntity;
import com.gh.gamecenter.entity.SignEntity;
import com.gh.gamecenter.entity.UserInfoEntity;
import com.gh.gamecenter.eventbus.EBConcernChanged;
import com.gh.gamecenter.eventbus.EBNetworkState;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.fragment.MainWrapperFragment;
import com.gh.gamecenter.history.HistoryActivity;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.message.MessageUnreadRepository;
import com.gh.gamecenter.message.MessageUnreadViewModel;
import com.gh.gamecenter.mygame.MyGameActivity;
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity;
import com.gh.gamecenter.qa.draft.CommunityDraftWrapperActivity;
import com.gh.gamecenter.qa.myqa.MyAskActivity;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.room.AppDatabase;
import com.gh.gamecenter.subject.SubjectActivity;
import com.gh.gamecenter.user.ApiResponse;
import com.gh.gamecenter.user.LoginTag;
import com.gh.gamecenter.user.UserViewModel;
import com.gh.gamecenter.video.videomanager.VideoManagerActivity;
import com.halo.assistant.HaloApp;
import com.jakewharton.rxbinding2.view.RxView;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Utils;
import com.tencent.connect.common.Constants;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.HttpException;
public class PersonalFragmentCopy extends BaseFragment implements Observer<ApiResponse<UserInfoEntity>>, LoginHelper.LoginCallback {
@BindView(R.id.scroll_view)
ScrollView mScrollView;
@BindView(R.id.personal_login_qq)
View mLoginQq;
@BindView(R.id.personal_login_wechat)
View mLoginWechat;
@BindView(R.id.personal_login_weibo)
View mLoginWeibo;
@BindView(R.id.personal_user_icon)
SimpleDraweeView mUserIcon;
@BindView(R.id.personal_user_name)
TextView mUserName;
@BindView(R.id.login_qq_icon)
ImageView mLoginQqIcon;
@BindView(R.id.login_qq_tv)
TextView mLoginQqTv;
@BindView(R.id.login_wechat_icon)
ImageView mLoginWechatIcon;
@BindView(R.id.login_wechat_tv)
TextView mLoginWechatTv;
@BindView(R.id.login_weibo_icon)
ImageView mLoginWeiboIcon;
@BindView(R.id.login_weibo_tv)
TextView mLoginWeiboTv;
@BindView(R.id.personal_game)
View mPersonalGame;
@BindView(R.id.personal_share)
View mPersonalShare;
@BindView(R.id.personal_suggestion)
View mPersonalSuggestion;
@BindView(R.id.personal_setting_update_hint)
TextView mPersonalSettingUpdateHint;
@BindView(R.id.personal_setting)
View mPersonalSetting;
@BindView(R.id.login_message_hint)
TextView mLoginMessageHint; // 亦即登录后按钮
@BindView(R.id.user_icon_hint)
View mIconHint;
@BindView(R.id.personal_ask)
View mPersonalAsk;
@BindView(R.id.personal_home_fans_hint)
TextView mFansHint;
@BindView(R.id.personal_user_badge)
SimpleDraweeView mUserBadge;
public final static String LOGIN_TAG = "login_tag"; //登入标识
public final static String LOGOUT_TAG = "logout_tag"; // 登出标识
public final static String MESSAGE_UNREAD_TAG = "message_unread_tag";
public final static String MESSAGE_READ_OVER = "MESSAGE_READ_OVER";
public static final int REQUEST_MESSAGE = 199;
private UserInfoEntity mUserInfoEntity;
private WaitingDialogFragment mLoginDialog;
private SharedPreferences sp;
private AppDatabase mDatabase;
private UserViewModel mUserViewModel;
private MessageUnreadViewModel mUnreadViewModel;
private boolean mIsLogging = false;
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Constants.REQUEST_LOGIN) { // QQ Login callback
LoginHelper.onQQLoginCallback(requestCode, resultCode, data);
} else if (requestCode == 32973) {// 32973 WeiBo requestCode
LoginHelper.onWeiboLoginCallback(requestCode, resultCode, data);
} else if (requestCode == REQUEST_MESSAGE) {
if (mUnreadViewModel != null) mUnreadViewModel.retry();
}
}
@Override
protected int getLayoutId() {
return R.layout.fragment_personal_copy;
}
@SuppressLint("CheckResult")
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sp = PreferenceManager.getDefaultSharedPreferences(getContext());
mDatabase = AppDatabase.getInstance(getContext());
checkUpdate();
final UserViewModel.Factory factory = new UserViewModel.Factory(getActivity().getApplication());
mUserViewModel = ViewModelProviders.of(this, factory).get(UserViewModel.class);
mUserViewModel.getLoginObsUserinfo().observe(this, this);
mUnreadViewModel = ViewModelProviders.of(this,
new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication())).get(MessageUnreadViewModel.class);
mUnreadViewModel.getLiveData().observe(this
, messageUnread -> {
if (messageUnread != null && messageUnread.getTotal() > 0) {
mFansHint.setVisibility(messageUnread.getFans() > 0 ? View.VISIBLE : View.GONE);
mFansHint.setText((messageUnread.getFans() + "个新粉丝"));
int count = messageUnread.getTotal() - messageUnread.getFans();
mLoginMessageHint.setVisibility(count > 0 ? View.VISIBLE : View.GONE);
BindingAdapters.setMessageUnread(mLoginMessageHint, count);
// 第一次开启应用时检查消息中心看有没有未读消息确定需不需要弹 Notifier 通知
if (mUnreadViewModel.isFirstTimeInit()) {
mUnreadViewModel.flagFirstTimeInit(false);
if (messageUnread.getMeta() != null && messageUnread.getMeta().getUser() != null) {
if (messageUnread.getMeta() != null) {
String displayText = StringUtils.shrinkStringWithDot(messageUnread.getMeta().getUser().getName(), 8);
String suffixText;
if ("follow_question".equals(messageUnread.getMeta().getType())) {
suffixText = "回答了你关注的问题";
} else {
suffixText = "回答了你的问题";
}
displayText += suffixText;
String content = messageUnread.getMeta().getAnswerId() + displayText;
if (Notifier.shouldShowNotifier(content)) {
Notifier.create(getActivity())
.setText(displayText)
.setDuration(5000)
.setIcon(messageUnread.getMeta().getUser().getIcon())
.setOnClickListener(view -> {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_ANSWER_ID, messageUnread.getMeta().getAnswerId());
bundle.putString(EntranceUtils.KEY_ENTRANCE, EntranceUtils.ENTRANCE_UMENG);
bundle.putString(EntranceUtils.KEY_TO, AnswerDetailActivity.class.getName());
EntranceUtils.jumpActivity(getActivity(), bundle);
MtaHelper.onEvent("消息弹窗", suffixText, "Does not contains any parameter.");
// 标记已读
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("type", messageUnread.getMeta().getType());
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
RetrofitManager.getInstance(requireContext()).getApi()
.postMessageRead(UserManager.getInstance().getUserId(), messageUnread.getMeta().getMessageId(), body)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<ResponseBody>() {
@Override
public void onResponse(@Nullable ResponseBody response) {
super.onResponse(response);
MessageUnreadRepository.INSTANCE.loadMessageUnreadData();
}
});
} catch (Exception e) {
e.printStackTrace();
}
Notifier.hide();
})
.show(true, 500L);
Notifier.tagNotifierAsShowed(content);
}
}
}
}
EventBus.getDefault().post(new EBReuse(MESSAGE_UNREAD_TAG));
} else {
mLoginMessageHint.setVisibility(View.GONE);
mFansHint.setVisibility(View.GONE);
EventBus.getDefault().post(new EBReuse(MESSAGE_READ_OVER));
}
});
// 微信/签到
RxView.clicks(mLoginWechat)
.throttleFirst(1, TimeUnit.SECONDS)
.subscribe(aVoid -> {
if (mUserInfoEntity != null) {
MtaHelper.onEvent("我的光环", "签到");
sign();
} else {
MtaHelper.onEvent("我的光环", "微信登录");
LoginHelper.loginWithWechat(this);
}
});
}
// 连接上网络事件
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBNetworkState busNetworkState) {
if (busNetworkState.isNetworkConnected()
&& mUserViewModel.isLogin()
&& (mUserInfoEntity == null || TextUtils.isEmpty(UserManager.getInstance().getToken()))) {
mUserViewModel.retryCheckLogin();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBReuse reuse) {
if (MESSAGE_READ_OVER.equals(reuse.getType())) { // 消息阅读完成
if (mLoginMessageHint != null) {
mLoginMessageHint.setVisibility(View.GONE);
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBUISwitch busNine) {
if (MainWrapperFragment.EB_MAIN_SCROLL_TOP.equals(busNine.getFrom())
&& MainWrapperFragment.INDEX_PERSONAL == busNine.getPosition()) {
mScrollView.fullScroll(ScrollView.FOCUS_UP);
}
}
@OnClick({
R.id.personal_login_qq, R.id.personal_login_weibo, R.id.personal_user_icon,
R.id.personal_history, R.id.personal_user_name, R.id.personal_game, R.id.personal_share,
R.id.personal_suggestion, R.id.personal_setting, R.id.personal_ask, R.id.personal_home,
R.id.personal_draft, R.id.personal_video_manager, R.id.personal_bind_wechat})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.personal_login_qq:
if (mUserInfoEntity != null) {
MtaHelper.onEvent("我的光环", "收藏");
startActivity(CollectionActivity.getCollectionActivity(getContext(), "(我的光环)"));
} else {
MtaHelper.onEvent("我的光环", "QQ登录");
LoginHelper.loginWithQQ(this, requireActivity());
}
break;
case R.id.personal_login_weibo:
if (mUserInfoEntity != null) {
MtaHelper.onEvent("我的光环", "消息");
startActivityForResult(MessageActivity.getIntent(getContext(), "(我的光环)+(消息中心)"), REQUEST_MESSAGE);
} else {
MtaHelper.onEvent("我的光环", "微博登录");
LoginHelper.loginWithWeibo(this, requireActivity());
}
break;
case R.id.personal_user_icon:
case R.id.personal_user_name:
if (mIconHint.getVisibility() == View.VISIBLE) {
LoginTokenEntity loginToken = UserManager.getInstance().getLoginTokenEntity();
mIconHint.setVisibility(View.GONE);
if (loginToken != null && loginToken.getId() != null)
sp.edit().putBoolean(loginToken.getId(), false).apply();
}
if (mUserInfoEntity != null) {
MtaHelper.onEvent("我的光环", "个人中心");
startActivity(UserInfoActivity.getIntent(getContext()));
} else {
MtaHelper.onEvent("我的光环", "手机登录");
CheckLoginUtils.checkLogin(getContext(), "我的光环-手机登录", null);
}
break;
case R.id.personal_game:
if (mUserInfoEntity != null) {
MtaHelper.onEvent("我的光环", "我的游戏");
startActivity(new Intent(getContext(), MyGameActivity.class));
} else {
toast("请先登录");
MtaHelper.onEvent("我的光环", "我的游戏");
CheckLoginUtils.checkLogin(getContext(), "我的光环-我的游戏", null);
}
break;
case R.id.personal_share:
MtaHelper.onEvent("我的光环", "分享");
startActivity(ShareGhActivity.getIntent(getContext()));
break;
case R.id.personal_suggestion:
MtaHelper.onEvent("我的光环", "反馈");
startActivity(HelpAndFeedbackActivity.getIntent(getActivity()));
break;
case R.id.personal_bind_wechat:
MtaHelper.onEvent("我的光环", "设置微信提醒");
startActivity(WebActivity.getBindWechatIntent(requireContext()));
break;
case R.id.personal_setting:
MtaHelper.onEvent("我的光环", "设置图标");
DataCollectionUtils.uploadClick(getActivity(), "设置图标", "我的光环");
startActivity(SettingActivity.getIntent(getContext(),
mPersonalSettingUpdateHint.getVisibility() == View.VISIBLE, "(我的光环)"));
break;
case R.id.personal_ask:
MtaHelper.onEvent("我的光环", "我的问答");
CheckLoginUtils.checkLogin(getContext(), "我的光环-我的问答", () -> startActivity(MyAskActivity.getIntent(getContext())));
break;
case R.id.personal_home:
CheckLoginUtils.checkLogin(getContext(), "我的光环-个人主页", () -> {
DirectUtils.directToHomeActivity(getContext(), UserManager.getInstance().getUserId(), "", "我的光环");
});
MtaHelper.onEvent("我的光环", "个人主页");
break;
case R.id.personal_draft:
CheckLoginUtils.checkLogin(getContext(), "我的光环-我的草稿", () -> {
startActivity(CommunityDraftWrapperActivity.getIntent(getContext()));
});
MtaHelper.onEvent("我的光环", "我的草稿");
break;
case R.id.personal_history:
startActivity(HistoryActivity.getHistoryIntent(getContext(), "我的光环-浏览记录"));
MtaHelper.onEvent("我的光环", "浏览记录");
break;
case R.id.personal_video_manager:
CheckLoginUtils.checkLogin(getContext(), "我的光环-视频投稿", () -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
startActivity(VideoManagerActivity.getIntent(getContext(), "", "我的光环-视频投稿"));
} else {
DialogUtils.showAlertDialog(getContext(), "提示",
"抱歉,您当前系统版本过低,暂不支持视频功能", "我知道了",
null, null, null);
}
});
MtaHelper.onEvent("我的光环", "视频投稿");
break;
}
}
private boolean isCanSign(long time) {
SimpleDateFormat formatDay = new SimpleDateFormat("dd", Locale.CHINA);
long lastSignTime = time * 1000;
long curTime = Utils.getTime(getContext()) * 1000;
int lastSignDay = Integer.parseInt(formatDay.format(lastSignTime));
int curDay = Integer.parseInt(formatDay.format(curTime));
if (lastSignDay != curDay || curTime - lastSignTime > 24 * 60 * 60 * 1000) {
return true;
}
return false;
}
private void sign() {
RetrofitManager.getInstance(getContext()).getApi()
.postSign(UserManager.getInstance().getUserId())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<SignEntity>() {
@Override
public void onResponse(SignEntity signEntity) {
mLoginWechatTv.setText("已签到");
if (isCanSign(signEntity.getLastTime())) {
DialogUtils.showSignDialog(getContext(), "签到成功获得经验1"
, getString(R.string.sign_dialog_content, signEntity.getSerialSign())
, getString(R.string.sign_dialog_content2, signEntity.getExperience())
, getSignSkipText(signEntity.getTitle()), () -> {
signSkip(signEntity);
}
);
signEntity.setLastTime(System.currentTimeMillis() / 1000);
} else {
DialogUtils.showSignDialog(getContext(), "今天已签到,明天再来吧~"
, getString(R.string.sign_dialog_content, signEntity.getSerialSign())
, getString(R.string.sign_dialog_content2, signEntity.getExperience())
, getSignSkipText(signEntity.getTitle()), () -> {
signSkip(signEntity);
}
);
}
signEntity.setId(UserManager.getInstance().getUserId());
if (mDatabase.signDao().updateSignEntity(signEntity) <= 0) {
mDatabase.signDao().addSignEntity(signEntity);
}
}
@Override
public void onFailure(HttpException e) {
if (e == null || e.code() != 401) {
toast(R.string.loading_network_error);
}
}
});
}
private String getSignSkipText(String text) {
return TextUtils.isEmpty(text) ? "去首页看看" : text;
}
private void signSkip(SignEntity signEntity) {
SignEntity.Data data = signEntity.getData();
String entrance = "(我的光环)+(签到)";
if (data == null || TextUtils.isEmpty(data.getType())) {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_HOME));
return;
}
switch (data.getType()) {
case "game":
DataUtils.onMtaEvent(getActivity(), "我的光环_签到跳转", "游戏", signEntity.getTitle());
GameDetailActivity.startGameDetailActivity(getContext(), data.getLink(), entrance);
break;
case "news":
DataUtils.onMtaEvent(getActivity(), "我的光环_签到跳转", "文章", signEntity.getTitle());
startActivity(NewsDetailActivity.getIntentById(getContext(), data.getLink(), entrance));
break;
case "column":
DataUtils.onMtaEvent(getActivity(), "我的光环_签到跳转", "专题", signEntity.getTitle());
SubjectActivity.startSubjectActivity(getContext(), data.getLink(), null, false, entrance);
break;
}
}
private void changeLoginState(boolean isLogin) {
if (isLogin) {
SignEntity signEntity = mDatabase.signDao().getSignEntityById(UserManager.getInstance().getUserId());
if (signEntity != null && !isCanSign(signEntity.getLastTime())) {
mLoginWechatTv.setText("已签到");
} else {
mLoginWechatTv.setText("签到");
}
if (mUserInfoEntity != null) {
ImageUtils.displayIcon(mUserIcon, mUserInfoEntity.getIcon());
mUserName.setText(mUserInfoEntity.getName());
if (mUserInfoEntity.getAuth() != null) {
mUserBadge.setVisibility(View.VISIBLE);
ImageUtils.display(mUserBadge, mUserInfoEntity.getAuth().getIcon());
}
}
mLoginQqIcon.setImageResource(R.drawable.personal_collection_icon);
mLoginQqTv.setText("收藏");
mLoginWechatIcon.setImageResource(R.drawable.personal_sign_icon);
mLoginWeiboIcon.setImageResource(R.drawable.personal_message_icon);
mLoginWeiboTv.setText("消息");
} else {
mUserBadge.setVisibility(View.GONE);
mIconHint.setVisibility(View.GONE);
mLoginQqIcon.setImageResource(R.drawable.qq_login_icon);
mLoginQqTv.setText(getString(R.string.QQ));
mLoginWechatIcon.setImageResource(R.drawable.wechat_login_icon);
mLoginWechatTv.setText(getString(R.string.wechat));
mLoginWeiboIcon.setImageResource(R.drawable.weibo_login_icon);
mLoginWeiboTv.setText(getString(R.string.sina_weibo));
mUserIcon.setImageURI("");
mUserName.setText("手机登录");
if (mLoginMessageHint.getVisibility() == View.VISIBLE) {
mLoginMessageHint.setVisibility(View.GONE);
EventBus.getDefault().post(new EBReuse(MESSAGE_READ_OVER));
}
}
}
private void checkUpdate() {
String channel = HaloApp.getInstance().getChannel();
RetrofitManager.getInstance(getContext())
.getApi()
.getUpdate(PackageUtils.getVersionName(), PackageUtils.getVersionCode(), channel)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<AppEntity>() {
@Override
public void onResponse(AppEntity response) {
super.onResponse(response);
if (response.getVersionCode() > PackageUtils.getVersionCode()) {
mPersonalSettingUpdateHint.setVisibility(View.VISIBLE);
} else {
mPersonalSettingUpdateHint.setVisibility(View.GONE);
}
}
});
}
@Override
public void onLoginSuccess(@NotNull LoginTag loginType, @NotNull JSONObject jsonContent) {
if (CommonDebug.IS_DEBUG) {
Utils.log("Login Output=>获取第三方登录信息成功" + jsonContent.toString() + "" + loginType.name());
}
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
mLoginDialog = WaitingDialogFragment.newInstance(getString(R.string.logging));
mLoginDialog.show(getChildFragmentManager(), null);
}
mIsLogging = true;
mUserViewModel.login(jsonContent, loginType);
LogUtils.login("logging", loginType.name(), getLoginEntranceByType(loginType.name()));
}
@Override
public void onLoginFailure(@NotNull LoginTag loginType, @NotNull String error) {
toast(error);
}
@Override
public void onChanged(@Nullable ApiResponse<UserInfoEntity> userInfoEntity) {
UserInfoEntity notifyUserInfo;
if (userInfoEntity != null) {
notifyUserInfo = userInfoEntity.getData();
} else {
notifyUserInfo = null;
}
if (notifyUserInfo != null && mUserInfoEntity == null) { // 单个用户,首次触发
mUnreadViewModel.retry(); // 检查是否有未读消息
EventBus.getDefault().post(new EBConcernChanged());
/**
* default_icon_ 判断是不是默认头像
* 具体默认头像链接请看:
* {@link com.gh.common.util.UserIconUtils#getUserIconUrl(int)}
*/
LoginTokenEntity loginToken = UserManager.getInstance().getLoginTokenEntity();
if (loginToken != null && loginToken.getId() != null &&
sp.getBoolean(loginToken.getId(), true) &&
notifyUserInfo.getIcon() != null &&
notifyUserInfo.getIcon().contains("default_icon_")) {
mIconHint.setVisibility(View.VISIBLE);
}
LoginTokenEntity loginTokenEntity = UserManager.getInstance().getLoginTokenEntity();
if (mIsLogging && loginTokenEntity != null) {
String loginType = loginTokenEntity.getLoginType();
LogUtils.login("success", loginType, getLoginEntranceByType(loginType));
mIsLogging = false;
}
}
mUserInfoEntity = notifyUserInfo;
if (notifyUserInfo == null) {
mUnreadViewModel.clean();
changeLoginState(false);
EventBus.getDefault().post(new EBConcernChanged());
} else {
changeLoginState(true);
}
if (mLoginDialog != null) {
mLoginDialog.dismissAllowingStateLoss();
}
}
public static String getLoginEntranceByType(String loginTag) {
String entrance = "";
switch (loginTag) {
case "qq":
entrance = "我的光环-QQ";
break;
case "wechat":
entrance = "我的光环-微信";
break;
case "weibo":
entrance = "我的光环-新浪微博";
break;
}
return entrance;
}
}

View File

@ -1,539 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/me_ll_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white">
<RelativeLayout
android:id="@+id/personal_user_icon_container"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="45dp">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/personal_user_icon"
android:layout_width="70dp"
android:layout_height="70dp"
fresco:placeholderImage="@drawable/user_default_icon_comment"
fresco:roundAsCircle="true" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/personal_user_badge"
android:layout_width="23dp"
android:layout_height="23dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>
<ImageView
android:id="@+id/user_icon_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/personal_user_icon_container"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@+id/personal_user_icon_container"
android:src="@drawable/user_icon_hint"
android:visibility="gone" />
<TextView
android:id="@+id/personal_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/personal_user_icon_container"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="@string/personal_default_username"
android:textColor="@android:color/black"
android:textSize="15sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:paddingTop="20dp">
<LinearLayout
android:id="@+id/personal_login_qq"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@drawable/reuse_listview_item_style"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="28dp">
<ImageView
android:id="@+id/login_qq_icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/qq_login_icon" />
</RelativeLayout>
<TextView
android:id="@+id/login_qq_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/QQ"
android:textColor="@color/title"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/personal_login_wechat"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@drawable/reuse_listview_item_style"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="28dp">
<ImageView
android:id="@+id/login_wechat_icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:src="@drawable/wechat_login_icon" />
</RelativeLayout>
<TextView
android:id="@+id/login_wechat_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/wechat"
android:textColor="@color/title"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/personal_login_weibo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@drawable/reuse_listview_item_style"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="28dp">
<ImageView
android:id="@+id/login_weibo_icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:src="@drawable/weibo_login_icon" />
<TextView
android:id="@+id/login_message_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_toRightOf="@+id/login_weibo_icon"
android:background="@drawable/message_unread_hint"
android:gravity="center"
android:maxLength="3"
android:minWidth="12dp"
android:minHeight="12dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="8dp"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/login_weibo_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/sina_weibo"
android:textColor="@color/title"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/personal_game"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_game_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_game_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_game_icon"
android:text="@string/personale_mygame"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/cutting_line"
android:background="@color/cutting_line" />
<RelativeLayout
android:id="@+id/personal_video_manager"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_video_manager_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_video_manager_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_video_manager_icon"
android:text="视频投稿"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/personal_ask"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_ask_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_ask_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_ask_icon"
android:text="@string/personal_ask"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/cutting_line"
android:background="@color/cutting_line" />
<RelativeLayout
android:id="@+id/personal_draft"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_draft_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_draft_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_draft_icon"
android:text="@string/personal_draft"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/personal_home"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_home_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_home_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_home_icon"
android:text="@string/personal_home"
android:textColor="@color/title"
android:textSize="15sp" />
<TextView
android:id="@+id/personal_home_fans_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/setting_update_hint"
android:paddingLeft="8dp"
android:paddingTop="2dp"
android:paddingRight="8dp"
android:paddingBottom="2dp"
android:textColor="@android:color/white"
android:textSize="12sp"
android:visibility="gone" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/cutting_line"
android:background="@color/cutting_line" />
<RelativeLayout
android:id="@+id/personal_history"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_history_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/ic_history" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_history_icon"
android:text="@string/personal_history"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/personal_suggestion"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_suggestion_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_suggestion_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_suggestion_icon"
android:text="@string/personal_feedback"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/cutting_line"
android:background="@color/cutting_line" />
<RelativeLayout
android:id="@+id/personal_share"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_share_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_share_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_share_icon"
android:text="@string/personal_share"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/personal_bind_wechat"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="8dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_bind_wechat_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/ic_options_wechat" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_bind_wechat_icon"
android:text="@string/personal_bind_wechat"
android:textColor="@color/title"
android:textSize="15sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/cutting_line"
android:background="@color/cutting_line" />
<RelativeLayout
android:id="@+id/personal_setting"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/reuse_listview_item_style"
android:paddingLeft="18dp"
android:paddingRight="18dp">
<ImageView
android:id="@+id/personal_setting_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_centerVertical="true"
android:layout_marginRight="18dp"
android:src="@drawable/personal_setting_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/personal_setting_icon"
android:text="@string/personale_settings"
android:textColor="@color/title"
android:textSize="15sp" />
<TextView
android:id="@+id/personal_setting_update_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/setting_update_hint"
android:paddingLeft="8dp"
android:paddingTop="2dp"
android:paddingRight="8dp"
android:paddingBottom="2dp"
android:text="@string/personal_update_hint"
android:textColor="@android:color/white"
android:textSize="12sp"
android:visibility="gone" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="8dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ViewStub
android:id="@+id/stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/fragment_personal" />
</FrameLayout>