处理一部分activity的toolbar,已经处理完毕的标记为Deprecated,为了保持MTA数据上报兼容性,暂时未删除对应的Activity

This commit is contained in:
CsHeng
2017-12-14 17:56:54 +08:00
parent e0b70b26f3
commit bf7b0b0a82
67 changed files with 2251 additions and 2495 deletions

View File

@ -41,6 +41,7 @@ public abstract class BaseActivity extends BaseToolBarActivity implements EasyPe
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
ButterKnife.bind(this);
mEntrance = getIntent().getStringExtra(KEY_ENTRANCE);
if (getIntent().getBundleExtra(KEY_DATA) != null) {
@ -69,12 +70,13 @@ public abstract class BaseActivity extends BaseToolBarActivity implements EasyPe
}
//如果是游戏分享newsTitle默认为空
public void showShare(String url, String gameName, String icon, String newsTitle, ArrayList<String> tag, boolean isToolsBox) {
public void showShare(String url, String gameName, String icon, String newsTitle, ArrayList<String> tagList, boolean isToolsBox) {
//判断是否是官方版
boolean isPlugin = false;
if (tag != null) {
for (String s : tag) {
// tagList.contains("官方版")???
if (tagList != null) {
for (String s : tagList) {
if (!"官方版".equals(s)) {
isPlugin = true;
}

View File

@ -4,11 +4,13 @@ import android.app.Activity;
import android.app.Application.ActivityLifecycleCallbacks;
import android.os.Bundle;
import com.gh.gamecenter.DataUtils;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.DataUtils;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.AppManager;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
/**
* 1、写点针对生命周期的统计代码
@ -24,8 +26,6 @@ public class GHActivityLifecycleCallbacksImpl implements ActivityLifecycleCallba
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
EventBus.getDefault().register(activity);
AppManager.getInstance().addActivity(activity);
}
@ -65,7 +65,6 @@ public class GHActivityLifecycleCallbacksImpl implements ActivityLifecycleCallba
@Override
public void onActivityDestroyed(Activity activity) {
AppManager.getInstance().finishActivity(activity);
EventBus.getDefault().unregister(activity);
}
}

View File

@ -10,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import com.gh.base.BaseActivity;
import com.gh.base.BaseToolBarActivity;
import com.gh.base.OnListClickListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.util.EntranceUtils;
@ -57,13 +58,13 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
handleOnClick(v);
}
protected void initTitle(@StringRes int res) {
initTitle(getString(res));
protected void setNavigationTitle(@StringRes int res) {
setNavigationTitle(getString(res));
}
protected void initTitle(String title) {
if (getActivity() instanceof BaseActivity) {
((BaseActivity) getActivity()).setNavigationTitle(title);
protected void setNavigationTitle(String title) {
if (getActivity() instanceof BaseToolBarActivity) {
((BaseToolBarActivity) getActivity()).setNavigationTitle(title);
}
}
@ -124,10 +125,22 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
EventBus.getDefault().unregister(this);
}
public void toast(@StringRes int res) {
toast(getString(res));
}
public void toast(String msg) {
Utils.toast(getContext(), msg);
}
public void toastLong(@StringRes int msg) {
toastLong(getString(msg));
}
public void toastLong(String msg) {
RuntimeUtils.getInstance().toastLong(getContext(), msg);
}
public boolean isEverPause() {
return isEverPause;
}
@ -138,7 +151,7 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
}
@Override
public void loadDone(Object obj) {
public void loadDone(T obj) {
}
@ -153,7 +166,7 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
}
@Override
public <T> void onListClick(View view, int position, T data) {
public <LIST> void onListClick(View view, int position, LIST data) {
}

View File

@ -35,7 +35,7 @@ import java.util.List;
*/
public abstract class BaseFragment_ViewPager extends BaseFragment implements DoubleTapTextView.OnDoubleTapListener {
protected static final String ARGS_INDEX = "index";
public static final String ARGS_INDEX = "index";
protected int mCheckedIndex = 0;
protected PagerAdapter mAdapter;
protected List<Fragment> mFragmentsList;

View File

@ -137,7 +137,7 @@ public class CommentUtils {
break;
case "查看对话":
context.startActivity(CommentDetailActivity.getCommentDetailIntent(context, commentEntity.getId()));
context.startActivity(CommentDetailActivity.getIntent(context, commentEntity.getId()));
break;
}
}

View File

@ -2,114 +2,23 @@ package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.gh.base.BaseActivity;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.manager.UpdateManager;
import com.tencent.bugly.beta.tinker.TinkerManager;
import java.lang.ref.WeakReference;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnLongClick;
import com.halo.assistant.fragment.AboutFragment;
import com.halo.assistant.ui.IntentFactory;
/**
* Created by khy on 2017/2/28.
*/
public class AboutActivity extends BaseActivity {
@BindView(R.id.about_version_tv)
TextView mAboutVersion;
@BindView(R.id.setting_rl_update)
RelativeLayout mAboutUpdateRl;
@BindView(R.id.about_version_pb)
ProgressBar mAboutPb;
@BindView(R.id.about_tv_version)
TextView mVersionName;
private Handler handler = new MyHandler(this);
@Deprecated
public class AboutActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context) {
Intent intent = new Intent(context, AboutActivity.class);
return intent;
// Intent intent = new Intent(context, AboutActivity.class);
return new IntentFactory.Builder(context)
.setActivity(AboutActivity.class)
.setFragment(AboutFragment.class).build();
}
@Override
protected int getLayoutId() {
return R.layout.activity_about;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_about));
// ((TextView) findViewById(R.id.about_tv_version)).setText("V" + PackageUtils.getVersionName(this));
mVersionName.setText("V" + PackageUtils.getPatchVersionName()); // TODO 版本号暂时与gradle versionName不一致
}
@Override
protected void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}
@OnClick({R.id.about_shengming, R.id.setting_rl_update})
public void OnClick(View view) {
if (view.getId() == R.id.setting_rl_update) {
UpdateManager.getInstance(AboutActivity.this).checkUpdate(false, handler); // 检出更新
} else if (view.getId() == R.id.about_shengming) {
Intent intent = WebActivity.getWebIntent(this);
startActivity(intent);
}
}
@OnLongClick(R.id.about_tv_version)
public boolean OnLongClick(View view) {
if (view.getId() == R.id.about_tv_version) {
String tinkerId = TinkerManager.getNewTinkerId();
if (!TextUtils.isEmpty(tinkerId)) {
mVersionName.setText("V" + PackageUtils.getPatchVersionName() + "." + tinkerId);
} else {
Toast.makeText(getApplicationContext(), R.string.toast_upload_latest, Toast.LENGTH_SHORT).show();
}
}
return false;
}
private static class MyHandler extends Handler {
private WeakReference<AboutActivity> mWeakReference;
public MyHandler(AboutActivity activity) {
mWeakReference = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
final AboutActivity activity = mWeakReference.get();
if (activity != null) {
if (msg.what == 0) {
final String version = (String) msg.obj;
activity.mAboutVersion.setText(StringUtils.buildString("发现新版本 V", version));
} else if (msg.what == 1) {
activity.mAboutVersion.setText(R.string.toast_upload_latest);
}
}
}
}
}

View File

@ -162,7 +162,6 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
mTitleTv.setTextColor(Color.WHITE);
mBackIv.setImageResource(R.drawable.reuse_kc_back);
// 添加分享图标
TextView hintTv = new TextView(this);
hintTv.setText("操作说明");
@ -173,8 +172,7 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
RelativeLayout reuse_actionbar = (RelativeLayout) mContentView.findViewById(
R.id.reuse_actionbar);
RelativeLayout reuse_actionbar = (RelativeLayout) findViewById(R.id.reuse_actionbar);
reuse_actionbar.addView(hintTv, params);
//修改沉浸栏以及ActionBar 颜色

View File

@ -2,240 +2,23 @@ package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.BaseActivity;
import com.gh.common.util.DialogUtils;
import com.gh.common.view.VerticalItemDecoration;
import com.gh.gamecenter.adapter.CleanApkAdapter;
import com.gh.gamecenter.entity.InstallGameEntity;
import com.gh.gamecenter.eventbus.EBSkip;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.text.DecimalFormat;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import com.halo.assistant.fragment.ApkCleanerFragment;
import com.halo.assistant.ui.IntentFactory;
/**
* Created by khy on 2017/1/24.
*/
public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.OnScanListener {
@BindView(R.id.apk_count)
TextView mApkCount;
@BindView(R.id.apk_rv)
RecyclerView mApkRv;
@BindView(R.id.delete_btn)
TextView mApkDeleteBtn;
@BindView(R.id.select_game_all)
CheckBox mApkSelectAll;
@BindView(R.id.scan_pb)
ProgressBar mScanPb;
@BindView(R.id.reuse_nodata_skip_tv_hint)
TextView mNodataSkipTv;
@BindView(R.id.reuse_nodata_skip_tv_btn)
TextView mNodataSkipBtn;
@BindView(R.id.reuse_nodata_skip)
LinearLayout mNodataSkipLl;
@BindView(R.id.delete_bottom)
LinearLayout mDeleteBottom;
@BindView(R.id.select_game_installed_ll)
RelativeLayout mInstallAllData;
private CleanApkAdapter mAdapter;
@Deprecated
public class CleanApkActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context) {
Intent intent = new Intent(context, CleanApkActivity.class);
return intent;
// Intent intent = new Intent(context, CleanApkActivity.class);
return new IntentFactory.Builder(context)
.setActivity(CleanApkActivity.class)
.setFragment(ApkCleanerFragment.class).build();
}
@Override
protected int getLayoutId() {
return R.layout.activity_clean_apk;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_clean_apk));
mNodataSkipLl.setVisibility(View.GONE);
mAdapter = new CleanApkAdapter(this, this, mApkDeleteBtn, mApkSelectAll);
mApkRv.setLayoutManager(new LinearLayoutManager(this));
mApkRv.addItemDecoration(new VerticalItemDecoration(this, 8, true));
mApkRv.setAdapter(mAdapter);
mApkSelectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
ArrayMap<Integer, Boolean> selectPosition = new ArrayMap<>();
ArrayMap<Integer, Boolean> selectPosition1 = mAdapter.getSelectPosition();
int itemCount = mAdapter.getItemCount();
if (isChecked) {
for (int i = 0; i < itemCount; i++) {
selectPosition.put(i, true);
}
} else {
int selectCount = 0;
for (Integer integer : selectPosition1.keySet()) {
if (selectPosition1.get(integer)) {
selectCount++;
}
}
if (selectCount != itemCount) {
return;
}
for (int i = 0; i < itemCount; i++) {
selectPosition.put(i, false);
}
}
mAdapter.setSelectPosition(selectPosition);
mAdapter.notifyItemRangeChanged(0, itemCount);
mAdapter.checkBoxControl(isChecked, 0);
}
});
mNodataSkipBtn.setText("去首页看看");
mNodataSkipTv.setText("安装包已清理干净\n快去发现更多好玩的游戏吧");
mNodataSkipTv.setLineSpacing(0, 1.5f);
}
@OnClick({R.id.delete_btn, R.id.reuse_nodata_skip_tv_btn})
public void onClick(View view) {
switch (view.getId()) {
case R.id.delete_btn: {
String s = mApkDeleteBtn.getText().toString();
if ("停止扫描".equals(s)) {
mAdapter.isStopScan();
} else {
if ("一键删除".equals(s)) {
Utils.toast(CleanApkActivity.this, "请选择需要删除的安装包");
return;
}
final List<InstallGameEntity> apkList = mAdapter.getApkList();
final ArrayMap<Integer, Boolean> selectPosition = mAdapter.getSelectPosition();
for (int i = 0; i < apkList.size(); i++) {
if (selectPosition.get(i) && apkList.get(i).getInstallStatus() == 1) {
DialogUtils.showWarningDialog(CleanApkActivity.this, "删除安装包"
, Html.fromHtml(getString(R.string.delete_apk_hint))
, "取消 ", "确定"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
deleteApk(apkList, selectPosition);
}
}, null);
return;
}
}
deleteApk(apkList, selectPosition);
}
break;
}
case R.id.reuse_nodata_skip_tv_btn: {
Intent intent = MainActivity.getMainIntent(this);
startActivity(intent);
mNodataSkipBtn.postDelayed(new Runnable() {
@Override
public void run() {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 0));
}
}, 300);
break;
}
}
}
private void deleteApk(List<InstallGameEntity> apkList, ArrayMap<Integer, Boolean> selectPosition) {
long size = 0;
for (int i = 0; i < apkList.size(); i++) {
if (selectPosition.get(i)) {
InstallGameEntity installGameEntity = apkList.get(i);
size = size + installGameEntity.getGameSize();
File file = new File(installGameEntity.getGamePath());
if (file.isFile() && file.exists()) {
file.delete();
mAdapter.deleteApk(i);
i--;
}
}
}
double allSize = (((float) size / 1024) / 1024);
DecimalFormat df = new DecimalFormat("#.00");
String sizeName = df.format(allSize) + "MB";
Utils.toast(CleanApkActivity.this, "删除成功,已为您节省" + sizeName + "空间");
mApkDeleteBtn.setText("一键删除");
mAdapter.notifyDataSetChanged(); // 刷新Adapter position
updateScanData();
if (apkList.size() == 0) { // 全部删除
mNodataSkipLl.setVisibility(View.VISIBLE);
mInstallAllData.setVisibility(View.GONE);
mDeleteBottom.setVisibility(View.GONE);
}
}
private void updateScanData() {
long allSize = 0;
List<InstallGameEntity> apkList = mAdapter.getApkList();
for (InstallGameEntity installGameEntity : apkList) {
allSize = allSize + installGameEntity.getGameSize();
}
double size = (((float) allSize / 1024) / 1024);
DecimalFormat df = new DecimalFormat("0.00");
String sizeName = df.format(size) + "MB";
mApkCount.setText(Html.fromHtml(getString(R.string.clean_apk_count, apkList.size(), sizeName)));
}
@Override
public void onScanOver() {
mApkDeleteBtn.setText("立即删除");
mApkDeleteBtn.setBackgroundResource(R.drawable.game_item_btn_red_style);
updateScanData();
mScanPb.setVisibility(View.GONE);
mApkSelectAll.setVisibility(View.VISIBLE);
mApkSelectAll.setChecked(true);
}
@Override
public void noData() {
mNodataSkipBtn.setText("去首页看看");
mNodataSkipTv.setText("暂无安装包");
mNodataSkipLl.setVisibility(View.VISIBLE);
mInstallAllData.setVisibility(View.GONE);
mDeleteBottom.setVisibility(View.GONE);
}
}

View File

@ -3,33 +3,25 @@ package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import com.gh.base.BaseActivity;
import com.gh.gamecenter.collection.CollectionFragment;
import com.gh.base.fragment.BaseFragment_ViewPager;
import com.gh.gamecenter.collection.CollectionWrapperFragment;
import com.halo.assistant.ui.IntentFactory;
/**
* Created by khy on 18/07/17.
*/
@Deprecated
public class CollectionActivity extends CommonActivity {
public class CollectionActivity extends BaseActivity {
public static final Intent getCollectionActivity(Context context) {
Intent intent = new Intent(context, CollectionActivity.class);
return intent;
@NonNull
public static Intent getCollectionActivity(Context context) {
Bundle args = new Bundle();
args.putInt(BaseFragment_ViewPager.ARGS_INDEX, CollectionWrapperFragment.INDEX_TOOL);
return new IntentFactory.Builder(context)
.setActivity(CollectionActivity.class)
.setFragment(CollectionWrapperFragment.class).setArgs(args).build();
}
@Override
protected int getLayoutId() {
return R.layout.activity_collection;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle("我的收藏");
getSupportFragmentManager().beginTransaction().replace(
R.id.layout_fragment_content, CollectionFragment.newInstance(0)).commitAllowingStateLoss();
}
}

View File

@ -1,241 +1,25 @@
package com.gh.gamecenter;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.BaseActivity;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.LoginUtils;
import com.gh.common.util.PostCommentUtils;
import com.gh.gamecenter.adapter.CommentDetailAdapter;
import com.gh.gamecenter.adapter.OnCommentCallBackListener;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.UserInfoEntity;
import com.lightgame.utils.Utils;
import org.json.JSONException;
import org.json.JSONObject;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnTouch;
import retrofit2.HttpException;
import com.halo.assistant.fragment.comment.CommentDetailFragment;
import com.halo.assistant.ui.IntentFactory;
/**
* Created by khy on 2017/3/22.
*/
@Deprecated
public class CommentDetailActivity extends CommonActivity {
// TODO: 16/11/17 时间比较紧 先暂时这么做 最好发表评论那块和评论详情整合
public class CommentDetailActivity extends BaseActivity implements OnCommentCallBackListener {
@BindView(R.id.comment_detail_rv)
RecyclerView mRecyclerView;
@BindView(R.id.comment_detail_close_comment)
View mCommentDetailCloseComment;
@BindView(R.id.comment_detail_comment_et)
EditText mCommentDetailCommentEt;
@BindView(R.id.comment_user_icon)
SimpleDraweeView mCommentUserIcon;
@BindView(R.id.comment_user_name)
TextView mCommentUserName;
@BindView(R.id.comment_send)
TextView mCommentSend;
@BindView(R.id.comment_detail_user_rl)
RelativeLayout mCommentDetailUserRl;
@BindView(R.id.comment_detail_comment_rl)
RelativeLayout mCommentDetailCommentRl;
@BindView(R.id.comment_detail_sv)
ScrollView mCommentDetailSv;
@BindView(R.id.reuse_none_data)
View mNoData;
private Dialog mSendingDialog;
private UserInfoEntity mUserInfo;
private CommentEntity mCommentEntity; // 回复评论的实体 用完马上清空
private CommentDetailAdapter mAdapter;
private LinearLayoutManager mLayoutManager;
public static Intent getCommentDetailIntent(Context context, String commentId) {
Intent intent = new Intent(context, CommentDetailActivity.class);
intent.putExtra(EntranceUtils.KEY_COMMENTID, commentId);
return intent;
}
@Override
protected int getLayoutId() {
return R.layout.activity_comment_detail;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_comment_detail));
String commentId = getIntent().getStringExtra(EntranceUtils.KEY_COMMENTID);
mAdapter = new CommentDetailAdapter(this, commentId, this, mNoData, mRecyclerView);
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE && !mAdapter.isOver() && !mAdapter.isLoading()) {
mAdapter.loadData(mAdapter.getItemCount());
}
}
});
mUserInfo = LoginUtils.getUserInfo(this);
if (mUserInfo != null) {
ImageUtils.Companion.display(mCommentUserIcon, mUserInfo.getIcon());
mCommentUserName.setText(mUserInfo.getName());
}
}
@Override
public void onCommentCallback(CommentEntity entity) {
mCommentEntity = entity;
setSoftInput(true);
}
@OnTouch(R.id.comment_detail_close_comment)
public boolean OnRecyclerTouchListener() {
if (mCommentDetailCloseComment.getVisibility() == View.VISIBLE) {
setSoftInput(false);
}
return true;
}
@OnClick(R.id.comment_send)
public void OnSendCommentListener() {
final String content = mCommentDetailCommentEt.getText().toString();
if (content.length() == 0) {
Utils.toast(this, "评论内容不能为空!");
return;
}
mSendingDialog = DialogUtils.showWaitDialog(this, "正在提交");
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("content", content);
} catch (JSONException e) {
e.printStackTrace();
}
if (mCommentEntity != null && mCommentEntity.getId() == null) {
Utils.toast(this, "评论异常 id null");
mSendingDialog.cancel();
return;
}
PostCommentUtils.addCommentData(CommentDetailActivity.this, null, jsonObject.toString(), mCommentEntity,
new PostCommentUtils.PostCommentListener() {
@Override
public void postSuccess(JSONObject response) {
mSendingDialog.dismiss();
toast("发表成功");
mCommentDetailCommentEt.setText("");
setSoftInput(false);
}
@Override
public void postFailed(Throwable e) {
mSendingDialog.dismiss();
if (e instanceof HttpException) {
HttpException exception = (HttpException) e;
if (exception.code() == 403) {
try {
JSONObject errorJson = new JSONObject(exception.response().errorBody().string());
String detail = errorJson.getString("detail");
switch (detail) {
case "too frequent":
toast("别话痨哦~休息一会再来评论吧~");
break;
case "user blocked":
toast("账号状态异常,暂时无法发表评论");
break;
case "article blocked":
toast("文章异常,无法发表评论");
setSoftInput(false);
break;
case "illegal":
toast("评论内容可能包括敏感信息,请修改后再发表");
break;
default:
toast("评论失败,未知原因");
break;
}
} catch (Exception ex) {
ex.printStackTrace();
toast("评论异常");
}
return;
}
}
toast("提交失败,请检查网络设置");
}
});
}
//软键盘控制
private void setSoftInput(boolean isShow) {
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (isShow) {
CheckLoginUtils.checkLogin(this, new CheckLoginUtils.OnLoggenInListener() {
@Override
public void onLoggedIn() {
imm.showSoftInputFromInputMethod(mCommentDetailCommentEt.getWindowToken(), 0);
imm.toggleSoftInputFromWindow(mCommentDetailCommentEt.getWindowToken(), 0, InputMethodManager.HIDE_NOT_ALWAYS);
mCommentDetailCommentRl.setVisibility(View.VISIBLE);
mCommentDetailCommentEt.setFocusable(true);
mCommentDetailCommentEt.setFocusableInTouchMode(true);
mCommentDetailCommentEt.requestFocus();
mCommentDetailCloseComment.setVisibility(View.VISIBLE);
if (mCommentEntity != null && mCommentEntity.getUser() != null) {
mCommentDetailCommentEt.setHint("回复" + mCommentEntity.getUser().getName() + "");
} else {
mCommentDetailCommentEt.setHint("优质评论会被优先展示");
}
}
});
} else {
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
mCommentDetailCloseComment.setVisibility(View.GONE);
mCommentDetailCommentRl.setVisibility(View.GONE);
if (mCommentEntity != null) {
mCommentEntity = null; // 清空当前评论实体
mCommentDetailCommentEt.setHint("优质评论会被优先展示");
mCommentDetailCommentEt.setText("");
}
}
public static Intent getIntent(Context context, String commentId) {
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_COMMENTID, commentId);
return new IntentFactory.Builder(context)
.setActivity(CommentDetailActivity.class)
.setFragment(CommentDetailFragment.class).setArgs(args).build();
}
}

View File

@ -4,209 +4,21 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.BaseActivity;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.util.EntranceUtils;
import com.gh.common.view.Concern_LinearLayout;
import com.gh.gamecenter.adapter.ConcernAdapter;
import com.gh.gamecenter.adapter.ConcernRecommendAdapter;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.eventbus.EBConcernChanged;
import com.gh.gamecenter.eventbus.EBReuse;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
public class ConcernActivity extends BaseActivity implements OnClickListener, OnRequestCallBackListener {
@BindView(R.id.concern_rv_show)
RecyclerView mConcernRv;
@BindView(R.id.concern_rv_recommend)
RecyclerView mConcernRecommendRv;
@BindView(R.id.concern_rl_title)
RelativeLayout mConcernTitleRl;
@BindView(R.id.reuse_none_data)
LinearLayout mNoneData;
@BindView(R.id.reuse_tv_none_data)
TextView mNoDataTv;
@BindView(R.id.reuse_no_connection)
LinearLayout mNoConn;
private ConcernAdapter concernAdapter;
private ConcernRecommendAdapter concernRecommendAdapter;
import com.halo.assistant.fragment.ConcernFragment;
import com.halo.assistant.ui.IntentFactory;
@Deprecated
public class ConcernActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context, String entrance) {
Intent intent = new Intent(context, ConcernActivity.class);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
return intent;
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
return new IntentFactory.Builder(context)
.setActivity(ConcernActivity.class)
.setFragment(ConcernFragment.class).setArgs(args).build();
}
@Override
protected int getLayoutId() {
return R.layout.activity_concern;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_concern));
mConcernTitleRl.setOnClickListener(this);
mConcernRv.setHasFixedSize(true);
mConcernRv.setLayoutManager(new GridLayoutManager(this, 3));
concernAdapter = new ConcernAdapter(this, this, mEntrance);
mConcernRv.setAdapter(concernAdapter);
mConcernRecommendRv.setHasFixedSize(true);
mConcernRecommendRv.setLayoutManager(new GridLayoutManager(this, 4));
}
@Override
public void loadDone() { // 关注推荐 回调
mConcernTitleRl.setVisibility(View.VISIBLE);
mConcernRecommendRv.setVisibility(View.VISIBLE);
int size = concernRecommendAdapter.getRecommendGameList().size();
mConcernRecommendRv.setLayoutManager(new GridLayoutManager(this, size > 4 ? 4 : size));
mConcernRecommendRv.getAdapter().notifyDataSetChanged();
}
// 关注的游戏加载完成 再加载热门推荐(根据已关注的游戏过滤)
@Override
public void loadDone(Object obj) {
mNoConn.setVisibility(View.GONE);
mNoneData.setVisibility(View.GONE);
concernRecommendAdapter = new ConcernRecommendAdapter(this, this, (List<GameEntity>)obj, mEntrance);
mConcernRecommendRv.setAdapter(concernRecommendAdapter);
if (obj == null) { // 未登录状态
mNoneData.setVisibility(View.VISIBLE);
mConcernRv.setVisibility(View.GONE);
mNoDataTv.setText(R.string.login_hint);
mNoDataTv.setTextColor(ContextCompat.getColor(ConcernActivity.this, R.color.theme));
}
}
@Override
public void loadError() {
mNoConn.setVisibility(View.VISIBLE);
mNoneData.setVisibility(View.GONE);
}
@Override
public void loadEmpty() {
if (concernAdapter.getConcernGameList() == null
|| concernAdapter.getConcernGameList().isEmpty()) {
mNoneData.setVisibility(View.VISIBLE);
mConcernRv.setVisibility(View.GONE);
mNoDataTv.setText(R.string.game_empty);
mNoDataTv.setTextColor(ContextCompat.getColor(ConcernActivity.this, R.color.c7c7c7));
}
if (concernRecommendAdapter.getRecommendGameList() == null
|| concernRecommendAdapter.getRecommendGameList().isEmpty()) {
mConcernTitleRl.setVisibility(View.GONE);
mConcernRecommendRv.setVisibility(View.GONE);
} else {
if (concernRecommendAdapter.getRecommendGameList().size() < 4) {
mConcernRecommendRv.setLayoutManager(
new GridLayoutManager(this, concernRecommendAdapter.getRecommendGameList().size()));
}
}
}
@OnClick({R.id.concern_rl_title, R.id.reuse_tv_none_data})
public void onClick(View v) {
switch (v.getId()) {
case R.id.concern_rl_title:
if (mConcernRecommendRv.getVisibility() == View.VISIBLE) {
((Concern_LinearLayout) mContentView).hideRecyclerView();
} else {
((Concern_LinearLayout) mContentView).showRecyclerView();
}
break;
case R.id.reuse_tv_none_data:
String hint = getString(R.string.login_hint);
if (hint.equals(mNoDataTv.getText().toString()))
startActivity(LoginActivity.getIntent(this, false));
break;
}
}
// 关注事件
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBConcernChanged changed) {
if (!changed.isSingle()) {
return;
}
if (changed.isConcern()) {
GameEntity concernGame = concernRecommendAdapter.concernGame(changed.getGameId());
if (concernGame != null) {
concernAdapter.getConcernGameList().add(0, concernGame);
concernAdapter.notifyDataSetChanged();
if (mNoneData.getVisibility() == View.VISIBLE) {
mNoneData.setVisibility(View.GONE);
mConcernRv.setVisibility(View.VISIBLE);
}
}
for (int i = 0, size = concernRecommendAdapter.getRecommendGameList().size(); i < size; i++) {
if (changed.getGameId().equals(concernRecommendAdapter.getRecommendGameList().get(i).getId())) {
concernRecommendAdapter.getRecommendGameList().remove(i);
concernRecommendAdapter.notifyItemRemoved(i); // 删除动画
concernRecommendAdapter.notifyDataSetChanged(); // 防止列表串行
if (concernRecommendAdapter.getRecommendGameList().isEmpty()) {
mConcernTitleRl.setVisibility(View.GONE);
mConcernRecommendRv.setVisibility(View.GONE);
}
break;
}
}
} else {
GameEntity gameEntity = concernAdapter.cancelConcern(changed.getGameId());
if (gameEntity != null) {
concernRecommendAdapter.getRecommendGameList().add(0, gameEntity);
concernRecommendAdapter.notifyDataSetChanged();
}
if (concernRecommendAdapter.getRecommendGameList().isEmpty()) {
mConcernTitleRl.setVisibility(View.GONE);
mConcernRecommendRv.setVisibility(View.GONE);
} else {
mConcernTitleRl.setVisibility(View.VISIBLE);
mConcernRecommendRv.setVisibility(View.VISIBLE);
}
}
}
// 登录事件
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBReuse reuse) {
if (reuse.getType().equals(LOGIN_TAG)) { // 登入
concernAdapter = new ConcernAdapter(this, this, mEntrance);
mConcernRv.setAdapter(concernAdapter);
mConcernRv.setVisibility(View.VISIBLE);
}
}
}

View File

@ -119,7 +119,6 @@ public class GameDetailActivity extends BaseActivity {
private GameDetailEntity mGameDetailEntity;
private String downloadAddWord;
private String downloadOffText;
private String name; // 页面位置
private String title; // 页面标题
private String shareCode;
private boolean mIsTouchScreen = false;
@ -146,7 +145,7 @@ public class GameDetailActivity extends BaseActivity {
private DetailViewHolder getDetailViewHolder() {
// 每次获取需要重新创建, 防止数据刷新
return new DetailViewHolder(mContentView, mGameEntity, mDownloadEntity, downloadOffText, downloadAddWord,
false, mEntrance, name, title); // 下载按钮ViewHolder
false, mEntrance, getString(R.string.title_game_detail), title); // 下载按钮ViewHolder
}
/**
@ -195,7 +194,7 @@ public class GameDetailActivity extends BaseActivity {
setNavigationTitle("");
// 增加actionBar Button
RelativeLayout reuse_actionbar = mContentView.findViewById(R.id.reuse_actionbar);
RelativeLayout reuse_actionbar = findViewById(R.id.reuse_actionbar);
mShareIv = LayoutInflater.from(this).inflate(R.layout.menu_action_share, reuse_actionbar, false); // 绑定parentView 否则会丢失宽高
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mShareIv.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
@ -204,8 +203,6 @@ public class GameDetailActivity extends BaseActivity {
mViewPager.setScrollable(true);
name = "游戏详情";
mGameId = getIntent().getStringExtra(EntranceUtils.KEY_GAMEID);
mEntrance = getIntent().getStringExtra(EntranceUtils.KEY_ENTRANCE);
Bundle data = getIntent().getBundleExtra(EntranceUtils.KEY_DATA);

View File

@ -4,216 +4,33 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.BaseActivity;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.adapter.GameNewsAdapter;
import com.gh.gamecenter.adapter.GameNewsTypeListAdapter;
import com.gh.gamecenter.eventbus.EBTypeChange;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import retrofit2.HttpException;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import com.halo.assistant.fragment.game.GameNewsSearchFragment;
import com.halo.assistant.ui.IntentFactory;
/**
* Created by LGT on 2016/8/29.
* 游戏新闻界面
* 游戏新闻界面由于MTA界面统计未重新记录的原因暂留此傀儡连名字都不能改真是可怕
*/
public class GameNewsActivity extends BaseActivity implements View.OnClickListener {
@BindView(R.id.game_news_list)
RecyclerView mGameNewsRv;
@BindView(R.id.game_news_top_type_list)
RecyclerView mGameNewsTypeRv;
@BindView(R.id.reuse_none_data)
LinearLayout mNoDataLl;
@BindView(R.id.reuse_tv_none_data)
TextView mNoDataTv;
private GameNewsAdapter adapter;
private GameNewsTypeListAdapter typeListAdapter;
private LinearLayoutManager layoutManager;
private ImageView ivSearch;
private ArrayMap<String, GameNewsAdapter> adapterMap;
private List<String> typeList;
private String gameId;
private float startY = 0;
@Deprecated
public class GameNewsActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context, String gameName, String gameId, String entrance) {
Intent intent = new Intent(context, GameNewsActivity.class);
intent.putExtra(EntranceUtils.KEY_GAMENAME, gameName);
intent.putExtra(EntranceUtils.KEY_GAMEID, gameId);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
return intent;
// Intent intent = new Intent(context, GameNewsActivity.class);
// intent.putExtra(EntranceUtils.KEY_GAMENAME, gameName);
// intent.putExtra(EntranceUtils.KEY_GAMEID, gameId);
// intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
// return intent;
final Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_GAMENAME, gameName);
args.putString(EntranceUtils.KEY_GAMEID, gameId);
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
return new IntentFactory.Builder(context)
.setActivity(GameNewsActivity.class)
.setFragment(GameNewsSearchFragment.class).setArgs(args).build();
}
@Override
protected int getLayoutId() {
return R.layout.activity_game_news;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ivSearch = new ImageView(this);
ivSearch.setImageResource(R.drawable.ic_search_white);
RelativeLayout.LayoutParams ivSearchParams = new RelativeLayout.LayoutParams(
DisplayUtils.dip2px(this, 20), DisplayUtils.dip2px(this, 20));
ivSearchParams.addRule(RelativeLayout.CENTER_VERTICAL);
ivSearchParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
ivSearchParams.setMargins(0, 0, DisplayUtils.dip2px(this, 10), 0);
RelativeLayout reuse_actionbar = (RelativeLayout) mContentView.findViewById(R.id.reuse_actionbar);
reuse_actionbar.addView(ivSearch, ivSearchParams);
ivSearch.setOnClickListener(this);
ivSearch.setVisibility(View.GONE);
String gameName = getIntent().getStringExtra(EntranceUtils.KEY_GAMENAME);
setNavigationTitle(gameName);
mNoDataTv.setText("暂无内容");
adapterMap = new ArrayMap<>();
typeList = new ArrayList<>();
gameId = getIntent().getStringExtra(EntranceUtils.KEY_GAMEID);
mGameNewsRv.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(this);
mGameNewsRv.setLayoutManager(layoutManager);
mGameNewsRv.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (adapter != null && newState == RecyclerView.SCROLL_STATE_IDLE
&& layoutManager.findLastVisibleItemPosition() == adapter.getItemCount() - 1) {
if (!adapter.isRemove() && !adapter.isLoading() && !adapter.isNetworkError()) {
adapter.addList(adapter.getNewsList().size());
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (layoutManager.findFirstVisibleItemPosition() >= 1) {
mGameNewsTypeRv.setVisibility(View.VISIBLE);
ivSearch.setVisibility(View.VISIBLE);
} else {
mGameNewsTypeRv.setVisibility(View.GONE);
ivSearch.setVisibility(View.GONE);
}
}
});
mGameNewsTypeRv.setHasFixedSize(true);
mGameNewsTypeRv.setLayoutManager(new GridLayoutManager(this, 5));
//禁止由于滑动出现的阴影
mGameNewsTypeRv.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
startY = event.getY();
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
if (Math.abs(startY - event.getY()) > 0) {
return true;
}
}
return false;
}
});
if (!TextUtils.isEmpty(gameId)) {
getGameArticleType();
}
}
private void getGameArticleType() {
RetrofitManager.getInstance(this).getApi()
.getGameArticleType(gameId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<String>>() {
@Override
public void onResponse(List<String> response) {
super.onResponse(response);
typeList = response;
typeList.add(0, "全部");
adapter = new GameNewsAdapter(GameNewsActivity.this, typeList, mGameNewsRv, gameId, "全部", mEntrance, mNoDataLl);
adapterMap.put("全部", adapter);
mGameNewsRv.setAdapter(adapter);
typeListAdapter = new GameNewsTypeListAdapter(GameNewsActivity.this, typeList, "全部");
mGameNewsTypeRv.setAdapter(typeListAdapter);
ViewGroup.LayoutParams params = mGameNewsTypeRv.getLayoutParams();
params.height = (int) Math.ceil(typeList.size() / 5f) * DisplayUtils.dip2px(GameNewsActivity.this, 35)
+ DisplayUtils.dip2px(GameNewsActivity.this, 12);
mGameNewsTypeRv.setLayoutParams(params);
}
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBTypeChange change) {
adapter = adapterMap.get(change.getType());
if (adapter == null) {
adapter = new GameNewsAdapter(GameNewsActivity.this, typeList, mGameNewsRv, gameId, change.getType(), mEntrance, mNoDataLl);
adapterMap.put(change.getType(), adapter);
}
mGameNewsRv.setAdapter(adapter);
mGameNewsTypeRv.setVisibility(View.GONE);
ivSearch.setVisibility(View.GONE);
typeListAdapter.setNewsType(change.getType(), change.getPosition());
}
@Override
public void onClick(View v) {
if (v == ivSearch) {
mGameNewsRv.scrollToPosition(0);
mGameNewsTypeRv.setVisibility(View.GONE);
ivSearch.setVisibility(View.GONE);
adapter.openKeyBoard();
}
}
}

View File

@ -200,7 +200,6 @@ public class InstallActivity extends BaseActivity implements InstallFragmentAdap
}
}
// 滑动item
@Override
public void onSmooth() {
@ -215,4 +214,5 @@ public class InstallActivity extends BaseActivity implements InstallFragmentAdap
public void onOpen() {
startActivityForResult(ChooseReceiverActivity.getIntent(this, true), KC_REQUEST);
}
}

View File

@ -16,6 +16,8 @@ import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.eventbus.EBKaiFuReset;
import com.gh.gamecenter.kaifu.KaiFuFragment;
import com.gh.gamecenter.kaifu.KaiFuWrapperFragment;
import com.halo.assistant.ui.IntentFactory;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -25,97 +27,16 @@ import butterknife.BindView;
/**
* Created by khy on 18/08/17.
*/
public class KaiFuActivity extends BaseActivity {
@BindView(R.id.reuse_actionbar)
RelativeLayout mReuseActionbar;
private TextView mResetTv;
private KaiFuFragment mKaiFuFragment;
private KaiFuFragment mGameKaiFuFragment;
public static final String SINGLE_GAME_KAIFU = "SINGLE_GAME_KAIFU";
public static final String ALL_GAME_KAIFU = "ALL_GAME_KAIFU";
@Deprecated
public class KaiFuActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context, String entrance) {
Intent intent = new Intent(context, KaiFuActivity.class);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
return intent;
}
@Override
protected int getLayoutId() {
return R.layout.activity_kaifu;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle("开服表");
mResetTv = new TextView(this);
mResetTv.setText("重置");
mResetTv.setTextColor(ContextCompat.getColor(this, R.color.title));
mResetTv.setGravity(Gravity.CENTER);
mResetTv.setVisibility(View.GONE);
mResetTv.setBackgroundResource(R.drawable.border_black_bg);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
DisplayUtils.dip2px(this, 48), DisplayUtils.dip2px(this, 28));
params.addRule(RelativeLayout.CENTER_VERTICAL);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.setMargins(0, 0, DisplayUtils.dip2px(this, 8), 0);
mReuseActionbar.addView(mResetTv, params);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
mKaiFuFragment = new KaiFuFragment();
fragmentTransaction.add(R.id.layout_fragment_content, mKaiFuFragment);
fragmentTransaction.commit();
mResetTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resetFragment();
}
});
}
private void resetFragment() {
mKaiFuFragment.setCurPage(mGameKaiFuFragment.getCurPage());
mResetTv.setVisibility(View.GONE);
mKaiFuFragment.onResume(); // 启动观察者
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.remove(mGameKaiFuFragment);
fragmentTransaction.show(mKaiFuFragment);
fragmentTransaction.commit();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBKaiFuReset reset) {
if (SINGLE_GAME_KAIFU.equals(reset.getControl())) {
mResetTv.setVisibility(View.VISIBLE);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.hide(mKaiFuFragment);
mKaiFuFragment.onPause();
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_GAMEID, reset.getGameId());
args.putInt("curPage", mKaiFuFragment.getCurPage());
mGameKaiFuFragment = new KaiFuFragment();
mGameKaiFuFragment.setArguments(args);
fragmentTransaction.add(R.id.layout_fragment_content, mGameKaiFuFragment, KaiFuFragment.class.getSimpleName());
fragmentTransaction.commit();
} else if (ALL_GAME_KAIFU.equals(reset.getControl())) {
resetFragment();
}
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
return new IntentFactory.Builder(context)
.setActivity(KaiFuActivity.class)
.setFragment(KaiFuWrapperFragment.class).setArgs(args).build();
}
}

View File

@ -72,7 +72,7 @@ public class LoginActivity extends BaseActivity {
DisplayUtils.dip2px(this, 48), ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
RelativeLayout reuseActionbar = (RelativeLayout) mContentView.findViewById(R.id.reuse_actionbar);
RelativeLayout reuseActionbar = (RelativeLayout) findViewById(R.id.reuse_actionbar);
reuseActionbar.addView(mOldUserIcon, params);
mOldUserIcon.setVisibility(View.GONE);

View File

@ -247,7 +247,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener,
setNavigationTitle("");
// 增加actionBar Button
RelativeLayout reuse_actionbar = mContentView.findViewById(R.id.reuse_actionbar);
RelativeLayout reuse_actionbar = findViewById(R.id.reuse_actionbar);
mNewsShare = LayoutInflater.from(this).inflate(R.layout.menu_action_share, reuse_actionbar, false); // 绑定parentView 否则会丢失宽高
mNewsShare.setVisibility(View.GONE);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mNewsShare.getLayoutParams();

View File

@ -3,317 +3,29 @@ package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gh.base.BaseActivity;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.NewsUtils;
import com.gh.common.view.VerticalItemDecoration;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.NewsTextViewHolder;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.utils.Utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import retrofit2.HttpException;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import com.halo.assistant.fragment.game.GameNewsSearchResultFragment;
import com.halo.assistant.ui.IntentFactory;
/**
* Created by khy on 2016/8/22.
* 新闻搜索界面
*/
public class NewsSearchActivity extends BaseActivity {
@BindView(R.id.gamedetail_news_rv)
RecyclerView mNewsSearchRv;
@BindView(R.id.tv_search)
TextView mNewsSearchTv;
@BindView(R.id.reuse_none_data)
LinearLayout mNoneData;
@BindView(R.id.et_search)
EditText mNewsSearchEt;
@BindView(R.id.gamedetail_news_ll_loading)
LinearLayout mLoading;
@BindView(R.id.reuse_no_connection)
LinearLayout mNoConn;
private LinearLayoutManager layoutManager;
private List<NewsEntity> newsEntities;
private NewsSearchAdapter searchAdapter;
private boolean isLoadOver = true;
private boolean isRemove = false;
private boolean isNetworkError = false;
private String searchKey;
private String gameId;
private Handler handler = new Handler();
private int page = 1;
@Deprecated
public class NewsSearchActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context, String gameName, String searchKey, String gameId, String entrance) {
Intent intent = new Intent(context, NewsSearchActivity.class);
intent.putExtra(EntranceUtils.KEY_GAMENAME, gameName);
intent.putExtra(EntranceUtils.KEY_SEARCHKEY, searchKey);
intent.putExtra(EntranceUtils.KEY_GAMEID, gameId);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
return intent;
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_GAMENAME, gameName);
args.putString(EntranceUtils.KEY_SEARCHKEY, searchKey);
args.putString(EntranceUtils.KEY_GAMEID, gameId);
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
return new IntentFactory.Builder(context)
.setActivity(NewsSearchActivity.class)
.setFragment(GameNewsSearchResultFragment.class).setArgs(args).build();
}
@Override
protected int getLayoutId() {
return R.layout.activity_gamedetail_news;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String gameName = intent.getExtras().getString(EntranceUtils.KEY_GAMENAME);
searchKey = intent.getExtras().getString(EntranceUtils.KEY_SEARCHKEY);
gameId = intent.getExtras().getString(EntranceUtils.KEY_GAMEID);
setNavigationTitle(gameName);
DisplayMetrics outMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
newsEntities = new ArrayList<>();
searchAdapter = new NewsSearchAdapter();
layoutManager = new LinearLayoutManager(this);
mNewsSearchRv.setLayoutManager(layoutManager);
mNewsSearchRv.setAdapter(searchAdapter);
mNewsSearchRv.addItemDecoration(new VerticalItemDecoration(NewsSearchActivity.this, 1, false));
mNewsSearchEt.setText(searchKey);
loadNewsData(page);
mNewsSearchTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
searchKey = mNewsSearchEt.getText().toString().trim();
if (searchKey.length() >= 1) {
newsEntities.clear();
searchAdapter.notifyDataSetChanged();
mLoading.setVisibility(View.VISIBLE);
mNoneData.setVisibility(View.GONE);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
handler.postDelayed(new Runnable() {
@Override
public void run() {
page = 1;
loadNewsData(page);
}
}, 500);
} else {
Utils.toast(NewsSearchActivity.this, getString(R.string.search_hint));
}
}
});
mNewsSearchRv.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE && layoutManager.findLastVisibleItemPosition() + 1 == searchAdapter.getItemCount()
&& isLoadOver && !isRemove && !isNetworkError) {
isLoadOver = false;
page++;
loadNewsData(page);
}
}
});
mNoConn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mNoConn.setVisibility(View.GONE);
mLoading.setVisibility(View.VISIBLE);
handler.postDelayed(new Runnable() {
@Override
public void run() {
loadNewsData(1);
}
}, 1000);
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}
private void loadNewsData(final int page) {
// DataUtils.onEvent(this, "游戏新闻搜索", searchKey);
// DataCollectionUtils.uploadSearch(this, searchKey, "游戏新闻搜索");
RetrofitManager.getInstance(this).getApi().getSearchNews(gameId, searchKey, page, 20)
.map(new Func1<List<NewsEntity>, List<NewsEntity>>() {
@Override
public List<NewsEntity> call(List<NewsEntity> list) {
// 去掉重复数据
return NewsUtils.removeDuplicateData(newsEntities, list);
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<NewsEntity>>() {
@Override
public void onResponse(List<NewsEntity> response) {
isLoadOver = true;
mLoading.setVisibility(View.GONE);
mNoneData.setVisibility(View.GONE);
if (response.size() != 0) {
newsEntities.addAll(response);
searchAdapter.notifyDataSetChanged();
} else {
if (page == 1) {
mNoneData.setVisibility(View.VISIBLE);
}
isRemove = true;
searchAdapter.notifyItemChanged(searchAdapter.getItemCount() - 1);
}
if (response.size() < 20) {
isRemove = true;
}
}
@Override
public void onFailure(HttpException e) {
if (page == 1) {
mNoConn.setVisibility(View.VISIBLE);
mLoading.setVisibility(View.GONE);
}
isLoadOver = true;
toast(R.string.loading_failed_hint);
isNetworkError = true;
searchAdapter.notifyItemChanged(searchAdapter.getItemCount() - 1);
}
});
}
public class NewsSearchAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == 0) {
View view = LayoutInflater.from(parent.getContext()).inflate(
R.layout.refresh_footerview, parent, false);
return new FooterViewHolder(view);
} else {
View view = LayoutInflater.from(parent.getContext()).inflate(
R.layout.news_text_item, parent, false);
return new NewsTextViewHolder(view);
}
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if (holder instanceof NewsTextViewHolder) {
NewsTextViewHolder viewHolder = (NewsTextViewHolder) holder;
viewHolder.title.setText(Html.fromHtml(newsEntities.get(position).getTitle()));
viewHolder.type.setVisibility(View.GONE);
viewHolder.line.setVisibility(View.GONE);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NewsEntity newsEntity = newsEntities.get(holder.getPosition());
Map<String, Object> kv = new HashMap<>();
kv.put("名字", newsEntity.getTitle());
kv.put("位置", String.valueOf(holder.getPosition() + 1));
DataUtils.onEvent(NewsSearchActivity.this, "点击", "游戏新闻搜索", kv);
DataCollectionUtils.uploadClick(NewsSearchActivity.this,
"列表", "游戏新闻搜索", newsEntity.getTitle());
// 统计阅读量
NewsUtils.statNewsViews(NewsSearchActivity.this, newsEntity.getId());
NewsDetailActivity.startNewsDetailActivity(NewsSearchActivity.this, newsEntity,
mEntrance + "+(游戏新闻搜索[" + searchKey + "])");
}
});
} else if (holder instanceof FooterViewHolder) {
FooterViewHolder viewHolder = (FooterViewHolder) holder;
viewHolder.itemView.setPadding(0, 0, 0, 0);
if (isNetworkError) {
viewHolder.loading.setVisibility(View.GONE);
viewHolder.hint.setText(R.string.loading_failed_retry);
viewHolder.itemView.setClickable(true);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isNetworkError = false;
notifyItemChanged(getItemCount() - 1);
loadNewsData(page);
}
});
} else if (isRemove) {
viewHolder.loading.setVisibility(View.GONE);
viewHolder.hint.setText(R.string.loading_complete);
viewHolder.itemView.setClickable(false);
} else {
viewHolder.loading.setVisibility(View.VISIBLE);
viewHolder.hint.setText(R.string.loading);
viewHolder.itemView.setClickable(false);
}
}
}
@Override
public int getItemViewType(int position) {
if (position == newsEntities.size()) {
return 0;
} else {
return 1;
}
}
@Override
public int getItemCount() {
if (newsEntities.isEmpty()) {
return 0;
}
return newsEntities.size() + 1;
}
}
}

View File

@ -138,7 +138,7 @@ public class ReceiverWaitingActivity extends BaseActivity {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
RelativeLayout reuse_actionbar = (RelativeLayout) mContentView.findViewById(
RelativeLayout reuse_actionbar = (RelativeLayout) findViewById(
R.id.reuse_actionbar);
reuse_actionbar.addView(hintTv, params);

View File

@ -1,54 +1,11 @@
package com.gh.gamecenter;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.BaseActivity;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.LoginUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.entity.LoginResponseEntity;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBSkip;
import com.halo.assistant.fragment.SettingsFragment;
import com.halo.assistant.ui.IntentFactory;
import com.halo.assistant.ui.SettingsFragment;
import com.kyleduo.switchbutton.SwitchButton;
import com.lightgame.download.FileUtils;
import com.tencent.bugly.beta.Beta;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import butterknife.BindView;
import butterknife.OnClick;
import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Observer;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import static com.gh.gamecenter.R.id.setting_rl_about;
import static java.lang.Thread.sleep;
/**
* 游戏设置页面
@ -56,374 +13,17 @@ import static java.lang.Thread.sleep;
* @ 吕方
* @since 0814
*/
public class SettingActivity extends BaseActivity implements OnClickListener {
@BindView(R.id.setting_sb_autoinstall)
SwitchButton mSettingAutoinstallSb;
@BindView(R.id.setting_sb_autodelete)
SwitchButton mSettingAutodeleteSb;
@BindView(R.id.setting_sb_concerngame)
SwitchButton mSettingConcerngameSb;
@BindView(R.id.setting_tv_cache)
TextView mSettingCacheTv;
@BindView(R.id.setting_tv_size)
TextView mSettingSizeTv;
@BindView(R.id.setting_logout_tv)
TextView mSettingLoginType;
@BindView(R.id.setting_logout_rl)
RelativeLayout mSettingLoginRl;
private SharedPreferences sp;
private Dialog loadingDialog = null;
private int checkSizeIndex;
public class SettingActivity extends CommonActivity {
@NonNull
public static Intent getIntent(Context context, String entrance) {
Intent intent = new Intent(context, SettingActivity.class);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
// Intent intent = new Intent(context, SettingActivity.class);
// intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
// return intent;
return new IntentFactory.Builder(context).setEntrance(entrance).setFragment(SettingsFragment.class).build();
}
@Override
public void finish() {
saveCurrentSetting();
super.finish();
}
@Override
protected int getLayoutId() {
return R.layout.activity_setting;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_settings));
mSettingCacheTv.setText(getCacheSize());
sp = PreferenceManager.getDefaultSharedPreferences(this);
// 未打开下载按钮,显示修复下载按钮
if (!sp.getBoolean("isShow", true)) {
findViewById(R.id.setting_cv_fix_download).setVisibility(View.VISIBLE);
}
mSettingAutoinstallSb.setChecked(sp.getBoolean("autoinstall", true));
mSettingAutodeleteSb.setChecked(sp.getBoolean("autodelete", true));
mSettingConcerngameSb.setChecked(sp.getBoolean("concerngame", true));
checkSizeIndex = sp.getInt("fontsize", 1);
if (checkSizeIndex == 0) {
checkSizeIndex = 1;
}
fontTextSize(checkSizeIndex);
initLoginStatus();
}
private void initLoginStatus() {
LoginResponseEntity loginToken = LoginUtils.getLoginToken(this);
if (loginToken != null) {
if (!TextUtils.isEmpty(loginToken.getLoginType())) {
String loginType = loginToken.getLoginType().trim();
switch (loginType) {
case "qq":
loginType = "QQ";
break;
case "wechat":
loginType = "微信";
break;
case "weibo":
loginType = "新浪微博";
break;
default:
if (loginType.length() == 11) {
String sub1 = loginType.substring(0, 3);
String sub2 = loginType.substring(9, 11);
loginType = StringUtils.buildString(sub1, "******", sub2);
}
break;
}
mSettingLoginType.setText(loginType);
}
mSettingLoginRl.setVisibility(View.VISIBLE);
} else {
mSettingLoginRl.setVisibility(View.GONE);
}
}
@Override
public void onPause() {
super.onPause();
saveCurrentSetting();
}
private void saveCurrentSetting() {
Editor mEditor = sp.edit();
mEditor.putBoolean("autoinstall", mSettingAutoinstallSb.isChecked());
mEditor.putBoolean("autodelete", mSettingAutodeleteSb.isChecked());
mEditor.putBoolean("concerngame", mSettingConcerngameSb.isChecked());
mEditor.putInt("fontsize", checkSizeIndex);
mEditor.apply();
}
// 获取缓存大小
private String getCacheSize() {
File ecDir = getExternalCacheDir();
long cacheLength = getFolderSize(getCacheDir());
if (ecDir != null) {
cacheLength += getFolderSize(ecDir);
}
return long2Size(cacheLength);
}
private long getFolderSize(File folder) {
long size = 0;
size += folder.length();
if (folder.isDirectory()) {
for (File file : folder.listFiles()) {
if (file.isDirectory()) {
size += getFolderSize(file);
} else {
size += file.length();
}
}
}
return size;
}
private String long2Size(Long length) {
float m = length / 1024f / 1024f;
String str = Float.toString(m);
int index = str.lastIndexOf(".");
if (index != -1 && str.length() > index + 3) {
str = str.substring(0, index + 3);
}
return str + "M";
}
@OnClick({
R.id.setting_cv_fix_download,
R.id.setting_rl_autoinstall,
R.id.setting_rl_autodelete,
R.id.setting_rl_cache,
R.id.setting_cv_font_size,
R.id.setting_rl_concerngame,
R.id.setting_rl_about,
R.id.setting_logout_rl
})
@Override
public void onClick(final View v) {
switch (v.getId()) {
case R.id.setting_cv_fix_download:
Editor editor = sp.edit();
editor.putBoolean("isShow", true);
editor.putBoolean("isCheckShow", false);
editor.apply();
toast("修复成功");
EventBus.getDefault().post(new EBReuse("Refresh"));
finish();
new Thread() {
@Override
public void run() {
try {
sleep(800);
} catch (InterruptedException e) {
e.printStackTrace();
}
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 0));
}
}.start();
break;
case R.id.setting_rl_autoinstall:
mSettingAutoinstallSb.performClick();
break;
case R.id.setting_rl_autodelete:
mSettingAutodeleteSb.performClick();
break;
case R.id.setting_rl_cache:
DialogUtils.showWarningDialog(this, "清除缓存", "清空缓存后未安装的游戏可能需要重新下载,确定清空?",
new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
loadingDialog = DialogUtils.showWaitDialog(SettingActivity.this, "清除缓存中...");
clearCache();
}
});
break;
case R.id.setting_cv_font_size:
fontSize();
break;
case setting_rl_about:
if (BuildConfig.DEBUG) {
Beta.checkUpgrade(); // 手动检查热补丁
}
startActivity(AboutActivity.getIntent(this));
break;
case R.id.setting_rl_concerngame:
mSettingConcerngameSb.performClick();
break;
case R.id.setting_logout_rl:
DialogUtils.showForceDialog(this, "注销登录", "退出账号即会回到游客状态,很多功能将无法使用(例如评论、客服消息),确定退出吗?",
"确定退出", "取消", new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
loadingDialog = DialogUtils.showWaitDialog(SettingActivity.this, "退出登录中...");
LoginUtils.logout(SettingActivity.this, new LoginUtils.OnLogoutListener() {
@Override
public void onCompleted() {
LoginUtils.cleanUserData(SettingActivity.this);
if (loadingDialog != null) loadingDialog.dismiss();
finish();
}
});
}
}, null);
break;
default:
break;
}
}
private void fontTextSize(int i) {
switch (i) {
case 1:
mSettingSizeTv.setText("小字号");
break;
case 2:
mSettingSizeTv.setText("中字号");
break;
case 3:
mSettingSizeTv.setText("大字号");
break;
case 4:
mSettingSizeTv.setText("特大字号");
break;
}
}
//设置正文字号
private void fontSize() {
View inflate = View.inflate(this, R.layout.dialog_font_size, null);
final RadioGroup radioGroup = (RadioGroup) inflate.findViewById(R.id.font_size_radiogroup);
((RadioButton) (radioGroup.getChildAt(checkSizeIndex - 1))).setChecked(true);
AlertDialog alertDialog = new AlertDialog.Builder(this, R.style.GhAlertDialog)
.setTitle(getString(R.string.font_primary))
.setPositiveButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setNegativeButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
checkSizeIndex = radioGroup.getCheckedRadioButtonId() % 4;
if (checkSizeIndex == 0) {
checkSizeIndex = 4;
}
dialog.cancel();
saveCurrentSetting();
fontTextSize(checkSizeIndex);
}
})
.setView(inflate)
.create();
alertDialog.show();
TextView mesage = (TextView) alertDialog.findViewById(android.R.id.message);
Button positiveBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE);
Button negativeBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE);
positiveBtn.setTextSize(14);
positiveBtn.setTextColor(ContextCompat.getColor(this, R.color.theme));
negativeBtn.setTextSize(14);
negativeBtn.setTextColor(ContextCompat.getColor(this, R.color.theme));
if (mesage != null) {
mesage.setTextSize(14);
mesage.setTextColor(ContextCompat.getColor(this, R.color.system_bar));
}
// final Dialog dialog = new Dialog(this);
// View inflate = View.inflate(this, R.layout.dialog_font_size, null);
// TextView tv_negative = (TextView) inflate.findViewById(R.id.font_size_negative);
// TextView tv_positive = (TextView) inflate.findViewById(R.id.font_size_positive);
// final RadioGroup radioGroup = (RadioGroup) inflate.findViewById(R.id.font_size_radiogroup);
// ((RadioButton) (radioGroup.getChildAt(checkSizeIndex - 1))).setChecked(true);
//
// tv_negative.setOnClickListener(new OnClickListener() {
// @Override
// public void onClick(View v) {
// dialog.cancel();
// }
// });
// tv_positive.setOnClickListener(new OnClickListener() {
// @Override
// public void onClick(View v) {
// checkSizeIndex = radioGroup.getCheckedRadioButtonId() % 4;
//
// if (checkSizeIndex == 0) {
// checkSizeIndex = 4;
// }
// dialog.cancel();
// saveCurrentSetting();
// fontTextSize(checkSizeIndex);
// }
// });
// dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
// dialog.setContentView(inflate);
// dialog.show();
}
// 清除缓存
private void clearCache() {
Observable.create(new OnSubscribe<Object>() {
@Override
public void call(Subscriber<? super Object> subscriber) {
long start = System.currentTimeMillis();
FileUtils.deleteFolder(getCacheDir());
FileUtils.deleteFolder(getExternalCacheDir());
long time = System.currentTimeMillis() - start;
if (time < 1000) {
try {
sleep(1000 - time);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
subscriber.onCompleted();
}
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Object>() {
@Override
public void onCompleted() {
if (loadingDialog != null) {
loadingDialog.dismiss();
}
mSettingCacheTv.setText(getCacheSize());
toast("缓存清除成功");
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(Object o) {
}
});
return new IntentFactory.Builder(context)
.setEntrance(entrance)
.setActivity(SettingActivity.class)
.setFragment(SettingsFragment.class).build();
}
}

View File

@ -88,7 +88,7 @@ public class UserInfoEditActivity extends BaseActivity implements LoginUtils.onC
params.addRule(RelativeLayout.CENTER_VERTICAL);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.setMargins(0, 0, DisplayUtils.dip2px(this, 18), 0);
RelativeLayout reuse_actionbar = mContentView.findViewById(R.id.reuse_actionbar);
RelativeLayout reuse_actionbar = findViewById(R.id.reuse_actionbar);
reuse_actionbar.addView(mSaveTv, params);
if (mUserInfoEntity != null) {

View File

@ -162,7 +162,7 @@ public class WebActivity extends BaseActivity implements View.OnClickListener{
}
// 增加actionBar Button
RelativeLayout reuse_actionbar = mContentView.findViewById(R.id.reuse_actionbar);
RelativeLayout reuse_actionbar = findViewById(R.id.reuse_actionbar);
mShareIv = LayoutInflater.from(this).inflate(R.layout.menu_action_share, reuse_actionbar, false); // 绑定parentView 否则会丢失宽高
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mShareIv.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter.adapter;
import android.app.Activity;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
@ -42,7 +43,8 @@ public class ConcernAdapter extends BaseRecyclerAdapter<ConcernViewHolder> {
private String mEntrance;
public ConcernAdapter(ConcernActivity context, OnRequestCallBackListener listener, String entrance) {
//TODO remove activity
public ConcernAdapter(Activity context, OnRequestCallBackListener listener, String entrance) {
super(context);
mListener = listener;
mEntrance = entrance;
@ -91,8 +93,6 @@ public class ConcernAdapter extends BaseRecyclerAdapter<ConcernViewHolder> {
public void onBindViewHolder(final ConcernViewHolder holder, int position) {
final GameEntity gameEntity = mConcernGameList.get(position);
if (mConcernGameList != null && position < mConcernGameList.size()) {
if (gameEntity.isLibaoExists()) {
holder.concern_libao_icon.setVisibility(View.VISIBLE);
} else {

View File

@ -17,7 +17,7 @@ import com.gh.common.util.StringUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.SubjectEntity;
import com.gh.gamecenter.game.GameFragmentAdapter;
import com.halo.assistant.fragment.game.GameFragmentAdapter;
import java.util.Date;
import java.util.List;

View File

@ -17,9 +17,14 @@ import butterknife.BindView;
/**
* Created by khy on 18/07/17.
*
* 我的收藏viewpager页面
*
*/
public class CollectionWrapperFragment extends BaseFragment_ViewPager_Checkable {
public class CollectionFragment extends BaseFragment_ViewPager_Checkable {
public static final int INDEX_TOOL = 0;
public static final int INDEX_ARTICLE = 1;
@BindView(R.id.slidebar_line)
View mSlideLine;
@ -27,10 +32,10 @@ public class CollectionFragment extends BaseFragment_ViewPager_Checkable {
private LinearLayout.LayoutParams mLayoutParams;
private int mWindowWidth;
public static CollectionFragment newInstance(int checkedIndex) {
public static CollectionWrapperFragment newInstance(int checkedIndex) {
final Bundle args = new Bundle(1);
args.putInt(ARGS_INDEX, checkedIndex);
final CollectionFragment fragment = new CollectionFragment();
final CollectionWrapperFragment fragment = new CollectionWrapperFragment();
fragment.setArguments(args);
return fragment;
}
@ -64,7 +69,7 @@ public class CollectionFragment extends BaseFragment_ViewPager_Checkable {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle("我的收藏");
DisplayMetrics outMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
mWindowWidth = outMetrics.widthPixels / 2;

View File

@ -24,7 +24,7 @@ import com.gh.gamecenter.eventbus.EBNetworkState;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.game.GameFragmentAdapter;
import com.halo.assistant.fragment.game.GameFragmentAdapter;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadEntity;

View File

@ -4,14 +4,18 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckedTextView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.halo.assistant.HaloApp;
import com.gh.base.adapter.FragmentAdapter;
import com.gh.base.fragment.BaseFragment;
import com.gh.gamecenter.R;
import com.halo.assistant.HaloApp;
import java.util.ArrayList;
import java.util.List;
@ -22,7 +26,7 @@ import butterknife.OnClick;
/**
* Created by khy on 20/08/17.
*/
//TODO 改写viewpgerfragment
public class KaiFuFragment extends BaseFragment {
@BindView(R.id.kaifu_tabbar_today)
@ -38,7 +42,6 @@ public class KaiFuFragment extends BaseFragment {
private List<Fragment> mFragments;
@Override
protected int getLayoutId() {
return R.layout.fragment_kaifu;
@ -47,7 +50,6 @@ public class KaiFuFragment extends BaseFragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFragments = new ArrayList<>();
for (int i = 0; i < 3; i++) {
KaiFuVpFragment kaiFuVpFragment = new KaiFuVpFragment();

View File

@ -44,9 +44,6 @@ import retrofit2.HttpException;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import static com.gh.gamecenter.KaiFuActivity.ALL_GAME_KAIFU;
import static com.gh.gamecenter.KaiFuActivity.SINGLE_GAME_KAIFU;
/**
* Created by khy on 18/08/17.
@ -324,14 +321,14 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
dialog.cancel();
switch (skipTv.getText().toString()) {
case "只看这个游戏":
EventBus.getDefault().post(new EBKaiFuReset(SINGLE_GAME_KAIFU, gameEntity.getId()));
EventBus.getDefault().post(new EBKaiFuReset(KaiFuWrapperFragment.SINGLE_GAME_KAIFU, gameEntity.getId()));
break;
case "进入游戏详情":
GameDetailActivity.startGameDetailActivity(mContext, gameEntity,
StringUtils.buildString(entrance, "+(开服表[", String.valueOf(position), "])"));
break;
case "返回所有游戏":
EventBus.getDefault().post(new EBKaiFuReset(ALL_GAME_KAIFU, gameEntity.getId()));
EventBus.getDefault().post(new EBKaiFuReset(KaiFuWrapperFragment.ALL_GAME_KAIFU, gameEntity.getId()));
break;
}
}

View File

@ -0,0 +1,108 @@
package com.gh.gamecenter.kaifu;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.eventbus.EBKaiFuReset;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
/**
* Created by CsHeng on 14/12/2017.
* <p>
* 用于控制开服界面的切换
*/
public class KaiFuWrapperFragment extends BaseFragment {
public static final String SINGLE_GAME_KAIFU = "SINGLE_GAME_KAIFU";
public static final String ALL_GAME_KAIFU = "ALL_GAME_KAIFU";
private MenuItem mResetMenuItem;
private KaiFuFragment mKaiFuFragment;
private KaiFuFragment mGameKaiFuFragment;
@Override
protected int getLayoutId() {
return R.layout.fragment_kaifu_wrapper;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_button, menu);
mResetMenuItem = menu.findItem(R.id.menu_button);
mResetMenuItem.setTitle(R.string.menu_text_reset);
mResetMenuItem.setVisible(false);
final TextView textView = mResetMenuItem.getActionView().findViewById(R.id.tv_menu_button);
textView.setText(R.string.menu_text_reset);
textView.setOnClickListener(this);
}
@Override
protected boolean handleOnClick(View view) {
switch (view.getId()) {
case R.id.tv_menu_button:
resetFragment();
return true;
}
return super.handleOnClick(view);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
setNavigationTitle("开服表");
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
mKaiFuFragment = new KaiFuFragment();
fragmentTransaction.add(R.id.layout_fragment_content, mKaiFuFragment);
fragmentTransaction.commit();
}
private void resetFragment() {
mKaiFuFragment.setCurPage(mGameKaiFuFragment.getCurPage());
mResetMenuItem.setVisible(false);
mKaiFuFragment.onResume(); // 启动观察者
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
fragmentTransaction.remove(mGameKaiFuFragment);
fragmentTransaction.show(mKaiFuFragment);
fragmentTransaction.commit();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBKaiFuReset reset) {
if (SINGLE_GAME_KAIFU.equals(reset.getControl())) {
mResetMenuItem.setVisible(true);
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
fragmentTransaction.hide(mKaiFuFragment);
mKaiFuFragment.onPause();
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_GAMEID, reset.getGameId());
args.putInt("curPage", mKaiFuFragment.getCurPage());
mGameKaiFuFragment = new KaiFuFragment();
mGameKaiFuFragment.setArguments(args);
fragmentTransaction.add(R.id.layout_fragment_content, mGameKaiFuFragment, KaiFuFragment.class.getSimpleName());
fragmentTransaction.commit();
} else if (ALL_GAME_KAIFU.equals(reset.getControl())) {
resetFragment();
}
}
}

View File

@ -35,7 +35,7 @@ public class LoginFragment extends BaseLoginFragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initTitle("登录光环助手");
setNavigationTitle("登录光环助手");
}
@Override

View File

@ -14,7 +14,7 @@ public class LoginOldUserFragment extends BaseLoginFragment{
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initTitle("老用户登录");
setNavigationTitle("老用户登录");
}
@Override

View File

@ -124,11 +124,11 @@ public class News3Fragment extends BaseFragment implements SwipeRefreshLayout.On
@Override
public void call(Void aVoid) {
if (mConcernGame.size() > 1 || (mConcernGame.size() == 1
&& !getContext().getString(R.string.ghzs_id).equals(mConcernGame.get(0).getId()))) {
&& !getString(R.string.ghzs_id).equals(mConcernGame.get(0).getId()))) {
OnSelectGameClickListener();
} else {
Intent intent = ConcernActivity.getIntent(getContext(), "资讯(攻略-我关注的游戏)");
getContext().startActivity(intent);
startActivity(intent);
}
}
});
@ -162,7 +162,7 @@ public class News3Fragment extends BaseFragment implements SwipeRefreshLayout.On
selectGameRv.setLayoutParams(params);
}
int widthPixels = getContext().getResources().getDisplayMetrics().widthPixels;
int widthPixels = getResources().getDisplayMetrics().widthPixels;
allGameRl.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
DisplayUtils.dip2px(getContext(), 50)));
@ -171,7 +171,7 @@ public class News3Fragment extends BaseFragment implements SwipeRefreshLayout.On
public void onClick(View v) {
isShowPopupBg(false);
Intent intent = ConcernActivity.getIntent(getContext(), "资讯(攻略-我关注的游戏)");
getContext().startActivity(intent);
startActivity(intent);
}
});

View File

@ -12,7 +12,7 @@ import com.gh.gamecenter.NormalActivity;
public abstract class NormalFragment extends BaseFragment {
protected void initTitle(String title) {
protected void setNavigationTitle(String title) {
if (getActivity() instanceof NormalActivity) {
((NormalActivity) getActivity()).setNavigationTitle(title);
}

View File

@ -43,7 +43,7 @@ import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.halo.assistant.HaloApp;
import com.halo.assistant.ui.IntentFactory;
import com.halo.assistant.ui.SettingsFragment;
import com.halo.assistant.fragment.SettingsFragment;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Utils;
import com.tencent.connect.common.Constants;

View File

@ -0,0 +1,110 @@
package com.halo.assistant.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.manager.UpdateManager;
import com.tencent.bugly.beta.tinker.TinkerManager;
import java.lang.ref.WeakReference;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnLongClick;
/**
* Created by CsHeng on 14/12/2017.
*/
public class AboutFragment extends BaseFragment {
@BindView(R.id.about_version_tv)
TextView mAboutVersion;
@BindView(R.id.setting_rl_update)
RelativeLayout mAboutUpdateRl;
@BindView(R.id.about_version_pb)
ProgressBar mAboutPb;
@BindView(R.id.about_tv_version)
TextView mVersionName;
private Handler handler = new MyHandler(this);
@Override
protected int getLayoutId() {
return R.layout.fragment_about;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_about));
// ((TextView) findViewById(R.id.about_tv_version)).setText("V" + PackageUtils.getVersionName(this));
mVersionName.setText("V" + PackageUtils.getPatchVersionName()); // TODO 版本号暂时与gradle versionName不一致
}
@Override
public void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}
@OnClick({R.id.about_shengming, R.id.setting_rl_update})
public void OnClick(View view) {
if (view.getId() == R.id.setting_rl_update) {
UpdateManager.getInstance(getContext()).checkUpdate(false, handler); // 检出更新
} else if (view.getId() == R.id.about_shengming) {
Intent intent = WebActivity.getWebIntent(getContext());
startActivity(intent);
}
}
@OnLongClick(R.id.about_tv_version)
public boolean OnLongClick(View view) {
if (view.getId() == R.id.about_tv_version) {
String tinkerId = TinkerManager.getNewTinkerId();
if (!TextUtils.isEmpty(tinkerId)) {
mVersionName.setText("V" + PackageUtils.getPatchVersionName() + "." + tinkerId);
} else {
toastLong(R.string.toast_upload_latest);
}
}
return false;
}
private static class MyHandler extends Handler {
private WeakReference<AboutFragment> mWeakReference;
public MyHandler(AboutFragment fragment) {
mWeakReference = new WeakReference<>(fragment);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
final AboutFragment fragment = mWeakReference.get();
if (fragment != null) {
if (msg.what == 0) {
final String version = (String) msg.obj;
fragment.mAboutVersion.setText(StringUtils.buildString("发现新版本 V", version));
} else if (msg.what == 1) {
fragment.mAboutVersion.setText(R.string.toast_upload_latest);
}
}
}
}
}

View File

@ -0,0 +1,238 @@
package com.halo.assistant.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.util.DialogUtils;
import com.gh.common.view.VerticalItemDecoration;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.CleanApkAdapter;
import com.gh.gamecenter.entity.InstallGameEntity;
import com.gh.gamecenter.eventbus.EBSkip;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.text.DecimalFormat;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
/**
* Created by CsHeng on 14/12/2017.
* <p>
* 扫描并删除apk
*/
public class ApkCleanerFragment extends BaseFragment implements CleanApkAdapter.OnScanListener {
@BindView(R.id.apk_count)
TextView mApkCount;
@BindView(R.id.apk_rv)
RecyclerView mApkRv;
@BindView(R.id.delete_btn)
TextView mApkDeleteBtn;
@BindView(R.id.select_game_all)
CheckBox mApkSelectAll;
@BindView(R.id.scan_pb)
ProgressBar mScanPb;
@BindView(R.id.reuse_nodata_skip_tv_hint)
TextView mNodataSkipTv;
@BindView(R.id.reuse_nodata_skip_tv_btn)
TextView mNodataSkipBtn;
@BindView(R.id.reuse_nodata_skip)
LinearLayout mNodataSkipLl;
@BindView(R.id.delete_bottom)
LinearLayout mDeleteBottom;
@BindView(R.id.select_game_installed_ll)
RelativeLayout mInstallAllData;
private CleanApkAdapter mAdapter;
@Override
protected int getLayoutId() {
return R.layout.fragment_apk_cleaner;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_clean_apk));
mNodataSkipLl.setVisibility(View.GONE);
mAdapter = new CleanApkAdapter(getContext(), this, mApkDeleteBtn, mApkSelectAll);
mApkRv.setLayoutManager(new LinearLayoutManager(getContext()));
mApkRv.addItemDecoration(new VerticalItemDecoration(getContext(), 8, true));
mApkRv.setAdapter(mAdapter);
mApkSelectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
ArrayMap<Integer, Boolean> selectPosition = new ArrayMap<>();
ArrayMap<Integer, Boolean> selectPosition1 = mAdapter.getSelectPosition();
int itemCount = mAdapter.getItemCount();
if (isChecked) {
for (int i = 0; i < itemCount; i++) {
selectPosition.put(i, true);
}
} else {
int selectCount = 0;
for (Integer integer : selectPosition1.keySet()) {
if (selectPosition1.get(integer)) {
selectCount++;
}
}
if (selectCount != itemCount) {
return;
}
for (int i = 0; i < itemCount; i++) {
selectPosition.put(i, false);
}
}
mAdapter.setSelectPosition(selectPosition);
mAdapter.notifyItemRangeChanged(0, itemCount);
mAdapter.checkBoxControl(isChecked, 0);
}
});
mNodataSkipBtn.setText("去首页看看");
mNodataSkipTv.setText("安装包已清理干净\n快去发现更多好玩的游戏吧");
mNodataSkipTv.setLineSpacing(0, 1.5f);
}
@OnClick({R.id.delete_btn, R.id.reuse_nodata_skip_tv_btn})
public void onClick(View view) {
switch (view.getId()) {
case R.id.delete_btn: {
String s = mApkDeleteBtn.getText().toString();
if ("停止扫描".equals(s)) {
mAdapter.isStopScan();
} else {
if ("一键删除".equals(s)) {
Utils.toast(getContext(), "请选择需要删除的安装包");
return;
}
final List<InstallGameEntity> apkList = mAdapter.getApkList();
final ArrayMap<Integer, Boolean> selectPosition = mAdapter.getSelectPosition();
for (int i = 0; i < apkList.size(); i++) {
if (selectPosition.get(i) && apkList.get(i).getInstallStatus() == 1) {
DialogUtils.showWarningDialog(getContext(), "删除安装包"
, Html.fromHtml(getString(R.string.delete_apk_hint))
, "取消 ", "确定"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
deleteApk(apkList, selectPosition);
}
}, null);
return;
}
}
deleteApk(apkList, selectPosition);
}
break;
}
case R.id.reuse_nodata_skip_tv_btn: {
Intent intent = MainActivity.getMainIntent(getContext());
startActivity(intent);
mNodataSkipBtn.postDelayed(new Runnable() {
@Override
public void run() {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 0));
}
}, 300);
break;
}
}
}
private void deleteApk(List<InstallGameEntity> apkList, ArrayMap<Integer, Boolean> selectPosition) {
long size = 0;
for (int i = 0; i < apkList.size(); i++) {
if (selectPosition.get(i)) {
InstallGameEntity installGameEntity = apkList.get(i);
size = size + installGameEntity.getGameSize();
File file = new File(installGameEntity.getGamePath());
if (file.isFile() && file.exists()) {
file.delete();
mAdapter.deleteApk(i);
i--;
}
}
}
double allSize = (((float) size / 1024) / 1024);
DecimalFormat df = new DecimalFormat("#.00");
String sizeName = df.format(allSize) + "MB";
Utils.toast(getContext(), "删除成功,已为您节省" + sizeName + "空间");
mApkDeleteBtn.setText("一键删除");
mAdapter.notifyDataSetChanged(); // 刷新Adapter position
updateScanData();
if (apkList.size() == 0) { // 全部删除
mNodataSkipLl.setVisibility(View.VISIBLE);
mInstallAllData.setVisibility(View.GONE);
mDeleteBottom.setVisibility(View.GONE);
}
}
private void updateScanData() {
long allSize = 0;
List<InstallGameEntity> apkList = mAdapter.getApkList();
for (InstallGameEntity installGameEntity : apkList) {
allSize = allSize + installGameEntity.getGameSize();
}
double size = (((float) allSize / 1024) / 1024);
DecimalFormat df = new DecimalFormat("0.00");
String sizeName = df.format(size) + "MB";
mApkCount.setText(Html.fromHtml(getString(R.string.clean_apk_count, apkList.size(), sizeName)));
}
@Override
public void onScanOver() {
mApkDeleteBtn.setText("立即删除");
mApkDeleteBtn.setBackgroundResource(R.drawable.game_item_btn_red_style);
updateScanData();
mScanPb.setVisibility(View.GONE);
mApkSelectAll.setVisibility(View.VISIBLE);
mApkSelectAll.setChecked(true);
}
@Override
public void noData() {
mNodataSkipBtn.setText("去首页看看");
mNodataSkipTv.setText("暂无安装包");
mNodataSkipLl.setVisibility(View.VISIBLE);
mInstallAllData.setVisibility(View.GONE);
mDeleteBottom.setVisibility(View.GONE);
}
}

View File

@ -0,0 +1,207 @@
package com.halo.assistant.fragment;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.OnRequestCallBackListener;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.view.Concern_LinearLayout;
import com.gh.gamecenter.LoginActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.ConcernAdapter;
import com.gh.gamecenter.adapter.ConcernRecommendAdapter;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.eventbus.EBConcernChanged;
import com.gh.gamecenter.eventbus.EBReuse;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
/**
* Created by CsHeng on 14/12/2017.
* <p>
* 关注页面
*/
public class ConcernFragment extends BaseFragment implements View.OnClickListener, OnRequestCallBackListener {
@BindView(R.id.concern_rv_show)
RecyclerView mConcernRv;
@BindView(R.id.concern_rv_recommend)
RecyclerView mConcernRecommendRv;
@BindView(R.id.concern_rl_title)
RelativeLayout mConcernTitleRl;
@BindView(R.id.reuse_none_data)
LinearLayout mNoneData;
@BindView(R.id.reuse_tv_none_data)
TextView mNoDataTv;
@BindView(R.id.reuse_no_connection)
LinearLayout mNoConn;
private ConcernAdapter concernAdapter;
private ConcernRecommendAdapter concernRecommendAdapter;
@Override
protected int getLayoutId() {
return R.layout.fragment_concern;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_concern));
mConcernTitleRl.setOnClickListener(this);
mConcernRv.setHasFixedSize(true);
mConcernRv.setLayoutManager(new GridLayoutManager(getContext(), 3));
concernAdapter = new ConcernAdapter(getActivity(), this, mEntrance);
mConcernRv.setAdapter(concernAdapter);
mConcernRecommendRv.setHasFixedSize(true);
mConcernRecommendRv.setLayoutManager(new GridLayoutManager(getContext(), 4));
}
@Override
public void loadDone() { // 关注推荐 回调
mConcernTitleRl.setVisibility(View.VISIBLE);
mConcernRecommendRv.setVisibility(View.VISIBLE);
int size = concernRecommendAdapter.getRecommendGameList().size();
mConcernRecommendRv.setLayoutManager(new GridLayoutManager(getContext(), size > 4 ? 4 : size));
mConcernRecommendRv.getAdapter().notifyDataSetChanged();
}
// 关注的游戏加载完成 再加载热门推荐(根据已关注的游戏过滤)
@Override
public void loadDone(Object obj) {
mNoConn.setVisibility(View.GONE);
mNoneData.setVisibility(View.GONE);
concernRecommendAdapter = new ConcernRecommendAdapter(getContext(), this, (List<GameEntity>) obj, mEntrance);
mConcernRecommendRv.setAdapter(concernRecommendAdapter);
if (obj == null) { // 未登录状态
mNoneData.setVisibility(View.VISIBLE);
mConcernRv.setVisibility(View.GONE);
mNoDataTv.setText(R.string.login_hint);
mNoDataTv.setTextColor(ContextCompat.getColor(getContext(), R.color.theme));
}
}
@Override
public void loadError() {
mNoConn.setVisibility(View.VISIBLE);
mNoneData.setVisibility(View.GONE);
}
@Override
public void loadEmpty() {
if (concernAdapter.getConcernGameList() == null
|| concernAdapter.getConcernGameList().isEmpty()) {
mNoneData.setVisibility(View.VISIBLE);
mConcernRv.setVisibility(View.GONE);
mNoDataTv.setText(R.string.game_empty);
mNoDataTv.setTextColor(ContextCompat.getColor(getContext(), R.color.c7c7c7));
}
if (concernRecommendAdapter.getRecommendGameList() == null
|| concernRecommendAdapter.getRecommendGameList().isEmpty()) {
mConcernTitleRl.setVisibility(View.GONE);
mConcernRecommendRv.setVisibility(View.GONE);
} else {
if (concernRecommendAdapter.getRecommendGameList().size() < 4) {
mConcernRecommendRv.setLayoutManager(
new GridLayoutManager(getContext(), concernRecommendAdapter.getRecommendGameList().size()));
}
}
}
@OnClick({R.id.concern_rl_title, R.id.reuse_tv_none_data})
public void onClick(View v) {
switch (v.getId()) {
case R.id.concern_rl_title:
if (mConcernRecommendRv.getVisibility() == View.VISIBLE) {
((Concern_LinearLayout) view).hideRecyclerView();
} else {
((Concern_LinearLayout) view).showRecyclerView();
}
break;
case R.id.reuse_tv_none_data:
String hint = getString(R.string.login_hint);
if (hint.equals(mNoDataTv.getText().toString()))
startActivity(LoginActivity.getIntent(getContext(), false));
break;
}
}
// 关注事件
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBConcernChanged changed) {
if (!changed.isSingle()) {
return;
}
if (changed.isConcern()) {
GameEntity concernGame = concernRecommendAdapter.concernGame(changed.getGameId());
if (concernGame != null) {
concernAdapter.getConcernGameList().add(0, concernGame);
concernAdapter.notifyDataSetChanged();
if (mNoneData.getVisibility() == View.VISIBLE) {
mNoneData.setVisibility(View.GONE);
mConcernRv.setVisibility(View.VISIBLE);
}
}
for (int i = 0, size = concernRecommendAdapter.getRecommendGameList().size(); i < size; i++) {
if (changed.getGameId().equals(concernRecommendAdapter.getRecommendGameList().get(i).getId())) {
concernRecommendAdapter.getRecommendGameList().remove(i);
concernRecommendAdapter.notifyItemRemoved(i); // 删除动画
concernRecommendAdapter.notifyDataSetChanged(); // 防止列表串行
if (concernRecommendAdapter.getRecommendGameList().isEmpty()) {
mConcernTitleRl.setVisibility(View.GONE);
mConcernRecommendRv.setVisibility(View.GONE);
}
break;
}
}
} else {
GameEntity gameEntity = concernAdapter.cancelConcern(changed.getGameId());
if (gameEntity != null) {
concernRecommendAdapter.getRecommendGameList().add(0, gameEntity);
concernRecommendAdapter.notifyDataSetChanged();
}
if (concernRecommendAdapter.getRecommendGameList().isEmpty()) {
mConcernTitleRl.setVisibility(View.GONE);
mConcernRecommendRv.setVisibility(View.GONE);
} else {
mConcernTitleRl.setVisibility(View.VISIBLE);
mConcernRecommendRv.setVisibility(View.VISIBLE);
}
}
}
// 登录事件
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBReuse reuse) {
if (reuse.getType().equals(LOGIN_TAG)) { // 登入
concernAdapter = new ConcernAdapter(getActivity(), this, mEntrance);
mConcernRv.setAdapter(concernAdapter);
mConcernRv.setVisibility(View.VISIBLE);
}
}
}

View File

@ -1,4 +1,4 @@
package com.halo.assistant.ui;
package com.halo.assistant.fragment;
import android.app.Dialog;
import android.content.DialogInterface;
@ -67,11 +67,11 @@ public class SettingsFragment extends BaseFragment {
@BindView(R.id.setting_logout_rl)
RelativeLayout mSettingLoginRl;
private SharedPreferences sp;
private SharedPreferences mSharedPreferences;
private Dialog loadingDialog = null;
private Dialog mLoadingDialog = null;
private int checkSizeIndex;
private int mCheckSizeIndex;
@Override
public void onStop() {
@ -81,32 +81,32 @@ public class SettingsFragment extends BaseFragment {
@Override
protected int getLayoutId() {
return R.layout.activity_setting;
return R.layout.fragment_setting;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initTitle(getString(R.string.title_settings));
setNavigationTitle(getString(R.string.title_settings));
mSettingCacheTv.setText(getCacheSize());
sp = PreferenceManager.getDefaultSharedPreferences(getContext());
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
// 未打开下载按钮显示修复下载按钮
if (!sp.getBoolean("isShow", true)) {
if (!mSharedPreferences.getBoolean("isShow", true)) {
view.findViewById(R.id.setting_cv_fix_download).setVisibility(View.VISIBLE);
}
mSettingAutoinstallSb.setChecked(sp.getBoolean("autoinstall", true));
mSettingAutodeleteSb.setChecked(sp.getBoolean("autodelete", true));
mSettingConcerngameSb.setChecked(sp.getBoolean("concerngame", true));
mSettingAutoinstallSb.setChecked(mSharedPreferences.getBoolean("autoinstall", true));
mSettingAutodeleteSb.setChecked(mSharedPreferences.getBoolean("autodelete", true));
mSettingConcerngameSb.setChecked(mSharedPreferences.getBoolean("concerngame", true));
checkSizeIndex = sp.getInt("fontsize", 1);
if (checkSizeIndex == 0) {
checkSizeIndex = 1;
mCheckSizeIndex = mSharedPreferences.getInt("fontsize", 1);
if (mCheckSizeIndex == 0) {
mCheckSizeIndex = 1;
}
fontTextSize(checkSizeIndex);
fontTextSize(mCheckSizeIndex);
initLoginStatus();
}
@ -149,11 +149,11 @@ public class SettingsFragment extends BaseFragment {
}
private void saveCurrentSetting() {
SharedPreferences.Editor mEditor = sp.edit();
SharedPreferences.Editor mEditor = mSharedPreferences.edit();
mEditor.putBoolean("autoinstall", mSettingAutoinstallSb.isChecked());
mEditor.putBoolean("autodelete", mSettingAutodeleteSb.isChecked());
mEditor.putBoolean("concerngame", mSettingConcerngameSb.isChecked());
mEditor.putInt("fontsize", checkSizeIndex);
mEditor.putInt("fontsize", mCheckSizeIndex);
mEditor.apply();
}
@ -207,7 +207,7 @@ public class SettingsFragment extends BaseFragment {
switch (v.getId()) {
case R.id.setting_cv_fix_download:
SharedPreferences.Editor editor = sp.edit();
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putBoolean("isShow", true);
editor.putBoolean("isCheckShow", false);
editor.apply();
@ -237,7 +237,7 @@ public class SettingsFragment extends BaseFragment {
new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
loadingDialog = DialogUtils.showWaitDialog(getContext(), "清除缓存中...");
mLoadingDialog = DialogUtils.showWaitDialog(getContext(), "清除缓存中...");
clearCache();
}
});
@ -259,12 +259,12 @@ public class SettingsFragment extends BaseFragment {
"确定退出", "取消", new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
loadingDialog = DialogUtils.showWaitDialog(getContext(), "退出登录中...");
mLoadingDialog = DialogUtils.showWaitDialog(getContext(), "退出登录中...");
LoginUtils.logout(getContext(), new LoginUtils.OnLogoutListener() {
@Override
public void onCompleted() {
LoginUtils.cleanUserData(getContext());
if (loadingDialog != null) loadingDialog.dismiss();
if (mLoadingDialog != null) mLoadingDialog.dismiss();
getActivity().finish();
}
});
@ -297,7 +297,7 @@ public class SettingsFragment extends BaseFragment {
private void fontSize() {
View inflate = View.inflate(getContext(), R.layout.dialog_font_size, null);
final RadioGroup radioGroup = (RadioGroup) inflate.findViewById(R.id.font_size_radiogroup);
((RadioButton) (radioGroup.getChildAt(checkSizeIndex - 1))).setChecked(true);
((RadioButton) (radioGroup.getChildAt(mCheckSizeIndex - 1))).setChecked(true);
AlertDialog alertDialog = new AlertDialog.Builder(getContext(), R.style.GhAlertDialog)
.setTitle(getString(R.string.font_primary))
.setPositiveButton("取消", new DialogInterface.OnClickListener() {
@ -309,14 +309,14 @@ public class SettingsFragment extends BaseFragment {
.setNegativeButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
checkSizeIndex = radioGroup.getCheckedRadioButtonId() % 4;
mCheckSizeIndex = radioGroup.getCheckedRadioButtonId() % 4;
if (checkSizeIndex == 0) {
checkSizeIndex = 4;
if (mCheckSizeIndex == 0) {
mCheckSizeIndex = 4;
}
dialog.cancel();
saveCurrentSetting();
fontTextSize(checkSizeIndex);
fontTextSize(mCheckSizeIndex);
}
})
.setView(inflate)
@ -362,8 +362,8 @@ public class SettingsFragment extends BaseFragment {
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Object>() {
@Override
public void onCompleted() {
if (loadingDialog != null) {
loadingDialog.dismiss();
if (mLoadingDialog != null) {
mLoadingDialog.dismiss();
}
mSettingCacheTv.setText(getCacheSize());
toast("缓存清除成功");

View File

@ -0,0 +1,230 @@
package com.halo.assistant.fragment.comment;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.LoginUtils;
import com.gh.common.util.PostCommentUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.CommentDetailAdapter;
import com.gh.gamecenter.adapter.OnCommentCallBackListener;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.UserInfoEntity;
import com.lightgame.utils.Util_System_Keyboard;
import com.lightgame.utils.Utils;
import org.json.JSONException;
import org.json.JSONObject;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnTouch;
import retrofit2.HttpException;
/**
* Created by CsHeng on 14/12/2017.
* <p>
* 评论详情页面
* TODO: 16/11/17 时间比较紧 先暂时这么做 最好发表评论那块和评论详情整合
*/
public class CommentDetailFragment extends BaseFragment implements OnCommentCallBackListener {
@BindView(R.id.comment_detail_rv)
RecyclerView mRecyclerView;
@BindView(R.id.comment_detail_close_comment)
View mCommentDetailCloseComment;
@BindView(R.id.comment_detail_comment_et)
EditText mCommentDetailCommentEt;
@BindView(R.id.comment_user_icon)
SimpleDraweeView mCommentUserIcon;
@BindView(R.id.comment_user_name)
TextView mCommentUserName;
@BindView(R.id.comment_detail_comment_rl)
View mCommentDetailCommentRl;
@BindView(R.id.reuse_none_data)
View mNoData;
private Dialog mSendingDialog;
private UserInfoEntity mUserInfo;
private CommentEntity mCommentEntity; // 回复评论的实体 用完马上清空
private CommentDetailAdapter mAdapter;
private LinearLayoutManager mLayoutManager;
@Override
protected int getLayoutId() {
return R.layout.fragment_comment_detail;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNavigationTitle(getString(R.string.title_comment_detail));
String commentId = getArguments().getString(EntranceUtils.KEY_COMMENTID);
mAdapter = new CommentDetailAdapter(getContext(), commentId, this, mNoData, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE && !mAdapter.isOver() && !mAdapter.isLoading()) {
mAdapter.loadData(mAdapter.getItemCount());
}
}
});
mUserInfo = LoginUtils.getUserInfo(getContext());
if (mUserInfo != null) {
ImageUtils.Companion.display(mCommentUserIcon, mUserInfo.getIcon());
mCommentUserName.setText(mUserInfo.getName());
}
}
@Override
public void onCommentCallback(CommentEntity entity) {
mCommentEntity = entity;
setSoftInput(true);
}
@OnTouch(R.id.comment_detail_close_comment)
public boolean OnRecyclerTouchListener() {
if (mCommentDetailCloseComment.getVisibility() == View.VISIBLE) {
setSoftInput(false);
}
return true;
}
@OnClick(R.id.comment_send)
public void OnSendCommentListener() {
final String content = mCommentDetailCommentEt.getText().toString();
if (content.length() == 0) {
Utils.toast(getContext(), "评论内容不能为空!");
return;
}
mSendingDialog = DialogUtils.showWaitDialog(getContext(), "正在提交");
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("content", content);
} catch (JSONException e) {
e.printStackTrace();
}
if (mCommentEntity != null && mCommentEntity.getId() == null) {
Utils.toast(getContext(), "评论异常 id null");
mSendingDialog.cancel();
return;
}
PostCommentUtils.addCommentData(getContext(), null, jsonObject.toString(), mCommentEntity,
new PostCommentUtils.PostCommentListener() {
@Override
public void postSuccess(JSONObject response) {
mSendingDialog.dismiss();
toast("发表成功");
mCommentDetailCommentEt.setText("");
setSoftInput(false);
}
@Override
public void postFailed(Throwable e) {
mSendingDialog.dismiss();
if (e instanceof HttpException) {
HttpException exception = (HttpException) e;
if (exception.code() == 403) {
try {
JSONObject errorJson = new JSONObject(exception.response().errorBody().string());
String detail = errorJson.getString("detail");
switch (detail) {
case "too frequent":
toast("别话痨哦~休息一会再来评论吧~");
break;
case "user blocked":
toast("账号状态异常,暂时无法发表评论");
break;
case "article blocked":
toast("文章异常,无法发表评论");
setSoftInput(false);
break;
case "illegal":
toast("评论内容可能包括敏感信息,请修改后再发表");
break;
default:
toast("评论失败,未知原因");
break;
}
} catch (Exception ex) {
ex.printStackTrace();
toast("评论异常");
}
return;
}
}
toast("提交失败,请检查网络设置");
}
});
}
//软键盘控制
private void setSoftInput(boolean isShow) {
// final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (isShow) {
CheckLoginUtils.checkLogin(getContext(), new CheckLoginUtils.OnLoggenInListener() {
@Override
public void onLoggedIn() {
Util_System_Keyboard.showSoftKeyboard(getContext(), mCommentDetailCommentEt);
// imm.showSoftInputFromInputMethod(mCommentDetailCommentEt.getWindowToken(), 0);
// imm.toggleSoftInputFromWindow(mCommentDetailCommentEt.getWindowToken(), 0, InputMethodManager.HIDE_NOT_ALWAYS);
mCommentDetailCommentRl.setVisibility(View.VISIBLE);
mCommentDetailCommentEt.setFocusable(true);
mCommentDetailCommentEt.setFocusableInTouchMode(true);
mCommentDetailCommentEt.requestFocus();
mCommentDetailCloseComment.setVisibility(View.VISIBLE);
if (mCommentEntity != null && mCommentEntity.getUser() != null) {
mCommentDetailCommentEt.setHint("回复" + mCommentEntity.getUser().getName() + "");
} else {
mCommentDetailCommentEt.setHint("优质评论会被优先展示");
}
}
});
} else {
Util_System_Keyboard.hideSoftKeyboard(getContext(), mCommentDetailCommentEt);
// imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
mCommentDetailCloseComment.setVisibility(View.GONE);
mCommentDetailCommentRl.setVisibility(View.GONE);
if (mCommentEntity != null) {
mCommentEntity = null; // 清空当前评论实体
mCommentDetailCommentEt.setHint("优质评论会被优先展示");
mCommentDetailCommentEt.setText("");
}
}
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.game;
package com.halo.assistant.fragment.game;
import android.content.Intent;
import android.graphics.Color;

View File

@ -0,0 +1,217 @@
package com.halo.assistant.fragment.game;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.GameNewsAdapter;
import com.gh.gamecenter.adapter.GameNewsTypeListAdapter;
import com.gh.gamecenter.eventbus.EBTypeChange;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import retrofit2.HttpException;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
/**
* 游戏新闻搜索界面
* <p>
* Created by CsHeng on 14/12/2017.
*/
public class GameNewsSearchFragment extends BaseFragment {
@BindView(R.id.game_news_list)
RecyclerView mGameNewsRv;
@BindView(R.id.game_news_top_type_list)
RecyclerView mGameNewsTypeRv;
@BindView(R.id.reuse_none_data)
LinearLayout mNoDataLl;
@BindView(R.id.reuse_tv_none_data)
TextView mNoDataTv;
private GameNewsAdapter mGameNewsAdapter;
private GameNewsTypeListAdapter mTypeListAdapter;
private LinearLayoutManager mLayoutManager;
private MenuItem mMenuItemSearch;
private ArrayMap<String, GameNewsAdapter> mAdapterMap;
private List<String> mTypeList;
private String mGameId;
private float mStartY = 0;
public static GameNewsSearchFragment newInstance(String gameName, String gameId, String entrance) {
final GameNewsSearchFragment fragment = new GameNewsSearchFragment();
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_GAMENAME, gameName);
args.putString(EntranceUtils.KEY_GAMEID, gameId);
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
fragment.setArguments(args);
return fragment;
}
@Override
protected int getLayoutId() {
return R.layout.fragment_game_news_search;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_search_white, menu);
mMenuItemSearch = menu.findItem(R.id.menu_search);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_search:
mGameNewsRv.scrollToPosition(0);
mGameNewsTypeRv.setVisibility(View.GONE);
mMenuItemSearch.setVisible(false);
mGameNewsAdapter.openKeyBoard();
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
Bundle args = getArguments();
String gameName = args.getString(EntranceUtils.KEY_GAMENAME);
setNavigationTitle(gameName);
mNoDataTv.setText("暂无内容");
mAdapterMap = new ArrayMap<>();
mTypeList = new ArrayList<>();
mGameId = args.getString(EntranceUtils.KEY_GAMEID);
mLayoutManager = new LinearLayoutManager(getContext());
mGameNewsRv.setHasFixedSize(true);
mGameNewsRv.setLayoutManager(mLayoutManager);
mGameNewsRv.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (mGameNewsAdapter != null && newState == RecyclerView.SCROLL_STATE_IDLE
&& mLayoutManager.findLastVisibleItemPosition() == mGameNewsAdapter.getItemCount() - 1) {
if (!mGameNewsAdapter.isRemove() && !mGameNewsAdapter.isLoading() && !mGameNewsAdapter.isNetworkError()) {
mGameNewsAdapter.addList(mGameNewsAdapter.getNewsList().size());
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (mLayoutManager.findFirstVisibleItemPosition() >= 1) {
mGameNewsTypeRv.setVisibility(View.VISIBLE);
mMenuItemSearch.setVisible(true);
} else {
mGameNewsTypeRv.setVisibility(View.GONE);
mMenuItemSearch.setVisible(false);
}
}
});
mGameNewsTypeRv.setHasFixedSize(true);
mGameNewsTypeRv.setLayoutManager(new GridLayoutManager(getContext(), 5));
//禁止由于滑动出现的阴影
mGameNewsTypeRv.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
mStartY = event.getY();
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
if (Math.abs(mStartY - event.getY()) > 0) {
return true;
}
}
return false;
}
});
if (!TextUtils.isEmpty(mGameId)) {
getGameArticleType();
}
}
private void getGameArticleType() {
RetrofitManager.getInstance(getContext()).getApi()
.getGameArticleType(mGameId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<String>>() {
@Override
public void onResponse(List<String> response) {
super.onResponse(response);
mTypeList = response;
mTypeList.add(0, "全部");
mGameNewsAdapter = new GameNewsAdapter(getContext(), mTypeList, mGameNewsRv, mGameId, "全部", mEntrance, mNoDataLl);
mAdapterMap.put("全部", mGameNewsAdapter);
mGameNewsRv.setAdapter(mGameNewsAdapter);
mTypeListAdapter = new GameNewsTypeListAdapter(getContext(), mTypeList, "全部");
mGameNewsTypeRv.setAdapter(mTypeListAdapter);
ViewGroup.LayoutParams params = mGameNewsTypeRv.getLayoutParams();
params.height = (int) Math.ceil(mTypeList.size() / 5f) * DisplayUtils.dip2px(getContext(), 35)
+ DisplayUtils.dip2px(getContext(), 12);
mGameNewsTypeRv.setLayoutParams(params);
}
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBTypeChange change) {
mGameNewsAdapter = mAdapterMap.get(change.getType());
if (mGameNewsAdapter == null) {
mGameNewsAdapter = new GameNewsAdapter(getContext(), mTypeList, mGameNewsRv, mGameId, change.getType(), mEntrance, mNoDataLl);
mAdapterMap.put(change.getType(), mGameNewsAdapter);
}
mGameNewsRv.setAdapter(mGameNewsAdapter);
mGameNewsTypeRv.setVisibility(View.GONE);
mMenuItemSearch.setVisible(false);
mTypeListAdapter.setNewsType(change.getType(), change.getPosition());
}
}

View File

@ -0,0 +1,309 @@
package com.halo.assistant.fragment.game;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.NewsUtils;
import com.gh.common.view.VerticalItemDecoration;
import com.gh.gamecenter.DataUtils;
import com.gh.gamecenter.NewsDetailActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.NewsTextViewHolder;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.utils.Util_System_Keyboard;
import com.lightgame.utils.Utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import retrofit2.HttpException;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
/**
* Created by CsHeng on 14/12/2017.
* 游戏新闻搜索结果界面
*/
public class GameNewsSearchResultFragment extends BaseFragment {
@BindView(R.id.gamedetail_news_rv)
RecyclerView mNewsSearchRv;
@BindView(R.id.tv_search)
TextView mNewsSearchTv;
@BindView(R.id.reuse_none_data)
LinearLayout mNoneData;
@BindView(R.id.et_search)
EditText mNewsSearchEt;
@BindView(R.id.gamedetail_news_ll_loading)
LinearLayout mLoading;
@BindView(R.id.reuse_no_connection)
LinearLayout mNoConn;
private LinearLayoutManager mLayoutManager;
private List<NewsEntity> mNewsEntities;
private NewsSearchAdapter mNewsSearchAdapter;
private boolean mIsLoadOver = true;
private boolean mIsRemove = false;
private boolean mIsNetworkError = false;
private String mSearchKey;
private String mGameId;
private Handler mHandler = new Handler();
private int mPage = 1;
@Override
protected int getLayoutId() {
return R.layout.fragment_game_news_search_result;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
String gameName = args.getString(EntranceUtils.KEY_GAMENAME);
mSearchKey = args.getString(EntranceUtils.KEY_SEARCHKEY);
mGameId = args.getString(EntranceUtils.KEY_GAMEID);
setNavigationTitle(gameName);
mNewsEntities = new ArrayList<>();
mNewsSearchAdapter = new NewsSearchAdapter();
mLayoutManager = new LinearLayoutManager(getContext());
mNewsSearchRv.setLayoutManager(mLayoutManager);
mNewsSearchRv.setAdapter(mNewsSearchAdapter);
mNewsSearchRv.addItemDecoration(new VerticalItemDecoration(getContext(), 1, false));
mNewsSearchEt.setText(mSearchKey);
loadNewsData(mPage);
mNewsSearchTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSearchKey = mNewsSearchEt.getText().toString().trim();
if (mSearchKey.length() >= 1) {
mNewsEntities.clear();
mNewsSearchAdapter.notifyDataSetChanged();
mLoading.setVisibility(View.VISIBLE);
mNoneData.setVisibility(View.GONE);
Util_System_Keyboard.hideSoftKeyboard(getActivity());
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mPage = 1;
loadNewsData(mPage);
}
}, 500);
} else {
Utils.toast(getContext(), getString(R.string.search_hint));
}
}
});
mNewsSearchRv.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE && mLayoutManager.findLastVisibleItemPosition() + 1 == mNewsSearchAdapter.getItemCount()
&& mIsLoadOver && !mIsRemove && !mIsNetworkError) {
mIsLoadOver = false;
mPage++;
loadNewsData(mPage);
}
}
});
mNoConn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mNoConn.setVisibility(View.GONE);
mLoading.setVisibility(View.VISIBLE);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
loadNewsData(1);
}
}, 1000);
}
});
}
@Override
public void onDestroy() {
super.onDestroy();
mHandler.removeCallbacksAndMessages(null);
}
private void loadNewsData(final int page) {
// DataUtils.onEvent(getContext(), "游戏新闻搜索", mSearchKey);
// DataCollectionUtils.uploadSearch(getContext(), mSearchKey, "游戏新闻搜索");
RetrofitManager.getInstance(getContext()).getApi().getSearchNews(mGameId, mSearchKey, page, 20)
.map(new Func1<List<NewsEntity>, List<NewsEntity>>() {
@Override
public List<NewsEntity> call(List<NewsEntity> list) {
// 去掉重复数据
return NewsUtils.removeDuplicateData(mNewsEntities, list);
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<NewsEntity>>() {
@Override
public void onResponse(List<NewsEntity> response) {
mIsLoadOver = true;
mLoading.setVisibility(View.GONE);
mNoneData.setVisibility(View.GONE);
if (response.size() != 0) {
mNewsEntities.addAll(response);
mNewsSearchAdapter.notifyDataSetChanged();
} else {
if (page == 1) {
mNoneData.setVisibility(View.VISIBLE);
}
mIsRemove = true;
mNewsSearchAdapter.notifyItemChanged(mNewsSearchAdapter.getItemCount() - 1);
}
if (response.size() < 20) {
mIsRemove = true;
}
}
@Override
public void onFailure(HttpException e) {
if (page == 1) {
mNoConn.setVisibility(View.VISIBLE);
mLoading.setVisibility(View.GONE);
}
mIsLoadOver = true;
toast(R.string.loading_failed_hint);
mIsNetworkError = true;
mNewsSearchAdapter.notifyItemChanged(mNewsSearchAdapter.getItemCount() - 1);
}
});
}
//TODO move out
public class NewsSearchAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == 0) {
View view = LayoutInflater.from(parent.getContext()).inflate(
R.layout.refresh_footerview, parent, false);
return new FooterViewHolder(view);
} else {
View view = LayoutInflater.from(parent.getContext()).inflate(
R.layout.news_text_item, parent, false);
return new NewsTextViewHolder(view);
}
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if (holder instanceof NewsTextViewHolder) {
NewsTextViewHolder viewHolder = (NewsTextViewHolder) holder;
viewHolder.title.setText(Html.fromHtml(mNewsEntities.get(position).getTitle()));
viewHolder.type.setVisibility(View.GONE);
viewHolder.line.setVisibility(View.GONE);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NewsEntity newsEntity = mNewsEntities.get(holder.getPosition());
Map<String, Object> kv = new HashMap<>();
kv.put("名字", newsEntity.getTitle());
kv.put("位置", String.valueOf(holder.getPosition() + 1));
DataUtils.onEvent(getContext(), "点击", "游戏新闻搜索", kv);
DataCollectionUtils.uploadClick(getContext(),
"列表", "游戏新闻搜索", newsEntity.getTitle());
// 统计阅读量
NewsUtils.statNewsViews(getContext(), newsEntity.getId());
NewsDetailActivity.startNewsDetailActivity(getContext(), newsEntity,
mEntrance + "+(游戏新闻搜索[" + mSearchKey + "])");
}
});
} else if (holder instanceof FooterViewHolder) {
FooterViewHolder viewHolder = (FooterViewHolder) holder;
viewHolder.itemView.setPadding(0, 0, 0, 0);
if (mIsNetworkError) {
viewHolder.loading.setVisibility(View.GONE);
viewHolder.hint.setText(R.string.loading_failed_retry);
viewHolder.itemView.setClickable(true);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mIsNetworkError = false;
notifyItemChanged(getItemCount() - 1);
loadNewsData(mPage);
}
});
} else if (mIsRemove) {
viewHolder.loading.setVisibility(View.GONE);
viewHolder.hint.setText(R.string.loading_complete);
viewHolder.itemView.setClickable(false);
} else {
viewHolder.loading.setVisibility(View.VISIBLE);
viewHolder.hint.setText(R.string.loading);
viewHolder.itemView.setClickable(false);
}
}
}
@Override
public int getItemViewType(int position) {
if (position == mNewsEntities.size()) {
return 0;
} else {
return 1;
}
}
@Override
public int getItemCount() {
if (mNewsEntities.isEmpty()) {
return 0;
}
return mNewsEntities.size() + 1;
}
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.game;
package com.halo.assistant.fragment.game;
import android.content.Context;
import android.support.v7.widget.RecyclerView;

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.game;
package com.halo.assistant.fragment.game;
import android.support.v7.widget.RecyclerView;
import android.view.View;
@ -29,4 +29,5 @@ public class GamePluginViewHolder extends BaseRecyclerViewHolder {
public GamePluginViewHolder(View itemView) {
super(itemView);
}
}

View File

@ -31,6 +31,12 @@ public class IntentFactory {
mContext = context;
}
@NonNull
public Builder setActivity(Class<? extends Activity> activityClass) {
mActivityClass = activityClass;
return this;
}
@NonNull
public Builder setFragment(@NonNull Class<? extends Fragment> cls) {
mFragmentClass = cls;
@ -44,7 +50,7 @@ public class IntentFactory {
}
@NonNull
public Builder args(@NonNull Bundle args) {
public Builder setArgs(@NonNull Bundle args) {
mBundleArgs = args;
return this;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,153 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<include layout = "@layout/reuse_actionbar" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "255dp"
android:gravity = "center"
android:orientation = "vertical" >
<ImageView
android:layout_width = "78dp"
android:layout_height = "78dp"
android:src = "@drawable/logo" />
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginBottom = "2dp"
android:layout_marginTop = "13sp"
android:text = "@string/app_name"
android:textColor = "@color/title"
android:textSize = "23sp"
android:textStyle = "bold" />
<TextView
android:id = "@+id/about_tv_version"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:textColor = "@color/content"
android:textSize = "12sp" />
</LinearLayout >
<LinearLayout
android:id = "@+id/about_content"
android:layout_width = "match_parent"
android:layout_height = "111dp"
android:background = "@android:color/white"
android:orientation = "vertical" >
<RelativeLayout
android:id = "@+id/setting_rl_update"
android:layout_width = "match_parent"
android:layout_height = "55dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/about_version_update"
android:textColor = "@color/title"
android:textSize = "17sp" />
<ProgressBar
android:id = "@+id/about_version_pb"
style = "?android:attr/progressBarStyle"
android:layout_width = "23dp"
android:layout_height = "22dp"
android:layout_centerVertical = "true"
android:layout_marginRight = "5dp"
android:layout_toLeftOf = "@+id/about_version_tv"
android:visibility = "gone" />
<TextView
android:id = "@+id/about_version_tv"
android:layout_width = "wrap_content"
android:layout_height = "match_parent"
android:layout_alignParentRight = "true"
android:gravity = "center"
android:textColor = "@color/hint"
android:textSize = "12sp" />
</RelativeLayout >
<View
android:layout_width = "match_parent"
android:layout_height = "1dp"
android:layout_marginLeft = "20dp"
android:layout_marginRight = "20dp"
android:background = "@color/cutting_line" />
<RelativeLayout
android:id = "@+id/about_shengming"
android:layout_width = "match_parent"
android:layout_height = "55dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "声明"
android:textColor = "@color/title"
android:textSize = "17sp" />
<ImageView
android:layout_width = "15dp"
android:layout_height = "14dp"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:src = "@drawable/about_more_iocn" />
</RelativeLayout >
</LinearLayout >
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_alignParentBottom = "true"
android:gravity = "bottom"
android:orientation = "vertical" >
<TextView
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:gravity = "center"
android:text = "光环工作室 版权所有"
android:textColor = "@color/content"
android:textSize = "11sp" />
<TextView
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_marginBottom = "25dp"
android:layout_marginTop = "17dp"
android:gravity = "center"
android:text = "Copyright 2017 GHZhuShou Team All Rights Reserved."
android:textColor = "@color/content"
android:textSize = "11sp" />
</LinearLayout >
</LinearLayout >
</LinearLayout >

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<include layout = "@layout/reuse_actionbar" />
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
<RelativeLayout
android:id = "@+id/select_game_installed_ll"
android:layout_width = "match_parent"
android:layout_height = "40dp"
android:background = "@android:color/white"
android:paddingLeft = "20dp" >
<ProgressBar
android:id = "@+id/scan_pb"
style = "@style/android:Widget.Holo.ProgressBar"
android:layout_width = "25dp"
android:layout_height = "25dp"
android:layout_centerVertical = "true"
android:layout_marginRight = "10dp"
android:visibility = "visible" />
<TextView
android:id = "@+id/apk_count"
android:layout_width = "wrap_content"
android:layout_height = "match_parent"
android:layout_toRightOf = "@+id/scan_pb"
android:gravity = "center"
android:text = "@string/clean_scanning"
android:textColor = "@color/title" />
<android.support.v7.widget.AppCompatCheckBox
android:id = "@+id/select_game_all"
style = "@style/KcCheckboxStyle"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:layout_marginRight = "18dp"
android:visibility = "gone" />
</RelativeLayout >
<android.support.v7.widget.RecyclerView
android:id = "@+id/apk_rv"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_above = "@+id/delete_bottom"
android:layout_below = "@+id/select_game_installed_ll" />
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:layout_below = "@+id/select_game_installed_ll"
android:background = "@drawable/shadow_down" />
<LinearLayout
android:id = "@+id/delete_bottom"
android:layout_width = "match_parent"
android:layout_height = "67dp"
android:layout_alignParentBottom = "true"
android:layout_marginTop = "-7dp"
android:orientation = "vertical" >
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:background = "@drawable/shadow" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "60dp"
android:background = "@android:color/white"
android:orientation = "horizontal"
android:padding = "10dp" >
<TextView
android:id = "@+id/delete_btn"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:background = "@drawable/game_item_btn_download_style"
android:gravity = "center"
android:text = "@string/clean_scan_stop"
android:textColor = "@android:color/white"
android:textSize = "14sp" />
</LinearLayout >
</LinearLayout >
<include layout = "@layout/reuse_nodata_skip" />
</RelativeLayout >
</LinearLayout >

View File

@ -1,108 +0,0 @@
<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" >
<include layout = "@layout/reuse_actionbar" />
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
<android.support.v7.widget.RecyclerView
android:id = "@+id/comment_detail_rv"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
<include
layout = "@layout/reuse_none_data"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
<View
android:id = "@+id/comment_detail_close_comment"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_above = "@+id/comment_detail_sv"
android:visibility = "visible" />
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:layout_above = "@+id/comment_detail_sv"
android:background = "@drawable/shadow" />
<ScrollView
android:id = "@+id/comment_detail_sv"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_alignParentBottom = "true"
android:background = "@android:color/white" >
<RelativeLayout
android:id = "@+id/comment_detail_comment_rl"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:paddingLeft = "18dp"
android:paddingRight = "18dp"
android:visibility = "gone" >
<EditText
android:id = "@+id/comment_detail_comment_et"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:background = "@null"
android:drawableBottom = "@drawable/et_line"
android:drawablePadding = "6dp"
android:hint = "@string/message_detail_comment_hint"
android:paddingTop = "14dp"
android:textColorHint = "@color/text_b2b2b2"
android:textCursorDrawable = "@drawable/cursor_color"
android:textSize = "14sp" />
<RelativeLayout
android:id = "@+id/comment_detail_user_rl"
android:layout_width = "match_parent"
android:layout_height = "70dp"
android:layout_below = "@+id/comment_detail_comment_et"
android:visibility = "visible" >
<com.facebook.drawee.view.SimpleDraweeView
android:id = "@+id/comment_user_icon"
style = "@style/frescoStyle"
android:layout_width = "45dp"
android:layout_height = "45dp"
android:layout_centerVertical = "true"
android:layout_marginRight = "17dp"
fresco:roundAsCircle = "true" />
<TextView
android:id = "@+id/comment_user_name"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_centerInParent = "true"
android:layout_toLeftOf = "@+id/comment_send"
android:layout_toRightOf = "@+id/comment_user_icon"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/comment_send"
android:layout_width = "60dp"
android:layout_height = "28.5dp"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:background = "@drawable/textview_comment_send_style"
android:clickable = "true"
android:gravity = "center"
android:text = "@string/message_detail_send"
android:textColor = "@android:color/white"
android:textSize = "14sp" />
</RelativeLayout >
</RelativeLayout >
</ScrollView >
</RelativeLayout >
</LinearLayout >

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<include layout = "@layout/reuse_actionbar" />
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
<android.support.v7.widget.RecyclerView
android:id = "@+id/game_news_list"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
<android.support.v7.widget.RecyclerView
android:id = "@+id/game_news_top_type_list"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:background = "@color/background"
android:paddingBottom = "10dp"
android:paddingLeft = "10dp"
android:paddingRight = "10dp"
android:paddingTop = "5dp"
android:visibility = "gone" />
<include layout = "@layout/reuse_none_data" />
</RelativeLayout >
</LinearLayout >

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<include layout = "@layout/reuse_actionbar" />
<FrameLayout
android:id="@+id/layout_fragment_content"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
</LinearLayout >

View File

@ -1,228 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<include layout = "@layout/reuse_actionbar" />
<ScrollView
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "vertical" >
<LinearLayout
android:id = "@+id/setting_cv_fix_download"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@color/fix_download"
android:orientation = "horizontal"
android:visibility = "gone" >
<TextView
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_gravity = "center"
android:gravity = "center"
android:text = "@string/setting_download_fix"
android:textColor = "@android:color/white"
android:textSize = "18sp" />
</LinearLayout >
<LinearLayout
android:id = "@+id/setting_cv_font_size"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:orientation = "horizontal"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "0dp"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:layout_weight = "3"
android:gravity = "left"
android:text = "@string/font_primary"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/setting_tv_size"
android:layout_width = "0dp"
android:layout_height = "wrap_content"
android:layout_weight = "1"
android:gravity = "right"
android:text = "@string/font_medium"
android:textColor = "@color/theme"
android:textSize = "12sp" />
</LinearLayout >
<RelativeLayout
android:id = "@+id/setting_rl_autoinstall"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "6dp" >
<TextView
android:id = "@+id/setting_tv_autoinstall"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_install_auto"
android:textColor = "@color/title"
android:textSize = "15sp" />
<com.kyleduo.switchbutton.SwitchButton
android:id = "@+id/setting_sb_autoinstall"
style = "@style/MySwitchButtonMD"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_concerngame"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "1dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "6dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_favorite_auto"
android:textColor = "@color/title"
android:textSize = "15sp" />
<com.kyleduo.switchbutton.SwitchButton
android:id = "@+id/setting_sb_concerngame"
style = "@style/MySwitchButtonMD"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_autodelete"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "1dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "6dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_clean_apk_auto"
android:textColor = "@color/title"
android:textSize = "15sp" />
<com.kyleduo.switchbutton.SwitchButton
android:id = "@+id/setting_sb_autodelete"
style = "@style/MySwitchButtonMD"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_cache"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_clear_cache"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/setting_tv_cache"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:text = "@string/setting_cache_size_def"
android:textColor = "@color/theme"
android:textSize = "12sp" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_about"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "1dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentLeft = "true"
android:layout_alignParentStart = "true"
android:layout_centerVertical = "true"
android:text = "@string/setting_about"
android:textColor = "@color/title"
android:textSize = "15sp" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_logout_rl"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_logout"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/setting_logout_tv"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:textColor = "@color/hint"
android:textSize = "13sp" />
</RelativeLayout >
</LinearLayout >
</ScrollView >
</LinearLayout >

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "255dp"
android:gravity = "center"
android:orientation = "vertical" >
<ImageView
android:layout_width = "78dp"
android:layout_height = "78dp"
android:src = "@drawable/logo" />
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginBottom = "2dp"
android:layout_marginTop = "13sp"
android:text = "@string/app_name"
android:textColor = "@color/title"
android:textSize = "23sp"
android:textStyle = "bold" />
<TextView
android:id = "@+id/about_tv_version"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:textColor = "@color/content"
android:textSize = "12sp" />
</LinearLayout >
<LinearLayout
android:id = "@+id/about_content"
android:layout_width = "match_parent"
android:layout_height = "111dp"
android:background = "@android:color/white"
android:orientation = "vertical" >
<RelativeLayout
android:id = "@+id/setting_rl_update"
android:layout_width = "match_parent"
android:layout_height = "55dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/about_version_update"
android:textColor = "@color/title"
android:textSize = "17sp" />
<ProgressBar
android:id = "@+id/about_version_pb"
style = "?android:attr/progressBarStyle"
android:layout_width = "23dp"
android:layout_height = "22dp"
android:layout_centerVertical = "true"
android:layout_marginRight = "5dp"
android:layout_toLeftOf = "@+id/about_version_tv"
android:visibility = "gone" />
<TextView
android:id = "@+id/about_version_tv"
android:layout_width = "wrap_content"
android:layout_height = "match_parent"
android:layout_alignParentRight = "true"
android:gravity = "center"
android:textColor = "@color/hint"
android:textSize = "12sp" />
</RelativeLayout >
<View
android:layout_width = "match_parent"
android:layout_height = "1dp"
android:layout_marginLeft = "20dp"
android:layout_marginRight = "20dp"
android:background = "@color/cutting_line" />
<RelativeLayout
android:id = "@+id/about_shengming"
android:layout_width = "match_parent"
android:layout_height = "55dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "声明"
android:textColor = "@color/title"
android:textSize = "17sp" />
<ImageView
android:layout_width = "15dp"
android:layout_height = "14dp"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:src = "@drawable/about_more_iocn" />
</RelativeLayout >
</LinearLayout >
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_alignParentBottom = "true"
android:gravity = "bottom"
android:orientation = "vertical" >
<TextView
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:gravity = "center"
android:text = "光环工作室 版权所有"
android:textColor = "@color/content"
android:textSize = "11sp" />
<TextView
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_marginBottom = "25dp"
android:layout_marginTop = "17dp"
android:gravity = "center"
android:text = "Copyright 2017 GHZhuShou Team All Rights Reserved."
android:textColor = "@color/content"
android:textSize = "11sp" />
</LinearLayout >
</LinearLayout >

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
<RelativeLayout
android:id = "@+id/select_game_installed_ll"
android:layout_width = "match_parent"
android:layout_height = "40dp"
android:background = "@android:color/white"
android:paddingLeft = "20dp" >
<ProgressBar
android:id = "@+id/scan_pb"
style = "@style/android:Widget.Holo.ProgressBar"
android:layout_width = "25dp"
android:layout_height = "25dp"
android:layout_centerVertical = "true"
android:layout_marginRight = "10dp"
android:visibility = "visible" />
<TextView
android:id = "@+id/apk_count"
android:layout_width = "wrap_content"
android:layout_height = "match_parent"
android:layout_toRightOf = "@+id/scan_pb"
android:gravity = "center"
android:text = "@string/clean_scanning"
android:textColor = "@color/title" />
<android.support.v7.widget.AppCompatCheckBox
android:id = "@+id/select_game_all"
style = "@style/KcCheckboxStyle"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:layout_marginRight = "18dp"
android:visibility = "gone" />
</RelativeLayout >
<android.support.v7.widget.RecyclerView
android:id = "@+id/apk_rv"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_above = "@+id/delete_bottom"
android:layout_below = "@+id/select_game_installed_ll" />
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:layout_below = "@+id/select_game_installed_ll"
android:background = "@drawable/shadow_down" />
<LinearLayout
android:id = "@+id/delete_bottom"
android:layout_width = "match_parent"
android:layout_height = "67dp"
android:layout_alignParentBottom = "true"
android:layout_marginTop = "-7dp"
android:orientation = "vertical" >
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:background = "@drawable/shadow" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "60dp"
android:background = "@android:color/white"
android:orientation = "horizontal"
android:padding = "10dp" >
<TextView
android:id = "@+id/delete_btn"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:background = "@drawable/game_item_btn_download_style"
android:gravity = "center"
android:text = "@string/clean_scan_stop"
android:textColor = "@android:color/white"
android:textSize = "14sp" />
</LinearLayout >
</LinearLayout >
<include layout = "@layout/reuse_nodata_skip" />
</RelativeLayout >

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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.support.v7.widget.RecyclerView
android:id = "@+id/comment_detail_rv"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
<include
layout = "@layout/reuse_none_data"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
<View
android:id = "@+id/comment_detail_close_comment"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_above = "@+id/comment_detail_sv"
android:visibility = "visible" />
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:layout_above = "@+id/comment_detail_sv"
android:background = "@drawable/shadow" />
<ScrollView
android:id = "@+id/comment_detail_sv"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_alignParentBottom = "true"
android:background = "@android:color/white" >
<RelativeLayout
android:id = "@+id/comment_detail_comment_rl"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:paddingLeft = "18dp"
android:paddingRight = "18dp"
android:visibility = "gone" >
<EditText
android:id = "@+id/comment_detail_comment_et"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:background = "@null"
android:drawableBottom = "@drawable/et_line"
android:drawablePadding = "6dp"
android:hint = "@string/message_detail_comment_hint"
android:paddingTop = "14dp"
android:textColorHint = "@color/text_b2b2b2"
android:textCursorDrawable = "@drawable/cursor_color"
android:textSize = "14sp" />
<RelativeLayout
android:id = "@+id/comment_detail_user_rl"
android:layout_width = "match_parent"
android:layout_height = "70dp"
android:layout_below = "@+id/comment_detail_comment_et"
android:visibility = "visible" >
<com.facebook.drawee.view.SimpleDraweeView
android:id = "@+id/comment_user_icon"
style = "@style/frescoStyle"
android:layout_width = "45dp"
android:layout_height = "45dp"
android:layout_centerVertical = "true"
android:layout_marginRight = "17dp"
fresco:roundAsCircle = "true" />
<TextView
android:id = "@+id/comment_user_name"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_centerInParent = "true"
android:layout_toLeftOf = "@+id/comment_send"
android:layout_toRightOf = "@+id/comment_user_icon"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/comment_send"
android:layout_width = "60dp"
android:layout_height = "28.5dp"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:background = "@drawable/textview_comment_send_style"
android:clickable = "true"
android:gravity = "center"
android:text = "@string/message_detail_send"
android:textColor = "@android:color/white"
android:textSize = "14sp" />
</RelativeLayout >
</RelativeLayout >
</ScrollView >
</RelativeLayout >

View File

@ -4,8 +4,6 @@
android:layout_height = "match_parent"
android:orientation = "vertical" >
<include layout = "@layout/reuse_actionbar" />
<RelativeLayout
android:layout_width = "match_parent"
android:layout_height = "0dp"

View File

@ -0,0 +1,24 @@
<?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" >
<android.support.v7.widget.RecyclerView
android:id = "@+id/game_news_list"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
<android.support.v7.widget.RecyclerView
android:id = "@+id/game_news_top_type_list"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:background = "@color/background"
android:paddingBottom = "10dp"
android:paddingLeft = "10dp"
android:paddingRight = "10dp"
android:paddingTop = "5dp"
android:visibility = "gone" />
<include layout = "@layout/reuse_none_data" />
</FrameLayout >

View File

@ -4,8 +4,6 @@
android:layout_height = "wrap_content"
android:orientation = "vertical" >
<include layout = "@layout/reuse_actionbar" />
<RelativeLayout
android:layout_width = "wrap_content"
android:layout_height = "38dp"

View File

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

View File

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "vertical" >
<LinearLayout
android:id = "@+id/setting_cv_fix_download"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@color/fix_download"
android:orientation = "horizontal"
android:visibility = "gone" >
<TextView
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_gravity = "center"
android:gravity = "center"
android:text = "@string/setting_download_fix"
android:textColor = "@android:color/white"
android:textSize = "18sp" />
</LinearLayout >
<LinearLayout
android:id = "@+id/setting_cv_font_size"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:orientation = "horizontal"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "0dp"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:layout_weight = "3"
android:gravity = "left"
android:text = "@string/font_primary"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/setting_tv_size"
android:layout_width = "0dp"
android:layout_height = "wrap_content"
android:layout_weight = "1"
android:gravity = "right"
android:text = "@string/font_medium"
android:textColor = "@color/theme"
android:textSize = "12sp" />
</LinearLayout >
<RelativeLayout
android:id = "@+id/setting_rl_autoinstall"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "6dp" >
<TextView
android:id = "@+id/setting_tv_autoinstall"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_install_auto"
android:textColor = "@color/title"
android:textSize = "15sp" />
<com.kyleduo.switchbutton.SwitchButton
android:id = "@+id/setting_sb_autoinstall"
style = "@style/MySwitchButtonMD"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_concerngame"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "1dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "6dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_favorite_auto"
android:textColor = "@color/title"
android:textSize = "15sp" />
<com.kyleduo.switchbutton.SwitchButton
android:id = "@+id/setting_sb_concerngame"
style = "@style/MySwitchButtonMD"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_autodelete"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "1dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "6dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_clean_apk_auto"
android:textColor = "@color/title"
android:textSize = "15sp" />
<com.kyleduo.switchbutton.SwitchButton
android:id = "@+id/setting_sb_autodelete"
style = "@style/MySwitchButtonMD"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_cache"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:gravity = "center_vertical"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_clear_cache"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/setting_tv_cache"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:text = "@string/setting_cache_size_def"
android:textColor = "@color/theme"
android:textSize = "12sp" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_rl_about"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "1dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentLeft = "true"
android:layout_alignParentStart = "true"
android:layout_centerVertical = "true"
android:text = "@string/setting_about"
android:textColor = "@color/title"
android:textSize = "15sp" />
</RelativeLayout >
<RelativeLayout
android:id = "@+id/setting_logout_rl"
android:layout_width = "match_parent"
android:layout_height = "48dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/reuse_listview_item_style"
android:paddingLeft = "20dp"
android:paddingRight = "20dp" >
<TextView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_centerVertical = "true"
android:text = "@string/setting_logout"
android:textColor = "@color/title"
android:textSize = "15sp" />
<TextView
android:id = "@+id/setting_logout_tv"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentRight = "true"
android:layout_centerVertical = "true"
android:textColor = "@color/hint"
android:textSize = "13sp" />
</RelativeLayout >
</LinearLayout >
</ScrollView >

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
<TextView
android:id = "@+id/tv_menu_button"
android:layout_width = "48dp"
android:layout_height = "28dp"
android:layout_centerInParent = "true"
android:layout_marginRight = "8dp"
android:background = "@drawable/border_black_bg"
android:gravity = "center"
android:textColor = "@color/title" />
</RelativeLayout >

View File

@ -5,6 +5,7 @@
android:layout_width = "match_parent"
android:layout_height = "?attr/actionBarSize" >
<!-- TODO 处理完之后只保留TitleTextView其他删掉-->
<RelativeLayout
android:id = "@+id/reuse_actionbar"
android:layout_width = "match_parent"

View File

@ -3,6 +3,7 @@
android:id = "@+id/reuse_none_data"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_gravity = "center"
android:gravity = "center"
android:orientation = "vertical"
android:visibility = "gone" >

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto" >
<item
android:id = "@+id/menu_button"
android:title = ""
app:actionLayout = "@layout/layout_menu_button"
app:showAsAction = "always" />
</menu >

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto" >
<item
android:id = "@+id/menu_search"
android:icon = "@drawable/ic_search_white"
android:title = "@string/menu_search"
app:showAsAction = "always" />
</menu >

View File

@ -382,6 +382,9 @@
<string name = "vote_count" >%1$d票</string >
<string name = "kefu_default_name" >光环客服</string >
<string name = "text_holder" >I\'m a Text</string >
<string name = "menu_search" >搜索</string >
<string name = "title_game_detail" >游戏详情</string >
<string name = "menu_text_reset" >重置</string >
<string-array name = "settings_font_size" >
<item >小字号</item >