多语言切换
This commit is contained in:
parent
32e3584fef
commit
bfbbe54308
@ -80,6 +80,7 @@ public class AppContext extends CommonAppContext {
|
|||||||
public LiveImDeletUtil liveImDeletUtil;
|
public LiveImDeletUtil liveImDeletUtil;
|
||||||
private final static List<WeakReference<Activity>> activities = new ArrayList<>();
|
private final static List<WeakReference<Activity>> activities = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
|
private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResumed(Activity activity) {
|
public void onActivityResumed(Activity activity) {
|
||||||
|
@ -27,6 +27,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.interfaces.LifeCycleListener;
|
import com.yunbao.common.interfaces.LifeCycleListener;
|
||||||
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.ClickUtil;
|
import com.yunbao.common.utils.ClickUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -48,6 +49,7 @@ public abstract class AbsActivity extends AppCompatActivity {
|
|||||||
Resources res = super.getResources();
|
Resources res = super.getResources();
|
||||||
Configuration config = new Configuration();
|
Configuration config = new Configuration();
|
||||||
config.setToDefaults();
|
config.setToDefaults();
|
||||||
|
config.locale = IMLoginManager.get(this).getLocaleLanguage();
|
||||||
res.updateConfiguration(config, res.getDisplayMetrics());
|
res.updateConfiguration(config, res.getDisplayMetrics());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,26 @@ public class LiveClassBean {
|
|||||||
private boolean isAll;
|
private boolean isAll;
|
||||||
private String des;
|
private String des;
|
||||||
private boolean checked;
|
private boolean checked;
|
||||||
|
private String chinese;
|
||||||
|
private String english;
|
||||||
|
|
||||||
|
public String getChinese() {
|
||||||
|
return chinese;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveClassBean setChinese(String chinese) {
|
||||||
|
this.chinese = chinese;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnglish() {
|
||||||
|
return english;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveClassBean setEnglish(String english) {
|
||||||
|
this.english = english;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -19,6 +19,7 @@ import com.yunbao.common.event.FollowEvent;
|
|||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.manager.APKManager;
|
import com.yunbao.common.manager.APKManager;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
import com.yunbao.common.manager.LiveClassManager;
|
||||||
import com.yunbao.common.manager.NewLevelManager;
|
import com.yunbao.common.manager.NewLevelManager;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.MD5Util;
|
import com.yunbao.common.utils.MD5Util;
|
||||||
@ -156,7 +157,7 @@ public class CommonHttpUtil {
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
locale = context.getResources().getConfiguration().getLocales().get(0);
|
locale = context.getResources().getConfiguration().getLocales().get(0);
|
||||||
} else {
|
} else {
|
||||||
locale = context.getResources().getConfiguration().locale;
|
locale = IMLoginManager.get(context).getLocaleLanguage();
|
||||||
}
|
}
|
||||||
if (locale.getLanguage().equals("zh")) {
|
if (locale.getLanguage().equals("zh")) {
|
||||||
lang = "chinese";
|
lang = "chinese";
|
||||||
@ -202,6 +203,10 @@ public class CommonHttpUtil {
|
|||||||
JSONArray levelArray = obj.getJSONArray("levelanchor_new");
|
JSONArray levelArray = obj.getJSONArray("levelanchor_new");
|
||||||
new NewLevelManager(context).UpAnchorDataLevel(levelArray.toJSONString());
|
new NewLevelManager(context).UpAnchorDataLevel(levelArray.toJSONString());
|
||||||
}
|
}
|
||||||
|
if (obj.containsKey("liveclass")) {//缓存直播间分类
|
||||||
|
JSONArray levelArray = obj.getJSONArray("liveclass");
|
||||||
|
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
|
||||||
|
}
|
||||||
if (obj.containsKey("apk_ver")) {
|
if (obj.containsKey("apk_ver")) {
|
||||||
APKManager.get().setApkVer(obj.getString("apk_ver"));
|
APKManager.get().setApkVer(obj.getString("apk_ver"));
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ import com.yunbao.common.views.floatingview.APPEasyFloat;
|
|||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录者信息管理
|
* 登录者信息管理
|
||||||
*/
|
*/
|
||||||
@ -46,6 +48,20 @@ public class IMLoginManager extends BaseCacheManager {
|
|||||||
private final String STATUS_ANCHOR_SAY = "anchorSay";
|
private final String STATUS_ANCHOR_SAY = "anchorSay";
|
||||||
private final String STATUS_ANCHOR_CALL = "anchorCallMe";
|
private final String STATUS_ANCHOR_CALL = "anchorCallMe";
|
||||||
|
|
||||||
|
private final String KEY_LANGUAGE = "language";
|
||||||
|
|
||||||
|
public void setLanguage(boolean isEnglish) {
|
||||||
|
put(KEY_LANGUAGE, isEnglish);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Locale getLocaleLanguage() {
|
||||||
|
if (!getBoolean(KEY_LANGUAGE, false)) {
|
||||||
|
return Locale.SIMPLIFIED_CHINESE;
|
||||||
|
} else {
|
||||||
|
return new Locale("en", "rUS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setDefaultBubbleUrl(String defaultBubbleUrl) {
|
public void setDefaultBubbleUrl(String defaultBubbleUrl) {
|
||||||
put(keyDefaultBubbleUrl, defaultBubbleUrl);
|
put(keyDefaultBubbleUrl, defaultBubbleUrl);
|
||||||
}
|
}
|
||||||
@ -55,7 +71,6 @@ public class IMLoginManager extends BaseCacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setXiaJBG(boolean xjbg) {
|
public void setXiaJBG(boolean xjbg) {
|
||||||
put(xiaJBG, xjbg);
|
put(xiaJBG, xjbg);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.yunbao.common.manager;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.yunbao.common.bean.LiveClassBean;
|
||||||
|
import com.yunbao.common.bean.NewLevelModel;
|
||||||
|
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LiveClassManager extends BaseCacheManager {
|
||||||
|
private final String KEY_LIVE_CLASS = "keyLiveClass";
|
||||||
|
private List<LiveClassBean> liveClass = new ArrayList<>();
|
||||||
|
|
||||||
|
public LiveClassManager(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存等级图标
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
*/
|
||||||
|
public void UpDataLiveClass(String json) {
|
||||||
|
liveClass = new Gson().fromJson(json, new TypeToken<List<LiveClassBean>>() {
|
||||||
|
}.getType());
|
||||||
|
put(KEY_LIVE_CLASS, liveClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取等级数据
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<LiveClassBean> getLiveClass() {
|
||||||
|
return getList(KEY_LIVE_CLASS, new TypeToken<List<LiveClassBean>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
}
|
1129
common/src/main/res/values-en-rUS/string.xml
Normal file
1129
common/src/main/res/values-en-rUS/string.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,9 +9,9 @@ ext {
|
|||||||
]
|
]
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式、
|
//正式、
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
//测试
|
//测试
|
||||||
// serverHost : "https ://ceshi.yaoulive.com",
|
serverHost : "https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package com.yunbao.main.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.AppManager;
|
import com.yunbao.common.utils.AppManager;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
@ -16,6 +19,7 @@ import java.util.Stack;
|
|||||||
public class LanguageSettingActivity extends AbsActivity {
|
public class LanguageSettingActivity extends AbsActivity {
|
||||||
private LinearLayout traditionalChinese, english;
|
private LinearLayout traditionalChinese, english;
|
||||||
private ImageView imgTraditionalChinese, imgEnglish;
|
private ImageView imgTraditionalChinese, imgEnglish;
|
||||||
|
private Locale locale;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -25,6 +29,14 @@ public class LanguageSettingActivity extends AbsActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
super.main();
|
super.main();
|
||||||
|
locale = IMLoginManager.get(mContext).getLocaleLanguage();
|
||||||
|
if (locale == Locale.SIMPLIFIED_CHINESE) {
|
||||||
|
findViewById(R.id.img_english).setVisibility(View.GONE);
|
||||||
|
findViewById(R.id.img_traditional_chinese).setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
findViewById(R.id.img_english).setVisibility(View.VISIBLE);
|
||||||
|
findViewById(R.id.img_traditional_chinese).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
traditionalChinese = findViewById(R.id.traditional_chinese);
|
traditionalChinese = findViewById(R.id.traditional_chinese);
|
||||||
english = findViewById(R.id.english);
|
english = findViewById(R.id.english);
|
||||||
imgEnglish = findViewById(R.id.img_english);
|
imgEnglish = findViewById(R.id.img_english);
|
||||||
@ -33,13 +45,23 @@ public class LanguageSettingActivity extends AbsActivity {
|
|||||||
ViewClicksAntiShake.clicksAntiShake(traditionalChinese, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(traditionalChinese, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
changeAllActivitysLanguage(Locale.SIMPLIFIED_CHINESE);
|
locale = Locale.SIMPLIFIED_CHINESE;
|
||||||
|
findViewById(R.id.img_english).setVisibility(View.GONE);
|
||||||
|
findViewById(R.id.img_traditional_chinese).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(english, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(english, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
changeAllActivitysLanguage(Locale.US);
|
locale = new Locale("en", "rUS");
|
||||||
|
findViewById(R.id.img_english).setVisibility(View.VISIBLE);
|
||||||
|
findViewById(R.id.img_traditional_chinese).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.complete), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
changeAllActivitysLanguage(locale);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -47,8 +69,12 @@ public class LanguageSettingActivity extends AbsActivity {
|
|||||||
private void changeAllActivitysLanguage(Locale locale) {
|
private void changeAllActivitysLanguage(Locale locale) {
|
||||||
Stack<Activity> allActivityStacks = AppManager.getInstance().getAllActivityStacks();
|
Stack<Activity> allActivityStacks = AppManager.getInstance().getAllActivityStacks();
|
||||||
for (int i = 0; i < allActivityStacks.size(); i++) {
|
for (int i = 0; i < allActivityStacks.size(); i++) {
|
||||||
|
if (!(allActivityStacks.get(i) instanceof LanguageSettingActivity)) {
|
||||||
LanguageUtil.shiftLanguage(locale, allActivityStacks.get(i), mContext);
|
LanguageUtil.shiftLanguage(locale, allActivityStacks.get(i), mContext);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
IMLoginManager.get(mContext).setLanguage(locale != Locale.SIMPLIFIED_CHINESE);
|
||||||
|
startActivity(new Intent(mContext, MainActivity.class));
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,21 @@ package com.yunbao.main.adapter;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.yunbao.common.bean.LiveClassBean;
|
import com.yunbao.common.bean.LiveClassBean;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class MainHomeLivesClassAdapter extends RecyclerView.Adapter<MainHomeLivesClassAdapter.Vh> {
|
public class MainHomeLivesClassAdapter extends RecyclerView.Adapter<MainHomeLivesClassAdapter.Vh> {
|
||||||
|
|
||||||
@ -71,6 +73,7 @@ public class MainHomeLivesClassAdapter extends RecyclerView.Adapter<MainHomeLive
|
|||||||
|
|
||||||
class Vh extends RecyclerView.ViewHolder {
|
class Vh extends RecyclerView.ViewHolder {
|
||||||
TextView mName;
|
TextView mName;
|
||||||
|
|
||||||
public Vh(View itemView) {
|
public Vh(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
mName = (TextView) itemView.findViewById(R.id.tv_class_name);
|
mName = (TextView) itemView.findViewById(R.id.tv_class_name);
|
||||||
@ -80,7 +83,18 @@ public class MainHomeLivesClassAdapter extends RecyclerView.Adapter<MainHomeLive
|
|||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
void setData(LiveClassBean bean, int position) {
|
void setData(LiveClassBean bean, int position) {
|
||||||
itemView.setTag(position);
|
itemView.setTag(position);
|
||||||
mName.setText(bean.getName());
|
Locale locale;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
locale = mContext.getResources().getConfiguration().getLocales().get(0);
|
||||||
|
} else {
|
||||||
|
locale = mContext.getResources().getConfiguration().locale;
|
||||||
|
}
|
||||||
|
if (locale.getLanguage().equals("zh")) {
|
||||||
|
mName.setText(bean.getChinese());
|
||||||
|
} else {
|
||||||
|
mName.setText(bean.getEnglish());
|
||||||
|
}
|
||||||
|
|
||||||
if (position == choice) {
|
if (position == choice) {
|
||||||
mName.setBackgroundResource(R.drawable.button_ffc621);
|
mName.setBackgroundResource(R.drawable.button_ffc621);
|
||||||
mName.setTextColor(Color.parseColor("#FFC621"));
|
mName.setTextColor(Color.parseColor("#FFC621"));
|
||||||
|
@ -7,8 +7,6 @@ import android.content.res.Configuration;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
|
||||||
import com.yunbao.main.activity.MainActivity;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -42,9 +40,8 @@ public class LanguageUtil {
|
|||||||
DisplayMetrics dm = resources.getDisplayMetrics();
|
DisplayMetrics dm = resources.getDisplayMetrics();
|
||||||
config.locale = locale;
|
config.locale = locale;
|
||||||
resources.updateConfiguration(config, dm);
|
resources.updateConfiguration(config, dm);
|
||||||
if (!(activity instanceof MainActivity)) {
|
activity.finish();
|
||||||
activity.recreate();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,7 @@ package com.yunbao.main.views;
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.Outline;
|
import android.graphics.Outline;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -14,7 +11,6 @@ import android.view.ViewGroup;
|
|||||||
import android.view.ViewOutlineProvider;
|
import android.view.ViewOutlineProvider;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.core.content.FileProvider;
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@ -29,7 +25,6 @@ import com.yunbao.common.activity.WebViewActivity;
|
|||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||||
import com.yunbao.common.bean.BannerBean;
|
import com.yunbao.common.bean.BannerBean;
|
||||||
import com.yunbao.common.bean.ConfigBean;
|
|
||||||
import com.yunbao.common.bean.LiveBean;
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.bean.LiveClassBean;
|
import com.yunbao.common.bean.LiveClassBean;
|
||||||
import com.yunbao.common.bean.WeekListBean;
|
import com.yunbao.common.bean.WeekListBean;
|
||||||
@ -37,10 +32,10 @@ import com.yunbao.common.custom.CommonRefreshView;
|
|||||||
import com.yunbao.common.custom.ItemDecoration;
|
import com.yunbao.common.custom.ItemDecoration;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
|
import com.yunbao.common.manager.LiveClassManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.MicStatusManager;
|
import com.yunbao.common.utils.MicStatusManager;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.ShareUtil;
|
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.views.CustomViewHolder;
|
import com.yunbao.common.views.CustomViewHolder;
|
||||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||||
@ -59,7 +54,6 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -272,9 +266,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
|
|||||||
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();
|
List<LiveClassBean> list = new LiveClassManager(mContext).getLiveClass();
|
||||||
if (configBean != null) {
|
|
||||||
List<LiveClassBean> list = configBean.getLiveClass();
|
|
||||||
if (list != null && list.size() > 0) {
|
if (list != null && list.size() > 0) {
|
||||||
List<LiveClassBean> targetList = new ArrayList<>();
|
List<LiveClassBean> targetList = new ArrayList<>();
|
||||||
if (list.size() <= 6) {
|
if (list.size() <= 6) {
|
||||||
@ -304,7 +296,6 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
|
|||||||
mClassRecyclerViewTop.setAdapter(topAdapter);
|
mClassRecyclerViewTop.setAdapter(topAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
View headView = mAdapter.getHeadView();
|
View headView = mAdapter.getHeadView();
|
||||||
mBanner = (Banner) headView.findViewById(R.id.banner);
|
mBanner = (Banner) headView.findViewById(R.id.banner);
|
||||||
mRefreshView.initData();
|
mRefreshView.initData();
|
||||||
|
@ -93,9 +93,9 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
|
|||||||
@Override
|
@Override
|
||||||
protected String[] getTitles() {
|
protected String[] getTitles() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
WordUtil.getString(R.string.follow),
|
mContext.getString(R.string.follow),
|
||||||
WordUtil.getString(R.string.hot),
|
mContext.getString(R.string.hot),
|
||||||
WordUtil.getString(R.string.recomment),
|
mContext.getString(R.string.recomment),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/complete"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
|
@ -161,7 +161,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:visibility="gone"
|
android:visibility="visible"
|
||||||
android:paddingTop="15dp"
|
android:paddingTop="15dp"
|
||||||
android:paddingBottom="25dp">
|
android:paddingBottom="25dp">
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user