Compare commits

...

35 Commits

Author SHA1 Message Date
44deb59624 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
# Conflicts:
#	gradle.properties
2017-12-11 18:42:29 +08:00
27fc39cb70 revert tinkerid 2017-12-11 17:35:25 +08:00
5480caf44e update gradle to 3.0 & fix tinker filepath 2017-12-11 17:33:44 +08:00
a448a974f1 1.开服日历页面时关闭日历详情
2.删除对开服信息时间的判断 如果有开服信息就显示开服日历
2017-12-07 16:14:15 +08:00
1738fac5fd Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2017-12-06 18:33:10 +08:00
7b74318ca5 修复详情页面 启动需要检查网络的BUG 2017-12-06 18:32:19 +08:00
6dabbe19dd update libs 2017-12-06 16:15:20 +08:00
e286be7f1e 修复开服表过年无法显示问题,修改开服表显示规则 2017-12-05 16:39:21 +08:00
ef040f68c7 区分企业QQ和普通QQ的打开方式 2017-12-05 10:15:44 +08:00
b134d077cf 礼包领取判断修正 2017-12-04 12:01:43 +08:00
69fe3b3d76 fix appbar scroll behavior 2017-11-28 15:37:57 +08:00
c134c4bf9e 删除无用log 2017-11-28 09:22:09 +08:00
633acb9236 礼包领取限制 2017-11-27 16:03:32 +08:00
cf84205571 修复礼包列表和专题列表分页加载过慢问题 2017-11-27 15:04:12 +08:00
5aced2c03c 光环助手V3.0.2优化需求与bug汇总(11-27) 2017-11-27 11:57:11 +08:00
6cfa949493 解决跳转QQ后无法聊天问题 2017-11-27 09:27:29 +08:00
dcfe3dee0e Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2017-11-23 20:04:24 +08:00
8348568ea7 修复3.0.1意见反馈Bug
1.ImageUtils传入的url允许为空
2.修复专题ActionBarTitle有可能为空问题
2017-11-23 19:58:00 +08:00
1d5dece894 fix git submodule update script 2017-11-23 15:57:52 +08:00
64594c4457 调整下载重试时间间隔 2017-11-22 17:12:07 +08:00
c2274d6b6f 3.0升级日志 2017-11-22 15:44:04 +08:00
165059ca2d 快传 传送最低时间设为1秒 2017-11-22 15:07:29 +08:00
89e05d1a29 设置GH_TEST渠道为Bugly(tinker)开发设备 2017-11-20 17:24:02 +08:00
9f00cab409 优化首页缓存 2017-11-19 12:00:00 +08:00
e8a795f97b 1117测试问题:
1.如果后台隐藏了评论,前端在消息中心点击跳转对话详情,会一直转圈圈,也没任何提示(应该要出现飞碟提示才对)
2.消息中心-客服,排版和“评论”不一致
(1)分割线与头像之间的间距(比“评论”那边窄了)
(2)昵称和时间之间的间距(比“评论”那边宽了)
2017-11-17 11:37:00 +08:00
96c233ebd0 光环助手V3.0.2 评论对话增加弹窗(回复/点赞/复制 等) 2017-11-16 20:04:03 +08:00
36ef13b237 光环助手V3.0.2优化需求汇总(20171116) 2017-11-16 18:06:23 +08:00
f54fdd6016 可以多次重定向,但有数量限制.断网重连先延迟后判断 2017-11-16 12:02:32 +08:00
a43947077a 新增打渠道包脚本 2017-11-16 09:19:47 +08:00
a863b7be13 fix proguard library 2017-11-15 17:33:47 +08:00
ab1ce8e179 HttpDns版本和友盟HttpDns改成一致 2017-11-15 17:12:27 +08:00
d391ab20b7 更换3.0.1tinker_id以及tinker_base_apk_dir 2017-11-15 15:13:47 +08:00
8403bc3a64 求版本敏感词优化 2017-11-15 15:07:34 +08:00
038e736eb1 下载暂停和继续延迟一秒,防止一个包同时有多个线程在下载(后续想一个更好的方案) 2017-11-15 10:41:02 +08:00
a215192175 下载增加httpdns 2017-11-14 20:42:27 +08:00
76 changed files with 1011 additions and 540 deletions

View File

@ -1,5 +1,12 @@
### Ver 3.0
* x
* 升级账号系统(登录流程/用户信息相关/用户账号相关操作(评论,礼包...))
* 新增收藏功能(文章/工具箱)
* 删除用户相关的所有本地数据库
* 重做总开服表
* 重做首页插件化模块
* 礼包重复领取机制改变(可重复领取的礼包,领取后立刻显示再领一个/再淘一个)
* 游戏下载平台面板修改(加快弹出速度,不再读取本地平台图片)
* 接入bugly(tinker)
### Ver 2.6
* xx

View File

@ -100,12 +100,15 @@ android {
}
}
flavorDimensions "nonsense"
/**
* 多渠道打包,渠道请参考"channel.txt"文件所有渠道值均通过java code设置
*/
productFlavors {
// publish release host
publish {
dimension "nonsense"
buildConfigField "String", "API_HOST", "\"${API_HOST}\""
buildConfigField "String", "USER_HOST", "\"${USER_HOST}\""
buildConfigField "String", "COMMENT_HOST", "\"${COMMENT_HOST}\""
@ -121,6 +124,7 @@ android {
}
// internal test dev host
internal {
dimension "nonsense"
buildConfigField "String", "API_HOST", "\"${DEV_API_HOST}\""
buildConfigField "String", "USER_HOST", "\"${DEV_USER_HOST}\""
buildConfigField "String", "COMMENT_HOST", "\"${DEV_COMMENT_HOST}\""
@ -161,79 +165,79 @@ rebuildChannel {
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
implementation fileTree(include: '*.jar', dir: 'libs')
debugCompile "com.squareup.leakcanary:leakcanary-android:${leakcanary}"
debugCompile "com.facebook.stetho:stetho:${stetho}"
debugCompile "com.facebook.stetho:stetho-okhttp3:${stetho}"
debugCompile "com.squareup.okhttp3:logging-interceptor:${okHttp}"
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakcanary}"
debugImplementation "com.facebook.stetho:stetho:${stetho}"
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stetho}"
debugImplementation "com.squareup.okhttp3:logging-interceptor:${okHttp}"
compile "com.android.support:multidex:${multidex}"
compile "com.android.support:design:${androidSupport}"
compile "com.android.support:support-v4:${androidSupport}"
compile "com.android.support:appcompat-v7:${androidSupport}"
compile "com.android.support:support-annotations:${androidSupport}"
compile "com.android.support:percent:${androidSupport}"
implementation "com.android.support:multidex:${multidex}"
implementation "com.android.support:design:${androidSupport}"
implementation "com.android.support:support-v4:${androidSupport}"
implementation "com.android.support:appcompat-v7:${androidSupport}"
implementation "com.android.support:support-annotations:${androidSupport}"
implementation "com.android.support:percent:${androidSupport}"
compile "com.kyleduo.switchbutton:library:${switchButton}"
compile "com.readystatesoftware.systembartint:systembartint:${systemBarTint}"
implementation "com.kyleduo.switchbutton:library:${switchButton}"
implementation "com.readystatesoftware.systembartint:systembartint:${systemBarTint}"
compile "com.facebook.fresco:fresco:${fresco}"
compile "com.facebook.fresco:animated-gif:${fresco}"
implementation "com.facebook.fresco:fresco:${fresco}"
implementation "com.facebook.fresco:animated-gif:${fresco}"
compile "com.squareup.okhttp3:okhttp:${okHttp}"
implementation "com.squareup.okhttp3:okhttp:${okHttp}"
compile "com.leon.channel:helper:${apkChannelPackage}"
implementation "com.leon.channel:helper:${apkChannelPackage}"
compile "com.squareup.retrofit2:retrofit:${retrofit}"
compile "com.squareup.retrofit2:converter-gson:${retrofit}" // include gson 2.7
compile "com.squareup.retrofit2:adapter-rxjava:${retrofit}"
// compile "com.google.code.gson:gson:${gson}"
implementation "com.squareup.retrofit2:retrofit:${retrofit}"
implementation "com.squareup.retrofit2:converter-gson:${retrofit}" // include gson 2.7
implementation "com.squareup.retrofit2:adapter-rxjava:${retrofit}"
// implementation "com.google.code.gson:gson:${gson}"
compile "com.j256.ormlite:ormlite-android:${ormlite}"
compile "com.j256.ormlite:ormlite-core:${ormlite}"
implementation "com.j256.ormlite:ormlite-android:${ormlite}"
implementation "com.j256.ormlite:ormlite-core:${ormlite}"
compile "com.jakewharton:butterknife:${butterKnife}"
implementation "com.jakewharton:butterknife:${butterKnife}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterKnife}"
compile "org.greenrobot:eventbus:${eventbus}"
implementation "org.greenrobot:eventbus:${eventbus}"
annotationProcessor "org.greenrobot:eventbus-annotation-processor:${eventbusApt}"
compile "io.reactivex:rxjava:${rxJava}"
compile "io.reactivex:rxandroid:${rxAndroid}"
compile "com.jakewharton.rxbinding:rxbinding:${rxBinding}"
implementation "io.reactivex:rxjava:${rxJava}"
implementation "io.reactivex:rxandroid:${rxAndroid}"
implementation "com.jakewharton.rxbinding:rxbinding:${rxBinding}"
//TODO update to rx 2.x
// compile "io.reactivex.rxjava2:rxjava:${rxJava2}"
// compile "io.reactivex.rxjava2:rxandroid:${rxAndroid2}"
// compile "com.jakewharton.rxbinding2:rxbinding:${rxBinding2}"
// implementation "io.reactivex.rxjava2:rxjava:${rxJava2}"
// implementation "io.reactivex.rxjava2:rxandroid:${rxAndroid2}"
// implementation "com.jakewharton.rxbinding2:rxbinding:${rxBinding2}"
compile "com.google.zxing:core:${zxing}"
compile "com.google.zxing:android-core:${zxing}"
implementation "com.google.zxing:core:${zxing}"
implementation "com.google.zxing:android-core:${zxing}"
compile "com.daimajia.swipelayout:library:${swipeLayout}"
compile("cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:${autoScrollViewPager}") {
implementation "com.daimajia.swipelayout:library:${swipeLayout}"
implementation("cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:${autoScrollViewPager}") {
exclude module: 'support-v4'
}
compile "com.sina.weibo.sdk:core:${weiboSDK}"
implementation "com.sina.weibo.sdk:core:${weiboSDK}"
// bugly with tinker support
compile "com.tencent.bugly:crashreport_upgrade:${buglyTinkerSupport}"
implementation "com.tencent.bugly:crashreport_upgrade:${buglyTinkerSupport}"
compile "pub.devrel:easypermissions:${easypermissions}"
implementation "pub.devrel:easypermissions:${easypermissions}"
compile project(':libraries:LGLibrary')
compile project(':libraries:MiPush')
compile project(':libraries:MTA')
compile project(':libraries:QQShare')
compile project(':libraries:TalkingData')
compile project(':libraries:UmengPush')
compile project(':libraries:WechatShare')
compile project(':libraries:iosched')
implementation project(':libraries:MiPush')
implementation project(':libraries:MTA')
implementation project(':libraries:QQShare')
implementation project(':libraries:TalkingData')
implementation project(':libraries:UmengPush')
implementation project(':libraries:WechatShare')
implementation project(':libraries:iosched')
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
File propFile = file('sign.properties');
File propFile = file('sign.properties')
if (propFile.exists()) {
def Properties props = new Properties()
props.load(new FileInputStream(propFile))

View File

@ -181,6 +181,11 @@
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
# easypermission
-keepclassmembers class * {
@pub.devrel.easypermissions.AfterPermissionGranted <methods>;
}
# 重命名文件为SourceFile再配合mapping符号表可以拿到真实的类名
-renamesourcefileattribute SourceFile
# 保留源文件行号

View File

@ -35,33 +35,33 @@ public class Injection {
}
public static OkHttpClient.Builder provideRetrofitBuilder() {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public void log(String message) {
//分段打印retrofit日志
if (message.startsWith("{") || message.startsWith("["))
if (message.length() > 4000) {
for (int i = 0; i < message.length(); i += 4000) {
if (i + 4000 < message.length())
Utils.log("OkHttp_Body::" + i, message.substring(i, i + 4000));
else
Utils.log("OkHttp_Body::" + i, message.substring(i, message.length()));
}
} else
Utils.log("OkHttp_Body::", message);
}
});
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
// HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
//
// @Override
// public void log(String message) {
// //分段打印retrofit日志
// if (message.startsWith("{") || message.startsWith("["))
// if (message.length() > 4000) {
// for (int i = 0; i < message.length(); i += 4000) {
// if (i + 4000 < message.length())
// Utils.log("OkHttp_Body::" + i, message.substring(i, i + 4000));
// else
// Utils.log("OkHttp_Body::" + i, message.substring(i, message.length()));
// }
// } else
// Utils.log("OkHttp_Body::", message);
// }
// });
// loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
builder.addNetworkInterceptor(interceptor);
builder.addNetworkInterceptor(new StethoInterceptor());
if (BuildConfig.DEBUG) {
builder.addNetworkInterceptor(loggingInterceptor);
}
// if (BuildConfig.DEBUG) {
// builder.addNetworkInterceptor(loggingInterceptor);
// }
return builder;
}

View File

@ -74,6 +74,16 @@
<category android:name = "android.intent.category.LAUNCHER" />
</intent-filter >
<!-- MTA可视化启动连接接口 -->
<intent-filter >
<data android:scheme = "${tencentAppScheme}" />
<action android:name = "android.intent.action.VIEW" />
<category android:name = "android.intent.category.DEFAULT" />
<category android:name = "android.intent.category.BROWSABLE" />
</intent-filter >
</activity >
<activity

View File

@ -8,6 +8,7 @@ import com.gh.common.constant.Config;
import com.halo.assistant.TinkerApp;
import com.tencent.bugly.beta.tinker.TinkerManager;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.mta.track.StatisticsDataAPI;
import com.tencent.stat.MtaSDkException;
import com.tencent.stat.StatConfig;
import com.tencent.stat.StatCrashReporter;
@ -70,6 +71,12 @@ public class DataUtils {
StatConfig.setSendPeriodMinutes(5);
}
// 设置启用Tlink
StatConfig.setTLinkStatus(true);
// 设置启用可视化埋点
StatisticsDataAPI.instance(context);
StatConfig.init(context);
StatConfig.setInstallChannel(channel);
StatConfig.setAntoActivityLifecycleStat(true);

View File

@ -188,7 +188,11 @@ public class DetailDownloadUtils {
if (v == mViewHolder.downloadTv) {
if (mGameEntity != null && !mGameEntity.getApk().isEmpty()) {
if (mGameEntity.getApk().size() == 1) {
if (NetworkUtils.isWifiConnected(mViewHolder.context)) {
String str = mViewHolder.downloadTv.getText().toString();
if (str.contains("启动")) {
DataUtils.onGameLaunchEvent(mViewHolder.context, mGameEntity.getName(), mGameEntity.getApk().get(0).getPlatform(), mName);
PackageUtils.launchApplicationByPackageName(mViewHolder.context, mGameEntity.getApk().get(0).getPackageName());
} else if (NetworkUtils.isWifiConnected(mViewHolder.context)) {
download();
} else {
DialogUtils.showDownloadDialog(mViewHolder.context, new DialogUtils.ConfirmListener() {
@ -213,7 +217,7 @@ public class DetailDownloadUtils {
mViewHolder.context.startActivity(intent);
} else if ("安装".equals(str)) {
if (mDownloadEntity == null) {
mDownloadEntity = DownloadManager.getInstance(mViewHolder.context).getDownloadEntityByUrl( mGameEntity.getApk().get(0).getUrl());
mDownloadEntity = DownloadManager.getInstance(mViewHolder.context).getDownloadEntityByUrl(mGameEntity.getApk().get(0).getUrl());
}
if (mDownloadEntity != null) {
@ -225,36 +229,30 @@ public class DetailDownloadUtils {
private void download() {
String str = mViewHolder.downloadTv.getText().toString();
if (str.contains("启动")) {
DataUtils.onGameLaunchEvent(mViewHolder.context, mGameEntity.getName(), mGameEntity.getApk().get(0).getPlatform(), mName);
PackageUtils.launchApplicationByPackageName(mViewHolder.context, mGameEntity.getApk().get(0).getPackageName());
String method;
if (str.contains("更新")) {
method = "更新";
} else if (str.contains("插件化")) {
method = "插件化";
} else {
String method;
if (str.contains("更新")) {
method = "更新";
} else if (str.contains("插件化")) {
method = "插件化";
} else {
method = mViewHolder.context.getString(R.string.download);
}
ApkEntity apkEntity = mGameEntity.getApk().get(0);
String msg = FileUtils.isCanDownload(mViewHolder.context, apkEntity.getSize());
if (TextUtils.isEmpty(msg)) {
DataUtils.onGameDownloadEvent(mViewHolder.context, mGameEntity.getName(), apkEntity.getPlatform(), StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"), "下载开始");
method = mViewHolder.context.getString(R.string.download);
}
ApkEntity apkEntity = mGameEntity.getApk().get(0);
String msg = FileUtils.isCanDownload(mViewHolder.context, apkEntity.getSize());
if (TextUtils.isEmpty(msg)) {
DataUtils.onGameDownloadEvent(mViewHolder.context, mGameEntity.getName(), apkEntity.getPlatform(), StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"), "下载开始");
DownloadManager.createDownload(mViewHolder.context, apkEntity, mGameEntity, method, StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"), mName + ":" + mTitle);
DownloadManager.createDownload(mViewHolder.context, apkEntity, mGameEntity, method, StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"), mName + ":" + mTitle);
mViewHolder.downloadTv.setVisibility(View.GONE);
mViewHolder.downloadPb.setVisibility(View.VISIBLE);
mViewHolder.downloadPer.setVisibility(View.VISIBLE);
mViewHolder.downloadPb.setProgress(0);
mViewHolder.downloadPer.setText("0.0%");
mViewHolder.downloadTv.setVisibility(View.GONE);
mViewHolder.downloadPb.setVisibility(View.VISIBLE);
mViewHolder.downloadPer.setVisibility(View.VISIBLE);
mViewHolder.downloadPb.setProgress(0);
mViewHolder.downloadPer.setText("0.0%");
// DownloadManager.getInstance(mViewHolder.context).putStatus(apkEntity.getUrl(), "downloading");
} else {
Utils.toast(mViewHolder.context, msg);
}
} else {
Utils.toast(mViewHolder.context, msg);
}
}
}

View File

@ -154,8 +154,8 @@ public class DialogUtils {
sizeName = df.format(size) + "MB";
}
if (sendTime == 0) {
sendTime = 1;
if (sendTime < 1000) { // 最少设置发送时间为1s为了简易计算
sendTime = 1000;
}
int i = (filesSize / 1024) / (sendTime / 1000);

View File

@ -23,7 +23,7 @@ import com.gh.gamecenter.R
class ImageUtils private constructor() {
// 自适应图片宽高
fun display(simpleDraweeView: SimpleDraweeView, url: String, width: Int) {
fun display(simpleDraweeView: SimpleDraweeView, url: String?, width: Int) {
val listener = object : BaseControllerListener<ImageInfo>() {
override fun onFinalImageSet(id: String?, imageInfo: ImageInfo?, animatable: Animatable?) {
if (imageInfo == null) {
@ -43,7 +43,7 @@ class ImageUtils private constructor() {
// 设置缩放类型,设置按压状态下的叠加图
fun display(resources: Resources, simpleDraweeView: SimpleDraweeView,
scaleType: ScalingUtils.ScaleType, url: String) {
scaleType: ScalingUtils.ScaleType, url: String?) {
val context = simpleDraweeView.context
simpleDraweeView.hierarchy = GenericDraweeHierarchyBuilder(resources)
.setFadeDuration(500)
@ -57,7 +57,7 @@ class ImageUtils private constructor() {
}
// 设置占位符
fun display(resources: Resources, simpleDraweeView: SimpleDraweeView, url: String, placeholderImage: Int) {
fun display(resources: Resources, simpleDraweeView: SimpleDraweeView, url: String?, placeholderImage: Int) {
val context = simpleDraweeView.context
simpleDraweeView.hierarchy = GenericDraweeHierarchyBuilder(resources)
.setFadeDuration(500)
@ -70,7 +70,7 @@ class ImageUtils private constructor() {
}
// 图片下载监听和设置低高分辨率图片
fun display(simpleDraweeView: SimpleDraweeView, url: String, lowUrl: String,
fun display(simpleDraweeView: SimpleDraweeView, url: String?, lowUrl: String?,
listener: ControllerListener<in ImageInfo>) {
simpleDraweeView.controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(ImageRequest.fromUri(url))
@ -80,7 +80,7 @@ class ImageUtils private constructor() {
}
// 获取bitmap
fun display(context: Context, url: String, dataSubscriber: BaseBitmapDataSubscriber) {
fun display(context: Context, url: String?, dataSubscriber: BaseBitmapDataSubscriber) {
val imageRequest = ImageRequestBuilder
.newBuilderWithSource(Uri.parse(url))
.setProgressiveRenderingEnabled(true)
@ -108,7 +108,7 @@ class ImageUtils private constructor() {
simpleDraweeView.setImageURI(url)
}
fun display(draweeView: SimpleDraweeView, @DrawableRes res: Int) {
fun display(draweeView: SimpleDraweeView, @DrawableRes res: Int?) {
draweeView.setImageURI("res:///" + res)
}
}

View File

@ -3,16 +3,13 @@ package com.gh.common.util;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.gh.common.constant.Constants;
import com.gh.gamecenter.R;
import com.gh.gamecenter.entity.LoginResponseEntity;
import com.gh.gamecenter.entity.UserInfoEntity;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.kuaichuan.Constant;
import com.gh.gamecenter.manager.RefreshTokenManager;
import com.gh.gamecenter.personal.PersonalFragment;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
@ -26,7 +23,6 @@ import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
@ -36,7 +32,6 @@ import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.HttpException;
import rx.Observable;
import rx.Scheduler;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
@ -299,7 +294,7 @@ public class LoginUtils {
if (loginToken != null && loginToken.getAccessToken() != null) {
LoginResponseEntity.AccessToken accessToken = loginToken.getAccessToken();
Long accessExpire = accessToken.getExpire();
if (false && accessExpire != null && accessExpire > Utils.getTime(context)) {
if (accessExpire != null && accessExpire > Utils.getTime(context)) {
getUserData(context, false, listener, null);
} else {
LoginResponseEntity.RefreshToken refreshToken = loginToken.getRefreshToken();
@ -334,12 +329,6 @@ public class LoginUtils {
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
Utils.log("=====eeee::" + e.toString());
}
@Override
public void onFailure(HttpException e) {
super.onFailure(e);

View File

@ -19,7 +19,13 @@ public class QQUtils {
}
if (ShareUtils.isQQClientAvailable(context)) {
//安装了QQ会直接调用QQ打开手机QQ进行会话 QQ号2586716223
String str = "mqqwpa://im/chat?chat_type=wpa&uin=" + qq + "&version=1&src_type=web&web_src=oicqzone.com";
String chatType;
if (qq.startsWith("400") || qq.startsWith("800")) {
chatType = "crm";
} else {
chatType = "wpa";
}
String str = "mqqwpa://im/chat?chat_type=" + chatType + "&uin=" + qq + "&version=1&src_type=web";
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));
} else {
//没有安装QQ 复制账号

View File

@ -0,0 +1,52 @@
package com.gh.common.view;
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
/**
* Workaround AppBarLayout.Behavior for https://issuetracker.google.com/66996774
*
* See https://gist.github.com/chrisbanes/8391b5adb9ee42180893300850ed02f2 for
* example usage.
*
* Change the package name as you wish.
*/
public class FixAppBarLayoutBehavior extends AppBarLayout.Behavior {
public FixAppBarLayoutBehavior() {
super();
}
public FixAppBarLayoutBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target,
int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
dxUnconsumed, dyUnconsumed, type);
stopNestedScrollIfNeeded(dyUnconsumed, child, target, type);
}
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child,
View target, int dx, int dy, int[] consumed, int type) {
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
stopNestedScrollIfNeeded(dy, child, target, type);
}
private void stopNestedScrollIfNeeded(int dy, AppBarLayout child, View target, int type) {
if (type == ViewCompat.TYPE_NON_TOUCH) {
final int currOffset = getTopAndBottomOffset();
if ((dy < 0 && currOffset == 0)
|| (dy > 0 && currOffset == -child.getTotalScrollRange())) {
ViewCompat.stopNestedScroll(target, ViewCompat.TYPE_NON_TOUCH);
}
}
}
}

View File

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

View File

@ -243,7 +243,9 @@ public class FileReceiverActivity extends BaseActivity implements OnReceiverCanc
}
}
List<DownloadEntity> all = DownloadDao.getInstance(this).getAll();
EventBus.getDefault().post(new EBDownloadChanged("download", View.VISIBLE, all.size()));
if (all.size() > 0) {
EventBus.getDefault().post(new EBDownloadChanged("download", View.VISIBLE, all.size()));
}
EventBus.getDefault().post(new EBDownloadStatus("download"));
mReceiverServer.close();

View File

@ -8,6 +8,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -66,6 +67,7 @@ public class LibaoActivity extends BaseActivity implements View.OnClickListener,
private int currentItem;
private int width;
private Libao1Fragment mLibao1Fragment;
@NonNull
public static Intent getIntent(Context context, String entrance) {
@ -87,7 +89,8 @@ public class LibaoActivity extends BaseActivity implements View.OnClickListener,
mZuixinTv.setSelected(true);
List<Fragment> list = new ArrayList<>();
list.add(new Libao1Fragment());
mLibao1Fragment = new Libao1Fragment();
list.add(mLibao1Fragment);
list.add(new Libao2Fragment());
list.add(new Libao3Fragment());
mLibaoVp.setAdapter(new FragmentAdapter(getSupportFragmentManager(), list));
@ -155,6 +158,12 @@ public class LibaoActivity extends BaseActivity implements View.OnClickListener,
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (mLibao1Fragment != null) mLibao1Fragment.onTouchEvent(ev);
return super.dispatchTouchEvent(ev);
}
@Override
public void onPageScrollStateChanged(int state) {

View File

@ -263,6 +263,8 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
curStatusCount++;
}
}
// 由领取到淘号的状态转换
if (repeat <= curStatusCount || curStatusCount == 0) { // 当前领取/淘号总数是否超过总重复领取次数 / 当前状态的礼包没有领取/淘号过
if (curStatusCount == 0 && ("ling".equals(beforeStatus) || "tao".equals(beforeStatus))) {
if (isCanLing()) { // 恢复原始状态
@ -306,7 +308,7 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
long curTime = Utils.getTime(this) * 1000;
int lingDay = Integer.parseInt(formatDay.format(lingTime));
int curDay = Integer.parseInt(formatDay.format(curTime));
if (curTime > lingTime && curDay != lingDay) {
if (curDay != lingDay || curTime - lingTime > 24 * 60 * 60 * 1000) {
return true;
} else {
return false;

View File

@ -18,12 +18,15 @@ import com.gh.base.BaseActivity;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.adapter.VPFragmentAdapter;
import com.gh.gamecenter.entity.SubjectHeadEntity;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.subject.OnSubjectTitleListener;
import com.gh.gamecenter.subject.SubjectFragment;
import com.gh.gamecenter.subject.SubjectTileFragment;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
import org.json.JSONObject;
@ -31,16 +34,19 @@ import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import retrofit2.HttpException;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import static com.gh.gamecenter.R.id.actionbar_tv_title;
/**
* Created by khy on 2017/4/29.
*/
public class SubjectActivity extends BaseActivity {
public class SubjectActivity extends BaseActivity implements OnSubjectTitleListener {
@BindView(R.id.subject_viewpager)
ViewPager mViewPager;
@ -52,6 +58,8 @@ public class SubjectActivity extends BaseActivity {
FrameLayout mSubjectTiled;
@BindView(R.id.reuse_no_connection)
View mNoConn;
@BindView(R.id.actionbar_tv_title)
TextView mActionBarTitle;
private String mId;
private String mName;
@ -94,25 +102,29 @@ public class SubjectActivity extends BaseActivity {
} else {
loadSubjectType();
}
mNoConn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mNoConn.setVisibility(View.GONE);
mLoading.setVisibility(View.VISIBLE);
loadSubjectType();
}
});
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (mTileFragment != null) {
mTileFragment.onTouchEvent(ev);
}
if (mTileFragment != null) mTileFragment.onTouchEvent(ev);
return super.dispatchTouchEvent(ev);
}
@OnClick({actionbar_tv_title, R.id.reuse_no_connection})
public void onClick(View view) {
switch (view.getId()) {
case actionbar_tv_title:
if (mTileFragment != null)
EventBus.getDefault().post(new EBReuse(SubjectFragment.SCROLL_TOP));
break;
case R.id.reuse_no_connection:
mNoConn.setVisibility(View.GONE);
mLoading.setVisibility(View.VISIBLE);
loadSubjectType();
break;
}
}
private void getSubjectName(String id) {
RetrofitManager.getInstance(this).getApi()
.getSubjectName(id)
@ -124,8 +136,7 @@ public class SubjectActivity extends BaseActivity {
try {
String name = response.getString("name");
TextView actionbar_tv_title = (TextView) findViewById(R.id.actionbar_tv_title);
actionbar_tv_title.setText(name);
mActionBarTitle.setText(name);
mBundle.putString(EntranceUtils.KEY_NAME, name);
loadSubjectType();
} catch (JSONException e) {
@ -136,8 +147,7 @@ public class SubjectActivity extends BaseActivity {
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
TextView actionbar_tv_title = (TextView) findViewById(R.id.actionbar_tv_title);
actionbar_tv_title.setText("专题");
mActionBarTitle.setText("专题");
mBundle.putString(EntranceUtils.KEY_NAME, "专题");
loadSubjectType();
}
@ -198,4 +208,9 @@ public class SubjectActivity extends BaseActivity {
// mTabLayout.setTabsFromPagerAdapter(adapter);
}
}
@Override
public void onChange(String title) {
mActionBarTitle.setText(title);
}
}

View File

@ -149,7 +149,7 @@ public class UserInfoEditActivity extends BaseActivity implements LoginUtils.onC
private void saveData() {
if ("name".equals(mEditType)) {
String value = mUserinfoNicknameEt.getText().toString();
String value = mUserinfoNicknameEt.getText().toString().trim();
if (!TextUtils.isEmpty(value)) {
if (value.equals(mUserInfoEntity.getName())) {
finish();

View File

@ -110,22 +110,14 @@ public class ViewImageActivity extends Activity implements OnPageChangeListener
Object object = mViewimageVp.findViewWithTag(position);
if (object != null) {
RelativeLayout view = (RelativeLayout) object;
final ZoomSimpleDraweeView imageView = (ZoomSimpleDraweeView) view.findViewById(R.id.viewimage_iv_show);
final ProgressBarCircularIndeterminate progressBar = (ProgressBarCircularIndeterminate) view.findViewById(R.id.viewimage_pb_loading);
final ZoomSimpleDraweeView imageView = view.findViewById(R.id.viewimage_iv_show);
final ProgressBarCircularIndeterminate progressBar = view.findViewById(R.id.viewimage_pb_loading);
progressBar.setVisibility(View.VISIBLE);
ImageUtils.Companion.getInstance().display(imageView, newUrls.get(position), urls.get(position),
new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
progressBar.setVisibility(View.GONE);
// if (imageInfo == null){
// return;
// }
// ImageInfo imageInfo1 = (ImageInfo) imageInfo;
// int height = imageInfo1.getHeight();
// int width = imageInfo1.getWidth();
// float index = (float) height / (float) width;
// imageView.setImagePro(index);
}
});
}

View File

@ -279,18 +279,13 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR
JSONObject responseObject = new JSONObject(string);
boolean cast = responseObject.getBoolean("cast");
String id = responseObject.getString("_id");
String illegal = responseObject.getString("illegal");
if (!TextUtils.isEmpty(illegal)) {
Utils.toast(VoteActivity.this, "包含非法内容,请修改后重试");
if (cast) {
Utils.toast(VoteActivity.this, "投票成功");
} else {
if (cast) {
Utils.toast(VoteActivity.this, "投票成功");
if (isNewVote) {
Utils.toast(VoteActivity.this, "已经存在相同的选项");
} else {
if (isNewVote) {
Utils.toast(VoteActivity.this, "已经存在相同的选项");
} else {
Utils.toast(VoteActivity.this, "你已经投过了");
}
Utils.toast(VoteActivity.this, "你已经投过了");
}
}
@ -311,7 +306,21 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
Utils.toast(VoteActivity.this, "提交失败");
if (e != null && e.code() == 403) {
try {
String string = e.response().errorBody().string();
JSONObject errorJson = new JSONObject(string);
String detail = errorJson.getString("detail");
if ("illegal".equals(detail)) {
Utils.toast(VoteActivity.this, "包含非法内容,请修改后重试");
}
} catch (Exception e1) {
e1.printStackTrace();
}
} else {
Utils.toast(VoteActivity.this, "提交失败");
}
waitDialog.dismiss();
}
});

View File

@ -29,20 +29,30 @@ import rx.schedulers.Schedulers;
*/
public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
private OnCommentCallBackListener mOnCommentCallBackListener;
private List<CommentEntity> mCommentList;
private RecyclerView mRecyclerView;
private View mDoData;
private String mCommentId;
private boolean mIsOver;
private boolean mIsLoading;
private boolean mIsNetworkError;
public CommentDetailAdapter(Context context, String commentId) {
public CommentDetailAdapter(Context context, String commentId,
OnCommentCallBackListener commentCallBackListener,
View noData, RecyclerView recyclerView) {
super(context);
mCommentId = commentId;
mOnCommentCallBackListener = commentCallBackListener;
mCommentList = new ArrayList<>();
mDoData = noData;
mRecyclerView = recyclerView;
loadData(0);
}
@ -63,7 +73,16 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
mIsLoading = false;
notifyItemRangeChanged(0, getItemCount() - 1);
if (mCommentList.size() == 0) {
mDoData.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.GONE);
} else {
mDoData.setVisibility(View.GONE);
mRecyclerView.setVisibility(View.VISIBLE);
notifyItemRangeChanged(0, getItemCount() - 1);
}
}
@Override
@ -133,6 +152,13 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
});
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CommentUtils.showReportDialog(commentEntity, mContext, mOnCommentCallBackListener, null);
}
});
}
private void initFooterViewHolder(FooterViewHolder holder) {

View File

@ -44,7 +44,7 @@ public class FileSendFragment extends BaseFragment {
super.initView(view);
view.findViewById(R.id.file_send_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {// TODO 需要申请权限
public void onClick(View v) {// TODO 需要申请权限 获取WiFi列表需要定位权限暂时没有任何提示
startActivityForResult(KcSelectGameActivity.getIntent(getContext(), false), KC_REQUEST);
}
});

View File

@ -2,6 +2,8 @@ package com.gh.gamecenter.download;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.Message;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
@ -21,12 +23,15 @@ import com.gh.common.util.PackageUtils;
import com.gh.common.view.RecyclerViewExtended;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.eventbus.EBDownloadChanged;
import com.gh.gamecenter.eventbus.EBMiPush;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
@ -199,18 +204,16 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
mNoDataSkipBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Intent intent = new Intent(getActivity(), MainActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// getActivity().startActivity(intent);
//
// mNoDataSkipBtn.postDelayed(new Runnable() {
// @Override
// public void run() {
// EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 0));
// }
// }, 300);
Intent intent = new Intent(getActivity(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getActivity().startActivity(intent);
DownloadManagerActivity.startDownloadManagerActivity(getActivity(), null, "");
mNoDataSkipBtn.postDelayed(new Runnable() {
@Override
public void run() {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 0));
}
}, 300);
}
});
@ -399,15 +402,15 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
}
public void pauseAll() {
// for (DownloadEntity downloadEntity : adapter.getDownloadingList()) {
//// DownloadManager.getInstance(getActivity()).put(downloadEntity.getUrl(),
//// System.currentTimeMillis());
//// Message msg = Message.obtain();
//// msg.what = DownloadConfig.PAUSE_DOWNLOAD_TASK;
//// msg.obj = downloadEntity.getUrl();
//// DownloadManager.getInstance(getActivity()).sendMessageDelayed(msg, 1000);
for (DownloadEntity downloadEntity : adapter.getDownloadingList()) {
DownloadManager.getInstance(getActivity()).put(downloadEntity.getUrl(),
System.currentTimeMillis());
Message msg = Message.obtain();
msg.what = DownloadConfig.PAUSE_DOWNLOAD_TASK;
msg.obj = downloadEntity.getUrl();
DownloadManager.getInstance(getActivity()).sendMessageDelayed(msg, 1000);
// DownloadManager.getInstance(getContext()).pause(downloadEntity);
// }
}
DownloadManager.getInstance(getContext()).pauseAll();
mDownloadmanagerAllstartTv.setText("全部开始");
mDownloadmanagerAllstartTv.setTextColor(ContextCompat.getColor(getContext(), R.color.theme));
@ -415,8 +418,15 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
private void startAll() {
for (DownloadEntity downloadEntity : adapter.getDownloadingList()) {
DownloadManager.getInstance(getContext()).add(downloadEntity);
adapter.getStatusMap().put(downloadEntity.getUrl(), "downloading");
// DownloadManager.getInstance(getContext()).add(downloadEntity);
// adapter.getStatusMap().put(downloadEntity.getUrl(), "downloading");
DownloadManager.getInstance(getActivity()).put(downloadEntity.getUrl(),
System.currentTimeMillis());
Message msg = Message.obtain();
msg.what = DownloadConfig.CONTINUE_DOWNLOAD_TASK;
msg.obj = downloadEntity.getUrl();
DownloadManager.getInstance(getActivity()).sendMessageDelayed(msg, 1000);
}
// DownloadManager.getInstance(getContext()).startAll();
mDownloadmanagerAllstartTv.setText("全部暂停");

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.os.Message;
import android.support.v4.content.ContextCompat;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.RecyclerView;
@ -29,6 +30,7 @@ import com.gh.gamecenter.adapter.viewholder.GameDownloadViewHolder;
import com.gh.gamecenter.eventbus.EBDownloadChanged;
import com.gh.gamecenter.manager.PackageManager;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.FileUtils;
@ -246,11 +248,11 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
statusMap.put(url, "downloading");
notifyItemChanged(doneList.isEmpty() ? 0 : 1 + doneList.size());
// Message msg = Message.obtain();
// msg.what = DownloadConfig.CONTINUE_DOWNLOAD_TASK;
// msg.obj = url;
// DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
DownloadManager.getInstance(mContext).add(downloadEntity);
Message msg = Message.obtain();
msg.what = DownloadConfig.CONTINUE_DOWNLOAD_TASK;
msg.obj = url;
DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
// DownloadManager.getInstance(mContext).add(downloadEntity);
} else {
DialogUtils.showDownloadDialog(mContext, new DialogUtils.ConfirmListener() {
@Override
@ -272,12 +274,12 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
statusMap.put(url, "downloading");
notifyItemChanged(doneList.isEmpty() ? 0 : 1 + doneList.size());
// Message msg = Message.obtain();
// msg.what = DownloadConfig.CONTINUE_DOWNLOAD_TASK;
// msg.obj = url;
// DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
Message msg = Message.obtain();
msg.what = DownloadConfig.CONTINUE_DOWNLOAD_TASK;
msg.obj = url;
DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
DownloadManager.getInstance(mContext).add(downloadEntity);
// DownloadManager.getInstance(mContext).add(downloadEntity);
}
});
}
@ -311,12 +313,12 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.dmDelete.setVisibility(View.VISIBLE);
statusMap.put(url, "pause");
notifyItemChanged(doneList.isEmpty() ? 0 : 1 + doneList.size());
// Message msg = Message.obtain();
// msg.what = DownloadConfig.PAUSE_DOWNLOAD_TASK;
// msg.obj = url;
// DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
Message msg = Message.obtain();
msg.what = DownloadConfig.PAUSE_DOWNLOAD_TASK;
msg.obj = url;
DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
DownloadManager.getInstance(mContext).pause(downloadEntity);
// DownloadManager.getInstance(mContext).pause(downloadEntity);
break;
case "等待":
Utils.toast(mContext, "最多只能同时启动3个下载任务");
@ -408,15 +410,15 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
});
}
} else {
// for (DownloadEntity downloadEntity : downloadingList) {
//// DownloadManager.getInstance(mContext).put(downloadEntity.getUrl(),
//// System.currentTimeMillis());
//// Message msg = Message.obtain();
//// msg.what = DownloadConfig.PAUSE_DOWNLOAD_TASK;
//// msg.obj = downloadEntity.getUrl();
//// DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
for (DownloadEntity downloadEntity : downloadingList) {
DownloadManager.getInstance(mContext).put(downloadEntity.getUrl(),
System.currentTimeMillis());
Message msg = Message.obtain();
msg.what = DownloadConfig.PAUSE_DOWNLOAD_TASK;
msg.obj = downloadEntity.getUrl();
DownloadManager.getInstance(mContext).sendMessageDelayed(msg, 1000);
// DownloadManager.getInstance(mContext).pause(downloadEntity);
// }
}
DownloadManager.getInstance(mContext).pauseAll();
viewHolder.dm_item_head_tv_allstart.setText(R.string.download_all_start);
viewHolder.dm_item_head_tv_allstart.setTextColor(ContextCompat.getColor(mContext, R.color.theme));

View File

@ -198,7 +198,6 @@ public class GameFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
@Override
public void onFailure(HttpException e) {
if (!TextUtils.isEmpty(mCacheRequestTag)) return;
mIsSubjectDigestError = true;
notifyItemChanged(0);
if (isLoadMore) {
@ -226,7 +225,6 @@ public class GameFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
@Override
public void onFailure(HttpException e) {
if (!TextUtils.isEmpty(mCacheRequestTag)) return;
mIsSlideError = true;
showView();
if (isFirst) {
@ -310,17 +308,19 @@ public class GameFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
/**
* {@link com.gh.gamecenter.retrofit.OkHttpCacheInterceptor#intercept(Interceptor.Chain)}
*/
if (response.size() > 0 && response.get(0).isCache()) {
if (mCacheRequestTag == null && (response.size() == 0 || response.get(0).isCache())) {
mCacheRequestTag = "retry";
initSubjectDigest(true);
} else {
mCacheRequestTag = null;
}
}
@Override
public void onFailure(HttpException e) {
if (!TextUtils.isEmpty(mCacheRequestTag)) return;
if (mCacheRequestTag == null) {
mCacheRequestTag = "retry";
initSubjectDigest(true);
return;
}
if (mCallBackListener != null) {
mCallBackListener.loadDone();
}
@ -393,12 +393,12 @@ public class GameFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
private void showView() {
if (mIsSlideError && mIsListError) {
mCallBackListener.loadError();
Utils.toast(mContext, mContext.getString(R.string.loading_failed_hint));
} else if (mIsSlideError) {
notifyItemChanged(0);
} else if (mIsListError) {
notifyItemChanged(getItemCount() - 1);
}
Utils.toast(mContext, mContext.getString(R.string.loading_failed_hint));
}
public void initLocationMap() {

View File

@ -39,7 +39,6 @@ import com.gh.gamecenter.entity.GameDetailContact;
import com.gh.gamecenter.entity.GameDetailEntity;
import com.gh.gamecenter.entity.GameDetailServer;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.KaiFuServerEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.NewsEntity;
@ -52,7 +51,6 @@ import com.lightgame.adapter.BaseRecyclerAdapter;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -214,21 +212,21 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
return false;
}
// 获取当前月的初始时间的时间戳
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
long curMonth = calendar.getTimeInMillis()/1000;
// // 获取当前月的初始时间的时间戳
// Calendar calendar = Calendar.getInstance();
// calendar.add(Calendar.MONTH, -1); // 上一个月时间
// calendar.set(Calendar.DAY_OF_MONTH, 1);
// calendar.set(Calendar.HOUR_OF_DAY, 0);
// calendar.set(Calendar.MINUTE, 0);
// calendar.set(Calendar.SECOND, 0);
// long curMonth = calendar.getTimeInMillis()/1000;
//
// List<KaiFuServerEntity> calendarService = mGameDetailEntity.getServerEntity().getCalendar();
// for (KaiFuServerEntity entity : calendarService) {
// if (entity.getTime() >= curMonth) return true;
// }
List<KaiFuServerEntity> calendarService = mGameDetailEntity.getServerEntity().getCalendar();
for (KaiFuServerEntity entity : calendarService) {
if (entity.getTime() > curMonth) return true;
}
return false;
return true; // 如果有开服信息就显示 不做时间过滤了
}

View File

@ -93,18 +93,19 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
private void checkExistCurSerer() {
long curDate = System.currentTimeMillis();
SimpleDateFormat formatMonth = new SimpleDateFormat("MM", Locale.CHINA);
int curMonth = Integer.parseInt(formatMonth.format(curDate));
for (KaiFuServerEntity kaiFuServerEntity : mServerList) { // 判断当月是否有开服
long time = kaiFuServerEntity.getTime();
int serverMonth = Integer.parseInt(formatMonth.format(time * 1000));
if (serverMonth == curMonth) {
isExistCurServer = true;
break;
}
}
isExistCurServer = true; // 此参数控制是否显示当月开服表(无论有没有开服信息),为防止需求变更先设死这个参数
// long curDate = System.currentTimeMillis();
// SimpleDateFormat formatMonth = new SimpleDateFormat("MM", Locale.CHINA);
// int curMonth = Integer.parseInt(formatMonth.format(curDate));
//
// for (KaiFuServerEntity kaiFuServerEntity : mServerList) { // 判断当月是否有开服
// long time = kaiFuServerEntity.getTime();
// int serverMonth = Integer.parseInt(formatMonth.format(time * 1000));
// if (serverMonth == curMonth) {
// isExistCurServer = true;
// break;
// }
// }
}
private void initView(final GameDetailKaiFuViewHolder viewHolder) {
@ -118,14 +119,14 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
int lastMonth = -1;
for (KaiFuServerEntity kaiFuServerEntity : mServerList) {
lastTime = kaiFuServerEntity.getTime();
lastMonth = Integer.parseInt(formatMonth.format(lastTime * 1000));
if (lastMonth > curMonth) break;
lastTime = kaiFuServerEntity.getTime() * 1000;
lastMonth = Integer.parseInt(formatMonth.format(lastTime));
if (lastMonth != curMonth && lastTime > curDate) break;
}
viewHolder.curMonth.setText(format.format(curDate));
if (lastMonth > curMonth) {
viewHolder.nextMonth.setText(format.format(lastTime * 1000));
if (lastMonth != curMonth && lastTime > curDate) {
viewHolder.nextMonth.setText(format.format(lastTime));
viewHolder.nextMonth.setVisibility(View.VISIBLE);
} else {
viewHolder.nextMonth.setVisibility(View.GONE);
@ -149,6 +150,10 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.curMonth.setTextColor(Color.BLACK);
isNextMonth = true;
initDate();
if (viewHolder.kaifuDetailRl.getVisibility() == View.VISIBLE) {
viewHolder.kaifuDetailRl.setVisibility(View.GONE);
}
}
}
});
@ -163,6 +168,10 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.curMonth.setBackgroundResource(R.drawable.calendar_bar_select);
isNextMonth = false;
initDate();
if (viewHolder.kaifuDetailRl.getVisibility() == View.VISIBLE) {
viewHolder.kaifuDetailRl.setVisibility(View.GONE);
}
}
}
});

View File

@ -92,8 +92,6 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
if (mGameEntity != null) {
initPosition();
getGameNews();
initGameIds();
}
@ -152,27 +150,6 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
}
// 获取游戏新闻
private void getGameNews() {
RetrofitManager.getInstance(mContext).getApi().getGameNews(mGameEntity.getId(), 3)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<NewsEntity>>() {
@Override
public void onResponse(List<NewsEntity> response) {
mGameDetailEntity.setNews(response);
initPosition();
notifyDataSetChanged();
}
@Override
public void onFailure(HttpException e) {
initPosition();
notifyDataSetChanged();
}
});
}
public void initGameIds() {
if (mGameDetailEntity.getRelatedGames() == null
|| mGameDetailEntity.getRelatedGames() != null

View File

@ -9,6 +9,7 @@ import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.SwipeRefreshLayout;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
@ -47,10 +48,13 @@ public class Libao1Fragment extends BaseFragment implements SwipeRefreshLayout.O
@BindView(R.id.libao_tv_search)
TextView mLibaoTvSearch;
public final static String OPEN_LIBAO_APPBAR = "open_libao_appbar";
private LibaoSearchFragment mSearchFragment;
private LibaoNewFragment mNewFragment;
private boolean mIsSearch;
private boolean mIsTouchScreen;
@Override
protected int getLayoutId() {
@ -93,6 +97,17 @@ public class Libao1Fragment extends BaseFragment implements SwipeRefreshLayout.O
});
}
public void onTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
mIsTouchScreen = true;
break;
case MotionEvent.ACTION_UP:
mIsTouchScreen = false;
break;
}
}
private void changeFragment() {
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
hideFragments(transaction);
@ -120,7 +135,7 @@ public class Libao1Fragment extends BaseFragment implements SwipeRefreshLayout.O
try {
if (fragmentByTag != null) {
transaction.show(fragmentByTag);
if (fragmentByTag instanceof LibaoSearchFragment) {
if (fragmentByTag instanceof LibaoSearchFragment) {
((LibaoSearchFragment) fragmentByTag).search();
}
} else {
@ -144,7 +159,7 @@ public class Libao1Fragment extends BaseFragment implements SwipeRefreshLayout.O
if (TextUtils.isEmpty(key)) {
toast(getString(R.string.search_hint));
return;
} else if (!mIsSearch){
} else if (!mIsSearch) {
mIsSearch = true;
}
break;
@ -185,6 +200,8 @@ public class Libao1Fragment extends BaseFragment implements SwipeRefreshLayout.O
} else if (LIBAO_CLOSEPAGE.equals(reuse.getType())) {
mAppBar.setVisibility(View.VISIBLE);
mRefreshLayout.setEnabled(true);
} else if (OPEN_LIBAO_APPBAR.equals(reuse.getType()) && !mIsTouchScreen) {
mAppBar.setExpanded(true, true);
}
}

View File

@ -29,6 +29,7 @@ import butterknife.OnClick;
import static com.gh.gamecenter.LibaoActivity.LIBAO_CLOSEPAGE;
import static com.gh.gamecenter.LibaoActivity.LIBAO_OPENPAGE;
import static com.gh.gamecenter.libao.Libao1Fragment.OPEN_LIBAO_APPBAR;
/**
* Created by khy on 5/09/17.
@ -131,6 +132,15 @@ public class LibaoNewFragment extends BaseFragment implements SwipeRefreshLayout
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
if (position == 0 && Math.abs(dy) > 10) {
EventBus.getDefault().post(new EBReuse(OPEN_LIBAO_APPBAR));
}
}
});

View File

@ -14,12 +14,17 @@ import com.gh.common.view.VerticalItemDecoration;
import com.gh.gamecenter.LibaoDetailActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.eventbus.EBReuse;
import org.greenrobot.eventbus.EventBus;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static com.gh.gamecenter.libao.Libao1Fragment.OPEN_LIBAO_APPBAR;
/**
* Created by khy on 5/09/17.
*/
@ -86,6 +91,15 @@ public class LibaoSearchFragment extends BaseFragment implements SwipeRefreshLay
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
if (position == 0 && Math.abs(dy) > 10) {
EventBus.getDefault().post(new EBReuse(OPEN_LIBAO_APPBAR));
}
}
});
}

View File

@ -70,7 +70,7 @@ public class KeFuFragment extends BaseFragment implements SwipeRefreshLayout.OnR
mAdapter = new KeFuFragmentAdapter(getContext(), this);
layoutManager = new LinearLayoutManager(getContext());
mRecyclerview.setLayoutManager(layoutManager);
mRecyclerview.addItemDecoration(new VerticalItemDecoration(getContext(), 8, true));
mRecyclerview.addItemDecoration(new VerticalItemDecoration(getContext(), 1, true));
mRecyclerview.setAdapter(mAdapter);
mRecyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() {

View File

@ -31,6 +31,7 @@ import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.NewsUtils;
import com.gh.common.util.QQUtils;
import com.gh.common.util.RandomUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.GameDetailActivity;
@ -240,12 +241,8 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
StringUtils.buildString(mEntrance, "+(新闻详情[", mNewsDetailEntity.getTitle(), "])")));
break;
case "qq":
String qq = id;
intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=" + qq));
try {
mContext.startActivity(intent);
QQUtils.startQQSession(mContext, id);
} catch (Exception e) {
Utils.toast(mContext, "请检查是否已经安装手机QQ");
e.printStackTrace();

View File

@ -2,7 +2,6 @@ package com.gh.gamecenter.retrofit;
import android.content.Context;
import com.gh.common.util.GzipUtils;
import com.gh.common.util.NetworkUtils;
import com.gh.common.util.TimestampUtils;
@ -39,7 +38,8 @@ class OkHttpNetworkInterceptor implements Interceptor {
@Override
public BufferedSource source() {
Buffer buffer = new Buffer();
buffer.write(GzipUtils.compressBytes("[]".getBytes()));
// buffer.write(GzipUtils.compressBytes("[]".getBytes())); 某些接口不适配 弃用
buffer.write("[]".getBytes());
return buffer;
}
};

View File

@ -0,0 +1,9 @@
package com.gh.gamecenter.subject;
/**
* Created by khy on 23/11/17.
*/
public interface OnSubjectTitleListener {
void onChange(String title);
}

View File

@ -3,7 +3,6 @@ package com.gh.gamecenter.subject;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
@ -25,6 +24,7 @@ import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.news.NewsWrapperFragment;
import com.lightgame.config.CommonDebug;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadEntity;
@ -44,8 +44,6 @@ public class SubjectFragment extends BaseFragment {
@BindView(R.id.subject_list)
RecyclerView subject_list;
@BindView(R.id.subject_type_list)
RecyclerView subject_type_list;
@BindView(R.id.subject_pb_loading)
ProgressBarCircularIndeterminate subject_pb_loading;
@BindView(R.id.reuse_no_connection)
@ -157,14 +155,6 @@ public class SubjectFragment extends BaseFragment {
}
}
});
GridLayoutManager layout = new GridLayoutManager(getContext(), 4) {
@Override
public boolean canScrollVertically() {
return false;
}
};
subject_type_list.setLayoutManager(layout);
}
@Subscribe(threadMode = ThreadMode.MAIN)

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter.subject;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
@ -25,7 +26,6 @@ import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.SubjectTypeAdapter;
import com.gh.gamecenter.eventbus.EBReuse;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -42,17 +42,15 @@ import butterknife.OnClick;
public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdapter.OnSelectTypeListener {
@BindView(R.id.subject_type_list)
RecyclerView subject_type_list;
RecyclerView mSubjectRv;
@BindView(R.id.subject_appbar)
AppBarLayout mAppbar;
@BindView(R.id.subject_coordinator)
CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.subject_tabbar_hot_tv)
TextView mTabbarHotTv;
@BindView(R.id.subject_tabbar_new_tv)
TextView mTabbarNewTv;
TextView mActionBarTitle;
private OnSubjectTitleListener mSubjectTitleListener;
public final static String OPEN_APPBAR = "openAppBar";
public final static String KEY_LISTORDER = "listOrder";
@ -62,7 +60,7 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
private String mListOrder;
private String mTagType;
private boolean mIsTouchScreen = false;
private boolean mIsTouchScreen;
public void loadData() {
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
@ -90,7 +88,7 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
fragmentByTag = new SubjectFragment();
Bundle mBundle = getActivity().getIntent().getExtras();
Bundle clone = (Bundle) mBundle.clone();
clone.putString(EntranceUtils.KEY_TAGTYPE,mTagType);
clone.putString(EntranceUtils.KEY_TAGTYPE, mTagType);
clone.putString(KEY_LISTORDER, mListOrder);
clone.putString(EntranceUtils.KEY_TYPE, mType);
fragmentByTag.setArguments(clone);
@ -106,13 +104,18 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
return R.layout.fragment_subject_tiled;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnSubjectTitleListener)
mSubjectTitleListener = (OnSubjectTitleListener) context;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle arguments = getArguments();
mActionBarTitle = (TextView) getActivity().findViewById(R.id.actionbar_tv_title);
mName = arguments.getString(EntranceUtils.KEY_NAME);
mEntrance = arguments.getString(EntranceUtils.KEY_ENTRANCE);
mTagType = arguments.getString(EntranceUtils.KEY_TAGTYPE);
@ -123,20 +126,19 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
mListOrder = "";
// 设置标题
GridLayoutManager layout = new GridLayoutManager(getContext(), 4) {
final GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 4) {
@Override
public boolean canScrollVertically() {
return false;
}
};
subject_type_list.setLayoutManager(layout);
layoutManager.setAutoMeasureEnabled(true);
mSubjectRv.setNestedScrollingEnabled(false);
mSubjectRv.setLayoutManager(layoutManager);
if (contentTitle != null && contentTitle.size() > 1) {
ViewGroup.LayoutParams params = subject_type_list.getLayoutParams();
params.height = (int) Math.ceil(contentTitle.size() / 4f) * DisplayUtils.dip2px(getContext(), 35);
subject_type_list.setLayoutParams(params);
((DefaultItemAnimator) subject_type_list.getItemAnimator()).setSupportsChangeAnimations(false);
SubjectTypeAdapter adapter = new SubjectTypeAdapter(getContext(), SubjectTileFragment.this, contentTitle);
subject_type_list.setAdapter(adapter);
((DefaultItemAnimator) mSubjectRv.getItemAnimator()).setSupportsChangeAnimations(false);
final SubjectTypeAdapter adapter = new SubjectTypeAdapter(getContext(), SubjectTileFragment.this, contentTitle);
mSubjectRv.setAdapter(adapter);
}
loadData();
@ -146,20 +148,16 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
if (!TextUtils.isEmpty(mName)) {
int totalScrollRange = appBarLayout.getTotalScrollRange();
if (Math.abs(verticalOffset) < totalScrollRange / 2) {
mActionBarTitle.setText(mName);
if (mSubjectTitleListener != null)
mSubjectTitleListener.onChange(mName);
} else if (Math.abs(verticalOffset) == totalScrollRange && totalScrollRange != 0) {
mActionBarTitle.setText(StringUtils.buildString(mName, "-", mType, ""));
if (mSubjectTitleListener != null)
mSubjectTitleListener.onChange(StringUtils.buildString(mName, "-", mType, ""));
}
}
}
});
mActionBarTitle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EventBus.getDefault().post(new EBReuse(SubjectFragment.SCROLL_TOP));
}
});
}
public void onTouchEvent(MotionEvent ev) {

View File

@ -24,6 +24,7 @@ import com.gh.gamecenter.Injection;
import com.leon.channel.helper.ChannelReaderUtil;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Utils;
import com.tencent.bugly.Bugly;
import com.umeng.message.IUmengRegisterCallback;
import com.umeng.message.PushAgent;
import com.umeng.message.UTrack;
@ -95,6 +96,10 @@ public class HaloApp extends TinkerAppLike {
}
Log.e("CHANNEL_ID", mChannel);
if ("GH_TEST".equals(mChannel)) {
Bugly.setIsDevelopmentDevice(getApplication(), true); // 定义Bugly(tinker)开发设置
}
DataUtils.init(getApplication(), BuildConfig.DEBUG, mChannel);
// 注册回调以用于做各种统计

View File

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

View File

@ -16,7 +16,7 @@
android:layout_height = "wrap_content"
android:background = "@color/background"
android:gravity = "center"
android:visibility = "visible" >
app:layout_behavior = "com.gh.common.view.FixAppBarLayoutBehavior" >
<RelativeLayout
android:layout_width = "wrap_content"

View File

@ -22,7 +22,8 @@
<android.support.v7.widget.RecyclerView
android:id = "@+id/libao1_rv_list"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
android:layout_height = "match_parent"
android:overScrollMode = "never" />
<com.gc.materialdesign.views.ProgressBarCircularIndeterminate
android:id = "@+id/libao1_pb_loading"

View File

@ -6,7 +6,8 @@
<android.support.v7.widget.RecyclerView
android:id = "@+id/libao_search_rv_list"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
android:layout_height = "match_parent"
android:overScrollMode = "never" />
<com.gc.materialdesign.views.ProgressBarCircularIndeterminate
android:id = "@+id/libao_search_pb_loading"

View File

@ -1,40 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
android:layout_height = "match_parent" >
<RelativeLayout
<android.support.v7.widget.RecyclerView
android:id = "@+id/subject_list"
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
android:layout_height = "match_parent"
android:overScrollMode = "never" />
<android.support.v7.widget.RecyclerView
android:id = "@+id/subject_type_list"
android:layout_width = "match_parent"
android:layout_height = "0dp" />
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:background = "@drawable/shadow_down" />
<android.support.v7.widget.RecyclerView
android:id = "@+id/subject_list"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:layout_below = "@+id/subject_type_list" />
<com.gc.materialdesign.views.ProgressBarCircularIndeterminate
android:id = "@+id/subject_pb_loading"
android:layout_width = "40dp"
android:layout_height = "40dp"
android:layout_centerInParent = "true"
android:background = "@color/theme" />
<View
android:layout_width = "match_parent"
android:layout_height = "7dp"
android:layout_below = "@+id/subject_type_list"
android:background = "@drawable/shadow_down" />
<include layout = "@layout/reuse_no_connection" />
<com.gc.materialdesign.views.ProgressBarCircularIndeterminate
android:id = "@+id/subject_pb_loading"
android:layout_width = "40dp"
android:layout_height = "40dp"
android:layout_centerInParent = "true"
android:background = "@color/theme" />
<include layout = "@layout/reuse_none_data" />
<include layout = "@layout/reuse_no_connection" />
<include layout = "@layout/reuse_none_data" />
</RelativeLayout >
</LinearLayout >
</RelativeLayout >

View File

@ -1,10 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<android.support.design.widget.AppBarLayout
android:id = "@+id/subject_appbar"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:background = "@android:color/white"
android:gravity = "center"
app:layout_behavior = "com.gh.common.view.FixAppBarLayoutBehavior" >
<include layout = "@layout/subject_tiled_body" />
<android.support.v7.widget.RecyclerView
android:id = "@+id/subject_type_list"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
app:layout_scrollFlags = "scroll|enterAlwaysCollapsed" />
</LinearLayout >
<LinearLayout
android:layout_width = "246dp"
android:layout_height = "29dp"
android:layout_marginBottom = "20dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/border_black_bg" >
<TextView
android:id = "@+id/subject_tabbar_hot_tv"
android:layout_width = "123dp"
android:layout_height = "29dp"
android:background = "@drawable/tabbar_left_bg"
android:gravity = "center"
android:text = "最热"
android:textColor = "@android:color/white"
android:textSize = "14sp" />
<TextView
android:id = "@+id/subject_tabbar_new_tv"
android:layout_width = "123dp"
android:layout_height = "29dp"
android:gravity = "center"
android:text = "最新"
android:textColor = "@color/title"
android:textSize = "14sp" />
</LinearLayout >
</android.support.design.widget.AppBarLayout >
<FrameLayout
android:id = "@+id/subject_content_rl"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
app:layout_behavior = "@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout >

View File

@ -8,7 +8,7 @@
android:paddingBottom = "16dp"
android:paddingLeft = "18dp"
android:paddingRight = "18dp"
android:paddingTop = "10dp" >
android:paddingTop = "15dp" >
<RelativeLayout
android:layout_width = "match_parent"
@ -36,10 +36,10 @@
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_below = "@id/message_kefu_name"
android:layout_marginTop = "8dp"
android:layout_marginTop = "4dp"
android:layout_toRightOf = "@id/message_kefu_icon"
android:textColor = "@color/hint"
android:textSize = "12sp" />
android:textSize = "11sp" />
<View
android:id = "@+id/message_kefu_hint"

View File

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/subject_coordinator"
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical" >
<android.support.design.widget.AppBarLayout
android:id="@+id/subject_appbar"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:gravity = "center"
android:background="@android:color/white">
<android.support.v7.widget.RecyclerView
android:id = "@+id/subject_type_list"
android:layout_width = "match_parent"
android:layout_height = "0dp"
app:layout_scrollFlags = "scroll|enterAlwaysCollapsed"/>
<LinearLayout
android:layout_width = "246dp"
android:layout_height = "29dp"
android:layout_marginBottom = "20dp"
android:layout_marginTop = "15dp"
android:background = "@drawable/border_black_bg" >
<TextView
android:id = "@+id/subject_tabbar_hot_tv"
android:layout_width = "123dp"
android:layout_height = "29dp"
android:background = "@drawable/tabbar_left_bg"
android:gravity = "center"
android:text = "最热"
android:textColor = "@android:color/white"
android:textSize = "14sp" />
<TextView
android:id = "@+id/subject_tabbar_new_tv"
android:layout_width = "123dp"
android:layout_height = "29dp"
android:gravity = "center"
android:text = "最新"
android:textColor = "@color/title"
android:textSize = "14sp" />
</LinearLayout >
</android.support.design.widget.AppBarLayout >
<RelativeLayout
android:id="@+id/subject_content_rl"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
app:layout_behavior = "@string/appbar_scrolling_view_behavior" >
<!--<android.support.v7.widget.RecyclerView-->
<!--android:id = "@+id/subject_list"-->
<!--android:layout_width = "match_parent"-->
<!--android:layout_height = "match_parent"-->
<!--android:overScrollMode="never"/>-->
<!--<View-->
<!--android:layout_width = "match_parent"-->
<!--android:layout_height = "7dp"-->
<!--android:background = "@drawable/shadow_down" />-->
<!--<com.gc.materialdesign.views.ProgressBarCircularIndeterminate-->
<!--android:id = "@+id/subject_pb_loading"-->
<!--android:layout_width = "40dp"-->
<!--android:layout_height = "40dp"-->
<!--android:layout_centerInParent = "true"-->
<!--android:background = "@color/theme" />-->
<!--<include layout = "@layout/reuse_no_connection" />-->
<!--<include layout = "@layout/reuse_none_data" />-->
</RelativeLayout >
</android.support.design.widget.CoordinatorLayout >

View File

@ -120,7 +120,7 @@
<string name = "news_detail_send_comment" >发表评论...</string >
<string name = "receiver_waiting_to_connect" >等待发送者连接...</string >
<string name = "receiver_connection_timeout_hint" >如果长时间未连接成功,建议退出重试</string >
<string name = "receiver_connection_permission_hint" >接收文件需要开启热点\\n 如果出现获取权限的提示,请点击允许</string >
<string name = "receiver_connection_permission_hint" >接收文件需要开启热点 \n 如果出现获取权限的提示,请点击允许</string >
<string name = "receiver_connection_tip" >为了避免消耗流量,请关闭你手机的移动网络</string >
<string name = "select_from_media_library" >从手机相册中选择</string >
<string name = "setting_download_fix" >一键修复下载</string >

View File

@ -3,7 +3,7 @@
apply from: 'dependencies.gradle'
buildscript {
ext.kotlin_version = '1.1.4-3'
ext.kotlin_version = '1.2.0'
repositories {
maven { url "https://maven.google.com" }
maven { url "https://dl.bintray.com/thelasterstar/maven/" } //weiboSDK
@ -11,13 +11,13 @@ buildscript {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:2.3.3"
classpath "com.android.tools.build:gradle:3.0.1"
// for tinker
// classpath 'com.tencent.tinker:tinker-patch-gradle-plugin:1.8.1'
// bugly for tinker
classpath "com.tencent.bugly:tinker-support:1.0.8"
classpath "com.tencent.bugly:tinker-support:1.1.1"
// for apkChannelPackage https://github.com/ltlovezh/ApkChannelPackage
classpath "com.leon.channel:plugin:1.0.5"
@ -31,6 +31,7 @@ allprojects {
maven { url "https://maven.google.com" }
maven { url "https://dl.bintray.com/thelasterstar/maven/" }//weiboSDK
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' }
jcenter()
}
}
@ -52,8 +53,9 @@ subprojects {
// for those defined in AndroidManifest.xml
manifestPlaceholders = [
manifestApplicationId : "${applicationId}",
tencentAppId : "${TENCENT_APPID}",
manifestApplicationId: "${applicationId}",
tencentAppId : "${TENCENT_APPID}",
tencentAppScheme : "${MTA_APP_SCHEME}",
]
}
lintOptions.abortOnError false

View File

@ -1,6 +1,6 @@
ext {
//Android
buildToolsVersion = "26.0.1"
buildToolsVersion = "27.0.1"
compileSdkVersion = 26
minSdkVersion = 14
// TODO fix permission/ target 23 will cause permission issues
@ -12,24 +12,21 @@ ext {
applicationId = "com.gh.gamecenter"
//Libraries
androidSupport = "26.0.2"
androidSupport = "27.0.2"
multidex = "1.0.1"
butterKnife = "8.4.0"
butterKnife = "8.8.1"
eventbus = "3.0.0"
eventbusApt = "3.0.1"
// rxJava & rxAndroid
rxJava = "1.1.0"
rxAndroid = "1.1.0"
rxAndroid = "1.2.1"
rxBinding = "0.3.0"
rxJava2 = "2.0.9"
rxAndroid2 = "2.0.1"
// https://github.com/trello/RxLifecycle/tree/2.x
rxLifecycle = "2.0.1"
// https://github.com/JakeWharton/RxBinding
rxBinding = "0.3.0"
rxBinding2 = "2.0.0"
retrofit = "2.2.0"
okHttp = "3.7.0"
gson = "2.8.0"
@ -42,7 +39,7 @@ ext {
autoScrollViewPager = "1.1.2"
weiboSDK = "2.0.3:openDefaultRelease@aar"
apkChannelPackage = "1.0.4"
apkChannelPackage = "1.0.5"
//Test
jUnit = '4.12'
@ -50,10 +47,11 @@ ext {
leakcanary = '1.5.1'
tinker = "1.8.1"
bugly = "2.6.5"
buglyTinkerSupport = "1.3.1"
bugly = "2.6.6"
buglyTinkerSupport = "1.3.4"
// 权限申请库
easypermissions = "1.0.0"
// httpdns = "1.1.3";
}

View File

@ -20,7 +20,7 @@ org.gradle.parallel=true
channel_file=channel.txt
# tinker patch version_name
PATCH_VERSION_NAME=3.0.1
PATCH_VERSION_NAME=3.0.2
# Third-party keys
DEBUG_UMENG_APPKEY=58e5b0b9c62dca35a00005e6
@ -36,6 +36,7 @@ WECHAT_SECRET=368b49e8471857575a033b206218f9fb
TD_APPID=81DB144D555386A38A70B833537EC256
TENCENT_APPID=1104659243
MTA_APPKEY=APV567FTBS7J
MTA_APP_SCHEME=mtaautotrack.46f88906bee9811365708f419397abf3
WEIBO_APPKEY=1723629218
UMENG_APPKEY=585a29fa8f4a9d327600023e
UMENG_MESSAGE_SECRET=8bcce6bed547ee624f5c2cc64d39a9e9
@ -67,5 +68,5 @@ USERSEA_HOST=https\://usersea.ghzs.com/v1d0/
# 请不要手动改动下面的值除非你明确需要以某个apk作为基准包需要打包请以scripts/tinker*.sh为准
TINKER_ENABLE=
TINKER_ID=1d544ff5
TINKER_BASE_APK_DIR=app-1108-20-13-16_1d544ff5
TINKER_ID=82fea044
TINKER_BASE_APK_DIR=app-1114-14-55-39_82fea044

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
api fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
}
android {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -20,4 +20,22 @@
#}
-keep class com.tencent.stat.** {* ;}
-keep class com.tencent.mid.** {* ;}
-keep class com.tencent.mid.** {* ;}
-keep class com.tencent.mat.** {* ;}
-dontwarn org.slf4j.**
-keep class org.slf4j.** { *; }
-dontwarn org.apache.thrift.**
-keep class org.apache.thrift.** {*;}
-keep class org.apache.commons.codec.binary.**
-keep interface org.apache.commons.codec.binary.**
-keep enum org.apache.commons.codec.binary.**
-keep class org.slf4j.**
-keep interface org.slf4j.**
-keep enum org.slf4j.**
-keep class com.sun.syndication.io.**
-keep interface com.sun.syndication.io.**
-keep enum com.sun.syndication.io.**
-keep class com.sun.syndication.feed.synd.**
-keep interface com.sun.syndication.feed.synd.**
-keep enum com.sun.syndication.feed.synd.**

View File

@ -1,30 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android = "http://schemas.android.com/apk/res/android"
package = "com.gh.mta" >
package = "com.gh.mta" >
<uses-permission android:name = "android.permission.INTERNET" />
<uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name = "android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name = "android.permission.READ_PHONE_STATE" />
<uses-permission android:name = "android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name = "android.permission.WRITE_SETTINGS" />
<uses-permission android:name = "android.permission.INTERNET" />
<uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name = "android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name = "android.permission.READ_PHONE_STATE" />
<uses-permission android:name = "android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name = "android.permission.WRITE_SETTINGS" />
<application >
<application >
<!-- MTA -->
<!--<meta-data-->
<!--android:name = "TA_APPKEY"-->
<!--android:value = "APV567FTBS7J" />-->
<!--<meta-data-->
<!--android:name = "InstallChannel"-->
<!--android:value = "GH_TEST" />-->
<!-- MTA -->
<!--<meta-data-->
<!--android:name = "TA_APPKEY"-->
<!--android:value = "APV567FTBS7J" />-->
<!--<meta-data-->
<!--android:name = "InstallChannel"-->
<!--android:value = "GH_TEST" />-->
<!-- MID3.5(mid-sdk-3.5.jar) 以上版本请务必增加此配置-->
<provider
android:name = "com.tencent.mid.api.MidProvider"
android:authorities = "${applicationId}.TENCENT.MID.V3"
android:exported = "true" />
<!-- MID3.5(mid-sdk-3.5.jar) 以上版本请务必增加此配置-->
<provider
android:name = "com.tencent.mid.api.MidProvider"
android:authorities = "${applicationId}.TENCENT.MID.V3"
android:exported = "true" />
</application >
</application >
</manifest >

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
api fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
}
android {

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
api fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
}
android {

Binary file not shown.

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
api fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
}
android {

View File

@ -1,7 +1,8 @@
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
api fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
api project(':libraries:LGLibrary')
}
android {

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
api fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
}
android {

View File

@ -1,10 +1,10 @@
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
compile "com.android.support:support-v4:${androidSupport}"
compile "com.android.support:appcompat-v7:${androidSupport}"
compile "com.android.support:recyclerview-v7:${androidSupport}"
api fileTree(dir: 'libs', exclude: 'android-support-*.jar', include: '*.jar')
implementation "com.android.support:support-v4:${androidSupport}"
implementation "com.android.support:appcompat-v7:${androidSupport}"
implementation "com.android.support:recyclerview-v7:${androidSupport}"
}
android {

View File

@ -67,7 +67,7 @@ public class ForegroundLinearLayout extends LinearLayout {
}
mForegroundInPadding = a.getBoolean(
R.styleable.ForegroundView_android_foregroundInsidePadding, true);
R.styleable.ForegroundView_foregroundInsidePadding, true);
a.recycle();
}

View File

@ -20,51 +20,51 @@
<attr name = "foreground" format = "reference" />
</declare-styleable >
<declare-styleable name = "DrawShadowFrameLayout" >
<attr name = "shadowDrawable" format = "reference" />
<attr name = "shadowVisible" format = "boolean" />
</declare-styleable >
<declare-styleable name = "DrawShadowFrameLayout" >
<attr name = "shadowDrawable" format = "reference" />
<attr name = "shadowVisible" format = "boolean" />
</declare-styleable >
<declare-styleable name = "ScrimInsetsView" >
<attr name = "appInsetForeground" format = "reference|color" />
</declare-styleable >
<declare-styleable name = "ScrimInsetsView" >
<attr name = "appInsetForeground" format = "reference|color" />
</declare-styleable >
<declare-styleable name = "BezelImageView" >
<attr name = "maskDrawable" format = "reference" />
<attr name = "borderDrawable" format = "reference" />
<attr name = "desaturateOnPress" format = "boolean" />
</declare-styleable >
<declare-styleable name = "BezelImageView" >
<attr name = "maskDrawable" format = "reference" />
<attr name = "borderDrawable" format = "reference" />
<attr name = "desaturateOnPress" format = "boolean" />
</declare-styleable >
<declare-styleable name = "MessageCard" >
<attr name = "messageTitle" format = "string" />
<attr name = "messageText" format = "string" />
<attr name = "button1text" format = "string" />
<attr name = "button1tag" format = "string" />
<attr name = "button1emphasis" format = "boolean" />
<attr name = "button2text" format = "string" />
<attr name = "button2tag" format = "string" />
<attr name = "button2emphasis" format = "boolean" />
<attr name = "emphasisColor" format = "color" />
</declare-styleable >
<declare-styleable name = "MessageCard" >
<attr name = "messageTitle" format = "string" />
<attr name = "messageText" format = "string" />
<attr name = "button1text" format = "string" />
<attr name = "button1tag" format = "string" />
<attr name = "button1emphasis" format = "boolean" />
<attr name = "button2text" format = "string" />
<attr name = "button2tag" format = "string" />
<attr name = "button2emphasis" format = "boolean" />
<attr name = "emphasisColor" format = "color" />
</declare-styleable >
<declare-styleable name = "AspectRatioView" >
<attr name = "aspectRatio" format = "float" />
</declare-styleable >
<declare-styleable name = "AspectRatioView" >
<attr name = "aspectRatio" format = "float" />
</declare-styleable >
<declare-styleable name = "ForegroundView" >
<attr name = "android:foreground" />
<attr name = "android:foregroundInsidePadding" />
<attr name = "android:foregroundGravity" />
</declare-styleable >
<declare-styleable name = "ForegroundView" >
<attr name = "android:foreground" />
<attr name = "foregroundInsidePadding" />
<attr name = "android:foregroundGravity" />
</declare-styleable >
<declare-styleable name = "VideoThumbnail" >
<attr name = "playIcon" format = "reference" />
<attr name = "playedTint" format = "color" />
</declare-styleable >
<declare-styleable name = "VideoThumbnail" >
<attr name = "playIcon" format = "reference" />
<attr name = "playedTint" format = "color" />
</declare-styleable >
<declare-styleable name = "CustomRatingBar" >
<attr name = "maxRating" format = "integer" />
<attr name = "filledDrawable" format = "integer" />
<attr name = "unfilledDrawable" format = "integer" />
</declare-styleable >
<declare-styleable name = "CustomRatingBar" >
<attr name = "maxRating" format = "integer" />
<attr name = "filledDrawable" format = "integer" />
<attr name = "unfilledDrawable" format = "integer" />
</declare-styleable >
</resources >

47
scripts/apk_channel.sh Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
CWD=$(cd "$(dirname "$0")"; pwd)
# *****************************************************************************
# @author khy
# @2017.11.15
#
# 打渠道包
# 将目标apk放到scripts/apk-channel文件夹中即可
#
# *****************************************************************************
source ${CWD}/tinker_env.sh
echo ${APK_CHANNEL_PATH}
if [ ! -d ${APK_CHANNEL_PATH} ];
then
echo "存放apk包的文件夹不存在"
exit 0
fi
for apkFile in ${APK_CHANNEL_PATH}/*
do
echo ${apkFile}
if [ -f "$apkFile" ];
then
if [[ $apkFile == *.apk ]];
then
APK_COUNT+=($apkFile)
fi
fi
done
if [ ${#APK_COUNT[*]} != 1 ]
then
echo "确保apk_channel文件夹内只有一个apk包, 否则无法确定以哪个包为渠道基础包"
exit 0
fi
if [ ! -d ${APK_CHANNEL_PATH}/channel ]; then
mkdir -p ${APK_CHANNEL_PATH}/channel
fi
java -jar ${CWD}/ApkChannelPackage.jar put -mtc ${PROJECT_BASE}/channel.txt ${APK_COUNT[0]} ${APK_CHANNEL_PATH}/channel

View File

@ -11,6 +11,6 @@
CWD=$(cd "$(dirname "$0")"; pwd)
git submodule init
git submodule update
git submodule sync
git submodule foreach git checkout master
git submodule foreach git pull

View File

@ -16,6 +16,8 @@ PROJECT_BASE=${CWD}/../
GRADLE_FILE=${PROJECT_BASE}/gradle.properties
APK_CHANNEL_PATH=${CWD}/apk-channel
OS=`uname`
case ${OS} in
Darwin) VERSION_CODE=`grep -r versionCode ${PROJECT_BASE}/dependencies.gradle | awk '{print $4}'`;;
@ -44,4 +46,4 @@ CMD_GRADLE_PATCH="${PROJECT_BASE}/gradlew -b ${PROJECT_BASE}/build.gradle buildT
# 打channel release包的apk应该以tinker打基准包的那个apk为准找出文件名包含flavor publish 的apk
#APP_RELEASE_FILE=${PROJECT_BASE}/release-app/${versionName}_${versionCode}/patch/app-xxxxxx-gitsha/app-publish-release.apk
APP_RELEASE_FILE=`find ${APP_RELEASE_BASE} -type f -name '*publish*.apk'`
[ -f ${APP_RELEASE_BASE} ] && APP_RELEASE_FILE=`find ${APP_RELEASE_BASE} -type f -name '*publish*.apk'`