Merge remote-tracking branch 'origin/3.0' into 3.0

# Conflicts:
#	app/src/main/java/com/gh/gamecenter/personal/PersonalFragment.java
This commit is contained in:
kehaoyuan
2017-06-19 11:06:16 +08:00
269 changed files with 4344 additions and 2893 deletions

View File

@ -72,20 +72,6 @@ public class AppController extends Application {
objectMap.remove(key);
}
public static String getProcessName(Context cxt, int pid) {
ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> runningApps = am.getRunningAppProcesses();
if (runningApps == null) {
return null;
}
for (RunningAppProcessInfo procInfo : runningApps) {
if (procInfo.pid == pid) {
return procInfo.processName;
}
}
return null;
}
public static synchronized AppController getInstance() {
return mInstance;
}
@ -107,7 +93,6 @@ public class AppController extends Application {
Thread.setDefaultUncaughtExceptionHandler(appUncaughtHandler);
}
// mChannel = (String) PackageUtils.getMetaData(this, getPackageName(), "TD_CHANNEL_ID");
mChannel = ChannelReaderUtil.getChannel(this);
if (TextUtils.isEmpty(mChannel)) {
//默认用Android Studio run时并没有写入channel magic number到apk包里面所以需要fallback
@ -121,6 +106,13 @@ public class AppController extends Application {
DataUtils.init(this, BuildConfig.DEBUG, mChannel);
//测试MTA崩溃的坑爹
// if (BuildConfig.DEBUG) {
// StatConfig.setDebugEnable(true);
// StatConfig.setStatSendStrategy(StatReportStrategy.DEVELOPER);
// throw new RuntimeException("test again");
// }
HttpsUtils.initHttpsUrlConnection(this);
// if (BuildConfig.DEBUG) {
@ -233,4 +225,18 @@ public class AppController extends Application {
return false;
}
// public static String getProcessName(Context cxt, int pid) {
// ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
// List<RunningAppProcessInfo> runningApps = am.getRunningAppProcesses();
// if (runningApps == null) {
// return null;
// }
// for (RunningAppProcessInfo procInfo : runningApps) {
// if (procInfo.pid == pid) {
// return procInfo.processName;
// }
// }
// return null;
// }
}

View File

@ -1,51 +0,0 @@
//package com.gh.base;
//
//
//import android.annotation.TargetApi;
//import android.app.Application;
//import android.content.Context;
//import android.content.Intent;
//import android.os.Build;
//import android.support.multidex.MultiDex;
//
//import com.tencent.tinker.lib.listener.DefaultPatchListener;
//import com.tencent.tinker.lib.listener.PatchListener;
//import com.tencent.tinker.lib.patch.AbstractPatch;
//import com.tencent.tinker.lib.patch.UpgradePatch;
//import com.tencent.tinker.lib.reporter.DefaultLoadReporter;
//import com.tencent.tinker.lib.reporter.DefaultPatchReporter;
//import com.tencent.tinker.lib.reporter.LoadReporter;
//import com.tencent.tinker.lib.reporter.PatchReporter;
//import com.tencent.tinker.lib.tinker.TinkerInstaller;
//import com.tencent.tinker.loader.app.DefaultApplicationLike;
//
//public class AppControllerLike extends DefaultApplicationLike {
//
// public AppControllerLike(Application application, int tinkerFlags, boolean tinkerLoadVerifyFlag,
// long applicationStartElapsedTime, long applicationStartMillisTime,
// Intent tinkerResultIntent) {
// super(application, tinkerFlags, tinkerLoadVerifyFlag, applicationStartElapsedTime,
// applicationStartMillisTime, tinkerResultIntent);
// }
//
// @Override
// public void onBaseContextAttached(Context base) {
// super.onBaseContextAttached(base);
// MultiDex.install(base);
//
// LoadReporter loadReporter = new DefaultLoadReporter(getApplication());
// PatchReporter patchReporter = new DefaultPatchReporter(getApplication());
// PatchListener patchListener = new DefaultPatchListener(getApplication());
// AbstractPatch upgradePatchProcessor = new UpgradePatch();
//
// TinkerInstaller.install(this, loadReporter, patchReporter, patchListener,
// AppTinkerResultService.class, upgradePatchProcessor);
//// TinkerInstaller.install(this);
// }
//
// @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
// public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
// getApplication().registerActivityLifecycleCallbacks(callback);
// }
//
//}

View File

@ -1,29 +0,0 @@
//package com.gh.base;
//
//import com.gh.common.util.Utils;
//import com.tencent.tinker.lib.service.DefaultTinkerResultService;
//import com.tencent.tinker.lib.service.PatchResult;
//import com.tencent.tinker.lib.util.TinkerServiceInternals;
//
//import java.io.File;
//
//
//public class AppTinkerResultService extends DefaultTinkerResultService {
//
// @Override
// public void onPatchResult(PatchResult result) {
// if (result == null) {
// return;
// }
// Utils.log(result);
//
// //first, we want to kill the recover process
// TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());
//
// if (result.isSuccess) {
// Utils.log("Tinkder Success");
// deleteRawPatchFile(new File(result.rawPatchFilePath));
// }
// }
//
//}

View File

@ -95,10 +95,11 @@ public class AppUncaughtHandler implements UncaughtExceptionHandler {
String errorMsg = Log.getStackTraceString(ex);
// MTA主动上传错误
StatService.reportError(mAppController.getApplicationContext(), errorMsg);
// StatService.reportError(mAppController.getApplicationContext(), errorMsg);
StatService.reportException(mAppController, ex);
// 上传错误数据
DataCollectionUtils.uploadError(mAppController.getApplicationContext(), errorMsg);
DataCollectionUtils.uploadError(mAppController, errorMsg);
// 保存到本地
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault());

View File

@ -22,7 +22,6 @@ import com.gh.common.util.ShareUtils;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
import com.gh.gamecenter.eventbus.EBShowDialog;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.readystatesoftware.systembartint.SystemBarTintManager.SystemBarConfig;
import org.greenrobot.eventbus.EventBus;
@ -36,7 +35,7 @@ import butterknife.ButterKnife;
import static com.gh.common.util.EntranceUtils.KEY_DATA;
import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
public abstract class BaseActivity extends BaseAppCompatToolBarActivity implements OnCallBackListener {
public abstract class BaseActivity extends BaseAppCompatToolBarActivity implements OnRequestCallBackListener {
protected String mEntrance;
private boolean mIsPause;
@ -84,7 +83,7 @@ public abstract class BaseActivity extends BaseAppCompatToolBarActivity implemen
}
}
protected void init(String title) {
protected void initTitle(String title) {
TextView actionbar_tv_title = (TextView) findViewById(R.id.actionbar_tv_title);
actionbar_tv_title.setText(title);
// setNavigationTitle(title);

View File

@ -23,7 +23,7 @@ public abstract class BaseAppCompatToolBarActivity extends BaseAppCompatActivity
private SystemBarTintManager mTintManager;
// TODO 获取沉浸栏管理,要进行版本判断或者判断是否为空
protected SystemBarTintManager getTintManager() {
public SystemBarTintManager getTintManager() {
return mTintManager;
}

View File

@ -2,6 +2,7 @@ package com.gh.base;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
@ -100,8 +101,6 @@ public abstract class BaseDetailActivity extends BaseActivity implements View.On
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// View contentView = View.inflate(this, R.layout.activity_detail, null);
// 添加分享图标
iv_share = new ImageView(this);
iv_share.setImageResource(R.drawable.ic_share);
@ -117,8 +116,6 @@ public abstract class BaseDetailActivity extends BaseActivity implements View.On
R.id.reuse_actionbar);
reuse_actionbar.addView(iv_share, params);
// init(contentView);
actionbar_tv_title = (TextView) findViewById(R.id.actionbar_tv_title);
detail_rv_show = (RecyclerView) findViewById(R.id.detail_rv_show);
detail_ll_bottom = (LinearLayout) findViewById(R.id.detail_ll_bottom);
@ -279,9 +276,9 @@ public abstract class BaseDetailActivity extends BaseActivity implements View.On
detail_tv_per.setText("安装");
if (mDownloadEntity.isPluggable()
&& PackageManager.isInstalled(mDownloadEntity.getPackageName())) {
detail_pb_progressbar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_plugin_radius_style));
detail_pb_progressbar.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progressbar_plugin_radius_style));
} else {
detail_pb_progressbar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_normal_radius_style));
detail_pb_progressbar.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progressbar_normal_radius_style));
}
break;
case cancel:

View File

@ -1,100 +0,0 @@
package com.gh.base;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.listener.OnCallBackListener;
import org.greenrobot.eventbus.EventBus;
import butterknife.ButterKnife;
/**
* Created by LGT on 2016/9/4.
* Fragment 基类
*/
public class BaseFragment extends Fragment implements OnCallBackListener {
protected View view;
protected boolean isEverpause;
protected String mEntrance;
protected void init(int layout) {
view = View.inflate(getActivity(), layout, null);
ButterKnife.bind(this, view);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mEntrance = getActivity().getIntent().getStringExtra(EntranceUtils.KEY_ENTRANCE);
isEverpause = false;
EventBus.getDefault().register(this);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
if (container != null) {
container.removeView(view);
}
return view;
}
@Override
public void onResume() {
super.onResume();
isEverpause = false;
}
@Override
public void onPause() {
super.onPause();
isEverpause = true;
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
public void toast(String msg) {
Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
}
public boolean isEverpause() {
return isEverpause;
}
@Override
public void loadDone() {
}
@Override
public void loadDone(Object obj) {
}
@Override
public void loadError() {
}
@Override
public void loadEmpty() {
}
}

View File

@ -1,206 +0,0 @@
//package com.gh.base;
//
//import android.annotation.TargetApi;
//import android.content.Context;
//import android.graphics.Color;
//import android.os.Build;
//import android.os.Bundle;
//import android.support.v4.app.FragmentActivity;
//import android.view.*;
//import android.view.View.OnClickListener;
//import android.view.ViewGroup.LayoutParams;
//import android.widget.*;
//import butterknife.ButterKnife;
//import com.gh.common.constant.Config;
//import com.gh.common.util.*;
//import com.gh.download.DownloadManager;
//import com.gh.gamecenter.R;
//import com.gh.gamecenter.eventbus.EBShowDialog;
//import com.readystatesoftware.systembartint.SystemBarTintManager;
//import com.readystatesoftware.systembartint.SystemBarTintManager.SystemBarConfig;
//import de.greenrobot.event.EventBus;
//
//import java.lang.reflect.Field;
//import java.lang.reflect.Method;
//import java.util.ArrayList;
//
//public class BaseFragmentActivity extends FragmentActivity {
//
// protected String mEntrance;
//
// private boolean isPause;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// AppManager.getInstance().addActivity(this);
// EventBus.getDefault().register(this);
// mEntrance = getIntent().getStringExtra("mEntrance");
// if (getIntent().getBundleExtra("data") != null) {
// mEntrance = getIntent().getBundleExtra("data").getString("mEntrance");
// }
// }
//
// public void init(View contentView, String title) {
// init(contentView);
// TextView actionbar_tv_title = (TextView) findViewById(R.id.actionbar_tv_title);
// actionbar_tv_title.setText(title);
// }
//
// public void init(View contentView) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// setTheme(R.style.AppTheme);
// setTranslucentStatus(true);
// SystemBarTintManager tintManager = new SystemBarTintManager(this);
// tintManager.setStatusBarTintEnabled(true);
// if (Build.MANUFACTURER.equals("Meizu") || Build.MANUFACTURER.equals("Xiaomi")) {
// tintManager.setStatusBarTintColor(Color.WHITE);
// } else {
// tintManager.setStatusBarTintColor(Color.BLACK);
// }
// SystemBarConfig config = tintManager.getConfig();
// contentView.setPadding(0, config.getPixelInsetTop(false), 0,
// config.getPixelInsetBottom());
//
// if (Build.MANUFACTURER.equals("Meizu")) {
// try {
// Window window = getWindow();
// if (window != null) {
// WindowManager.LayoutParams lp = window.getAttributes();
// Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
// Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");
// darkFlag.setAccessible(true);
// meizuFlags.setAccessible(true);
// int bit = darkFlag.getInt(null);
// int value = meizuFlags.getInt(lp);
// value |= bit;
// meizuFlags.setInt(lp, value);
// window.setAttributes(lp);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// } else if (Build.MANUFACTURER.equals("Xiaomi")) {
// try {
// Window window = getWindow();
// if (window != null) {
// Class<?> clazz = window.getClass();
// Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
// Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
// int darkModeFlag = field.getInt(layoutParams);
// Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
// extraFlagField.invoke(window, darkModeFlag, darkModeFlag);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
//
// setContentView(contentView);
//
// ButterKnife.bind(this);
//
// int actionbar_height = getSharedPreferences(Config.PREFERENCE,
// Context.MODE_PRIVATE).getInt("actionbar_height",
// DisplayUtils.dip2px(getApplicationContext(), 48));
//
// RelativeLayout reuse_actionbar = (RelativeLayout) findViewById(R.id.reuse_actionbar);
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
// LayoutParams.MATCH_PARENT, actionbar_height);
// reuse_actionbar.setLayoutParams(params);
//
// findViewById(R.id.actionbar_rl_back).setOnClickListener(
// new OnClickListener() {
// @Override
// public void onClick(View v) {
// finish();
// }
// });
// }
//
// public void toast(String msg) {
// Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
// }
//
// public void toast(int msg) {
// Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
// }
//
// @TargetApi(19)
// protected void setTranslucentStatus(boolean status) {
// Window window = getWindow();
// WindowManager.LayoutParams winParams = window.getAttributes();
// final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
// if (status) {
// winParams.flags |= bits;
// } else {
// winParams.flags &= ~bits;
// }
// window.setAttributes(winParams);
// }
//
// //如果是游戏分享newsTitle默认为空
// public void showShare(String url, String gameName, String icon, String newsTitle, ArrayList<String> tag) {
//
// //判断是否是官方版
// boolean isPlugin = false;
// if (tag != null) {
// for (String s : tag) {
// if (!"官方版".equals(s)) {
// isPlugin = true;
// }
// }
// }
//
// ShareUtils.getInstance(this).showShareWindows(new View(this), url, gameName, icon, newsTitle, isPlugin, true);
//
// if (newsTitle == null) {
// DataUtils.onEvent(this, "内容分享", gameName);
// } else {
// DataUtils.onEvent(this, "内容分享", newsTitle);
// }
// }
//
// public void onEventMainThread(final EBShowDialog showDialog) {
// if (!isPause && this.getClass().getName().equals(RunningUtils.getTopActivity(this))) {
// if ("hijack".equals(showDialog.getType())) {
// DialogUtils.showQqSessionDialog(this, null);// 建议用户联系客服
// } else if ("plugin".equals(showDialog.getType())) {
// DialogUtils.showPluginDialog(this, new DialogUtils.ConfirmListener() {
// @Override
// public void onConfirm() {
// if (FileUtils.isEmptyFile(showDialog.getPath())) {
// Toast.makeText(BaseFragmentActivity.this, "解析包出错(可能被误删了),请重新下载", Toast.LENGTH_SHORT).show();
// } else {
// startActivity(PackageUtils.getUninstallIntent(BaseFragmentActivity.this, showDialog.getPath()));
// }
// }
// });
// }
// }
// }
//
// @Override
// protected void onDestroy() {
// super.onDestroy();
// EventBus.getDefault().unregister(this);
// AppManager.getInstance().finishActivity(this);
// }
//
// @Override
// protected void onPause() {
// super.onPause();
// DataUtils.onPause(this);
// isPause = true;
// }
//
// @Override
// protected void onResume() {
// super.onResume();
// DataUtils.onResume(this);
// isPause = false;
// DownloadManager.getInstance(this).initGameMap();
// }
//
//}

View File

@ -0,0 +1,23 @@
package com.gh.base;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import butterknife.ButterKnife;
/**
* 目前仅提供butterknife bind方法
*
* @author CsHeng
* @Date 16/06/2017
* @Time 9:55 AM
*/
public abstract class BaseRecyclerViewHolder extends RecyclerView.ViewHolder {
public BaseRecyclerViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -1,9 +1,9 @@
package com.gh.gamecenter.listener;
package com.gh.base;
/**
* Created by Administrator on 2016/9/8.
*/
public interface OnCallBackListener {
public interface OnRequestCallBackListener {
void loadDone();

View File

@ -1,48 +1,48 @@
package com.gh.base;
import java.io.Serializable;
public enum SuggestionType implements Serializable {
FEEDBACK("普通反馈", 1),
SUGGESTION("功能建议", 2),
CRASH("发生闪退", 3),
GAME("游戏问题", 4),
COLLECT("游戏收录", 5),
POST("文章投稿", 6);
private String mName;
private int mIndex;
private SuggestionType(String name, int index) {
mName = name;
mIndex = index;
}
public static String getName(int index) {
for (SuggestionType c : SuggestionType.values()) {
if (c.mIndex == index) {
return c.mName;
}
}
return "";
}
public static int getIndex(String name) {
for (SuggestionType c : SuggestionType.values()) {
if (c.mName == name) {
return c.mIndex;
}
}
return -1;
}
public int getIndex() {
return mIndex;
}
public String getName() {
return mName;
}
}
//package com.gh.base;
//
//import java.io.Serializable;
//
//public enum SuggestionType implements Serializable {
//
// FEEDBACK("普通反馈", 1),
// SUGGESTION("功能建议", 2),
// CRASH("发生闪退", 3),
// GAME("游戏问题", 4),
// COLLECT("游戏收录", 5),
// POST("文章投稿", 6);
//
// private String mName;
// private int mIndex;
//
// private SuggestionType(String name, int index) {
// mName = name;
// mIndex = index;
// }
//
// public static String getName(int index) {
// for (SuggestionType c : SuggestionType.values()) {
// if (c.mIndex == index) {
// return c.mName;
// }
// }
// return "";
// }
//
// public static int getIndex(String name) {
// for (SuggestionType c : SuggestionType.values()) {
// if (c.mName == name) {
// return c.mIndex;
// }
// }
// return -1;
// }
//
// public int getIndex() {
// return mIndex;
// }
//
// public String getName() {
// return mName;
// }
//
//}

View File

@ -1,28 +1,31 @@
package com.gh.gamecenter.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
/**
* @author CsHeng
* @Date 2017/4/25
* @Time 10:19
*/
public abstract class BaseRecyclerAdapter<V extends ViewHolder> extends RecyclerView.Adapter<V> {
protected static final int TAG_POSITION = 0x12345678;
protected Context mContext;
protected LayoutInflater mLayoutInflater;
public BaseRecyclerAdapter(Context context) {
//TODO 排查必须使用activity context的场景比如startActivity
// mContext = context.getApplicationContext();
mContext = context;
mLayoutInflater = LayoutInflater.from(mContext);
}
}
package com.gh.base.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
/**
* @author CsHeng
* @Date 2017/4/25
* @Time 10:19
*/
public abstract class BaseRecyclerAdapter<V extends ViewHolder> extends RecyclerView.Adapter<V> {
/**
* 用于click listener的处理
*/
protected static final int TAG_POSITION = 0x12345678;
protected Context mContext;
protected LayoutInflater mLayoutInflater;
public BaseRecyclerAdapter(Context context) {
//TODO 排查必须使用activity context的场景比如startActivity
// mContext = context.getApplicationContext();
mContext = context;
mLayoutInflater = LayoutInflater.from(mContext);
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.adapter;
package com.gh.base.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

View File

@ -0,0 +1,139 @@
package com.gh.base.fragment;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.RuntimeUtils;
import com.gh.gamecenter.eventbus.EBMiPush;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import butterknife.ButterKnife;
/**
* Created by LGT on 2016/9/4.
* Fragment 基类
*/
public abstract class BaseFragment extends Fragment implements OnRequestCallBackListener, View.OnClickListener {
// TODO private view
protected View view;
protected boolean isEverPause;
protected String mEntrance;
@LayoutRes
protected abstract int getLayoutId();
/**
* 责任链谁处理了就返回true否则返回super.handleOnClick(View view)
*
* @return
*/
protected boolean handleOnClick(View view) {
return true;
}
@Override
public void onClick(View v) {
handleOnClick(v);
}
protected void initView(View view) {
}
protected void postRunnable(Runnable runnable) {
// if (getView() != null) {
// getView().post(runnable);
// }
RuntimeUtils.getInstance().runOnUiThread(runnable);
}
protected void postDelayedRunnable(Runnable runnable, long delayMillis) {
RuntimeUtils.getInstance().runOnUiThread(runnable, delayMillis);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mEntrance = getActivity().getIntent().getStringExtra(EntranceUtils.KEY_ENTRANCE);
isEverPause = false;
EventBus.getDefault().register(this);
view = View.inflate(getContext(), getLayoutId(), null);
ButterKnife.bind(this, view);
initView(view);
}
//TODO 尴尬必须的有subscribe才能register
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onDummyEvent(EBMiPush push) {
//
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (container != null) {
container.removeView(view);
}
return view;
}
@Override
public void onResume() {
super.onResume();
isEverPause = false;
}
@Override
public void onPause() {
super.onPause();
isEverPause = true;
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
public void toast(String msg) {
Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
}
public boolean isEverPause() {
return isEverPause;
}
@Override
public void loadDone() {
}
@Override
public void loadDone(Object obj) {
}
@Override
public void loadError() {
}
@Override
public void loadEmpty() {
}
}

View File

@ -0,0 +1,109 @@
/**
* project: OPlay
* <p/>
* <p/>
* ========================================================================
* amend date amend user amend reason
* 2013-3-6 CsHeng
*/
package com.gh.base.fragment;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import com.lightgame.adapter.BaseFragmentPagerAdapter;
import com.lightgame.view.DoubleTapTextView;
import java.util.ArrayList;
import java.util.List;
/**
* ViewPager 配合RadioGroup实现双切换<br/>
* 记得自己控制onCreateView返回和radioGroup里面radiobutton个数,Viewpager的布局<br/>
*
* @author CsHeng
* @date 2013-3-6
*/
public abstract class BaseFragment_ViewPager extends BaseFragment implements DoubleTapTextView.OnDoubleTapListener {
private static final String ARGS_INDEX = "index";
protected int mCheckedIndex = 0;
protected PagerAdapter mAdapter;
protected List<Fragment> mFragmentsList;
protected ViewPager mViewPager;
@LayoutRes
protected abstract int getLayoutId();
@IdRes
protected abstract int getViewPagerId();
protected abstract void initFragmentList(List<Fragment> fragments);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFragmentsList = new ArrayList<>();
initFragmentList(mFragmentsList);
mAdapter = BaseFragmentPagerAdapter.newInstance(getChildFragmentManager(), mFragmentsList);
final Bundle args = getArguments();
if (args != null) {
mCheckedIndex = args.getInt(ARGS_INDEX);
}
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mViewPager = (ViewPager) view.findViewById(getViewPagerId());
mViewPager.setOffscreenPageLimit(mFragmentsList.size());
mViewPager.setAdapter(mAdapter);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (mCheckedIndex < mFragmentsList.size()) {
mViewPager.setCurrentItem(mCheckedIndex, false);
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (getArguments() != null) {
getArguments().putInt(ARGS_INDEX, mCheckedIndex);
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (mViewPager != null) {
mViewPager.setAdapter(null);
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (mFragmentsList != null) {
mFragmentsList.clear();
}
}
@Override
public boolean onDoubleTap() {
final Fragment fragment = mFragmentsList.get(mViewPager.getCurrentItem());
return fragment instanceof DoubleTapTextView.OnDoubleTapListener && ((DoubleTapTextView.OnDoubleTapListener)
fragment).onDoubleTap();
}
}

View File

@ -0,0 +1,105 @@
/**
* project: OPlay
* <p/>
* <p/>
* ========================================================================
* amend date amend user amend reason
* 2013-3-6 CsHeng
*/
package com.gh.base.fragment;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
/**
* ViewPager 配合ViewGroup Checkable实现双切换<br/>
* 记得自己控制onCreateView返回和ViewGroup里面Checkable个数,ViewPager的布局<br/>
*
* @author CsHeng
* @date 2013-3-6
* @update 2014-09-29
*/
public abstract class BaseFragment_ViewPager_Checkable extends BaseFragment_ViewPager implements
ViewPager.OnPageChangeListener {
protected ViewGroup mCheckableGroup;
@IdRes
protected abstract int getCheckableGroupId();
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mCheckableGroup = (ViewGroup) view.findViewById(getCheckableGroupId());
for (int i = 0, size = mCheckableGroup.getChildCount(); i < size; i++) {
mCheckableGroup.getChildAt(i).setOnClickListener(this);
}
mViewPager.addOnPageChangeListener(this);
}
@Override
public void onDestroyView() {
super.onDestroyView();
mViewPager.removeOnPageChangeListener(this);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
checkIndex(mCheckedIndex);
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int index) {
onPageChanged(index);
}
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
protected boolean handleOnClick(View view) {
final int toCheck = mCheckableGroup.indexOfChild(view);
if (toCheck != -1) {
mViewPager.setCurrentItem(toCheck, false);
return true;
}
return super.handleOnClick(view);
}
protected void checkIndex(int index) {
final int childCount = mCheckableGroup.getChildCount();
if (index < childCount && mCheckedIndex < childCount) {
final View toChecked = mCheckableGroup.getChildAt(index);
if (toChecked instanceof Checkable) {
((Checkable) toChecked).setChecked(true);
}
if (index != mCheckedIndex) {
final View checkedChild = mCheckableGroup.getChildAt(mCheckedIndex);
if (checkedChild instanceof Checkable) {
((Checkable) checkedChild).setChecked(false);
}
}
mCheckedIndex = index;
}
}
protected void onPageChanged(int index) {
checkIndex(index);
}
}

View File

@ -8,12 +8,12 @@ import com.gh.gamecenter.BuildConfig;
public class Config {
public static final String HOST = "http://dev.api2.ghzhushou.com/v2d6/";
public static final String USER_HOST = "http://dev.user2.ghzhushou.com/v1d2/";
public static final String COMMENT_HOST = "http://dev.comment2.ghzhushou.com/v1d2/";
public static final String HOST = "http://api2.ghzhushou.com/v2d6/";
public static final String USER_HOST = "http://user2.ghzhushou.com/v1d2/";
public static final String COMMENT_HOST = "http://comment2.ghzhushou.com/v1d2/";
public static final String DATA_HOST = "http://data.ghzhushou.com/";
public static final String LIBAO_HOST = "http://dev.libao2.ghzhushou.com/v1d2/";
public static final String MESSAGE_HOST = "http://message.ghzhushou.com/v1d1/"; // TODO TEST v1d1
public static final String LIBAO_HOST = "http://libao2.ghzhushou.com/v1d2/";
public static final String MESSAGE_HOST = "http://message.ghzhushou.com/v1d0/"; // TODO TEST v1d1
public static final String PREFERENCE = "ghzhushou";
// Third-Party confs

View File

@ -5,9 +5,7 @@ import android.content.Context;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -15,7 +13,7 @@ import android.widget.TextView;
import com.gh.gamecenter.CommentDetailActivity;
import com.gh.gamecenter.MessageDetailActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.MessageDetailAdapter;
import com.gh.gamecenter.adapter.OnCommentCallBackListener;
import com.gh.gamecenter.db.CommentDao;
import com.gh.gamecenter.entity.CommentEntity;
@ -65,17 +63,17 @@ public class CommentUtils {
}
}
public static void showReportDialog(final CommentEntity commentEntity, final Context mContext
, final MessageDetailAdapter.OnCommentCallBackListener mCallBackListener, final String newsId) {
public static void showReportDialog(final CommentEntity commentEntity, final Context context,
final OnCommentCallBackListener listener, final String newsId) {
CommentDao commentDao = new CommentDao(mContext);
CommentDao commentDao = new CommentDao(context);
final Dialog dialog = new Dialog(mContext);
final Dialog dialog = new Dialog(context);
LinearLayout container = new LinearLayout(mContext);
LinearLayout container = new LinearLayout(context);
container.setOrientation(LinearLayout.VERTICAL);
container.setBackgroundColor(Color.WHITE);
container.setPadding(0, DisplayUtils.dip2px(mContext, 12), 0, DisplayUtils.dip2px(mContext, 12));
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
List<String> dialogType = new ArrayList<>();
@ -91,16 +89,16 @@ public class CommentUtils {
}
for (String s : dialogType) {
final TextView reportTv = new TextView(mContext);
final TextView reportTv = new TextView(context);
reportTv.setText(s);
reportTv.setTextSize(17);
reportTv.setTextColor(ContextCompat.getColor(mContext, R.color.title));
reportTv.setTextColor(ContextCompat.getColor(context, R.color.title));
reportTv.setBackgroundResource(R.drawable.textview_white_style);
int widthPixels = mContext.getResources().getDisplayMetrics().widthPixels;
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
reportTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
LinearLayout.LayoutParams.WRAP_CONTENT));
reportTv.setPadding(DisplayUtils.dip2px(mContext, 20), DisplayUtils.dip2px(mContext, 12),
0, DisplayUtils.dip2px(mContext, 12));
reportTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
0, DisplayUtils.dip2px(context, 12));
container.addView(reportTv);
reportTv.setOnClickListener(new View.OnClickListener() {
@ -109,23 +107,23 @@ public class CommentUtils {
dialog.cancel();
switch (reportTv.getText().toString()) {
case "回复":
if (mCallBackListener != null) {
mCallBackListener.showSoftInput(commentEntity);
if (listener != null) {
listener.onCommentCallback(commentEntity);
} else if (!TextUtils.isEmpty(newsId)) {
mContext.startActivity(MessageDetailActivity.getMessageDetailIntent(mContext, commentEntity, newsId));
context.startActivity(MessageDetailActivity.getMessageDetailIntent(context, commentEntity, newsId));
} else {
Utils.toast(mContext, "缺少关键属性");
Utils.toast(context, "缺少关键属性");
}
break;
case "复制":
LibaoUtils.copyLink(commentEntity.getContent(), mContext);
LibaoUtils.copyLink(commentEntity.getContent(), context);
break;
case "举报":
showReportTypeDialog(commentEntity, mContext);
showReportTypeDialog(commentEntity, context);
break;
case "查看对话":
mContext.startActivity(CommentDetailActivity.getCommentDetailIntent(mContext, commentEntity.getId()));
context.startActivity(CommentDetailActivity.getCommentDetailIntent(context, commentEntity.getId()));
break;
}
}

View File

@ -32,42 +32,51 @@ public class DataUtils {
public static void init(Application context, final boolean debug, String channel) {
//TalkingData
TCAgent.LOG_ON = debug;
if (!debug) {
TCAgent.init(context, Config.TD_APPID, channel);
//TODO 去除为了测试MTA的问题这个版本不启用
TCAgent.setReportUncaughtExceptions(true);
} else {
TCAgent.LOG_ON = true;
}
// 打开debug开关可查看mta上报日志或错误
// debug true release false
StatConfig.setDebugEnable(debug);
//MTA
StatService.setContext(context);
StatService.registerActivityLifecycleCallbacks(context);
if (!debug) {
// 禁止MTA打印日志
StatConfig.setDebugEnable(false);
//TODO 加入账号之后设置用户
// StatConfig.setCustomUserId(context, "userid");
// 收集未处理的异常
StatConfig.setAutoExceptionCaught(true);
StatConfig.setAntoActivityLifecycleStat(true);
// 设置数据上报策略
StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
StatConfig.setSendPeriodMinutes(5);
StatConfig.init(context);
StatConfig.setInstallChannel(channel);
StatService.setContext(context);
StatService.registerActivityLifecycleCallbacks(context);
StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
// 开启异常时的实时上报
crashReporter.setEnableInstantReporting(true);
// 开启java异常捕获
crashReporter.setJavaCrashHandlerStatus(true);
try {
// 开启收集服务
StatService.startStatService(context, Config.MTA_APPKEY, com.tencent.stat.common.StatConstants.VERSION);
} catch (MtaSDkException e) {
e.printStackTrace();
}
StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
// 开启异常时的实时上报
crashReporter.setEnableInstantReporting(true);
// 开启java异常捕获
crashReporter.setJavaCrashHandlerStatus(true);
} else {
// 打开debug开关可查看mta上报日志或错误
// debug true release false
StatConfig.setDebugEnable(true);
}
}
public static void onEvent(Context var0, String var1, String var2) {
@ -108,18 +117,18 @@ public class DataUtils {
Map<String, Object> kv = new HashMap<>();
kv.put("版本", platform);
kv.put("状态", status);
DataUtils.onEvent(context, "游戏下载", gameName, kv);
onEvent(context, "游戏下载", gameName, kv);
Map<String, Object> kv2 = new HashMap<>();
kv2.put("版本", platform);
kv2.put("状态", status);
kv2.put("位置", entrance);
DataUtils.onEvent(context, "游戏下载位置", gameName, kv2);
onEvent(context, "游戏下载位置", gameName, kv2);
Map<String, Object> kv3 = new HashMap<>();
kv3.put(entrance, "下载数");
kv3.put(entrance, status);
DataUtils.onEvent(context, "应用数据", gameName, kv3);
onEvent(context, "应用数据", gameName, kv3);
}
// 游戏更新
@ -127,7 +136,7 @@ public class DataUtils {
Map<String, Object> kv = new HashMap<>();
kv.put("版本", paltform);
kv.put("状态", status);
DataUtils.onEvent(context, "游戏更新", gameName, kv);
onEvent(context, "游戏更新", gameName, kv);
}
}

View File

@ -3,6 +3,7 @@ package com.gh.common.util;
import android.content.Context;
import android.graphics.Color;
import android.os.Message;
import android.support.v4.content.ContextCompat;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
@ -239,7 +240,7 @@ public class DownloadItemUtils {
if (isNormal) {
holder.gameDownloadBtn.setText("下载中");
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
holder.gameDownloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
holder.gameDownloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
}
} else if (status.equals(DownloadStatus.waiting)) {
holder.gameProgressbar.setProgress((int) (downloadEntity.getPercent() * 10));
@ -253,7 +254,7 @@ public class DownloadItemUtils {
if (isNormal) {
holder.gameDownloadBtn.setText("下载中");
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
holder.gameDownloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
holder.gameDownloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
}
} else if (status.equals(DownloadStatus.pause)
|| status.equals(DownloadStatus.timeout)
@ -269,7 +270,7 @@ public class DownloadItemUtils {
if (isNormal) {
holder.gameDownloadBtn.setText("下载中");
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
holder.gameDownloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
holder.gameDownloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
}
} else if (status.equals(DownloadStatus.done)) {
holder.gameProgressbar.setProgress(1000);
@ -388,7 +389,7 @@ public class DownloadItemUtils {
downloadBtn.setText("下载中");
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
downloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
} else {
@ -397,10 +398,7 @@ public class DownloadItemUtils {
}
//插件化
private static void plugin(Context context,
GameEntity gameEntity,
TextView downloadBtn,
String entrance,
private static void plugin(Context context, GameEntity gameEntity, TextView downloadBtn, String entrance,
String location) {
String msg = FileUtils.isCanDownload(context, gameEntity.getApk().get(0).getSize());
if (TextUtils.isEmpty(msg)) {
@ -411,7 +409,7 @@ public class DownloadItemUtils {
downloadBtn.setText("下载中");
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
downloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
} else {
@ -420,9 +418,7 @@ public class DownloadItemUtils {
}
//安装
private static void install(final Context context,
GameEntity gameEntity,
int position,
private static void install(final Context context, GameEntity gameEntity, int position,
RecyclerView.Adapter<? extends RecyclerView.ViewHolder> adapter) {
DownloadEntity downloadEntity = DownloadManager.getInstance(context).get(gameEntity.getApk().get(0).getUrl());
if (downloadEntity != null) {
@ -441,10 +437,7 @@ public class DownloadItemUtils {
}
//更新
private static void update(Context context,
GameEntity gameEntity,
String entrance,
String location) {
private static void update(Context context, GameEntity gameEntity, String entrance, String location) {
DataUtils.onGameUpdateEvent(context, gameEntity.getName(), gameEntity.getApk().get(0).getPlatform(), "下载开始");
DownloadManager.createDownload(context, gameEntity, "更新", entrance, location);
}

View File

@ -1,6 +1,5 @@
package com.gh.common.util;
import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
@ -215,7 +214,7 @@ public class LibaoUtils {
});
}
public static void initLibaoBtn(final Activity activity, final TextView libaoBtn, final LibaoEntity libaoEntity, final LibaoDao libaoDao,
public static void initLibaoBtn(final Context context, final TextView libaoBtn, final LibaoEntity libaoEntity, final LibaoDao libaoDao,
final boolean isInstallRequired, final LibaoDetailAdapter adapter, final String entrance) {
libaoBtn.setTextColor(Color.WHITE);
@ -257,8 +256,7 @@ public class LibaoUtils {
int[][] states2 = new int[2][];
states2[0] = new int[]{android.R.attr.state_pressed};
states2[1] = new int[]{};
int[] colors2 = new int[]{Color.WHITE,
Color.parseColor("#ffb13c")};
int[] colors2 = new int[]{Color.WHITE, Color.parseColor("#ffb13c")};
ColorStateList sl2 = new ColorStateList(states2, colors2);
libaoBtn.setText("已淘号");
libaoBtn.setBackgroundResource(R.drawable.libao_taoed_style);
@ -278,16 +276,16 @@ public class LibaoUtils {
public void onClick(View v) {
// 领取限制
if ("领取".equals(libaoBtn.getText().toString()) || "淘号".equals(libaoBtn.getText().toString())) {
if (isInstallRequired && !isAppInstalled(libaoBtn.getContext(), libaoEntity.getPackageName())) {
if (isInstallRequired && !isAppInstalled(context, libaoEntity.getPackageName())) {
String platform;
if (TextUtils.isEmpty(libaoEntity.getPlatform())) {
platform = "";
} else {
platform = PlatformUtils.getInstance(libaoBtn.getContext())
platform = PlatformUtils.getInstance(context)
.getPlatformName(libaoEntity.getPlatform()) + "";
}
DialogUtils.showWarningDialog(libaoBtn.getContext(), "条件不符",
DialogUtils.showWarningDialog(context, "条件不符",
Html.fromHtml("请先" + "<font color=\"#06D0A8\">"
+ "安装《" + libaoEntity.getGame().getName() + ""
+ platform + "</font>"), "关闭", "立即安装"
@ -303,17 +301,17 @@ public class LibaoUtils {
switch (libaoBtn.getText().toString()) {
case "未开始":
Utils.toast(libaoBtn.getContext(), "还没到开始领取时间");
Utils.toast(context, "还没到开始领取时间");
break;
case "查看":
Intent intent = LibaoDetailActivity.getLibaoDetailIntent(libaoEntity, libaoBtn, entrance);
libaoBtn.getContext().startActivity(intent);
Intent intent = LibaoDetailActivity.getIntent(context, libaoEntity, entrance);
context.startActivity(intent);
break;
case "领取":
libaoLing(activity, libaoBtn, libaoEntity, adapter, isInstallRequired, libaoDao, null, entrance);
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, libaoDao, null, entrance);
break;
case "淘号":
postLibaoTao(libaoBtn.getContext(), libaoEntity.getId(), true, new PostLibaoListener() {
postLibaoTao(context, libaoEntity.getId(), true, new PostLibaoListener() {
@Override
public void postSucced(Object response) {
@ -330,11 +328,11 @@ public class LibaoUtils {
try {
String detail = responseBody.getString("detail");
if ("maintaining".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "网络状态异常,请稍后再试");
Utils.toast(context, "网络状态异常,请稍后再试");
} else if ("fail to compete".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "淘号失败,稍后重试");
Utils.toast(context, "淘号失败,稍后重试");
} else {
Utils.toast(libaoBtn.getContext(), "淘号异常");
Utils.toast(context, "淘号异常");
}
} catch (JSONException e) {
e.printStackTrace();
@ -342,13 +340,13 @@ public class LibaoUtils {
return;
}
Utils.toast(libaoBtn.getContext(), "淘号成功");
Utils.toast(context, "淘号成功");
libaoEntity.setStatus("taoed");
LibaoInfo libaoInfo = LibaoInfo.createLibaoInfo(libaoEntity);
libaoInfo.setCode(libaoCode);
libaoInfo.setTime(Utils.getTime(libaoBtn.getContext()));
libaoInfo.setTime(Utils.getTime(context));
libaoDao.add(libaoInfo);
EventBus.getDefault().post(new EBReuse("libaoChanged"));
@ -357,20 +355,20 @@ public class LibaoUtils {
adapter.notifyDataSetChanged();
final String finalLibaoCode = libaoCode;
DialogUtils.showWarningDialog(libaoBtn.getContext(), "淘号成功", Html.fromHtml("礼包码:"
DialogUtils.showWarningDialog(context, "淘号成功", Html.fromHtml("礼包码:"
+ "<font color=\"#ffb13c\">" + libaoCode + "</font>" +
"<br/>淘号礼包不保证可用,请尽快进入游戏尝试兑换")
, "关闭", " 复制礼包码"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
copyLink(finalLibaoCode, libaoBtn.getContext());
copyLink(finalLibaoCode, context);
if (isInstallRequired) {
libaoBtn.postDelayed(new Runnable() {
@Override
public void run() {
lunningAppDialog(libaoBtn.getContext()
lunningAppDialog(context
, Html.fromHtml("礼包码:"
+ "<font color=\"#ffb13c\">" + finalLibaoCode + "</font>"
+ " 复制成功"
@ -392,14 +390,14 @@ public class LibaoUtils {
try {
JSONObject errorJson = new JSONObject(exception.response().errorBody().string());
String detail = errorJson.getString("detail");
Utils.toast(libaoBtn.getContext(), "返回::" + detail);
Utils.toast(context, "返回::" + detail);
if ("coming".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "礼包领取时间未开始");
Utils.toast(context, "礼包领取时间未开始");
} else if ("finish".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "礼包领取时间已结束");
Utils.toast(context, "礼包领取时间已结束");
} else if ("fetched".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "你已领过这个礼包了");
getCunHaoXiang(libaoBtn.getContext(), true);
Utils.toast(context, "你已领过这个礼包了");
getCunHaoXiang(context, true);
int[][] states2 = new int[2][];
states2[0] = new int[]{android.R.attr.state_pressed};
@ -412,23 +410,23 @@ public class LibaoUtils {
libaoBtn.setTextColor(sl2);
libaoEntity.setStatus("taoed");
} else if ("try tao".equals(detail) || "used up".equals(detail)) {
DialogUtils.showHintDialog(libaoBtn.getContext(), "礼包已领光"
DialogUtils.showHintDialog(context, "礼包已领光"
, "手速不够快,礼包已经被抢光了,十分抱歉", "知道了");
} else if ("maintaining".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "网络状态异常,请稍后再试");
Utils.toast(context, "网络状态异常,请稍后再试");
} else if ("fail to compete".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "淘号失败,稍后重试");
Utils.toast(context, "淘号失败,稍后重试");
} else {
Utils.toast(libaoBtn.getContext(), "操作失败");
Utils.toast(context, "操作失败");
}
} catch (Exception ex) {
ex.printStackTrace();
Utils.toast(libaoBtn.getContext(), "礼包处理异常" + ex.toString());
Utils.toast(context, "礼包处理异常" + ex.toString());
}
return;
}
}
Utils.toast(libaoBtn.getContext(), "发生异常");
Utils.toast(context, "发生异常");
}
});
break;
@ -437,10 +435,14 @@ public class LibaoUtils {
});
}
private static void libaoLing(final Activity activity, final TextView libaoBtn, final LibaoEntity libaoEntity, final LibaoDetailAdapter adapter,
private static void libaoLing(final Context context, final TextView libaoBtn, final LibaoEntity libaoEntity, final LibaoDetailAdapter adapter,
final boolean isInstallRequired, final LibaoDao libaoDao, String captchaCode, final String entrance) {
postLibaoLing(libaoBtn.getContext(), libaoEntity.getId(), true, new PostLibaoListener() {
if (BuildConfig.DEBUG) {
Log.e("LIBAO", "context? " + context + libaoBtn.getContext());
}
postLibaoLing(context, libaoEntity.getId(), true, new PostLibaoListener() {
@Override
public void postSucced(Object response) {
@ -454,7 +456,7 @@ public class LibaoUtils {
}
if (TextUtils.isEmpty(libaoCode)) {
Utils.toast(libaoBtn.getContext(), "领取异常");
Utils.toast(context, "领取异常");
return;
}
libaoEntity.setAvailable(libaoEntity.getAvailable() - 1);
@ -462,7 +464,7 @@ public class LibaoUtils {
libaoEntity.setStatus("linged");
LibaoInfo libaoInfo = LibaoInfo.createLibaoInfo(libaoEntity);
libaoInfo.setTime(Utils.getTime(libaoBtn.getContext()));
libaoInfo.setTime(Utils.getTime(context));
libaoInfo.setCode(libaoCode);
libaoDao.add(libaoInfo);
@ -472,19 +474,19 @@ public class LibaoUtils {
adapter.notifyDataSetChanged();
final String finalLibaoCode = libaoCode;
DialogUtils.showWarningDialog(libaoBtn.getContext(), "领取成功", Html.fromHtml("礼包码:"
DialogUtils.showWarningDialog(context, "领取成功", Html.fromHtml("礼包码:"
+ "<font color=\"#00B7FA\">" + libaoCode + "</font>" +
"<br/>请尽快使用礼包码将于60分钟后进入淘号池")
, "关闭", " 复制礼包码"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
copyLink(finalLibaoCode, libaoBtn.getContext());
copyLink(finalLibaoCode, context);
if (isInstallRequired) {
libaoBtn.postDelayed(new Runnable() {
@Override
public void run() {
lunningAppDialog(libaoBtn.getContext()
lunningAppDialog(context
, Html.fromHtml("礼包码:"
+ "<font color=\"#00B7FA\">" + finalLibaoCode + "</font>"
+ " 复制成功" + "<br/>请尽快进入游戏兑换"), libaoEntity);
@ -508,11 +510,11 @@ public class LibaoUtils {
String detail = errorJson.getString("detail");
if ("coming".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "礼包领取时间未开始");
Utils.toast(context, "礼包领取时间未开始");
} else if ("finish".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "礼包领取时间已结束");
Utils.toast(context, "礼包领取时间已结束");
} else if ("fetched".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "你已领过这个礼包了");
Utils.toast(context, "你已领过这个礼包了");
int countdown = 0;
if (errorJson.toString().contains("countdown")) {
countdown = errorJson.getInt("countdown");
@ -520,7 +522,7 @@ public class LibaoUtils {
if (countdown > 0 && countdown < 60 * 10) {
EventBus.getDefault().post(new EBUISwitch(REFRESH_LIBAO_TIME, countdown));
} else {
getCunHaoXiang(libaoBtn.getContext(), true);
getCunHaoXiang(context, true);
}
int[][] states = new int[2][];
@ -535,38 +537,33 @@ public class LibaoUtils {
libaoEntity.setStatus("linged");
} else if ("try tao".equals(detail) || "used up".equals(detail)) {
DialogUtils.showHintDialog(libaoBtn.getContext(), "礼包已领光"
DialogUtils.showHintDialog(context, "礼包已领光"
, "手速不够快,礼包已经被抢光了,十分抱歉", "知道了");
libaoEntity.setStatus("used_up");
initLibaoBtn(activity, libaoBtn, libaoEntity, libaoDao, isInstallRequired, adapter, entrance);
initLibaoBtn(context, libaoBtn, libaoEntity, libaoDao, isInstallRequired, adapter, entrance);
} else if ("maintaining".equals(detail)) {
Utils.toast(libaoBtn.getContext(), "网络状态异常,请稍后再试");
Utils.toast(context, "网络状态异常,请稍后再试");
} else {
Utils.toast(libaoBtn.getContext(), "操作失败");
Utils.toast(context, "操作失败");
}
} catch (Exception ex) {
ex.printStackTrace();
Utils.toast(libaoBtn.getContext(), "礼包处理异常");
Utils.toast(context, "礼包处理异常");
}
return;
} else if (exception.code() == 412) {
// 需要验证
if (BuildConfig.DEBUG) {
Log.e("LIBAO", "context? " + libaoBtn.getContext() + activity);
}
GeetestUtils.getInstance().showDialog(activity, new GeetestListener() {
GeetestUtils.getInstance().showDialog(context, new GeetestListener() {
@Override
public void onVerified(String captcha) {
libaoLing(activity, libaoBtn, libaoEntity, adapter, isInstallRequired, libaoDao, captcha, entrance);
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, libaoDao, captcha, entrance);
}
});
return;
}
}
Utils.toast(libaoBtn.getContext(), "发生异常");
Utils.toast(context, "发生异常");
}
}, captchaCode);
}
@ -612,8 +609,8 @@ public class LibaoUtils {
// 合并List<LibaoStatusEntity> 和 List<LibaoEntity> 并检查重复领取的礼包
public static void initLiBaoEntity(LibaoDao libaoDao, List<LibaoStatusEntity> statusList
, List<LibaoEntity> mLibaoList, Context mContext) {
public static void initLiBaoEntity(LibaoDao libaoDao, List<LibaoStatusEntity> statusList,
List<LibaoEntity> libaoEntities, Context mContext) {
for (LibaoInfo libaoInfo : libaoDao.getAll()) {
for (LibaoStatusEntity libaoStatusEntity : statusList) {
@ -635,7 +632,7 @@ public class LibaoUtils {
}
}
for (LibaoEntity libaoEntity : mLibaoList) {
for (LibaoEntity libaoEntity : libaoEntities) {
for (LibaoStatusEntity libaoStatusEntity : statusList) {
if (libaoEntity.getId().equals(libaoStatusEntity.getId())) {
libaoEntity.setAvailable(libaoStatusEntity.getAvailable());

View File

@ -91,12 +91,10 @@ public class PackageUtils {
private static String[] parseSignature(byte[] signature) {
String[] ret = null;
try {
CertificateFactory certFactory = CertificateFactory
.getInstance("X.509");
X509Certificate cert = (X509Certificate) certFactory
.generateCertificate(new ByteArrayInputStream(signature));
ret = new String[]{cert.getPublicKey().toString(),
cert.getSerialNumber().toString()};
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate) certFactory.generateCertificate(
new ByteArrayInputStream(signature));
ret = new String[]{cert.getPublicKey().toString(), cert.getSerialNumber().toString()};
} catch (CertificateException e) {
e.printStackTrace();
}
@ -159,8 +157,8 @@ public class PackageUtils {
*/
public static Intent getUninstallIntent(Context context, String path) {
Intent uninstallIntent = new Intent();
uninstallIntent.setAction("android.intent.action.DELETE");
uninstallIntent.addCategory("android.intent.category.DEFAULT");
uninstallIntent.setAction(Intent.ACTION_DELETE);
uninstallIntent.addCategory(Intent.CATEGORY_DEFAULT);
String packageName = getPackageNameByPath(context, path);
uninstallIntent.setData(Uri.parse("package:" + packageName));
InstallUtils.getInstance(context).addUninstall(packageName);
@ -172,8 +170,7 @@ public class PackageUtils {
*/
public static String getPackageNameByPath(Context context, String path) {
PackageManager packageManager = context.getApplicationContext().getPackageManager();
PackageInfo info = packageManager.getPackageArchiveInfo(path,
PackageManager.GET_ACTIVITIES);
PackageInfo info = packageManager.getPackageArchiveInfo(path, PackageManager.GET_ACTIVITIES);
if (info != null) {
ApplicationInfo appInfo = info.applicationInfo;
return appInfo.packageName;

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
@ -47,25 +48,25 @@ public class CardRelativeLayout extends RelativeLayout {
}
if (isTran) {
mLeftDrawable = getResources().getDrawable(R.drawable.frame_tran_left);
topDrawable = getResources().getDrawable(R.drawable.frame_tran_top);
mRightDrawable = getResources().getDrawable(R.drawable.frame_tran_right);
bottomDrawable = getResources().getDrawable(R.drawable.frame_tran_bottom);
mLeftDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_left);
topDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_top);
mRightDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_right);
bottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_bottom);
leftTopDrawable = getResources().getDrawable(R.drawable.frame_tran_left_top_square);
rightTopDrawable = getResources().getDrawable(R.drawable.frame_tran_right_top_square);
leftBottomDrawable = getResources().getDrawable(R.drawable.frame_tran_left_bottom_square);
rightBottomDrawable = getResources().getDrawable(R.drawable.frame_tran_right_bottom_square);
leftTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_left_top_square);
rightTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_right_top_square);
leftBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_left_bottom_square);
rightBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_tran_right_bottom_square);
} else {
mLeftDrawable = getResources().getDrawable(R.drawable.frame_left);
topDrawable = getResources().getDrawable(R.drawable.frame_top);
mRightDrawable = getResources().getDrawable(R.drawable.frame_right);
bottomDrawable = getResources().getDrawable(R.drawable.frame_bottom);
mLeftDrawable = ContextCompat.getDrawable(context, R.drawable.frame_left);
topDrawable = ContextCompat.getDrawable(context, R.drawable.frame_top);
mRightDrawable = ContextCompat.getDrawable(context, R.drawable.frame_right);
bottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_bottom);
leftTopDrawable = getResources().getDrawable(R.drawable.frame_left_top_square);
rightTopDrawable = getResources().getDrawable(R.drawable.frame_right_top_square);
leftBottomDrawable = getResources().getDrawable(R.drawable.frame_left_bottom_square);
rightBottomDrawable = getResources().getDrawable(R.drawable.frame_right_bottom_square);
leftTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_left_top_square);
rightTopDrawable = ContextCompat.getDrawable(context, R.drawable.frame_right_top_square);
leftBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_left_bottom_square);
rightBottomDrawable = ContextCompat.getDrawable(context, R.drawable.frame_right_bottom_square);
}
}

View File

@ -32,7 +32,7 @@ import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.listener.OnCollectionCallBackListener;
import com.gh.gamecenter.adapter.OnCollectionCallBackListener;
import com.gh.gamecenter.manager.PackageManager;
import org.greenrobot.eventbus.EventBus;

View File

@ -1,40 +0,0 @@
package com.gh.common.view;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* Created by khy on 2017/2/24.
* 控制是否可以左右滑动
*/
public class NoScrollableViewPager extends ViewPager {
private boolean isScrollable;
public NoScrollableViewPager(Context context) {
super(context);
isScrollable = true;
}
public NoScrollableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
isScrollable = true;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return isScrollable && super.onInterceptTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return isScrollable && super.onTouchEvent(ev);
}
public void setScrollable(boolean scrollable) {
isScrollable = scrollable;
}
}

View File

@ -0,0 +1,49 @@
package com.gh.common.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import com.gh.gamecenter.R;
import cn.trinea.android.view.autoscrollviewpager.AutoScrollViewPager;
/**
* @author CsHeng
* @Date 17/06/2017
* @Time 12:24 PM
*/
public class ScaleAutoScrollViewPager extends AutoScrollViewPager {
private boolean mMeasureByHeight = false; // default width
private float mScale = 1f;// default square
public ScaleAutoScrollViewPager(Context context) {
super(context);
}
public ScaleAutoScrollViewPager(Context context, AttributeSet set) {
super(context, set);
TypedArray a = context.obtainStyledAttributes(set, R.styleable.ScaleView);
int enumV = a.getInt(R.styleable.ScaleView_measureBy, 0);
mScale = a.getFloat(R.styleable.ScaleView_fractionValue, mScale);
if (enumV != 0) {
mMeasureByHeight = true;
}
a.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
if (mMeasureByHeight) {
setMeasuredDimension((int) (height * mScale), height);
} else {
setMeasuredDimension(width, (int) (width * mScale));
}
}
}

View File

@ -0,0 +1,63 @@
package com.gh.common.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.gamecenter.R;
/**
* @author CsHeng
* @Date 17/06/2017
* @Time 2:46 PM
*/
public class ScaleSimpleDraweeView extends SimpleDraweeView {
private boolean mMeasureByHeight = false; // default width
private float mFraction = 1f;// default square
public ScaleSimpleDraweeView(Context context) {
super(context);
}
public ScaleSimpleDraweeView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public ScaleSimpleDraweeView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
public ScaleSimpleDraweeView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(context, attrs);
}
public void init(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScaleView);
int enumV = a.getInt(R.styleable.ScaleView_measureBy, 0);
mFraction = a.getFloat(R.styleable.ScaleView_fractionValue, mFraction);
if (enumV != 0) {
mMeasureByHeight = true;
}
a.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
if (mMeasureByHeight) {
setMeasuredDimension((int) (height * mFraction), height);
} else {
setMeasuredDimension(width, (int) (width * mFraction));
}
}
}

View File

@ -8,7 +8,7 @@ public abstract class DataWatcher implements Observer {
@Override
public void update(Observable observable, Object data) {
if (data != null && data instanceof DownloadEntity) {
if (data instanceof DownloadEntity) {
onDataChanged((DownloadEntity) data);
}
}

View File

@ -38,7 +38,7 @@ public class AboutActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_about));
initTitle(getString(R.string.title_about));
((TextView) findViewById(R.id.about_tv_version)).setText("V" + PackageUtils.getVersionName(this));

View File

@ -147,7 +147,7 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_choose_activity));
initTitle(getString(R.string.title_choose_activity));
mTitleTv.setTextColor(Color.WHITE);
mBackIv.setImageResource(R.drawable.reuse_kc_back);

View File

@ -68,11 +68,11 @@ public class CleanApkActivity extends BaseActivity implements CleanApkAdapter.On
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_clean_apk));
initTitle(getString(R.string.title_clean_apk));
mNodataSkipLl.setVisibility(View.GONE);
mAdapter = new CleanApkAdapter(this, mApkDeleteBtn, mApkSelectAll);
mAdapter = new CleanApkAdapter(this, this, mApkDeleteBtn, mApkSelectAll);
mApkRv.setLayoutManager(new LinearLayoutManager(this));
mApkRv.addItemDecoration(new VerticalItemDecoration(this, 8, true));
mApkRv.setAdapter(mAdapter);

View File

@ -37,7 +37,7 @@ public class CommentDetailActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_comment_detail));
initTitle(getString(R.string.title_comment_detail));
String commentId = getIntent().getExtras().getString("commentId");

View File

@ -52,7 +52,7 @@ public class ConcernActivity extends BaseActivity implements OnClickListener {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_concern));
initTitle(getString(R.string.title_concern));
concernManager = new ConcernManager(getApplicationContext());

View File

@ -73,7 +73,7 @@ public class CropImageActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_crop_image));
initTitle(getString(R.string.title_crop_image));
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);

View File

@ -17,9 +17,9 @@ import com.gh.base.BaseActivity;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.adapter.FragmentAdapter;
import com.gh.base.adapter.FragmentAdapter;
import com.gh.gamecenter.download.FileSendFragment;
import com.gh.gamecenter.download.GameDownLoadFragment;
import com.gh.gamecenter.download.GameDownloadFragment;
import com.gh.gamecenter.download.GameUpdateFragment;
import com.gh.gamecenter.eventbus.EBDownloadChanged;
import com.gh.gamecenter.eventbus.EBMiPush;
@ -108,7 +108,7 @@ public class DownloadManagerActivity extends BaseActivity implements OnClickList
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_downloadmanager));
initTitle(getString(R.string.title_downloadmanager));
downloadmanager_ll_download.setOnClickListener(this);
downloadmanager_ll_update.setOnClickListener(this);
@ -149,7 +149,7 @@ public class DownloadManagerActivity extends BaseActivity implements OnClickList
downloadmanager_slide_line.setLayoutParams(lparams);
List<Fragment> list = new ArrayList<>();
list.add(new GameDownLoadFragment());
list.add(new GameDownloadFragment());
list.add(new GameUpdateFragment());
list.add(new FileSendFragment());
downloadmanager_viewPager.setAdapter(new FragmentAdapter(getSupportFragmentManager(), list));

View File

@ -252,7 +252,7 @@ public class FileReceiverActivity extends BaseActivity implements OnReceiverCanc
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_file_receive));
initTitle(getString(R.string.title_file_receive));
isDestroy = false;

View File

@ -161,7 +161,7 @@ public class FileSenderActivity extends BaseActivity implements FileSenderAdapte
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_file_sender));
initTitle(getString(R.string.title_file_sender));
mFileInfos = (List<FileInfo>) AppController.get("FileInfo", false);

View File

@ -7,6 +7,7 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.view.MotionEvent;
@ -20,6 +21,7 @@ import android.widget.Toast;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.AppController;
import com.gh.base.BaseActivity;
import com.gh.base.adapter.FragmentAdapter;
import com.gh.common.constant.Config;
import com.gh.common.util.ApkActiveUtils;
import com.gh.common.util.ConcernUtils;
@ -35,11 +37,10 @@ import com.gh.common.util.PackageUtils;
import com.gh.common.util.ShareUtils;
import com.gh.common.util.Utils;
import com.gh.common.view.DownloadDialog;
import com.gh.common.view.NoScrollableViewPager;
import com.lightgame.view.NoScrollableViewPager;
import com.gh.download.DataWatcher;
import com.gh.download.DownloadEntity;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.adapter.FragmentAdapter;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameDetailEntity;
import com.gh.gamecenter.entity.GameEntity;
@ -186,7 +187,7 @@ public class GameDetailActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init("");
initTitle("");
mViewPager.setScrollable(true);
@ -612,9 +613,9 @@ public class GameDetailActivity extends BaseActivity {
mDownloadPer.setText("安装");
if (mDownloadEntity.isPluggable()
&& PackageManager.isInstalled(mDownloadEntity.getPackageName())) {
mDownloadPb.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_plugin_radius_style));
mDownloadPb.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progressbar_plugin_radius_style));
} else {
mDownloadPb.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_normal_radius_style));
mDownloadPb.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progressbar_normal_radius_style));
}
break;
case cancel:

View File

@ -85,7 +85,7 @@ public class GameNewsActivity extends BaseActivity implements View.OnClickListen
ivSearch.setVisibility(View.GONE);
String gameName = getIntent().getStringExtra("gameName");
init(gameName);
initTitle(gameName);
mNoDataTv.setText("暂无内容");

View File

@ -109,7 +109,7 @@ public class KaiFuActivity extends BaseActivity implements KaiFuDialogAdapter.On
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_kaifu));
initTitle(getString(R.string.title_kaifu));
kaifuType = "全部";

View File

@ -69,7 +69,7 @@ public class KcSelectGameActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_select_game));
initTitle(getString(R.string.title_select_game));
if (getIntent() != null && getIntent().getExtras() != null) {
mIsConn = getIntent().getExtras().getBoolean("isConn");

View File

@ -11,8 +11,8 @@ import android.widget.TextView;
import com.gh.base.BaseActivity;
import com.gh.common.util.DisplayUtils;
import com.gh.common.view.NoScrollableViewPager;
import com.gh.gamecenter.adapter.FragmentAdapter;
import com.lightgame.view.NoScrollableViewPager;
import com.gh.base.adapter.FragmentAdapter;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.libao.Libao1Fragment;
@ -64,7 +64,7 @@ public class LibaoActivity extends BaseActivity implements View.OnClickListener,
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init("礼包中心");
initTitle("礼包中心");
mZuixinTv.setSelected(true);

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
@ -8,9 +9,7 @@ import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.gh.base.AppController;
import com.gh.base.BaseDetailActivity;
import com.gh.common.util.ApkActiveUtils;
import com.gh.common.util.EntranceUtils;
@ -76,17 +75,17 @@ public class LibaoDetailActivity extends BaseDetailActivity implements LibaoDeta
};
@NonNull
public static Intent getLibaoDetailIntent(LibaoEntity libaoEntity, TextView libaoBtn, String entrance) {
AppController.put("libaoEntity", libaoEntity);
Intent intent = new Intent(libaoBtn.getContext(), LibaoDetailActivity.class);
public static Intent getIntent(Context context, LibaoEntity libaoEntity, String entrance) {
Intent intent = new Intent(context, LibaoDetailActivity.class);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
intent.putExtra(LibaoDetailActivity.class.getSimpleName(), libaoEntity);
return intent;
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
AppController.put("libaoEntity", mAdapter.getLibaoEntity());
outState.putParcelable(LibaoDetailActivity.class.getSimpleName(), mAdapter.getLibaoEntity());
}
@Override
@ -94,15 +93,18 @@ public class LibaoDetailActivity extends BaseDetailActivity implements LibaoDeta
super.onCreate(savedInstanceState);
actionbar_tv_title.setText("礼包详情");
mLibaoEntity = (LibaoEntity) AppController.get("libaoEntity", true);
if (savedInstanceState != null) {
mLibaoEntity = savedInstanceState.getParcelable(LibaoDetailActivity.class.getSimpleName());
} else {
mLibaoEntity = getIntent().getParcelableExtra(LibaoDetailActivity.class.getSimpleName());
}
name = "礼包详情";
iv_share.setVisibility(View.GONE);
mIsScroll = true;
mAdapter = new LibaoDetailAdapter(this, this, this,
mLibaoEntity, detail_tv_download, mEntrance);
mAdapter = new LibaoDetailAdapter(this, this, this, mLibaoEntity, detail_tv_download, mEntrance);
detail_rv_show.setLayoutManager(new LinearLayoutManager(this) {
@Override
public boolean canScrollVertically() {

View File

@ -5,29 +5,20 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.util.ArrayMap;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckedTextView;
import android.widget.ImageView;
import com.gh.base.AppController;
import com.gh.base.BaseActivity;
import com.gh.base.SearchBarHint;
import com.gh.common.constant.Config;
import com.gh.common.util.ClassUtils;
import com.gh.common.util.DataCollectionUtils;
@ -47,37 +38,27 @@ import com.gh.download.DataWatcher;
import com.gh.download.DownloadEntity;
import com.gh.download.DownloadManager;
import com.gh.download.DownloadStatus;
import com.gh.gamecenter.db.KeFuMarkReadDao;
import com.gh.gamecenter.db.MessageMarkReadDao;
import com.gh.gamecenter.db.info.ConcernInfo;
import com.gh.gamecenter.db.info.GameInfo;
import com.gh.gamecenter.db.info.MessageMarkReadInfo;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameDigestEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.entity.MessageUnreadEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBShowDialog;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.game.GameFragment;
import com.gh.gamecenter.fragment.MainFragment;
import com.gh.gamecenter.manager.ConcernManager;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.FilterManager;
import com.gh.gamecenter.manager.GameManager;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.UpdateManager;
import com.gh.gamecenter.message.MessageFragment;
import com.gh.gamecenter.news.NewsFragment;
import com.gh.gamecenter.personal.PersonalFragment;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.ObservableUtil;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -95,7 +76,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import butterknife.BindView;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
@ -109,40 +89,13 @@ import rx.schedulers.Schedulers;
/**
* 项目的主Activity3个Fragment都嵌入在这里。
*/
public class MainActivity extends BaseActivity implements OnClickListener {
public class MainActivity extends BaseActivity {
public static final int INDEX_GAME = 0;
public static final int INDEX_NEWS = 1;
public static final int INDEX_MESSAGE = 2;
public static final int INDEX_PERSONAL = 3;
public final static String EB_MAINACTIVITY_TAG = "MainActivity";
public final static String EB_SKIP_GAMEFRAGMENT = "GameFragment";
@BindView(R.id.main_iv_game)
ImageView ivGame;
@BindView(R.id.main_iv_news)
ImageView ivNews;
@BindView(R.id.main_iv_message)
ImageView ivMessage;
@BindView(R.id.main_iv_personal)
ImageView ivPersonal;
@BindView(R.id.main_tv_game)
CheckedTextView tvGame;
@BindView(R.id.main_tv_news)
CheckedTextView tvNews;
@BindView(R.id.main_tv_message)
CheckedTextView tvMessage;
@BindView(R.id.main_tv_personal)
CheckedTextView tvPersonal;
@BindView(R.id.main_iv_message_hint)
View mMessageHint;
private NewsFragment newsFragment;
private MessageFragment messageFragment;
private PersonalFragment personalFragment;
private GameFragment gameFragment;
private SharedPreferences sp;
private ConcernManager concernManager;
private ArrayList<String> mSearchHintLint;
private int currentTab;
private boolean isSkipped;
Runnable skipRun = new Runnable() {
@Override
@ -374,13 +327,12 @@ public class MainActivity extends BaseActivity implements OnClickListener {
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt("currentTab", currentTab);
outState.putBoolean("isSkipped", isSkipped);
}
@Override
protected int getLayoutId() {
return R.layout.activity_main;
return R.layout.layout_wrapper_activity;
}
@Override
@ -681,19 +633,18 @@ public class MainActivity extends BaseActivity implements OnClickListener {
isSkipped = false;
initViews();
// initViews();
if (savedInstanceState != null) {
currentTab = savedInstanceState.getInt("currentTab");
// currentTab = savedInstanceState.getInt("currentTab");
isSkipped = savedInstanceState.getBoolean("isSkipped");
} else {
currentTab = 0;
// } else {
// currentTab = 0;
}
setTabSelection(currentTab);
replaceFragment(new MainFragment());
concernManager = new ConcernManager(getApplicationContext());
getSearchHints();
if (!isNewFirstLaunch && sp.getBoolean("autoupdate", true)) {
// 检查助手更新
UpdateManager.getInstance(this).checkUpdate(true, null);
@ -745,9 +696,6 @@ public class MainActivity extends BaseActivity implements OnClickListener {
getSuggestionType();
checkMarkRead(); // 检查是否有记录已读消息
checkMessageUnread(true); // 检查是否有未读消息
}
@Override
@ -762,123 +710,6 @@ public class MainActivity extends BaseActivity implements OnClickListener {
handler.removeCallbacksAndMessages(null);
}
private void checkMessageUnread(boolean isCheck) {
TokenUtils.getToken(this, isCheck)
.flatMap(new Func1<String, Observable<MessageUnreadEntity>>() {
@Override
public Observable<MessageUnreadEntity> call(String token) {
return RetrofitManager.getMessage().getMessageUnread(token);
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<MessageUnreadEntity>() {
@Override
public void onResponse(MessageUnreadEntity response) {
super.onResponse(response);
if (response != null && response.getKefuList() != null && response.getKefuList().size() > 0) {
KeFuMarkReadDao dao = new KeFuMarkReadDao(MainActivity.this);
for (int i = 0; i < response.getKefuList().size(); i++) {
if (dao.isMarkRead(response.getKefuList().get(i))) {
response.getKefuList().remove(i);
i--;
}
}
if (response.getKefuList() != null && response.getKefuList().size() > 0) {
mMessageHint.setVisibility(View.VISIBLE);
}
}
if (response != null && response.getComment() > 0) {
mMessageHint.setVisibility(View.VISIBLE);
}
}
@Override
public void onFailure(HttpException e) {
if (e != null && e.code() == 401) {
checkMessageUnread(false);
}
}
});
}
private void checkMarkRead() {
MessageMarkReadDao readDao = new MessageMarkReadDao(MainActivity.this);
List<MessageMarkReadInfo> readInfos = readDao.getAll();
if (readInfos == null || readInfos.size() == 0) {
return;
}
MessageMarkReadInfo readInfo = readInfos.get(0);
HashMap<String, Boolean> kefuIds = readInfo.getKefuIds();
HashMap<String, Boolean> noticeIds = readInfo.getNoticeIds();
if (kefuIds != null && kefuIds.size() > 0) {
Utils.log("======提交已读客服消息");
JSONArray array = new JSONArray();
for (String s : kefuIds.keySet()) {
array.put(s);
}
Utils.log("======客服id::" + array.toString());
RequestBody body = RequestBody.create(MediaType.parse("application/json"), array.toString());
postMarkRead("kefu", true, body, readDao);
}
if (noticeIds != null && noticeIds.size() > 0) {
Utils.log("======提交已读公告消息");
JSONArray array = new JSONArray();
for (String s : noticeIds.keySet()) {
array.put(s);
}
Utils.log("======客服id::" + array.toString());
RequestBody body = RequestBody.create(MediaType.parse("application/json"), array.toString());
postMarkRead("notice", true, body, readDao);
}
}
private void postMarkRead(final String type, boolean isCkeck, final RequestBody body, final MessageMarkReadDao readDao) {
TokenUtils
.getToken(MainActivity.this, isCkeck)
.flatMap(new Func1<String, Observable<ResponseBody>>() {
@Override
public Observable<ResponseBody> call(String token) {
if ("kefu".equals(type)) {
return RetrofitManager.getMessage().postMarkKeFuRead(body, token);
} else {
return RetrofitManager.getMessage().postMarkNoticeRead(body, token);
}
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<ResponseBody>() {
@Override
public void onResponse(ResponseBody response) {
super.onResponse(response);
Utils.log("=========postMarkRead::" + type);
if ("kefu".equals(type)) {
readDao.cleanKeFu();
} else {
readDao.cleanNotice();
}
}
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
if (e != null && e.code() == 401) {
postMarkRead(type, false, body, readDao);
}
}
});
}
private void getSuggestionType() {
RetrofitManager
.getApi()
@ -996,7 +827,7 @@ public class MainActivity extends BaseActivity implements OnClickListener {
final ArrayList<GameEntity> concernDigest = new ArrayList<>();
if (arrGameId.size() == 0) {
EventBus.getDefault().post(new EBUISwitch("NewsFragment", -2)); // 没有关注
EventBus.getDefault().post(new EBUISwitch("NewsWrapperFragment", -2)); // 没有关注
}
List<Observable<GameEntity>> list = new ArrayList<>();
@ -1019,13 +850,6 @@ public class MainActivity extends BaseActivity implements OnClickListener {
});
}
private void initViews() {
findViewById(R.id.main_ll_game).setOnClickListener(this);
findViewById(R.id.main_ll_news).setOnClickListener(this);
findViewById(R.id.main_ll_message).setOnClickListener(this);
findViewById(R.id.main_ll_personal).setOnClickListener(this);
}
private void checkPermission() {
List<PackageInfo> installedList = getPackageManager().getInstalledPackages(0);
if (installedList.isEmpty()) {
@ -1049,32 +873,6 @@ public class MainActivity extends BaseActivity implements OnClickListener {
}
}
private void getSearchHints() {
RetrofitManager.getApi().getSearchHints()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<ArrayList<String>>() {
@Override
public void onResponse(ArrayList<String> response) {
if (response.size() != 0) {
// if (response.size() == 1) {
// mSearchHintLint = response.get(0);
// } else {
// mSearchHintLint = response.get(RandomUtils.nextInt(response.size()));
// }
mSearchHintLint = response;
if (gameFragment != null) {
gameFragment.setHint(mSearchHintLint);
}
if (newsFragment != null) {
newsFragment.setHint(mSearchHintLint);
}
}
}
});
}
// 获取META-INF中的plugin_update 文件判断是否从游戏插件中下载的app是则获取游戏id启动游戏更新下载该游戏
private void getPluginUpdate() {
ApplicationInfo appinfo = getApplicationInfo();
@ -1109,133 +907,6 @@ public class MainActivity extends BaseActivity implements OnClickListener {
}
}
@Override
public void onClick(View v) {
final int id = v.getId();
switch (v.getId()) {
case R.id.main_ll_game:
EventBus.getDefault().post(new EBUISwitch(EB_MAINACTIVITY_TAG, INDEX_GAME));
setTabSelection(INDEX_GAME);
break;
case R.id.main_ll_news:
EventBus.getDefault().post(new EBUISwitch(EB_MAINACTIVITY_TAG, INDEX_NEWS));
setTabSelection(INDEX_NEWS);
break;
case R.id.main_ll_message:
EventBus.getDefault().post(new EBUISwitch(EB_MAINACTIVITY_TAG, INDEX_MESSAGE));
setTabSelection(INDEX_MESSAGE);
break;
case R.id.main_ll_personal:
EventBus.getDefault().post(new EBUISwitch(EB_MAINACTIVITY_TAG, INDEX_PERSONAL));
setTabSelection(INDEX_PERSONAL);
break;
default:
break;
}
SystemBarTintManager tintManager = getTintManager();
if (tintManager != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (id == R.id.main_ll_personal) {
tintManager.setStatusBarTintResource(R.color.theme);
} else if (Build.MANUFACTURER.equals("Meizu") || Build.MANUFACTURER.equals("Xiaomi")) {
tintManager.setStatusBarTintColor(Color.WHITE);
} else {
tintManager.setStatusBarTintColor(Color.BLACK);
}
}
}
private void setTabSelection(int index) {
clearSelection();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
hideFragments(transaction);
switch (index) {
case INDEX_GAME:
ivGame.setImageResource(R.drawable.ic_game_select);
tvGame.setChecked(true);
gameFragment = alterFragment(transaction, GameFragment.class);
break;
case INDEX_NEWS:
ivNews.setImageResource(R.drawable.ic_news_select);
tvNews.setChecked(true);
newsFragment = alterFragment(transaction, NewsFragment.class);
break;
case INDEX_MESSAGE:
ivMessage.setImageResource(R.drawable.ic_message_select);
tvMessage.setChecked(true);
messageFragment = alterFragment(transaction, MessageFragment.class);
break;
case INDEX_PERSONAL:
ivPersonal.setImageResource(R.drawable.ic_user_select);
tvPersonal.setChecked(true);
personalFragment = alterFragment(transaction, PersonalFragment.class);
break;
default:
break;
}
currentTab = index;
transaction.commit();
}
// 清除掉所有的选中状态。
private void clearSelection() {
ivGame.setImageResource(R.drawable.ic_game_unselect);
ivNews.setImageResource(R.drawable.ic_news_unselect);
ivMessage.setImageResource(R.drawable.ic_message_unselect);
ivPersonal.setImageResource(R.drawable.ic_user_unselect);
tvGame.setChecked(false);
tvNews.setChecked(false);
tvMessage.setChecked(false);
tvPersonal.setChecked(false);
}
// 将所有的Fragment都置为隐藏状态。
private void hideFragments(FragmentTransaction transaction) {
List<Fragment> list = getSupportFragmentManager().getFragments();
if (list != null) {
for (Fragment fragment : list) {
transaction.hide(fragment);
}
}
}
// private <T extends Fragment & SearchBarHint> T alterFragment(Class<T> cls) {
private <T extends Fragment> T alterFragment(FragmentTransaction transaction, Class<T> cls) {
T fragmentByTag = (T) getSupportFragmentManager().findFragmentByTag(cls.getSimpleName());
try {
if (fragmentByTag != null) {
transaction.show(fragmentByTag);
} else {
fragmentByTag = cls.newInstance();
transaction.add(R.id.main_content, fragmentByTag, cls.getSimpleName());
if (fragmentByTag instanceof SearchBarHint && mSearchHintLint != null && mSearchHintLint.size() > 0) {
((SearchBarHint) fragmentByTag).setHint(mSearchHintLint);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return fragmentByTag;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBSkip skip) {
if (EB_SKIP_GAMEFRAGMENT.equals(skip.getType())) {
EventBus.getDefault().post(new EBUISwitch(EB_MAINACTIVITY_TAG, INDEX_GAME));
setTabSelection(INDEX_GAME);
EventBus.getDefault().post(new EBSkip(EB_MAINACTIVITY_TAG, skip.getCurrentItem()));
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBReuse reuse) {
if (MessageFragment.MESSAGE_READ_OVER.equals(reuse.getType())) {
Utils.log("======= over??");
mMessageHint.setVisibility(View.GONE);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBPackage busFour) {
final String packageName = busFour.getPackageName();

View File

@ -34,6 +34,7 @@ import com.gh.common.util.TimestampUtils;
import com.gh.common.util.TokenUtils;
import com.gh.common.util.Utils;
import com.gh.gamecenter.adapter.MessageDetailAdapter;
import com.gh.gamecenter.adapter.OnCommentCallBackListener;
import com.gh.gamecenter.db.CommentDao;
import com.gh.gamecenter.db.info.CommentInfo;
import com.gh.gamecenter.entity.CommentEntity;
@ -63,7 +64,7 @@ import rx.schedulers.Schedulers;
* Created by khy on 2016/11/8.
* 消息详情界面
*/
public class MessageDetailActivity extends BaseActivity implements MessageDetailAdapter.OnCommentCallBackListener {
public class MessageDetailActivity extends BaseActivity implements OnCommentCallBackListener {
@BindView(R.id.message_detail_rv)
RecyclerView mMessageDetailRv;
@ -169,13 +170,13 @@ public class MessageDetailActivity extends BaseActivity implements MessageDetail
mConcernEntity = null;
}
init(getString(R.string.title_message_detail));
initTitle(getString(R.string.title_message_detail));
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
mCommentDao = new CommentDao(this);
adapter = new MessageDetailAdapter(this, mCommentDao, mMessageDetailRv, mConcernEntity, mEntrance);
adapter = new MessageDetailAdapter(this, this, mCommentDao, mMessageDetailRv, mConcernEntity, mEntrance);
mLayoutManager = new LinearLayoutManager(this);
mMessageDetailRv.setLayoutManager(mLayoutManager);
mMessageDetailRv.setAdapter(adapter);
@ -538,7 +539,7 @@ public class MessageDetailActivity extends BaseActivity implements MessageDetail
}
@Override
public void showSoftInput(CommentEntity entity) {
public void onCommentCallback(CommentEntity entity) {
mCommentEntity = entity;
setSoftInput(true);
}

View File

@ -7,6 +7,7 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
@ -207,7 +208,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init("");
initTitle("");
// 添加分享图标
iv_share = new ImageView(this);
@ -689,9 +690,9 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener
detail_tv_per.setText("安装");
if (mDownloadEntity.isPluggable()
&& PackageManager.isInstalled(mDownloadEntity.getPackageName())) {
detail_pb_progressbar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_plugin_radius_style));
detail_pb_progressbar.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progressbar_plugin_radius_style));
} else {
detail_pb_progressbar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_normal_radius_style));
detail_pb_progressbar.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progressbar_normal_radius_style));
}
break;
case cancel:

View File

@ -88,7 +88,7 @@ public class NewsSearchActivity extends BaseActivity {
searchKey = intent.getExtras().getString("searchKey");
gameId = intent.getExtras().getString("gameId");
init(gameName);
initTitle(gameName);
DisplayMetrics outMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(outMetrics);

View File

@ -72,7 +72,7 @@ public class PluginActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_plugin));
initTitle(getString(R.string.title_plugin));
reuse_no_connection.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -119,7 +119,7 @@ public class ReceiverWaitingActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_receive_waiting));
initTitle(getString(R.string.title_receive_waiting));
mTitleTv.setTextColor(Color.WHITE);
mBackIv.setImageResource(R.drawable.reuse_kc_back);

View File

@ -80,7 +80,7 @@ public class SelectUserIconActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_select_user_icon));
initTitle(getString(R.string.title_select_user_icon));
sp = getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);

View File

@ -80,7 +80,7 @@ public class SettingActivity extends BaseActivity implements OnClickListener {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_settings));
initTitle(getString(R.string.title_settings));
setting_tv_cache.setText(getCacheSize());

View File

@ -78,7 +78,7 @@ public class ShareCardActivity extends BaseActivity {
picName = "shareImg.jpg";
init(getString(R.string.title_share_card));
initTitle(getString(R.string.title_share_card));
//修改沉浸栏以及ActionBar 颜色
mActionbar.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), android.R.color.black));

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@ -22,9 +23,12 @@ import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.image.ImageInfo;
import com.gh.base.BaseActivity;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.MessageShareUtils;
import com.gh.common.util.QRCodeUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.retrofit.ObservableUtil;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import com.tencent.tauth.Tencent;
@ -33,6 +37,7 @@ import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
@ -81,6 +86,31 @@ public class ShareCardPicActivity extends BaseActivity {
private String newsId;
public static void startShareCardPicActivity(Context context, ConcernEntity concernEntity, String entrance) {
final String shareContent;
if (concernEntity.getBrief() != null) {
shareContent = concernEntity.getBrief();
} else {
shareContent = concernEntity.getContent();
}
Intent intent = new Intent(context, ShareCardPicActivity.class);
Bundle bundle = new Bundle();
bundle.putString("gameName", concernEntity.getGameName());
bundle.putString("gameIconUrl", concernEntity.getGameIcon());
bundle.putString("shareContent", shareContent);
if (concernEntity.getLink() == null) {
bundle.putString("newsId", concernEntity.getId());
}
if (concernEntity.getImg() != null && concernEntity.getImg().size() > 0) {
bundle.putStringArrayList("shareArrImg", (ArrayList<String>) concernEntity.getImg());
}
intent.putExtras(bundle);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(entrance, "+(消息详情[", concernEntity.getGameName(), "])"));
context.startActivity(intent);
}
@Override
protected int getLayoutId() {
return R.layout.activity_sharecard_pic;
@ -110,7 +140,7 @@ public class ShareCardPicActivity extends BaseActivity {
picName = "shareImgPic.jpg";
currentImgPosition = 0;
init(getString(R.string.title_share_card_pic));
initTitle(getString(R.string.title_share_card_pic));
shareArrImg = new Vector<>();
shareArrImg.addAll(arrImg);

View File

@ -3,7 +3,6 @@ package com.gh.gamecenter;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.text.Html;
import android.widget.Button;
@ -56,7 +55,7 @@ public class ShareGhActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_share_gh));
initTitle(getString(R.string.title_share_gh));
ButterKnife.bind(this);
mGhAddress.setText(Html.fromHtml("<u>" + "www.ghzhushou.com" + "</u>"));

View File

@ -135,7 +135,7 @@ public class ShareGhWfifActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_share_via_wifi));
initTitle(getString(R.string.title_share_via_wifi));
ButterKnife.bind(this);
mUriHandlers = new ArrayList<>();

View File

@ -38,7 +38,7 @@ public class SkipActivity extends BaseActivity {
@Override
protected int getLayoutId() {
//TODO 暂时无意义设置避免崩溃罢了修改完主题和Toolbar相关内容会干掉这个
return R.layout.activity_main;
return R.layout.fragment_main;
}
@Override

View File

@ -86,7 +86,7 @@ public class SubjectActivity extends BaseActivity {
mId = mBundle.getString("id");
mName = mBundle.getString("name");
init(mName);
initTitle(mName);
if (TextUtils.isEmpty(mName) && !TextUtils.isEmpty(mId)) {
getSubjectName(mId);
@ -195,7 +195,7 @@ public class SubjectActivity extends BaseActivity {
new VPFragmentAdapter(getSupportFragmentManager(), fragments, tag);
mViewPager.setAdapter(adapter);
mTabLayout.setupWithViewPager(mViewPager);
mTabLayout.setTabsFromPagerAdapter(adapter);
// mTabLayout.setTabsFromPagerAdapter(adapter);
}
}
}

View File

@ -30,7 +30,7 @@ public class SuggestSelectActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_suggest_select));
initTitle(getString(R.string.title_suggest_select));
}
@OnClick({R.id.suggest_type1, R.id.suggest_type2, R.id.suggest_type3, R.id.suggest_type4,

View File

@ -167,7 +167,7 @@ public class SuggestionActivity extends BaseActivity implements SuggestTypeAdapt
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init(getString(R.string.title_suggestion));
initTitle(getString(R.string.title_suggestion));
curType = getIntent().getExtras().getInt("suggestType");
String suggestContent = getIntent().getExtras().getString("content");

View File

@ -60,7 +60,7 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init("光环工具箱");
initTitle("光环工具箱");
mRefresh.setColorSchemeResources(R.color.theme);
mRefresh.setOnRefreshListener(this);

View File

@ -90,7 +90,7 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR
mVoteDao = new VersionVoteDao(this);
init(getString(R.string.title_vote_formatable, gameName));
initTitle(getString(R.string.title_vote_formatable, gameName));
layoutManager = new LinearLayoutManager(this);
mVoteRv.setLayoutManager(layoutManager);

View File

@ -121,7 +121,7 @@ public class WebActivity extends BaseActivity implements View.OnClickListener{
}
init(webTitle);
initTitle(webTitle);
webView.loadUrl(webUrl);

View File

@ -1,12 +1,12 @@
package com.gh.gamecenter.adapter;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.os.Handler;
import android.support.v4.content.ContextCompat;
import android.support.v4.util.ArrayMap;
import android.view.View;
@ -14,13 +14,15 @@ import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.BitmapUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.RuntimeUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.CleanApkActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.KcSelectGameViewHolder;
import com.gh.gamecenter.entity.InstallGameEntity;
import com.gh.gamecenter.retrofit.Response;
import java.io.File;
import java.text.DecimalFormat;
@ -28,7 +30,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.gh.gamecenter.retrofit.Response;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
@ -51,15 +52,12 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
private boolean mIsScanOver;
private Handler mHandler = new Handler();
public CleanApkAdapter(Context context, OnScanListener listener, TextView apkDeleteBtn, CheckBox apkSelectAll) {
super(context);
mApkDeleteBtn = apkDeleteBtn;
mApkSelectAll = apkSelectAll;
public CleanApkAdapter(CleanApkActivity activity, TextView apkDeleteBtn, CheckBox apkSelectAll) {
super(activity);
this.mContext = activity;
this.mApkDeleteBtn = apkDeleteBtn;
this.mApkSelectAll = apkSelectAll;
mScanListener = activity;
mScanListener = listener;
mApkList = new ArrayList<>();
mSelectPosition = new ArrayMap<>();
@ -136,7 +134,7 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
mApkList.add(apkEntity);
mSelectPosition.put((mApkList.size() - 1), false);
mHandler.post(new Runnable() {
RuntimeUtils.getInstance().runOnUiThread(new Runnable() {
@Override
public void run() {
notifyItemChanged((mApkList.size() - 1));

View File

@ -9,6 +9,7 @@ import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
import android.view.ViewGroup;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.constant.Config;
import com.gh.common.constant.ItemViewType;
import com.gh.common.util.CommentUtils;

View File

@ -4,6 +4,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.ApkActiveUtils;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataUtils;
@ -16,7 +17,7 @@ import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.ConcernViewHolder;
import com.gh.gamecenter.db.info.ConcernInfo;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.gamecenter.manager.ConcernManager;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -37,7 +38,7 @@ import rx.schedulers.Schedulers;
*/
public class ConcernAdapter extends BaseRecyclerAdapter<ConcernViewHolder> {
private OnCallBackListener mListener;
private OnRequestCallBackListener mListener;
private List<ConcernInfo> mConcernList;
private List<GameEntity> mConcernGameList;
@ -46,7 +47,7 @@ public class ConcernAdapter extends BaseRecyclerAdapter<ConcernViewHolder> {
private String mEntrance;
public ConcernAdapter(ConcernActivity context, OnCallBackListener listener, String entrance) {
public ConcernAdapter(ConcernActivity context, OnRequestCallBackListener listener, String entrance) {
super(context);
mListener = listener;

View File

@ -5,6 +5,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.ApkActiveUtils;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataUtils;
@ -15,7 +16,7 @@ import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.ConcernViewHolder;
import com.gh.gamecenter.db.info.ConcernInfo;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.gamecenter.manager.ConcernManager;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -34,7 +35,7 @@ import rx.schedulers.Schedulers;
*/
public class ConcernRecommendAdapter extends BaseRecyclerAdapter<ConcernViewHolder> {
private OnCallBackListener mListener;
private OnRequestCallBackListener mListener;
private List<GameEntity> mGameList;
private List<GameEntity> mRecommendGameList;
@ -45,7 +46,7 @@ public class ConcernRecommendAdapter extends BaseRecyclerAdapter<ConcernViewHold
private String mEntrance;
public ConcernRecommendAdapter(Context context, OnCallBackListener listener, String entrance) {
public ConcernRecommendAdapter(Context context, OnRequestCallBackListener listener, String entrance) {
super(context);
mListener = listener;
mEntrance = entrance;

View File

@ -8,6 +8,7 @@ import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.SpeedUtils;

View File

@ -5,6 +5,7 @@ import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.SpeedUtils;
import com.gh.common.util.Utils;

View File

@ -12,6 +12,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DisplayUtils;

View File

@ -7,6 +7,7 @@ import android.graphics.drawable.StateListDrawable;
import android.view.View;
import android.view.ViewGroup;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.GameNewsTypeViewHolder;
import com.gh.gamecenter.eventbus.EBTypeChange;
@ -22,18 +23,12 @@ import java.util.List;
public class GameNewsTypeListAdapter extends BaseRecyclerAdapter<GameNewsTypeViewHolder> {
private List<String> mTypeList;
private String mNewsType;
private int mCurrentPosition;
public GameNewsTypeListAdapter(Context context, List<String> tList, String type) {
super(context);
mTypeList = tList;
mNewsType = type;
mCurrentPosition = 0;
}
@Override
@ -78,7 +73,6 @@ public class GameNewsTypeListAdapter extends BaseRecyclerAdapter<GameNewsTypeVie
if (type.equals(mNewsType)) {
holder.game_news_type_list_tv_type.setSelected(true);
holder.game_news_type_list_tv_type.setTextColor(Color.WHITE);
mCurrentPosition = position;
} else {
holder.game_news_type_list_tv_type.setSelected(false);
holder.game_news_type_list_tv_type.setTextColor(Color.parseColor("#b3b3b3"));

View File

@ -70,6 +70,7 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
ImageUtils.getInstance().display(mContext.getResources(), (SimpleDraweeView) view,
slideEntity.getImage(), R.drawable.preload);
// indicator.setPosition(mSlideEntityList.mSize(), getPosition(position));
view.setOnClickListener(new View.OnClickListener() {

View File

@ -9,6 +9,7 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.constant.ItemViewType;
import com.gh.common.util.ApkActiveUtils;
import com.gh.common.util.DataCollectionUtils;
@ -28,7 +29,7 @@ import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.KaiFuServerEntity;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.gamecenter.manager.GameManager;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.Response;
@ -52,7 +53,7 @@ import rx.schedulers.Schedulers;
*/
public class KaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
private OnCallBackListener mOnCallBackListener;
private OnRequestCallBackListener mOnRequestCallBackListener;
private OnScrollToKaiFuIndexListener mOnScrollToKaiFuIndexListener;
private List<GameEntity> mSubjectList;
@ -75,10 +76,10 @@ public class KaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
private boolean mIsLoadedBottom;
private boolean mIsLoadedTop;
public KaiFuAdapter(KaiFuActivity context, OnCallBackListener callBackListener,
public KaiFuAdapter(KaiFuActivity context, OnRequestCallBackListener callBackListener,
OnScrollToKaiFuIndexListener scrollToKaiFuIndexListener, String kaifuType) {
super(context);
mOnCallBackListener = callBackListener;
mOnRequestCallBackListener = callBackListener;
mKaifuType = kaifuType;
mOnScrollToKaiFuIndexListener = scrollToKaiFuIndexListener;
@ -117,14 +118,14 @@ public class KaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
e.printStackTrace();
}
mInitOffset = offset;
mOnCallBackListener.loadDone(offset);
mOnRequestCallBackListener.loadDone(offset);
initListBottom(offset);
}
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
mOnCallBackListener.loadError();
mOnRequestCallBackListener.loadError();
}
});
@ -195,8 +196,8 @@ public class KaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
@Override
public void onFailure(HttpException e) {
if (offset == mInitOffset) {
if (mOnCallBackListener != null) {
mOnCallBackListener.loadError();
if (mOnRequestCallBackListener != null) {
mOnRequestCallBackListener.loadError();
}
} else {
Toast.makeText(mContext, "加载失败,请检查网络状态", Toast.LENGTH_SHORT).show();
@ -335,11 +336,11 @@ public class KaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
initLocationMap();
if (mOnCallBackListener != null) {
if (mOnRequestCallBackListener != null) {
if (mSubjectList.size() == 0) {
mOnCallBackListener.loadEmpty();
mOnRequestCallBackListener.loadEmpty();
} else {
mOnCallBackListener.loadDone();
mOnRequestCallBackListener.loadDone();
}
}
@ -353,8 +354,8 @@ public class KaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
@Override
public void onFailure(HttpException e) {
if (offset == mInitOffset) {
if (mOnCallBackListener != null) {
mOnCallBackListener.loadError();
if (mOnRequestCallBackListener != null) {
mOnRequestCallBackListener.loadError();
}
} else {
Toast.makeText(mContext, "加载失败,请检查网络状态", Toast.LENGTH_SHORT).show();

View File

@ -11,8 +11,10 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DisplayUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
import com.gh.gamecenter.adapter.viewholder.StrategyDialogViewHolder;
import com.gh.gamecenter.db.info.ConcernInfo;
import com.gh.gamecenter.manager.ConcernManager;
@ -56,7 +58,7 @@ public class KaiFuDialogAdapter extends BaseRecyclerAdapter<ViewHolder> {
textView.setText("以下是已关注的游戏");
textView.setBackgroundColor(Color.parseColor("#ededed"));
textView.setGravity(Gravity.CENTER);
return new TitleViewHolder(textView);
return new ReuseViewHolder(textView);
} else {
View view = mLayoutInflater.inflate(R.layout.dialog_strategy_item, parent, false);
return new StrategyDialogViewHolder(view);
@ -118,10 +120,4 @@ public class KaiFuDialogAdapter extends BaseRecyclerAdapter<ViewHolder> {
void selectPosition(int position, String tag, String gameName);
}
public class TitleViewHolder extends RecyclerView.ViewHolder {
public TitleViewHolder(View itemView) {
super(itemView);
}
}
}

View File

@ -6,7 +6,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
@ -20,6 +19,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.gh.base.AppController;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.constant.ItemViewType;
import com.gh.common.util.BitmapUtils;
import com.gh.common.util.DisplayUtils;
@ -28,6 +28,7 @@ import com.gh.common.util.Utils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.KcSelectGameViewHolder;
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
import com.gh.gamecenter.db.info.ConcernInfo;
import com.gh.gamecenter.entity.InstallGameEntity;
import com.gh.gamecenter.kuaichuan.FileInfo;
@ -184,7 +185,7 @@ public class KcSelectGameAdapter extends BaseRecyclerAdapter<ViewHolder> {
textView.setTextColor(ContextCompat.getColor(mContext, R.color.title));
textView.setBackgroundColor(Color.WHITE);
textView.setText("已安装的应用(" + mApkList.size() + "");
return new TitleViewHolder(textView);
return new ReuseViewHolder(textView);
}
return null;
}
@ -399,10 +400,4 @@ public class KcSelectGameAdapter extends BaseRecyclerAdapter<ViewHolder> {
return mApkList.size();
}
public class TitleViewHolder extends RecyclerView.ViewHolder {
public TitleViewHolder(View itemView) {
super(itemView);
}
}
}

View File

@ -6,6 +6,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.LibaoUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.R;

View File

@ -1,6 +1,5 @@
package com.gh.gamecenter.adapter;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.LinearLayoutManager;
@ -15,6 +14,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gh.base.OnRequestCallBackListener;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.LibaoUtils;
@ -23,14 +24,13 @@ import com.gh.common.util.StringUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.SuggestionActivity;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.GameDetailNewsViewHolder;
import com.gh.gamecenter.adapter.viewholder.LibaoDetailTopViewHolder;
import com.gh.gamecenter.db.LibaoDao;
import com.gh.gamecenter.db.info.LibaoInfo;
import com.gh.gamecenter.entity.LibaoDetailEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.gamedetail.GameDetailNewsViewHolder;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -46,7 +46,7 @@ import rx.schedulers.Schedulers;
*/
public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
private OnCallBackListener mOnCallBackListener;
private OnRequestCallBackListener mOnRequestCallBackListener;
private OnCodeScrollListener mOnCodeScrollListener;
private TextView mDownloadTv;
@ -60,11 +60,11 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
private String mEntrance;
public LibaoDetailAdapter(Context context, OnCallBackListener onCallBackListener,
public LibaoDetailAdapter(Context context, OnRequestCallBackListener onRequestCallBackListener,
OnCodeScrollListener onCodeScrollListener, LibaoEntity libaoEntity,
TextView tvDownload, String entrance) {
super(context);
mOnCallBackListener = onCallBackListener;
mOnRequestCallBackListener = onRequestCallBackListener;
mOnCodeScrollListener = onCodeScrollListener;
mLibaoEntity = libaoEntity;
mDownloadTv = tvDownload;
@ -83,13 +83,13 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
@Override
public void onResponse(LibaoDetailEntity response) {
mLibaoDetailEntity = response;
mOnCallBackListener.loadDone();
mOnRequestCallBackListener.loadDone();
notifyDataSetChanged();
}
@Override
public void onFailure(HttpException e) {
mOnCallBackListener.loadEmpty();
mOnRequestCallBackListener.loadEmpty();
}
});
}
@ -116,6 +116,7 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
initLibaoDetailContent((GameDetailNewsViewHolder) holder, position);
} else if (holder instanceof FooterViewHolder) {
FooterViewHolder viewHolder = (FooterViewHolder) holder;
viewHolder.initItemPadding();
viewHolder.loading.setVisibility(View.GONE);
viewHolder.hint.setText("此礼包有问题?点击反馈");
@ -192,11 +193,9 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
if (libaoInfo.getLibaoId().equals(mLibaoEntity.getId())) {
if (mContext instanceof Activity) {
LibaoUtils.initLibaoBtn((Activity) mContext, holder.libaoCopyBtn, mLibaoEntity, mLibaoDao,
mLibaoDetailEntity.getInstallRequired(), this,
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"));
}
LibaoUtils.initLibaoBtn(mContext, holder.libaoCopyBtn, mLibaoEntity, mLibaoDao,
mLibaoDetailEntity.getInstallRequired(), this,
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"));
// holder.libaoCopyBtn.setBackgroundResource(R.drawable.textview_blue_style);
// holder.libaoCopyBtn.setTextColor(Color.WHITE);
@ -269,11 +268,9 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
holder.libaoDes.setText(content);
if (mLibaoEntity.getStatus() != null && mLibaoDetailEntity != null) {
if (mContext instanceof Activity) {
LibaoUtils.initLibaoBtn((Activity) mContext, holder.libaoCopyBtn, mLibaoEntity, mLibaoDao,
mLibaoDetailEntity.getInstallRequired(), this,
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"));
}
LibaoUtils.initLibaoBtn(mContext, holder.libaoCopyBtn, mLibaoEntity, mLibaoDao,
mLibaoDetailEntity.getInstallRequired(), this,
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"));
}
// 判断按钮状态是否为空(礼包详情进入),重新获取

View File

@ -4,7 +4,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
@ -14,6 +13,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.constant.Config;
import com.gh.common.util.CommentUtils;
import com.gh.common.util.ConcernContentUtils;
@ -30,7 +30,6 @@ import com.gh.common.util.Utils;
import com.gh.gamecenter.MessageDetailActivity;
import com.gh.gamecenter.NewsDetailActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.ShareCardActivity;
import com.gh.gamecenter.ShareCardPicActivity;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.adapter.viewholder.CommentHeadViewHolder;
@ -77,7 +76,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
boolean isGetRvHeight = true; // 防止评论时弹出软键盘 影响RecyclerView高度
int rvHeight;
private ConcernEntity mConcernEntity;
private OnCommentCallBackListener mCallBackListener;
private OnCommentCallBackListener mOnCommentCallBackListener;
private RecyclerView mRecyclerView;
private List<CommentEntity> mHotCommentList;
private List<CommentEntity> mNormalCommentList;
@ -86,18 +85,18 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
private SharedPreferences sp;
private String userName; //用户名
private String userIcon; //用户icon
private String entrance;
private String mEntrance;
private boolean isOver;
private boolean isLoading;
private boolean isNetworkError;
private boolean isRefreshPosition;
public MessageDetailAdapter(MessageDetailActivity context, CommentDao commentDao, RecyclerView messageDetailRv,
ConcernEntity concernEntity, String entrance) {
public MessageDetailAdapter(MessageDetailActivity context, OnCommentCallBackListener listener, CommentDao commentDao,
RecyclerView messageDetailRv, ConcernEntity concernEntity, String entrance) {
super(context);
this.mRecyclerView = messageDetailRv;
this.entrance = entrance;
mCallBackListener = context;
mRecyclerView = messageDetailRv;
mEntrance = entrance;
mOnCommentCallBackListener = listener;
mVoteDao = new VoteDao(context);
mCommentDao = commentDao;
@ -122,7 +121,9 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
} else if (mConcernEntity != null) {
isOver = true;
notifyItemChanged(getItemCount() - 1);
mCallBackListener.showSoftInput(null);
if (mOnCommentCallBackListener != null) {
mOnCommentCallBackListener.onCommentCallback(null);
}
}
}
@ -290,7 +291,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.imgLayout.setVisibility(View.VISIBLE);
viewHolder.imgLayout.removeAllViews();
ConcernContentUtils.addContentPic(mContext, viewHolder.imgLayout, mConcernEntity.getImg(),
StringUtils.buildString(entrance, "+(消息详情[", mConcernEntity.getGameName(), "])"),
StringUtils.buildString(mEntrance, "+(消息详情[", mConcernEntity.getGameName(), "])"),
mContext.getResources().getDisplayMetrics().widthPixels - DisplayUtils.dip2px(mContext, 34));
}
@ -302,38 +303,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String shareContent;
if (mConcernEntity.getBrief() != null) {
shareContent = mConcernEntity.getBrief();
} else {
shareContent = mConcernEntity.getContent();
}
if (mConcernEntity.getImg() != null && mConcernEntity.getImg().size() > 0) {
Intent intent = new Intent(mContext, ShareCardPicActivity.class);
Bundle bundle = new Bundle();
bundle.putString("gameName", mConcernEntity.getGameName());
bundle.putString("gameIconUrl", mConcernEntity.getGameIcon());
bundle.putString("shareContent", shareContent);
if (mConcernEntity.getLink() == null) {
bundle.putString("newsId", mConcernEntity.getId());
}
bundle.putStringArrayList("shareArrImg", (ArrayList<String>) mConcernEntity.getImg());
intent.putExtras(bundle);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(entrance, "+(消息详情[", mConcernEntity.getGameName(), "])"));
mContext.startActivity(intent);
} else {
Intent intent = new Intent(mContext, ShareCardActivity.class);
Bundle bundle = new Bundle();
bundle.putString("gameName", mConcernEntity.getGameName());
bundle.putString("gameIconUrl", mConcernEntity.getGameIcon());
bundle.putString("shareContent", shareContent);
if (mConcernEntity.getLink() == null) {
bundle.putString("newsId", mConcernEntity.getId());
}
intent.putExtras(bundle);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(entrance, "+(消息详情[", mConcernEntity.getGameName(), "])"));
mContext.startActivity(intent);
}
ShareCardPicActivity.startShareCardPicActivity(mContext, mConcernEntity, mEntrance);
}
});
@ -354,12 +324,12 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
intent.putExtra("url", mConcernEntity.getLink());
intent.putExtra("gameName", mConcernEntity.getGameName());
intent.putExtra("newsId", mConcernEntity.getId());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(entrance, "+(消息详情[", mConcernEntity.getGameName(), "])"));
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(mEntrance, "+(消息详情[", mConcernEntity.getGameName(), "])"));
mContext.startActivity(intent);
} else {
Intent intent = new Intent(mContext, NewsDetailActivity.class);
intent.putExtra("newsId", mConcernEntity.getId());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(entrance, "+(消息详情[", mConcernEntity.getGameName(), "])"));
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(mEntrance, "+(消息详情[", mConcernEntity.getGameName(), "])"));
mContext.startActivity(intent);
}
}
@ -368,7 +338,9 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.comment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallBackListener.showSoftInput(null);
if (mOnCommentCallBackListener != null) {
mOnCommentCallBackListener.onCommentCallback(null);
}
}
});
@ -532,7 +504,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CommentUtils.showReportDialog(finalCommentEntity, mContext, mCallBackListener, null);
CommentUtils.showReportDialog(finalCommentEntity, mContext, mOnCommentCallBackListener, null);
}
});
}
@ -676,7 +648,4 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
return isOver;
}
public interface OnCommentCallBackListener {
void showSoftInput(CommentEntity entity);
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.listener;
package com.gh.gamecenter.adapter;
import com.gh.gamecenter.entity.GameCollectionEntity;

View File

@ -0,0 +1,7 @@
package com.gh.gamecenter.adapter;
import com.gh.gamecenter.entity.CommentEntity;
public interface OnCommentCallBackListener {
void onCommentCallback(CommentEntity entity);
}

View File

@ -19,6 +19,7 @@ import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.constant.Config;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DialogUtils;
@ -38,7 +39,6 @@ import com.gh.gamecenter.adapter.viewholder.PlatformViewHolder;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.CollectionColseEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.listener.OnCollectionCallBackListener;
import com.gh.gamecenter.manager.PackageManager;
import java.io.File;

View File

@ -18,7 +18,6 @@ import com.gh.download.DownloadManager;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.CollectionColseEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.listener.OnCollectionCallBackListener;
import java.util.List;

View File

@ -4,6 +4,7 @@ import android.support.v4.util.ArrayMap;
import android.view.View;
import android.view.ViewGroup;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DownloadItemUtils;
@ -19,7 +20,7 @@ import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.gamecenter.manager.GameManager;
import com.gh.gamecenter.manager.PackageManager;
@ -33,14 +34,14 @@ import java.util.Map;
*/
public class PluginAdapter extends BaseRecyclerAdapter<GameNormalViewHolder> {
private OnCallBackListener mListener;
private OnRequestCallBackListener mListener;
private List<GameEntity> mPluginList;
private ArrayMap<String, ArrayList<Integer>> mLocationMap;
private String mEntrance;
public PluginAdapter(PluginActivity context, OnCallBackListener listener, String entrance) {
public PluginAdapter(PluginActivity context, OnRequestCallBackListener listener, String entrance) {
super(context);
mListener = listener;
mEntrance = entrance;

View File

@ -12,6 +12,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DisplayUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.SubjectTypeAdapter.GameTypeViewHolder;

View File

@ -10,6 +10,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import com.gh.base.AppController;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.MD5Utils;
@ -23,7 +24,7 @@ import com.gh.gamecenter.adapter.viewholder.LibaoSearchViewHolder;
import com.gh.gamecenter.adapter.viewholder.ToolBoxViewHolder;
import com.gh.gamecenter.db.info.ConcernInfo;
import com.gh.gamecenter.entity.ToolBoxEntity;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.gamecenter.manager.ConcernManager;
import com.gh.gamecenter.retrofit.ObservableUtil;
import com.gh.gamecenter.retrofit.Response;
@ -49,7 +50,7 @@ import static com.gh.gamecenter.R.string.loading;
public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
private OnCallBackListener mCallBackListener;
private OnRequestCallBackListener mCallBackListener;
private OnSearchCallBackListener mSearchListener;
private List<ToolBoxEntity> mEntityList;
@ -66,7 +67,7 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
private boolean mLoadKeyOver;
private boolean mIsRequestError; // key请求返回409
public ToolBoxRvAdapter(Context context, OnCallBackListener listener, OnSearchCallBackListener searchListener,
public ToolBoxRvAdapter(Context context, OnRequestCallBackListener listener, OnSearchCallBackListener searchListener,
boolean isSearch, String key) {
super(context);
this.mIsSearch = isSearch;

View File

@ -9,13 +9,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.gh.base.adapter.BaseRecyclerAdapter;
import com.gh.common.util.DisplayUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.VoteViewHolder;
import com.gh.gamecenter.db.VersionVoteDao;
import com.gh.gamecenter.entity.VersionVoteEntity;
import com.gh.gamecenter.listener.OnCallBackListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -32,7 +33,7 @@ import rx.schedulers.Schedulers;
*/
public class VoteAdapter extends BaseRecyclerAdapter<ViewHolder> {
private OnCallBackListener mCallBackListener;
private OnRequestCallBackListener mCallBackListener;
private OnAddVoteListener mAddVoteListener;
@ -48,11 +49,11 @@ public class VoteAdapter extends BaseRecyclerAdapter<ViewHolder> {
private String mGameId;
public VoteAdapter(Context context, OnCallBackListener onCallBackListener
public VoteAdapter(Context context, OnRequestCallBackListener onRequestCallBackListener
, OnAddVoteListener addVoteListener, String gameId, VersionVoteDao voteDao) {
super(context);
this.mCallBackListener = onCallBackListener;
this.mCallBackListener = onRequestCallBackListener;
this.mAddVoteListener = addVoteListener;
this.mGameId = gameId;

View File

@ -1,18 +1,17 @@
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by khy on 2016/11/9.
*/
public class CommentHeadViewHolder extends RecyclerView.ViewHolder {
public class CommentHeadViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.comment_head_line)
public View commentHeadLine;
@ -21,6 +20,6 @@ public class CommentHeadViewHolder extends RecyclerView.ViewHolder {
public CommentHeadViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -1,20 +1,19 @@
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by khy on 2016/11/9.
*/
public class CommentViewHolder extends RecyclerView.ViewHolder {
public class CommentViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.comment_line)
public View commentLine;
@ -35,6 +34,5 @@ public class CommentViewHolder extends RecyclerView.ViewHolder {
public CommentViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -1,30 +1,34 @@
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
/**
* Created by LGT on 2016/9/20.
*/
public class ConcernViewHolder extends RecyclerView.ViewHolder {
public class ConcernViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.concern_item_icon)
public SimpleDraweeView concern_item_icon;
@BindView(R.id.concern_item_name)
public TextView concern_item_name;
@BindView(R.id.concern_item_concern)
public TextView concern_item_concern;
@BindView(R.id.concern_libao_icon)
public ImageView concern_libao_icon;
public ConcernViewHolder(View itemView) {
super(itemView);
concern_item_icon = (SimpleDraweeView) itemView.findViewById(R.id.concern_item_icon);
concern_item_name = (TextView) itemView.findViewById(R.id.concern_item_name);
concern_item_concern = (TextView) itemView.findViewById(R.id.concern_item_concern);
concern_libao_icon = (ImageView) itemView.findViewById(R.id.concern_libao_icon);
}
}

View File

@ -1,25 +1,25 @@
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
/**
* Created by LGT on 2016/8/15.
*/
public class DownloadHeadViewHolder extends RecyclerView.ViewHolder {
public class DownloadHeadViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.dm_item_head_tv_task)
public TextView dm_item_head_tv_task;
@BindView(R.id.dm_item_head_tv_allstart)
public TextView dm_item_head_tv_allstart;
public DownloadHeadViewHolder(View itemView) {
super(itemView);
dm_item_head_tv_task = (TextView) itemView.findViewById(R.id.dm_item_head_tv_task);
dm_item_head_tv_allstart = (TextView) itemView.findViewById(R.id.dm_item_head_tv_allstart);
}
}

View File

@ -1,15 +1,14 @@
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* @author 温冠超
@ -18,47 +17,36 @@ import butterknife.ButterKnife;
* @update 2015-8-11
* @des 下拉或上啦刷新中,进度显示控件
*/
public class FooterViewHolder extends ViewHolder {
public class FooterViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.footerview_loading)
public ProgressBar loading;
@BindView(R.id.footerview_hint)
public TextView hint;
@BindView(R.id.footerview_line_left)
public View lineLeft;
@BindView(R.id.footerview_line_right)
public View lineRight;
private View mView;
public FooterViewHolder(View itemView) {
super(itemView);
mView = itemView;
ButterKnife.bind(this, itemView);
}
// 减去recyclerView item间隔个别列表间隔很大
public void initItemPadding() {
mView.setPadding(0, 0, 0, 0);
itemView.setPadding(0, 0, 0, 0);
}
public void initFooterViewHolder(boolean mIsNetworkError, boolean mIsOver,
OnClickListener onClickListener) {
public void initFooterViewHolder(boolean mIsNetworkError, boolean mIsOver, OnClickListener onClickListener) {
if (mIsNetworkError) {
lineLeft.setVisibility(View.GONE);
lineRight.setVisibility(View.GONE);
loading.setVisibility(View.GONE);
hint.setText("加载失败,点击重试");
itemView.setClickable(true);
// holder.itemView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// mIsNetworkError = false;
// notifyItemChanged(getItemCount() - 1);
// initSubjectList();
// }
// });
itemView.setOnClickListener(onClickListener);
} else if (mIsOver) {
lineLeft.setVisibility(View.VISIBLE);

View File

@ -1,18 +1,18 @@
package com.gh.gamecenter.gamedetail;
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.RelativeLayout;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by khy on 2016/12/14.
*/
public class GameDetaiLibaoViewHolder extends RecyclerView.ViewHolder {
public class GameDetaiLibaoViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.gamedetail_item_libao_gallery)
public RecyclerView libaoRv;
@ -21,6 +21,6 @@ public class GameDetaiLibaoViewHolder extends RecyclerView.ViewHolder {
public GameDetaiLibaoViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -1,18 +1,17 @@
package com.gh.gamecenter.gamedetail;
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by khy on 2017/3/28.
*/
public class GameDetailCalenderViewHolder extends RecyclerView.ViewHolder {
public class GameDetailCalenderViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.calendar_day)
public TextView calendarDay;
@ -21,6 +20,6 @@ public class GameDetailCalenderViewHolder extends RecyclerView.ViewHolder {
public GameDetailCalenderViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -1,21 +1,20 @@
package com.gh.gamecenter.gamedetail;
package com.gh.gamecenter.adapter.viewholder;
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.BaseRecyclerViewHolder;
import com.gh.common.view.MarqueeView;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by khy on 2017/3/27.
*/
public class GameDetailFuLiViewHolder extends RecyclerView.ViewHolder {
public class GameDetailFuLiViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.gamedetail_item_fuli_des)
public TextView fuliDes;
@ -36,10 +35,8 @@ public class GameDetailFuLiViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.gamedetail_item_notice_ll)
public LinearLayout filiNoticeLl;
public GameDetailFuLiViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -0,0 +1,17 @@
package com.gh.gamecenter.adapter.viewholder;
import android.view.View;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
public class GameDetailGameTagTypeViewHolder extends BaseRecyclerViewHolder {
public TextView type;
public GameDetailGameTagTypeViewHolder(View itemView) {
super(itemView);
type = (TextView) itemView;
}
}

View File

@ -1,23 +1,23 @@
package com.gh.gamecenter.gamedetail;
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by khy on 2017/3/28.
*/
public class GameDetailGameTagViewHolder extends RecyclerView.ViewHolder {
public class GameDetailGameTagViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.gamedetail_gametag_rv)
public RecyclerView gametagRv;
public GameDetailGameTagViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -1,24 +1,26 @@
package com.gh.gamecenter.gamedetail;
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
/**
* Created by LGT on 2016/9/8.
*/
public class GameDetailIntroViewHolder extends RecyclerView.ViewHolder {
public class GameDetailIntroViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.gamedetail_item_intro_gallery)
public RecyclerView gamedetail_item_intro_gallery;
@BindView(R.id.gamedetail_item_intro_content)
public TextView gamedetail_item_intro_content;
public GameDetailIntroViewHolder(View itemView) {
super(itemView);
gamedetail_item_intro_gallery = (RecyclerView) itemView.findViewById(R.id.gamedetail_item_intro_gallery);
gamedetail_item_intro_content = (TextView) itemView.findViewById(R.id.gamedetail_item_intro_content);
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.gamedetail;
package com.gh.gamecenter.adapter.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
@ -7,41 +7,41 @@ import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by khy on 2017/3/28.
*/
public class GameDetailKaiFuViewHolder extends RecyclerView.ViewHolder {
public class GameDetailKaiFuViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.gamedetail_kaifu_rv)
RecyclerView kaifuRv;
public RecyclerView kaifuRv;
@BindView(R.id.gamedetail_kaifu_cur_month)
TextView curMonth;
public TextView curMonth;
@BindView(R.id.gamedetail_kaifu_next_month)
TextView nextMonth;
public TextView nextMonth;
@BindView(R.id.gamedetail_kaifu_rl)
RelativeLayout kaifuRl;
public RelativeLayout kaifuRl;
@BindView(R.id.gamedetail_kaifu_detail)
RelativeLayout kaifuDetailRl;
public RelativeLayout kaifuDetailRl;
@BindView(R.id.gamedetail_kaifu_colse_detail)
TextView colseDetail;
public TextView colseDetail;
@BindView(R.id.gamedetail_kaifu_suggest)
TextView kaifuSuggest;
public TextView kaifuSuggest;
@BindView(R.id.gamedetail_kaifu_detail_time)
TextView detailTime;
public TextView detailTime;
@BindView(R.id.gamedetail_kaifu_detail_list)
LinearLayout detailList;
public LinearLayout detailList;
@BindView(R.id.gamedetail_kaifu_detail_sv)
ScrollView detailSv;
public ScrollView detailSv;
@BindView(R.id.gamedetail_kaifu_des)
TextView kaifuDes;
public TextView kaifuDes;
public GameDetailKaiFuViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}

View File

@ -0,0 +1,30 @@
package com.gh.gamecenter.adapter.viewholder;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
/**
* Created by LGT on 2016/9/18.
*/
public class GameDetailNewsServerItemViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.newsserver_item_name)
public TextView newsserver_item_name;
@BindView(R.id.newsserver_item_line)
public View newsserver_item_line;
@BindView(R.id.newsserver_item_point)
public ImageView newsserver_item_point;
@BindView(R.id.newsserver_item_time)
public TextView newsserver_item_time;
public GameDetailNewsServerItemViewHolder(View itemView) {
super(itemView);
}
}

View File

@ -0,0 +1,32 @@
package com.gh.gamecenter.adapter.viewholder;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gh.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.R;
import butterknife.BindView;
/**
* Created by LGT on 2016/9/8.
*/
public class GameDetailNewsViewHolder extends BaseRecyclerViewHolder {
@BindView(R.id.gamedetail_item_news_more)
public LinearLayout gamedetail_item_news_more;
@BindView(R.id.gamedetail_item_news_list)
public LinearLayout gamedetail_item_news_list;
@BindView(R.id.gamedetail_item_news_title)
public TextView gamedetail_item_news_title;
@BindView(R.id.gamedetail_item_line)
public View gamedetail_item_line;
@BindView(R.id.gamedetail_item_news_line_top)
public View gamedetail_item_news_line_top;
public GameDetailNewsViewHolder(View itemView) {
super(itemView);
}
}

Some files were not shown because too many files have changed in this diff Show More