游戏求版本功能(未对接接口), 文章详情优化(文章内容跳转未做),消息中心(未接接口),首页资讯改版,跳转意见反馈规则汇总
This commit is contained in:
@ -40,6 +40,7 @@ import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.TokenUtils;
|
||||
import com.gh.common.util.TrafficUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.download.DataWatcher;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadManager;
|
||||
@ -50,6 +51,7 @@ import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameDigestEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.entity.SuggestionTypeEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.eventbus.EBShowDialog;
|
||||
@ -62,13 +64,14 @@ import com.gh.gamecenter.manager.FilterManager;
|
||||
import com.gh.gamecenter.manager.GameManager;
|
||||
import com.gh.gamecenter.manager.PackageManager;
|
||||
import com.gh.gamecenter.manager.UpdateManager;
|
||||
import com.gh.gamecenter.message.MessageFragment;
|
||||
import com.gh.gamecenter.news.NewsFragment;
|
||||
import com.gh.gamecenter.personal.PersonalFragment;
|
||||
import com.gh.gamecenter.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.retrofit.ObservableUtil;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.gh.gamecenter.zixun.ZiXunFragment;
|
||||
import com.gh.gamecenter.wenda.WenDaFragment;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
@ -79,6 +82,7 @@ import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
@ -99,15 +103,21 @@ import rx.schedulers.Schedulers;
|
||||
*/
|
||||
public class MainActivity extends BaseFragmentActivity implements OnClickListener {
|
||||
|
||||
// private NewsFragment newsFragment;
|
||||
private ZiXunFragment ziXunFragment;
|
||||
private NewsFragment newsFragment;
|
||||
private MessageFragment messageFragment;
|
||||
private WenDaFragment wenDaFragment;
|
||||
// private ZiXunFragment ziXunFragment;
|
||||
private PersonalFragment personalFragment;
|
||||
private GameFragment gameFragment;
|
||||
private ImageView ivGame;
|
||||
private ImageView ivNews;
|
||||
private ImageView ivWenDa;
|
||||
private ImageView ivMessage;
|
||||
private ImageView ivPersonal;
|
||||
private TextView tvGame;
|
||||
private TextView tvNews;
|
||||
private TextView tvWenDa;
|
||||
private TextView tvMessage;
|
||||
private TextView tvPersonal;
|
||||
|
||||
private SharedPreferences sp;
|
||||
@ -393,6 +403,47 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
if (sp.getBoolean("changeDefaultIcon", false) && sp.getInt("default_user_icon", 0) != 0) {
|
||||
postDefaultIcon(true, sp.getInt("default_user_icon", 0));
|
||||
}
|
||||
|
||||
getSuggestionType();
|
||||
}
|
||||
|
||||
private void getSuggestionType() {
|
||||
RetrofitManager
|
||||
.getApi()
|
||||
.getSuggestionType()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<SuggestionTypeEntity>(){
|
||||
@Override
|
||||
public void onResponse(SuggestionTypeEntity response) {
|
||||
super.onResponse(response);
|
||||
Set<String> suggestionGame = response.getGame();
|
||||
Set<String> suggestionLibao = response.getLibao();
|
||||
Set<String> suggestionPlugin = response.getPlugin();
|
||||
Set<String> suggestionService = response.getService();
|
||||
SharedPreferences.Editor edit = sp.edit();
|
||||
if (suggestionGame.size() != 0) {
|
||||
edit.putStringSet("suggestionGame", suggestionGame);
|
||||
}
|
||||
if (suggestionLibao.size() != 0) {
|
||||
edit.putStringSet("suggestionLibao", suggestionLibao);
|
||||
}
|
||||
if (suggestionPlugin.size() != 0) {
|
||||
edit.putStringSet("suggestionPlugin", suggestionPlugin);
|
||||
}
|
||||
if (suggestionService.size() != 0) {
|
||||
edit.putStringSet("suggestionService", suggestionService);
|
||||
}
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Utils.log("反馈的问题选项::ERROR::" + e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 更新用户使用的助手信息
|
||||
@ -514,12 +565,18 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
private void initViews() {
|
||||
findViewById(R.id.main_ll_game).setOnClickListener(this);
|
||||
findViewById(R.id.main_ll_news).setOnClickListener(this);
|
||||
findViewById(R.id.main_ll_wenda).setOnClickListener(this);
|
||||
findViewById(R.id.main_ll_message).setOnClickListener(this);
|
||||
findViewById(R.id.main_ll_personal).setOnClickListener(this);
|
||||
ivGame = (ImageView) findViewById(R.id.main_iv_game);
|
||||
ivNews = (ImageView) findViewById(R.id.main_iv_news);
|
||||
ivWenDa = (ImageView) findViewById(R.id.main_iv_wenda);
|
||||
ivMessage = (ImageView) findViewById(R.id.main_iv_message);
|
||||
ivPersonal = (ImageView) findViewById(R.id.main_iv_personal);
|
||||
tvGame = (TextView) findViewById(R.id.main_tv_game);
|
||||
tvNews = (TextView) findViewById(R.id.main_tv_news);
|
||||
tvWenDa = (TextView) findViewById(R.id.main_tv_wenda);
|
||||
tvMessage = (TextView) findViewById(R.id.main_tv_message);
|
||||
tvPersonal = (TextView) findViewById(R.id.main_tv_personal);
|
||||
}
|
||||
|
||||
@ -895,8 +952,8 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
if (gameFragment != null) {
|
||||
gameFragment.setHint(searchHint);
|
||||
}
|
||||
if (ziXunFragment != null) {
|
||||
ziXunFragment.setHint(searchHint);
|
||||
if (newsFragment != null) {
|
||||
newsFragment.setHint(searchHint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -946,9 +1003,13 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
} else if (id == R.id.main_ll_news) {
|
||||
EventBus.getDefault().post(new EBUISwitch("MainActivity", 1));
|
||||
setTabSelection(1);
|
||||
} else if (id == R.id.main_ll_wenda) {
|
||||
setTabSelection(2);
|
||||
} else if (id == R.id.main_ll_message){
|
||||
setTabSelection(3);
|
||||
} else if (id == R.id.main_ll_personal) {
|
||||
EventBus.getDefault().post(new EBUISwitch("MainActivity", 2));
|
||||
setTabSelection(2);
|
||||
setTabSelection(4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -986,30 +1047,78 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
case 1:
|
||||
ivNews.setImageResource(R.drawable.ic_news_select);
|
||||
tvNews.setTextColor(getResources().getColor(R.color.theme));
|
||||
if (ziXunFragment == null) {
|
||||
if (newsFragment == null) {
|
||||
List<Fragment> list = getSupportFragmentManager().getFragments();
|
||||
if (list != null) {
|
||||
for (Fragment fragment : list) {
|
||||
if (fragment.getClass().equals(NewsFragment.class)) {
|
||||
ziXunFragment = (ZiXunFragment) fragment;
|
||||
transaction.show(ziXunFragment);
|
||||
newsFragment = (NewsFragment) fragment;
|
||||
transaction.show(newsFragment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ziXunFragment == null) {
|
||||
ziXunFragment = new ZiXunFragment();
|
||||
if (newsFragment == null) {
|
||||
newsFragment = new NewsFragment();
|
||||
if (searchHint != null && searchHint.size() > 0) {
|
||||
ziXunFragment.setHint(searchHint);
|
||||
newsFragment.setHint(searchHint);
|
||||
}
|
||||
transaction.add(R.id.main_content, ziXunFragment);
|
||||
transaction.add(R.id.main_content, newsFragment);
|
||||
}
|
||||
} else {
|
||||
transaction.show(ziXunFragment);
|
||||
transaction.show(newsFragment);
|
||||
}
|
||||
currentTab = 1;
|
||||
break;
|
||||
case 2:
|
||||
ivWenDa.setImageResource(R.drawable.ic_wenda_select);
|
||||
tvWenDa.setTextColor(getResources().getColor(R.color.theme));
|
||||
if (wenDaFragment == null) {
|
||||
List<Fragment> list = getSupportFragmentManager().getFragments();
|
||||
if (list != null) {
|
||||
for (Fragment fragment : list) {
|
||||
if (fragment.getClass().equals(WenDaFragment.class)) {
|
||||
wenDaFragment = (WenDaFragment) fragment;
|
||||
transaction.show(wenDaFragment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wenDaFragment == null) {
|
||||
wenDaFragment = new WenDaFragment();
|
||||
transaction.add(R.id.main_content, wenDaFragment);
|
||||
}
|
||||
} else {
|
||||
transaction.show(wenDaFragment);
|
||||
}
|
||||
currentTab = 2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ivMessage.setImageResource(R.drawable.ic_message_select);
|
||||
tvMessage.setTextColor(getResources().getColor(R.color.theme));
|
||||
if (messageFragment == null) {
|
||||
List<Fragment> list = getSupportFragmentManager().getFragments();
|
||||
if (list != null) {
|
||||
for (Fragment fragment : list) {
|
||||
if (fragment.getClass().equals(MessageFragment.class)) {
|
||||
messageFragment = (MessageFragment) fragment;
|
||||
transaction.show(messageFragment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messageFragment == null) {
|
||||
messageFragment = new MessageFragment();
|
||||
transaction.add(R.id.main_content, messageFragment);
|
||||
}
|
||||
} else {
|
||||
transaction.show(messageFragment);
|
||||
}
|
||||
currentTab = 3;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ivPersonal.setImageResource(R.drawable.ic_user_select);
|
||||
tvPersonal.setTextColor(getResources().getColor(R.color.theme));
|
||||
if (personalFragment == null) {
|
||||
@ -1030,7 +1139,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
} else {
|
||||
transaction.show(personalFragment);
|
||||
}
|
||||
currentTab = 2;
|
||||
currentTab = 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1042,9 +1151,13 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
private void clearSelection() {
|
||||
ivGame.setImageResource(R.drawable.ic_game_unselect);
|
||||
ivNews.setImageResource(R.drawable.ic_news_unselect);
|
||||
ivWenDa.setImageResource(R.drawable.ic_wenda_unselect);
|
||||
ivMessage.setImageResource(R.drawable.ic_message_unselect);
|
||||
ivPersonal.setImageResource(R.drawable.ic_user_unselect);
|
||||
tvGame.setTextColor(Color.parseColor("#a7a8b2"));
|
||||
tvNews.setTextColor(Color.parseColor("#a7a8b2"));
|
||||
tvWenDa.setTextColor(Color.parseColor("#a7a8b2"));
|
||||
tvMessage.setTextColor(Color.parseColor("#a7a8b2"));
|
||||
tvPersonal.setTextColor(Color.parseColor("#a7a8b2"));
|
||||
}
|
||||
|
||||
@ -1056,8 +1169,14 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
if (gameFragment != null) {
|
||||
transaction.hide(gameFragment);
|
||||
}
|
||||
if (ziXunFragment != null) {
|
||||
transaction.hide(ziXunFragment);
|
||||
if (wenDaFragment != null) {
|
||||
transaction.hide(wenDaFragment);
|
||||
}
|
||||
if (messageFragment != null) {
|
||||
transaction.hide(messageFragment);
|
||||
}
|
||||
if (newsFragment != null) {
|
||||
transaction.hide(newsFragment);
|
||||
}
|
||||
|
||||
List<Fragment> list = getSupportFragmentManager().getFragments();
|
||||
|
||||
Reference in New Issue
Block a user