优化汇总(20170106),礼包相关优化补充(20170104), 快速点击弹窗按钮可能会出现卡死
This commit is contained in:
@ -2,6 +2,7 @@ package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@ -58,7 +59,13 @@ public class ConcernUtils {
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe();
|
||||
.subscribe(new Response<ResponseBody>(){
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
super.onFailure(e);
|
||||
Utils.log("Concern::整体更新设备失败" + e.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
@ -77,6 +79,7 @@ public class LibaoUtils {
|
||||
public void onResponse(List<LibaoEntity> response) {
|
||||
LibaoDao libaoDao = new LibaoDao(context);
|
||||
for (LibaoEntity libaoEntity : response) {
|
||||
Utils.log("============cunhaoxiang" + libaoEntity.getPackageName() + "==" + libaoEntity.getName());
|
||||
LibaoInfo libaoInfo = LibaoInfo.createLibaoInfo(libaoEntity);
|
||||
libaoInfo.setActive(libaoEntity.isActive());
|
||||
libaoDao.add(libaoInfo);
|
||||
@ -322,6 +325,7 @@ public class LibaoUtils {
|
||||
libaoEntity.setAvailable(libaoEntity.getAvailable() - 1);
|
||||
|
||||
LibaoInfo libaoInfo = LibaoInfo.createLibaoInfo(libaoEntity);
|
||||
// libaoInfo.setTime(String.valueOf(new Date().getTime()));
|
||||
libaoInfo.setCode(libaoCode);
|
||||
libaoDao.add(libaoInfo);
|
||||
|
||||
@ -344,7 +348,9 @@ public class LibaoUtils {
|
||||
@Override
|
||||
public void run() {
|
||||
lunningAppDialog(libaoBtn.getContext()
|
||||
, "请尽快进入游戏兑换", libaoEntity);
|
||||
, Html.fromHtml("礼包码:"
|
||||
+ "<font color=\"#06D0A8\">" + finalLibaoCode + "</font>"
|
||||
+ " 复制成功" +"<br/>请尽快进入游戏兑换"), libaoEntity);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
@ -415,6 +421,7 @@ public class LibaoUtils {
|
||||
|
||||
LibaoInfo libaoInfo = LibaoInfo.createLibaoInfo(libaoEntity);
|
||||
libaoInfo.setCode(libaoCode);
|
||||
// libaoInfo.setTime(String.valueOf(new Date().getTime()));
|
||||
libaoDao.add(libaoInfo);
|
||||
|
||||
EventBus.getDefault().post(new EBReuse("libaoChanged"));
|
||||
@ -437,7 +444,10 @@ public class LibaoUtils {
|
||||
@Override
|
||||
public void run() {
|
||||
lunningAppDialog(libaoBtn.getContext()
|
||||
, "淘号礼包不保证可用,请尽快进入游戏尝试兑换", libaoEntity);
|
||||
, Html.fromHtml("礼包码:"
|
||||
+ "<font color=\"#ffb13c\">" + finalLibaoCode + "</font>"
|
||||
+ " 复制成功"
|
||||
+"<br/>淘号礼包不保证可用,请尽快进入游戏尝试兑换"), libaoEntity);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
@ -505,7 +515,7 @@ public class LibaoUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void lunningAppDialog (final Context context, String msg, final LibaoEntity libaoEntity) {
|
||||
public static void lunningAppDialog (final Context context, Spanned msg, final LibaoEntity libaoEntity) {
|
||||
DialogUtils.showWarningDialog(context, "复制成功", msg
|
||||
, "关闭", "启动游戏"
|
||||
, new DialogUtils.ConfiremListener() {
|
||||
|
||||
@ -18,11 +18,14 @@ import com.gh.gamecenter.eventbus.EBConcernChanged;
|
||||
import com.gh.gamecenter.gamedetail.GameDetailAdapter;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.jakewharton.rxbinding.view.RxView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Action1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
@ -87,6 +90,23 @@ public class GameDetailActivity extends BaseDetailActivity implements View.OnCli
|
||||
reuse_ll_loading.setVisibility(View.GONE);
|
||||
reuse_no_connection.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
// 防抖处理
|
||||
RxView.clicks(iv_share)
|
||||
.throttleFirst(1, TimeUnit.SECONDS)
|
||||
.subscribe(new Action1<Void>() {
|
||||
@Override
|
||||
public void call(Void aVoid) {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("点击", "分享");
|
||||
DataUtils.onEvent(GameDetailActivity.this, "插件数据", gameEntity.getName(), kv);
|
||||
|
||||
DataCollectionUtils.uploadClick(GameDetailActivity.this, "分享", "游戏详情", gameEntity.getName());
|
||||
|
||||
String url = "http://www.ghzhushou.com/game/" + adapter.getGameDetailEntity().getShareCode();
|
||||
showShare(url, gameEntity.getName(), gameEntity.getIcon(), null, gameEntity.getTag());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,15 +147,6 @@ public class GameDetailActivity extends BaseDetailActivity implements View.OnCli
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
} else if (v == iv_share) {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("点击", "分享");
|
||||
DataUtils.onEvent(this, "插件数据", gameEntity.getName(), kv);
|
||||
|
||||
DataCollectionUtils.uploadClick(this, "分享", "游戏详情", gameEntity.getName());
|
||||
|
||||
String url = "http://www.ghzhushou.com/game/" + adapter.getGameDetailEntity().getShareCode();
|
||||
showShare(url, gameEntity.getName(), gameEntity.getIcon(), null, gameEntity.getTag());
|
||||
} else if (v == actionbar_rl_back) {
|
||||
if (ChangeSkinUtils.isChecking) {
|
||||
DialogUtils.showWarningDialog(GameDetailActivity.this, "退出提示",
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -131,10 +129,6 @@ public class LibaoActivity extends BaseFragmentActivity implements View.OnClickL
|
||||
} else if (v == mChunhaoxiangTv) {
|
||||
mLibaoVp.setCurrentItem(2);
|
||||
}
|
||||
|
||||
// 隐藏软键盘
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,13 +2,11 @@ package com.gh.gamecenter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.base.BaseDetailActivity;
|
||||
import com.gh.gamecenter.adapter.LibaoDetailAdapter;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.LibaoEntity;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
@ -81,16 +79,6 @@ public class LibaoDetailActivity extends BaseDetailActivity {
|
||||
downloadOffText = gameEntity.getDownloadOffText();
|
||||
initDownload(true);
|
||||
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
if (mLibaoEntity.getPlatform().equals(apkEntity.getPlatform())) {
|
||||
mLibaoEntity.setPackageName(apkEntity.getPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(mLibaoEntity.getPackageName()) && gameEntity.getApk().size() > 0) {
|
||||
mLibaoEntity.setPackageName(gameEntity.getApk().get(0).getPackageName());
|
||||
}
|
||||
|
||||
mAdapter.addLibaoDetail();
|
||||
}
|
||||
|
||||
|
||||
@ -48,14 +48,17 @@ import com.gh.gamecenter.manager.PackageManager;
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailAdapter;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.jakewharton.rxbinding.view.RxView;
|
||||
import com.tencent.tauth.Tencent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Action1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
@ -213,6 +216,35 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener
|
||||
detail_tv_per.setOnClickListener(this);
|
||||
reuse_no_connection.setOnClickListener(this);
|
||||
detail_ll_comment.setOnClickListener(this);
|
||||
|
||||
// 防抖处理
|
||||
RxView.clicks(iv_share)
|
||||
.throttleFirst(1, TimeUnit.SECONDS)
|
||||
.subscribe(new Action1<Void>() {
|
||||
@Override
|
||||
public void call(Void aVoid) {
|
||||
if (adapter != null && adapter.getNewsDetailEntity() != null) {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("名字", adapter.getNewsDetailEntity().getTitle());
|
||||
kv.put("位置", "分享");
|
||||
DataUtils.onEvent(NewsDetailActivity.this, "点击", "新闻详情", kv);
|
||||
|
||||
DataCollectionUtils.uploadClick(NewsDetailActivity.this, "分享", "新闻详情"
|
||||
, adapter.getNewsDetailEntity().getTitle());
|
||||
|
||||
String url = "http://www.ghzhushou.com/article/" +
|
||||
adapter.getNewsDetailEntity().getId() + ".html";
|
||||
if (gameEntity == null){
|
||||
showShare(url, adapter.getNewsDetailEntity().getTitle(),
|
||||
"http://image.ghzhushou.com/pic/57d604808ab49e467d8b4568.png",
|
||||
adapter.getNewsDetailEntity().getTitle(), null);
|
||||
}else {
|
||||
showShare(url, gameEntity.getName(), gameEntity.getIcon(),
|
||||
adapter.getNewsDetailEntity().getTitle(), gameEntity.getTag());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// @Override
|
||||
@ -370,27 +402,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener
|
||||
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
if (v == iv_share) {
|
||||
if (adapter != null && adapter.getNewsDetailEntity() != null) {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("名字", adapter.getNewsDetailEntity().getTitle());
|
||||
kv.put("位置", "分享");
|
||||
DataUtils.onEvent(this, "点击", "新闻详情", kv);
|
||||
|
||||
DataCollectionUtils.uploadClick(this, "分享", "新闻详情", adapter.getNewsDetailEntity().getTitle());
|
||||
|
||||
String url = "http://www.ghzhushou.com/article/" +
|
||||
adapter.getNewsDetailEntity().getId() + ".html";
|
||||
if (gameEntity == null){
|
||||
showShare(url, adapter.getNewsDetailEntity().getTitle(),
|
||||
"http://image.ghzhushou.com/pic/57d604808ab49e467d8b4568.png",
|
||||
adapter.getNewsDetailEntity().getTitle(), null);
|
||||
}else {
|
||||
showShare(url, gameEntity.getName(), gameEntity.getIcon(),
|
||||
adapter.getNewsDetailEntity().getTitle(), gameEntity.getTag());
|
||||
}
|
||||
}
|
||||
} else if (v == reuse_no_connection) {
|
||||
if (v == reuse_no_connection) {
|
||||
detail_rv_show.setVisibility(View.VISIBLE);
|
||||
reuse_ll_loading.setVisibility(View.VISIBLE);
|
||||
reuse_no_connection.setVisibility(View.GONE);
|
||||
|
||||
@ -5,6 +5,7 @@ import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
@ -19,12 +20,14 @@ import com.gh.gamecenter.adapter.StrategyAdapter;
|
||||
import com.gh.gamecenter.adapter.StrategyDialogAdapter;
|
||||
import com.gh.gamecenter.db.info.ConcernInfo;
|
||||
import com.gh.gamecenter.manager.ConcernManager;
|
||||
import com.jakewharton.rxbinding.view.RxView;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import rx.functions.Action1;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/12/5.
|
||||
@ -42,7 +45,9 @@ public class StrategyActivity extends BaseActivity implements StrategyDialogAdap
|
||||
|
||||
private PopupWindow mPopupWindow;
|
||||
|
||||
private int mDialogGamePosition;
|
||||
private static int mDialogGamePosition = -1;
|
||||
private static String gameId;
|
||||
private static String gameName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -52,9 +57,7 @@ public class StrategyActivity extends BaseActivity implements StrategyDialogAdap
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
mDialogGamePosition = -1;
|
||||
|
||||
mStrategyAdapter = new StrategyAdapter(this, null, mNoData);
|
||||
mStrategyAdapter = new StrategyAdapter(this, gameId, mNoData);
|
||||
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||
mStrategyRv.setLayoutManager(layoutManager);
|
||||
mStrategyRv.setAdapter(mStrategyAdapter);
|
||||
@ -77,9 +80,21 @@ public class StrategyActivity extends BaseActivity implements StrategyDialogAdap
|
||||
mSelectGameRl.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(gameName)) {
|
||||
mGameName.setText(gameName);
|
||||
}
|
||||
|
||||
// 防抖处理
|
||||
RxView.clicks(mSelectGameRl)
|
||||
.throttleFirst(1, TimeUnit.SECONDS)
|
||||
.subscribe(new Action1<Void>() {
|
||||
@Override
|
||||
public void call(Void aVoid) {
|
||||
OnSelectGameClickListener();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@OnClick(R.id.strategy_select_game_rl)
|
||||
public void OnSelectGameClickListener() {
|
||||
isShowPopupBg(true);
|
||||
|
||||
@ -93,8 +108,9 @@ public class StrategyActivity extends BaseActivity implements StrategyDialogAdap
|
||||
public void onClick(View v) {
|
||||
mGameName.setText("全部游戏");
|
||||
mDialogGamePosition = -1;
|
||||
gameId = null;
|
||||
isShowPopupBg(false);
|
||||
mStrategyAdapter = new StrategyAdapter(StrategyActivity.this, null, mNoData);
|
||||
mStrategyAdapter = new StrategyAdapter(StrategyActivity.this, gameId, mNoData);
|
||||
mStrategyRv.setAdapter(mStrategyAdapter);
|
||||
}
|
||||
});
|
||||
@ -178,12 +194,15 @@ public class StrategyActivity extends BaseActivity implements StrategyDialogAdap
|
||||
|
||||
@Override
|
||||
public void selectPosition(int position, ConcernInfo concernInfo) {
|
||||
gameId = concernInfo.getId();
|
||||
gameName = concernInfo.getGameName();
|
||||
mNoData.setVisibility(View.GONE);
|
||||
mDialogGamePosition = position;
|
||||
mGameName.setText(concernInfo.getGameName());
|
||||
|
||||
mGameName.setText(gameName);
|
||||
isShowPopupBg(false);
|
||||
|
||||
mStrategyAdapter = new StrategyAdapter(this, concernInfo.getId(), mNoData);
|
||||
mStrategyAdapter = new StrategyAdapter(this, gameId, mNoData);
|
||||
mStrategyRv.setAdapter(mStrategyAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,10 @@ package com.gh.gamecenter;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gc.materialdesign.views.ProgressBarCircularIndeterminate;
|
||||
import com.gh.base.BaseActivity;
|
||||
@ -18,9 +20,19 @@ import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.eventbus.EBNetworkState;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import okhttp3.ResponseBody;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
public class SubjectActivity extends BaseActivity {
|
||||
|
||||
private RecyclerView subject_list;
|
||||
@ -28,6 +40,7 @@ public class SubjectActivity extends BaseActivity {
|
||||
private ProgressBarCircularIndeterminate subject_pb_loading;
|
||||
private LinearLayout reuse_no_connection;
|
||||
private LinearLayoutManager layoutManager;
|
||||
private TextView actionbar_tv_title;
|
||||
|
||||
private int page = 1;
|
||||
|
||||
@ -57,8 +70,10 @@ public class SubjectActivity extends BaseActivity {
|
||||
|
||||
View contentView = View.inflate(this, R.layout.activity_subject, null);
|
||||
String name = getIntent().getStringExtra("name");
|
||||
String id = getIntent().getStringExtra("id");
|
||||
if (getIntent().getBundleExtra("data") != null) {
|
||||
name = getIntent().getBundleExtra("data").getString("name");
|
||||
id = getIntent().getBundleExtra("data").getString("id");
|
||||
}
|
||||
init(contentView, name);
|
||||
|
||||
@ -92,6 +107,38 @@ public class SubjectActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
if (TextUtils.isEmpty(name) && !TextUtils.isEmpty(id)) {
|
||||
getSubjectName(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void getSubjectName(String id) {
|
||||
RetrofitManager.getApi()
|
||||
.getSubjectName(id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ResponseBody>(){
|
||||
@Override
|
||||
public void onResponse(ResponseBody response) {
|
||||
super.onResponse(response);
|
||||
actionbar_tv_title = (TextView) findViewById(R.id.actionbar_tv_title);
|
||||
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(response.string().toString());
|
||||
actionbar_tv_title.setText(jsonObject.getString("name"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
super.onFailure(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.DownloadListener;
|
||||
@ -15,6 +16,7 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.gamecenter.entity.CommentnumEntity;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
|
||||
@ -35,6 +37,7 @@ public class WebActivity extends BaseActivity {
|
||||
@BindView(R.id.web_progressbar) ProgressBar progressBar;
|
||||
@BindView(R.id.web_comment) TextView webComment;
|
||||
@BindView(R.id.news_bottom) RelativeLayout newsBottom;
|
||||
@BindView(R.id.actionbar_tv_title) TextView newsTitle;
|
||||
|
||||
private String newsId;
|
||||
private int commentNum;
|
||||
@ -47,12 +50,13 @@ public class WebActivity extends BaseActivity {
|
||||
if (getIntent().getBundleExtra("data") != null) {
|
||||
Bundle data = getIntent().getBundleExtra("data");
|
||||
webUrl = data.getString("url");
|
||||
webTitle = "推送网页";
|
||||
webTitle = "";
|
||||
} else {
|
||||
webUrl = getIntent().getStringExtra("url");
|
||||
webTitle = getIntent().getStringExtra("gameName");
|
||||
newsId = getIntent().getStringExtra("newsId");
|
||||
}
|
||||
// webUrl = "http://tieba.baidu.com/f?kw=%E7%BD%91%E6%98%93%E9%98%B4%E9%98%B3%E5%B8%88&red_tag=3194925450";
|
||||
|
||||
View contentView = View.inflate(this, R.layout.activity_web, null);
|
||||
init(contentView, webTitle);
|
||||
@ -67,11 +71,11 @@ public class WebActivity extends BaseActivity {
|
||||
|
||||
//用webview打开url
|
||||
webView.setWebViewClient(new WebViewClient(){
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
// @Override
|
||||
// public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
// view.loadUrl(url);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
||||
@ -95,10 +99,23 @@ public class WebActivity extends BaseActivity {
|
||||
|
||||
//设置加载进度条
|
||||
webView.setWebChromeClient(new WebChromeClient(){
|
||||
|
||||
@Override
|
||||
public void onReceivedTitle(WebView view, String title) {
|
||||
super.onReceivedTitle(view, title);
|
||||
if (TextUtils.isEmpty(newsId)) {
|
||||
newsTitle.setEllipsize(TextUtils.TruncateAt.END);
|
||||
newsTitle.setPadding(DisplayUtils.dip2px(getApplication(), 30), 0,DisplayUtils.dip2px(getApplication(), 30), 0);
|
||||
newsTitle.setSingleLine();
|
||||
newsTitle.setText(title);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
progressBar.setProgress(newProgress);
|
||||
if (newProgress == 100){
|
||||
if (newProgress == 100 && newsId != null){
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if (newsBottom.getVisibility() == View.GONE) {
|
||||
newsBottom.setVisibility(View.VISIBLE);
|
||||
@ -136,7 +153,7 @@ public class WebActivity extends BaseActivity {
|
||||
super.onNext(response);
|
||||
if (response.size() > 0 && response.get(0).getNum() > 0) {
|
||||
commentNum = response.get(0).getNum();
|
||||
webComment.setText("查看评论(" + response.get(0).getNum() + ")");
|
||||
webComment.setText("查看评论 (" + response.get(0).getNum() + ")");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -156,7 +173,7 @@ public class WebActivity extends BaseActivity {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
// 刷新评论数
|
||||
if (resultCode == 1001 && progressBar.getVisibility() == View.VISIBLE && newsId != null) {
|
||||
webComment.setText("查看评论(" + data.getExtras().getInt("commentNum") + ")");
|
||||
webComment.setText("查看评论 (" + data.getExtras().getInt("commentNum") + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ public class ConcernRecommendAdapter extends RecyclerView.Adapter<ConcernViewHol
|
||||
|
||||
private ConcernManager concernManager;
|
||||
|
||||
private Toast toast;
|
||||
|
||||
public ConcernRecommendAdapter(ConcernActivity activity) {
|
||||
this.context = activity;
|
||||
this.listener = activity;
|
||||
@ -145,7 +147,11 @@ public class ConcernRecommendAdapter extends RecyclerView.Adapter<ConcernViewHol
|
||||
|
||||
concernManager.addByEntity(gameEntity);
|
||||
|
||||
Toast.makeText(context, "关注成功", Toast.LENGTH_SHORT).show();
|
||||
if (toast != null) {
|
||||
toast.cancel();
|
||||
}
|
||||
toast = Toast.makeText(context, "关注成功", Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
|
||||
listener.loadEmpty();
|
||||
}
|
||||
|
||||
@ -219,14 +219,14 @@ public class LibaoDetailAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||
holder.libaoCopyBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mLibaoDetailEntity.getInstallRequired()) {
|
||||
String msg;
|
||||
if (mLibaoDetailEntity != null && mLibaoDetailEntity.getInstallRequired()) {
|
||||
Spanned msg;
|
||||
if ("ling".equals(libaoInfo.getStatus())) {
|
||||
msg = "礼包码:" + libaoInfo.getCode() +
|
||||
"\n请尽快进入游戏兑换";
|
||||
msg = Html.fromHtml("礼包码:" + "<font color=\"#06D0A8\">" + libaoInfo.getCode() + "</font>" + " 复制成功" +
|
||||
"<br/>请尽快进入游戏兑换");
|
||||
} else {
|
||||
msg = "礼包码:" + libaoInfo.getCode() +
|
||||
"\n淘号礼包不保证可用,请尽快进入游戏尝试兑换";
|
||||
msg = Html.fromHtml("礼包码:" +"<font color=\"#ffb13c\">" + libaoInfo.getCode() + "</font>" + " 复制成功" +
|
||||
"<br/>淘号礼包不保证可用,请尽快进入游戏尝试兑换");
|
||||
}
|
||||
|
||||
LibaoUtils.lunningAppDialog(mContext, msg, mLibaoEntity);
|
||||
@ -237,7 +237,7 @@ public class LibaoDetailAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||
|
||||
Spanned libaoCode;
|
||||
if ("ling".equals(libaoInfo.getStatus())) {
|
||||
libaoCode = Html.fromHtml("已领取:" + "<font color=\"#00B7FA\">" +libaoInfo.getCode()+ "</font>");
|
||||
libaoCode = Html.fromHtml("已领取:" + "<font color=\"#06D0A8\">" +libaoInfo.getCode()+ "</font>");
|
||||
if (count == 0) {
|
||||
content = Html.fromHtml("剩余:" + count + "%");
|
||||
} else {
|
||||
|
||||
@ -24,6 +24,7 @@ import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameImageViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameTestViewHolder;
|
||||
import com.gh.gamecenter.db.LibaoDao;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.listener.OnCallBackListener;
|
||||
@ -48,17 +49,20 @@ public class SubjectAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||
private OnCallBackListener listener;
|
||||
|
||||
private List<GameEntity> subjectList;
|
||||
private boolean order;
|
||||
private boolean isLoaded;
|
||||
|
||||
|
||||
private ArrayMap<String, ArrayList<Integer>> locationMap;
|
||||
|
||||
private LibaoDao libaoDao;
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String entrance;
|
||||
|
||||
private boolean isRemove;
|
||||
private boolean isNetworkError;
|
||||
private boolean order;
|
||||
private boolean isLoaded;
|
||||
|
||||
public SubjectAdapter(SubjectActivity activity) {
|
||||
|
||||
@ -81,6 +85,7 @@ public class SubjectAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||
subjectList = new ArrayList<>();
|
||||
isLoaded = false;
|
||||
isNetworkError = false;
|
||||
libaoDao = new LibaoDao(context);
|
||||
|
||||
initList(1);
|
||||
}
|
||||
@ -378,10 +383,14 @@ public class SubjectAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||
|
||||
final GameEntity gameEntity = subjectList.get(position);
|
||||
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
if (libaoDao.isExist(gameEntity.getId())) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.libaoIcon.setVisibility(View.GONE);
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.libaoIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
holder.gameThumb.setImageURI(gameEntity.getIcon());
|
||||
|
||||
@ -37,6 +37,17 @@ public class AppRunTimeDao {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新一个记录
|
||||
*/
|
||||
public void update(AppRunTimeInfo runTimeInfo) {
|
||||
try {
|
||||
dao.update(runTimeInfo);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据包名获取某一个App的运行时长
|
||||
*/
|
||||
|
||||
@ -65,8 +65,20 @@ public class LibaoDao {
|
||||
try {
|
||||
dao.deleteById(libaoId);
|
||||
} catch (SQLException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExist(String gameId) {
|
||||
try {
|
||||
if (dao.queryBuilder().where().eq("gameId", gameId).query().size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public class VoteDao {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* 根据commentId 查找是否点过赞
|
||||
*/
|
||||
public boolean isVote(String id) {
|
||||
|
||||
@ -51,10 +51,21 @@ public class LibaoInfo implements Serializable {
|
||||
@DatabaseField(columnName = "active")
|
||||
private boolean active = true;
|
||||
|
||||
@DatabaseField(columnName = "packName")
|
||||
private String packName;
|
||||
|
||||
public LibaoInfo() {
|
||||
|
||||
}
|
||||
|
||||
public String getPackName() {
|
||||
return packName;
|
||||
}
|
||||
|
||||
public void setPackName(String packName) {
|
||||
this.packName = packName;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
@ -168,6 +179,7 @@ public class LibaoInfo implements Serializable {
|
||||
libaoInfo.setCode(libaoEntity.getCode());
|
||||
libaoInfo.setAvailable(libaoEntity.getAvailable());
|
||||
libaoInfo.setTotal(libaoEntity.getTotal());
|
||||
libaoInfo.setPackName(libaoEntity.getPackageName());
|
||||
return libaoInfo;
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ public class LibaoEntity {
|
||||
|
||||
private int total;
|
||||
|
||||
@SerializedName("package")
|
||||
private String packageName;
|
||||
|
||||
private boolean active;
|
||||
@ -175,6 +176,7 @@ public class LibaoEntity {
|
||||
libaoEntity.setCode(libaoInfo.getCode());
|
||||
libaoEntity.setAvailable(libaoInfo.getAvailable());
|
||||
libaoEntity.setTotal(libaoInfo.getTotal());
|
||||
libaoEntity.setPackageName(libaoInfo.getPackName());
|
||||
return libaoEntity;
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,10 @@ public class GameFragment extends HomeFragment implements SwipeRefreshLayout.OnR
|
||||
offset = y - y1;
|
||||
y = y1;
|
||||
if ((adapterPosition == -1 || adapterPosition == 0) && Math.abs(offset) < 50) {
|
||||
adapter.stretchTop(-Math.round(offset)/2, false);
|
||||
|
||||
float d = (offset) * adapter.getDragPercent();
|
||||
|
||||
adapter.stretchTop(-Math.round(d), false);
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
|
||||
@ -50,6 +50,8 @@ import com.gh.gamecenter.adapter.viewholder.GameImageViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameTestViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewPagerViewHolder;
|
||||
import com.gh.gamecenter.db.LibaoDao;
|
||||
import com.gh.gamecenter.db.info.LibaoInfo;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
@ -88,11 +90,14 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
private List<GameEntity> pluginList;
|
||||
private List<SubjectEntity> subjectList;
|
||||
private List<SubjectDigestEntity> subjectDigestList;
|
||||
private List<LibaoInfo> libaoInfos;
|
||||
|
||||
// 包名对应游戏位置
|
||||
private ArrayMap<String, ArrayList<Integer>> locationMap;
|
||||
private ArrayMap<String, List<GameEntity>> subjectChangedMap; //存储换一换的数据
|
||||
|
||||
private LibaoDao libaoDao;
|
||||
|
||||
private int itemCount;
|
||||
private int pluginSize;
|
||||
|
||||
@ -115,6 +120,9 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
this.context = fragment.getActivity();
|
||||
this.listener = fragment;
|
||||
|
||||
libaoDao = new LibaoDao(context);
|
||||
libaoInfos = libaoDao.getAll();
|
||||
|
||||
game_swipe_refresh = refreshLayout;
|
||||
|
||||
slideList = new ArrayList<>();
|
||||
@ -517,7 +525,7 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
|
||||
// topHeight = (int) (outMetrics.widthPixels / 16f * 10f);
|
||||
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, topHeight); //整个头部大小16:10 viewpager大小16:7
|
||||
view.setLayoutParams(params);
|
||||
|
||||
@ -525,6 +533,14 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
RelativeLayout.LayoutParams vpParams = new RelativeLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, (int) (outMetrics.widthPixels / 16f * 7f));
|
||||
viewPager.setLayoutParams(vpParams);
|
||||
|
||||
LinearLayout hint = (LinearLayout) view.findViewById(R.id.viewpager_ll_hint);
|
||||
RelativeLayout.LayoutParams hintParams = new RelativeLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
hintParams.setMargins(0, (int) (outMetrics.widthPixels / 16f * 5.3f), 0, 0);
|
||||
hintParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||
hint.setLayoutParams(hintParams);
|
||||
|
||||
return new GameViewPagerViewHolder(view);
|
||||
} else if (viewType == ItemViewType.COLUMN_HEADER) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(
|
||||
@ -588,13 +604,39 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
}
|
||||
|
||||
if (slideList.size() != 0 && viewHolder.viewPager.getAdapter() == null) {
|
||||
viewHolder.viewpager_ll_hint.removeAllViews();
|
||||
for (int i = 0, size = slideList.size(); i < size; i++) {
|
||||
ImageView imageView = new ImageView(context);
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
DisplayUtils.dip2px(context, 6), DisplayUtils.dip2px(context, 6));
|
||||
lparams.bottomMargin = DisplayUtils.dip2px(context, 6);
|
||||
if (i == 0) {
|
||||
imageView.setImageResource(R.drawable.oval_hint_up);
|
||||
} else {
|
||||
imageView.setImageResource(R.drawable.oval_hint_dn);
|
||||
}
|
||||
if (i != 0) {
|
||||
lparams.leftMargin = DisplayUtils.dip2px(context, 6);
|
||||
}
|
||||
imageView.setLayoutParams(lparams);
|
||||
viewHolder.viewpager_ll_hint.addView(imageView);
|
||||
}
|
||||
|
||||
viewHolder.viewPager.setAdapter(new ImagePagerAdapter(context, slideList, true));
|
||||
viewHolder.viewPager.setInterval(3000);
|
||||
viewHolder.viewPager.startAutoScroll();
|
||||
viewHolder.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
|
||||
for (int i = 0, size = viewHolder.viewpager_ll_hint.getChildCount(); i < size; i++) {
|
||||
if (i == position % size) {
|
||||
((ImageView) viewHolder.viewpager_ll_hint.getChildAt(i))
|
||||
.setImageResource(R.drawable.oval_hint_up);
|
||||
} else {
|
||||
((ImageView) viewHolder.viewpager_ll_hint.getChildAt(i))
|
||||
.setImageResource(R.drawable.oval_hint_dn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -734,10 +776,14 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
}
|
||||
}
|
||||
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
if (libaoDao.isExist(gameEntity.getId())) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.libaoIcon.setVisibility(View.GONE);
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.libaoIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (subjectEntity.isOrder()) {
|
||||
@ -1021,7 +1067,6 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
holder.link.setVisibility(View.GONE);
|
||||
}else {
|
||||
holder.link.setVisibility(View.VISIBLE);
|
||||
//TODO
|
||||
if (subjectList.get(i).getHome().equals("change")) {
|
||||
holder.more.setText("换一批");
|
||||
holder.more.setTextColor(context.getResources().getColor(R.color.theme));
|
||||
@ -1046,7 +1091,6 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
holder.progressBar.setVisibility(View.VISIBLE);
|
||||
//TODO 换一批操作
|
||||
boolean isNetworkLoad = true;
|
||||
for (String subjectId : subjectChangedMap.keySet()) {
|
||||
if (subjectId.equals(subjectEntity.getId())) {
|
||||
@ -1201,6 +1245,12 @@ public class GameFragmentAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
|
||||
}
|
||||
|
||||
public float getDragPercent() {
|
||||
int offset = topHeight - topHeightOld;
|
||||
float distance = (float) (offset * 3) / (float) topHeightOld;
|
||||
return (float) (1.0 - distance);
|
||||
}
|
||||
|
||||
public void startAutoScroll() {
|
||||
isAutoScroll = true;
|
||||
notifyItemChanged(0);
|
||||
|
||||
@ -148,8 +148,7 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
@Override
|
||||
public void onResponse(List<LibaoEntity> response) {
|
||||
super.onResponse(response);
|
||||
libaoList = response;
|
||||
getLibaoStatus(libaoList);
|
||||
getLibaoStatus(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,7 +160,7 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
|
||||
//获取礼包状态
|
||||
private void getLibaoStatus(List<LibaoEntity> response) {
|
||||
private void getLibaoStatus(final List<LibaoEntity> response) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0, size = response.size(); i < size; i++) {
|
||||
builder.append(response.get(i).getId());
|
||||
@ -189,22 +188,27 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < libaoList.size(); i++) {
|
||||
LibaoEntity libaoEntity = libaoList.get(i);
|
||||
for (int i = 0; i < response.size(); i++) {
|
||||
LibaoEntity libaoEntity = response.get(i);
|
||||
for (LibaoStatusEntity libaoStatusEntity : list) {
|
||||
if ("finish".equals(libaoEntity.getStatus())) {
|
||||
libaoList.remove(i);
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
if (libaoEntity.getId().equals(libaoStatusEntity.getId())) {
|
||||
libaoEntity.setStatus(libaoStatusEntity.getStatus());
|
||||
libaoEntity.setAvailable(libaoStatusEntity.getAvailable());
|
||||
libaoEntity.setTotal(libaoStatusEntity.getTotal());
|
||||
if (libaoStatusEntity.getId().equals(libaoEntity.getId())) {
|
||||
if ("finish".equals(libaoStatusEntity.getStatus())) {
|
||||
response.remove(i);
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
if (libaoEntity.getId().equals(libaoStatusEntity.getId())) {
|
||||
libaoEntity.setStatus(libaoStatusEntity.getStatus());
|
||||
libaoEntity.setAvailable(libaoStatusEntity.getAvailable());
|
||||
libaoEntity.setTotal(libaoStatusEntity.getTotal());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initPosition();
|
||||
if (response.size() != 0) {
|
||||
libaoList = response;
|
||||
initPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@ -874,30 +878,26 @@ public class GameDetailAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
int index = 0;
|
||||
if (position_top != -1 && gameDetailEntity.isSkinTest()) {
|
||||
index = 1;
|
||||
}
|
||||
|
||||
if (position_top != -1 && position == position_top) {
|
||||
return 1;
|
||||
}
|
||||
if (position_top != -1 && gameDetailEntity.isSkinTest() && position == position_top + 1) {
|
||||
if (position_top != -1 && gameDetailEntity.isSkinTest() && position == position_skin) {
|
||||
return 6;
|
||||
}
|
||||
if (position_newsserver != -1 && position == position_newsserver + index) {
|
||||
if (position_newsserver != -1 && position == position_newsserver) {
|
||||
return 2;
|
||||
}
|
||||
if (position_plugin != -1 && position == position_plugin + index) {
|
||||
if (position_plugin != -1 && position == position_plugin) {
|
||||
return 3;
|
||||
}
|
||||
if (position_libao != -1 && position == position_libao + index) {
|
||||
if (position_libao != -1 && position == position_libao) {
|
||||
return 7;
|
||||
}
|
||||
if (position_news != -1 && position == position_news + index) {
|
||||
if (position_news != -1 && position == position_news) {
|
||||
return 4;
|
||||
}
|
||||
if (position_intro != -1 && position == position_intro + index) {
|
||||
if (position_intro != -1 && position == position_intro) {
|
||||
return 5;
|
||||
}
|
||||
return position;
|
||||
|
||||
@ -2,7 +2,6 @@ package com.gh.gamecenter.gamedetail;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -39,35 +38,10 @@ public class GameLibaoGalleryAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||
LibaoEntity libaoEntity = mLibaoList.get(position);
|
||||
viewHolder.libaoName.setText(libaoEntity.getName());
|
||||
|
||||
|
||||
if (libaoEntity.getStatus() == null) return;
|
||||
|
||||
switch (libaoEntity.getStatus()) {
|
||||
case "coming":
|
||||
viewHolder.libaoBtn.setText("未开始");
|
||||
viewHolder.libaoBtn.setBackgroundColor(Color.parseColor("#00B7FA"));
|
||||
break;
|
||||
case "ling":
|
||||
viewHolder.libaoBtn.setText("领取");
|
||||
viewHolder.libaoBtn.setBackgroundColor(Color.parseColor("#06D0A8"));
|
||||
break;
|
||||
case "tao":
|
||||
viewHolder.libaoBtn.setText("淘号");
|
||||
viewHolder.libaoBtn.setBackgroundColor(Color.parseColor("#ffb13c"));
|
||||
break;
|
||||
case "used_up":
|
||||
viewHolder.libaoBtn.setText("已领光");
|
||||
viewHolder.libaoBtn.setBackgroundColor(Color.parseColor("#DCDCDC"));
|
||||
break;
|
||||
case "linged":
|
||||
viewHolder.libaoBtn.setText("已领取");
|
||||
viewHolder.libaoBtn.setBackgroundColor(Color.parseColor("#00B7FA"));
|
||||
break;
|
||||
case "taoed":
|
||||
viewHolder.libaoBtn.setText("已淘号");
|
||||
viewHolder.libaoBtn.setBackgroundColor(Color.parseColor("#00B7FA"));
|
||||
break;
|
||||
}
|
||||
viewHolder.libaoBtn.setOnClickListener(new View.OnClickListener() {
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AppController.put("libaoEntity", mLibaoList.get(position));
|
||||
@ -75,10 +49,6 @@ public class GameLibaoGalleryAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
if ("used_up".equals(libaoEntity.getStatus())) {
|
||||
viewHolder.libaoBtn.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -15,7 +15,6 @@ import butterknife.ButterKnife;
|
||||
public class GameLibaoGalleryViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
@BindView(R.id.gamedetail_libao_name) public TextView libaoName;
|
||||
@BindView(R.id.gamedetail_libao_btn) public TextView libaoBtn;
|
||||
|
||||
public GameLibaoGalleryViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
@ -289,6 +289,16 @@ public class Libao1FragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
||||
imm.hideSoftInputFromWindow(libao1Fragment.getActivity().getWindow().getDecorView().getWindowToken(), 0);
|
||||
}
|
||||
});
|
||||
|
||||
holder.searchEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(libao1Fragment.getActivity().getWindow().getDecorView().getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initLibaoViewHolder(final LibaoNormalViewHolder holder, final int position) {
|
||||
|
||||
@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -61,7 +62,7 @@ public class Libao3FragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
||||
mCallBackListener.loadEmpty();
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < mLibaoInfos.size(); i++) { // 数据转换
|
||||
for (int i = mLibaoInfos.size() - 1; i >= 0; i--) { // 数据转换
|
||||
LibaoInfo libaoInfo = mLibaoInfos.get(i);
|
||||
if (!libaoInfo.isActive()) {
|
||||
continue;
|
||||
@ -105,13 +106,17 @@ public class Libao3FragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
||||
|
||||
viewHolder.libaoGameIcon.setImageURI(libaoEntity.getIcon());
|
||||
|
||||
viewHolder.libaoGameName.setText(libaoEntity.getGame().getName() + " - " + PlatformUtils.getInstance(mContext)
|
||||
.getPlatformName(libaoEntity.getPlatform()));
|
||||
if (TextUtils.isEmpty(libaoEntity.getPlatform())) {
|
||||
viewHolder.libaoGameName.setText(libaoEntity.getGame().getName());
|
||||
} else {
|
||||
viewHolder.libaoGameName.setText(libaoEntity.getGame().getName() + " - " +PlatformUtils.getInstance(mContext)
|
||||
.getPlatformName(libaoEntity.getPlatform()));
|
||||
}
|
||||
|
||||
if (libaoEntity.getCode() != null ) {
|
||||
Spanned content;
|
||||
if ("ling".equals(libaoEntity.getStatus())) {
|
||||
content = Html.fromHtml("已领取:" + "<font color=\"#00B7FA\">" +libaoEntity.getCode()+ "</font>");
|
||||
content = Html.fromHtml("已领取:" + "<font color=\"#06D0A8\">" +libaoEntity.getCode()+ "</font>");
|
||||
} else {
|
||||
content = Html.fromHtml("已淘号:" + "<font color=\"#ffb13c\">" +libaoEntity.getCode()+ "</font>");
|
||||
}
|
||||
@ -121,6 +126,19 @@ public class Libao3FragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LibaoUtils.copyLink(libaoEntity.getCode(), mContext);
|
||||
if (!TextUtils.isEmpty(libaoEntity.getPackageName()) && LibaoUtils.isAppInstalled(mContext
|
||||
, libaoEntity.getPackageName())) {
|
||||
Spanned msg;
|
||||
if ("ling".equals(libaoEntity.getStatus())) {
|
||||
msg = Html.fromHtml("礼包码:" + "<font color=\"#06D0A8\">" + libaoEntity.getCode() + "</font>" + " 复制成功" +
|
||||
"<br/>请尽快进入游戏兑换");
|
||||
} else {
|
||||
msg = Html.fromHtml("礼包码:" +"<font color=\"#ffb13c\">" + libaoEntity.getCode() + "</font>" + " 复制成功" +
|
||||
"<br/>淘号礼包不保证可用,请尽快进入游戏尝试兑换");
|
||||
}
|
||||
LibaoUtils.lunningAppDialog(mContext, msg, libaoEntity);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -137,8 +155,8 @@ public class Libao3FragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
||||
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
DialogUtils.showWarningDialog(mContext, "删除礼包", "礼包码删除之后"+
|
||||
"<font color=\"#ff0000\">不可恢复</font>" +",请确定您已经兑换过该礼包"
|
||||
DialogUtils.showWarningDialog(mContext, "删除礼包", Html.fromHtml( "礼包码删除之后"+
|
||||
"<font color=\"#ff0000\">不可恢复</font>" +",请确定您已经兑换过该礼包")
|
||||
, "取消", "确定删除"
|
||||
, new DialogUtils.ConfiremListener() {
|
||||
@Override
|
||||
|
||||
@ -18,6 +18,7 @@ import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.db.LibaoDao;
|
||||
import com.gh.gamecenter.db.info.ConcernInfo;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
@ -45,6 +46,8 @@ public class ConcernFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
private Context context;
|
||||
private OnCallBackListener listener;
|
||||
|
||||
private LibaoDao libaoDao;
|
||||
|
||||
private List<ConcernInfo> concernList;
|
||||
private List<GameEntity> gameList;
|
||||
|
||||
@ -67,6 +70,8 @@ public class ConcernFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
|
||||
cardMargin = (int) context.getResources().getDimension(R.dimen.cardview_margin);
|
||||
|
||||
libaoDao = new LibaoDao(context);
|
||||
|
||||
ConcernManager concernManager = new ConcernManager(context);
|
||||
concernList = concernManager.getConcernGame();
|
||||
|
||||
@ -183,6 +188,16 @@ public class ConcernFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
|
||||
private void initGameNormal(final GameNormalViewHolder holder, final GameEntity gameEntity, int i) {
|
||||
|
||||
if (libaoDao.isExist(gameEntity.getId())) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.libaoIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
// 第一个
|
||||
if (i == 0) {
|
||||
((CardLinearLayout) holder.itemView).setmTop(cardMargin);
|
||||
|
||||
@ -21,6 +21,7 @@ import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.db.LibaoDao;
|
||||
import com.gh.gamecenter.db.info.ConcernInfo;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
@ -59,6 +60,8 @@ public class InstallFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
|
||||
private boolean isRemove;
|
||||
|
||||
private LibaoDao libaoDao;
|
||||
|
||||
public InstallFragmentAdapter(InstallFragment fragment) {
|
||||
this.context = fragment.getActivity();
|
||||
|
||||
@ -71,6 +74,8 @@ public class InstallFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
|
||||
cardMargin = (int) context.getResources().getDimension(R.dimen.cardview_margin);
|
||||
|
||||
libaoDao = new LibaoDao(context);
|
||||
|
||||
ConcernManager cManager = new ConcernManager(context);
|
||||
List<ConcernInfo> runnableGame = cManager.getInstalledGame();
|
||||
if (runnableGame.isEmpty()) {
|
||||
@ -236,6 +241,7 @@ public class InstallFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
for (GameEntity entity : gameList) {
|
||||
if (entity.getId().equals(id)) {
|
||||
GameEntity newEntity = entity.clone();
|
||||
newEntity.setLibaoExists(entity.isLibaoExists());
|
||||
if (newEntity != null && newEntity.getApk().size() > 1) {
|
||||
for (ApkEntity apkEntity : newEntity.getApk()) {
|
||||
if (sortedList.get(i).getPackageName().equals(apkEntity.getPackageName())) {
|
||||
@ -358,10 +364,14 @@ public class InstallFragmentAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||
|
||||
holder.gameThumb.setImageURI(gameEntity.getIcon());
|
||||
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
if (libaoDao.isExist(gameEntity.getId())) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.libaoIcon.setVisibility(View.GONE);
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
holder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.libaoIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (gameEntity.getApk() == null || gameEntity.getApk().isEmpty()
|
||||
|
||||
@ -152,7 +152,7 @@ public interface ApiService {
|
||||
@GET("index/recommend")
|
||||
Observable<List<SubjectDigestEntity>> getSubjectDigest(); //获取主页专题入口数据
|
||||
|
||||
@GET("game/column/{subject_id}/huanyihuan}")
|
||||
@GET("game/column/{subject_id}/huanyihuan")
|
||||
Observable<List<GameEntity>> getSubjectGame(@Path("subject_id") String subject_id); //获取专题游戏 用于主页换一批
|
||||
|
||||
@Headers({"Content-Type: application/json", "Accept: application/json"})
|
||||
@ -165,4 +165,7 @@ public interface ApiService {
|
||||
@GET("device/{device_id}/concern") // 获取设备关注数据
|
||||
Observable<List<String>> getConcern(@Path("device_id") String device_id);
|
||||
|
||||
@GET("column/{column_id}/name")
|
||||
Observable<ResponseBody> getSubjectName(@Path("column_id") String column_id); //根据专题ID获取专题名称
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.gh.base.AppController;
|
||||
import com.gh.common.util.GzipUtils;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -39,8 +40,8 @@ public class OkHttpInterceptor implements Interceptor {
|
||||
}
|
||||
|
||||
// log 打印
|
||||
// Utils.log(String.format("Interceptor Sending request %s on %s%n%s",
|
||||
// request.url(), chain.connection(), request.headers()));
|
||||
Utils.log(String.format("Interceptor Sending request %s on %s%n%s",
|
||||
request.url(), chain.connection(), request.headers()));
|
||||
|
||||
Response response = chain.proceed(request);
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.db.LibaoDao;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.listener.OnCallBackListener;
|
||||
@ -40,6 +41,8 @@ public class SearchGameDetailFragmentAdapter extends RecyclerView.Adapter<Recycl
|
||||
private List<GameEntity> gameList;
|
||||
private ArrayMap<String, ArrayList<Integer>> locationMap;
|
||||
|
||||
private LibaoDao libaoDao;
|
||||
|
||||
private String key;
|
||||
|
||||
public SearchGameDetailFragmentAdapter(SearchGameDetailFragment fragment, String key) {
|
||||
@ -49,6 +52,8 @@ public class SearchGameDetailFragmentAdapter extends RecyclerView.Adapter<Recycl
|
||||
gameList = new ArrayList<>();
|
||||
locationMap = new ArrayMap<>();
|
||||
|
||||
libaoDao = new LibaoDao(context);
|
||||
|
||||
this.key = key;
|
||||
if (!TextUtils.isEmpty(key)) {
|
||||
search(key);
|
||||
@ -124,10 +129,14 @@ public class SearchGameDetailFragmentAdapter extends RecyclerView.Adapter<Recycl
|
||||
final GameNormalViewHolder viewHolder = (GameNormalViewHolder) holder;
|
||||
final GameEntity gameEntity = gameList.get(position);
|
||||
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
if (libaoDao.isExist(gameEntity.getId())) {
|
||||
viewHolder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.libaoIcon.setVisibility(View.GONE);
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
viewHolder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.libaoIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
// 第一个
|
||||
|
||||
@ -18,6 +18,7 @@ import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.view.CardLinearLayout;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.db.LibaoDao;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.listener.OnCallBackListener;
|
||||
@ -40,12 +41,16 @@ public class SearchGameListFragmentAdapter extends RecyclerView.Adapter<Recycler
|
||||
private List<GameEntity> gameList;
|
||||
private ArrayMap<String, ArrayList<Integer>> locationMap;
|
||||
|
||||
private LibaoDao libaoDao;
|
||||
|
||||
private String key;
|
||||
|
||||
public SearchGameListFragmentAdapter(SearchGameListFragment fragment, String key) {
|
||||
this.context = fragment.getActivity();
|
||||
this.listener = fragment;
|
||||
|
||||
libaoDao = new LibaoDao(context);
|
||||
|
||||
gameList = new ArrayList<>();
|
||||
locationMap = new ArrayMap<>();
|
||||
|
||||
@ -124,10 +129,14 @@ public class SearchGameListFragmentAdapter extends RecyclerView.Adapter<Recycler
|
||||
((CardLinearLayout) viewHolder.itemView).setmTop(DisplayUtils.dip2px(context, 8));
|
||||
((CardLinearLayout) viewHolder.itemView).setmBottom(0);
|
||||
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
if (libaoDao.isExist(gameEntity.getId())) {
|
||||
viewHolder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.libaoIcon.setVisibility(View.GONE);
|
||||
if (gameEntity.isLibaoExists()) {
|
||||
viewHolder.libaoIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.libaoIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
((GameNormalViewHolder) holder).gameThumb.setImageURI(gameEntity.getIcon());
|
||||
|
||||
@ -14,7 +14,7 @@ public class StatisticsUtils {
|
||||
|
||||
if (runTimeDao.isExist(packageName)) {
|
||||
Utils.log("存在记录=================" + (runTimeCount + runTimeDao.getRunTimeCount(packageName)));
|
||||
runTimeDao.add(new AppRunTimeInfo(packageName, (runTimeCount + runTimeDao.getRunTimeCount(packageName))));
|
||||
runTimeDao.update(new AppRunTimeInfo(packageName, (runTimeCount + runTimeDao.getRunTimeCount(packageName))));
|
||||
} else {
|
||||
Utils.log("不存在记录=================" + runTimeCount);
|
||||
runTimeDao.add(new AppRunTimeInfo(packageName, runTimeCount ));
|
||||
|
||||
Reference in New Issue
Block a user