diff --git a/app/libs/libammsdk.jar b/app/libs/libammsdk.jar new file mode 100644 index 0000000000..bdb5909594 Binary files /dev/null and b/app/libs/libammsdk.jar differ diff --git a/app/libs/open_sdk_r5756.jar b/app/libs/open_sdk_r5756.jar new file mode 100644 index 0000000000..72daab63bf Binary files /dev/null and b/app/libs/open_sdk_r5756.jar differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 20cb0f7738..ee49eb7a0b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -150,6 +150,23 @@ + + + + + + + + + + diff --git a/app/src/main/java/com/gh/common/util/DialogUtils.java b/app/src/main/java/com/gh/common/util/DialogUtils.java index 4c5e3f8534..209453b7b7 100644 --- a/app/src/main/java/com/gh/common/util/DialogUtils.java +++ b/app/src/main/java/com/gh/common/util/DialogUtils.java @@ -114,7 +114,7 @@ public class DialogUtils { public static void showCancelDialog(Context context, final ConfiremListener listener) { Spanned content = Html.fromHtml("取消关注游戏后,您将无法及时收到游戏的" + "攻略、" + - "资讯等最新动态提醒,您确定取消吗?"); + "资讯等最新动态提醒"); showWarningDialog(context, "取消关注", content, "暂不取消", "确定取消", listener, null); } diff --git a/app/src/main/java/com/gh/common/util/ImageUtils.java b/app/src/main/java/com/gh/common/util/ImageUtils.java index d3140f2165..896e426ecb 100644 --- a/app/src/main/java/com/gh/common/util/ImageUtils.java +++ b/app/src/main/java/com/gh/common/util/ImageUtils.java @@ -254,6 +254,10 @@ public class ImageUtils { }); } + //获取图片BitMap + public void loadBitmap(String url, ImageLoadingListener listener){ + imageLoader.loadImage(url, listener); + } public void display(String url, ImageView imageView, ScaleType scaleType) { display(url, imageView, R.drawable.ocupy, scaleType, null); diff --git a/app/src/main/java/com/gh/common/util/ShareUtils.java b/app/src/main/java/com/gh/common/util/ShareUtils.java index a38b515716..420527e874 100644 --- a/app/src/main/java/com/gh/common/util/ShareUtils.java +++ b/app/src/main/java/com/gh/common/util/ShareUtils.java @@ -1,8 +1,11 @@ package com.gh.common.util; +import android.app.Activity; import android.content.ClipboardManager; import android.content.Context; +import android.graphics.Bitmap; import android.graphics.Color; +import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.Gravity; @@ -14,9 +17,24 @@ import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.RelativeLayout; import android.widget.TextView; +import android.widget.Toast; import com.gh.gamecenter.R; +import com.nostra13.universalimageloader.core.assist.FailReason; +import com.nostra13.universalimageloader.core.listener.ImageLoadingListener; +import com.tencent.connect.share.QQShare; +import com.tencent.connect.share.QzoneShare; +import com.tencent.mm.sdk.openapi.IWXAPI; +import com.tencent.mm.sdk.openapi.SendMessageToWX; +import com.tencent.mm.sdk.openapi.WXAPIFactory; +import com.tencent.mm.sdk.openapi.WXMediaMessage; +import com.tencent.mm.sdk.openapi.WXWebpageObject; +import com.tencent.mm.sdk.platformtools.Util; +import com.tencent.tauth.IUiListener; +import com.tencent.tauth.Tencent; +import com.tencent.tauth.UiError; +import java.util.ArrayList; import java.util.HashMap; import cn.sharesdk.framework.Platform; @@ -24,10 +42,6 @@ import cn.sharesdk.framework.PlatformActionListener; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.sina.weibo.SinaWeibo; import cn.sharesdk.system.text.ShortMessage; -import cn.sharesdk.tencent.qq.QQ; -import cn.sharesdk.tencent.qzone.QZone; -import cn.sharesdk.wechat.friends.Wechat; -import cn.sharesdk.wechat.moments.WechatMoments; /** * Created by khy on 2016/9/4. @@ -42,7 +56,9 @@ public class ShareUtils { private boolean isPlugin = false; - private int maxHeight; + private static IWXAPI api; + private static Tencent mTencent; + private int[] arrLogo = {R.drawable.share_wechat_logo, R.drawable.share_wechatmoments_logo, R.drawable.share_qq_logo , R.drawable.share_qzone_logo, R.drawable.share_sinaweibo_logo, R.drawable.share_shortmessage_logo , R.drawable.share_copyfont_logo, R.drawable.share_cancel_logo}; @@ -55,6 +71,8 @@ public class ShareUtils { public static ShareUtils getInstance(Context context) { if (instance == null) { instance = new ShareUtils(); + mTencent = Tencent.createInstance("1104659243", context); //初始化QQ分享 + api = WXAPIFactory.createWXAPI(context, "wx3ffd0785fad18396"); //初始化微信分享 } instance.context = context; return instance; @@ -67,15 +85,13 @@ public class ShareUtils { this.shareNewsTitle = newsTitle; this.isPlugin = isPlugin; - maxHeight = context.getResources().getDisplayMetrics().heightPixels; - RelativeLayout contentView = new RelativeLayout(context); contentView.setBackgroundColor(0x4c000000); contentView.setFocusable(true); contentView.setFocusableInTouchMode(true); RecyclerView shareRecyclerView = new RecyclerView(context); - shareRecyclerView.setPadding(DisplayUtils.dip2px(context, 4), DisplayUtils.dip2px(context, 4), DisplayUtils.dip2px(context, 4), 0); + shareRecyclerView.setPadding(DisplayUtils.dip2px(context, 10), DisplayUtils.dip2px(context, 4), DisplayUtils.dip2px(context, 10), 0); shareRecyclerView.setBackgroundColor(Color.WHITE); //RecyclerView禁止滑动 @@ -207,90 +223,148 @@ public class ShareUtils { //QQ分享 private void qqSahre(){ - QQ.ShareParams qqParams = new QQ.ShareParams(); + Utils.toast(context,"分享跳转中..."); + Bundle params = new Bundle(); if (shareNewsTitle != null){ - qqParams.setTitle(shareGameName); - qqParams.setText(shareNewsTitle); + params.putString(QQShare.SHARE_TO_QQ_TITLE, shareGameName); + params.putString(QQShare.SHARE_TO_QQ_SUMMARY, shareNewsTitle); }else { - qqParams.setTitle("向你推荐:"); + params.putString(QQShare.SHARE_TO_QQ_TITLE, "向你推荐:"); if (isPlugin){ - qqParams.setText(shareGameName + "(光环加速版)"); + params.putString(QQShare.SHARE_TO_QQ_SUMMARY, shareGameName + "(光环加速版)"); }else { - qqParams.setText(shareGameName); + params.putString(QQShare.SHARE_TO_QQ_SUMMARY, shareGameName); } } - qqParams.setImageUrl(shareIcon); - qqParams.setTitleUrl(shareUrl); - qqParams.setSite("光环助手"); - sharePlatform(qqParams,QQ.NAME); + params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT); + params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, shareUrl); + params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, shareIcon); + params.putString(QQShare.SHARE_TO_QQ_APP_NAME, "光环助手"); + + mTencent.shareToQQ( + (Activity) context, params, new IUiListener() { + @Override + public void onComplete(Object o) { + Toast.makeText(context, "QQ分享成功", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onError(UiError uiError) { + Toast.makeText(context, "QQ分享失败", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onCancel() { + Toast.makeText(context, "QQ分享取消", Toast.LENGTH_SHORT).show(); + } + }); + popupWindow.dismiss(); } //微信好友分享 private void wechatSahre(){ - Wechat.ShareParams wechatParams = new Wechat.ShareParams(); + Utils.toast(context,"分享跳转中..."); + WXWebpageObject webpage = new WXWebpageObject(); + WXMediaMessage msg = new WXMediaMessage(webpage); + webpage.webpageUrl = shareUrl; if (shareNewsTitle != null){ - wechatParams.setText(shareNewsTitle); + msg.title = shareGameName; + msg.description = shareNewsTitle; }else { if (isPlugin){ - wechatParams.setTitle("向你推荐"); - wechatParams.setText(shareGameName + "(光环加速版)"); + msg.title = "向你推荐"; + msg.description = shareGameName + "(光环加速版)"; }else { - wechatParams.setTitle("向你推荐"); - wechatParams.setText(shareGameName); + msg.title = "向你推荐"; + msg.description = shareGameName; } } - wechatParams.setShareType(Platform.SHARE_WEBPAGE); - wechatParams.setImageUrl(shareIcon); - wechatParams.setUrl(shareUrl); - sharePlatform(wechatParams,Wechat.NAME); + SendMessageToWX.Req req = new SendMessageToWX.Req(); + req.transaction = buildTransaction("webpage"); + req.message = msg; + req.scene = SendMessageToWX.Req.WXSceneSession; + + loadBitMap(shareIcon, msg, req); + popupWindow.dismiss(); } //QQ空间分享 private void qZoneSahre(){ - QZone.ShareParams qZoneParams = new QZone.ShareParams(); + Utils.toast(context,"分享跳转中..."); + Bundle params = new Bundle(); if (shareNewsTitle != null){ - qZoneParams.setTitle(shareGameName); - qZoneParams.setText(shareNewsTitle); + params.putString(QzoneShare.SHARE_TO_QQ_TITLE, shareGameName); + params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareNewsTitle); }else { - qZoneParams.setTitle("向你推荐:"); + params.putString(QzoneShare.SHARE_TO_QQ_TITLE, "向你推荐:"); if (isPlugin){ - qZoneParams.setText("向你推荐:" + shareGameName + "(光环加速版)"); + params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareGameName + "(光环加速版)"); }else { - qZoneParams.setText("向你推荐:" + shareGameName); + params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareGameName); } } - qZoneParams.setImageUrl(shareIcon); - qZoneParams.setTitleUrl(shareUrl); - qZoneParams.setSite("光环助手"); - sharePlatform(qZoneParams,QZone.NAME); + ArrayList imageUrls = new ArrayList(); + imageUrls.add(shareIcon); + + params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_NO_TYPE); + params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, shareUrl); + params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls); + params.putString(QzoneShare.SHARE_TO_QQ_APP_NAME, "光环助手"); + + mTencent.shareToQzone( + (Activity) context, params, new IUiListener() { + @Override + public void onComplete(Object o) { + Toast.makeText(context, "QQ空间分享成功", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onError(UiError uiError) { + Toast.makeText(context, "QQ空间分享失败", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onCancel() { + Toast.makeText(context, "QQ空间分享取消", Toast.LENGTH_SHORT).show(); + } + }); + popupWindow.dismiss(); } //微信朋友圈分享 private void wechatMomentsSahre(){ - WechatMoments.ShareParams wechatMomentsParams = new WechatMoments.ShareParams(); + Utils.toast(context,"分享跳转中..."); + WXWebpageObject webpage = new WXWebpageObject(); + WXMediaMessage msg = new WXMediaMessage(webpage); + webpage.webpageUrl = shareUrl; if (shareNewsTitle != null){ - wechatMomentsParams.setTitle(shareNewsTitle); + msg.title = shareNewsTitle; }else { if (isPlugin){ - wechatMomentsParams.setTitle("向你推荐:" + shareGameName + "(光环加速版)"); + msg.title = "向你推荐:" + shareGameName + "(光环加速版)"; }else { - wechatMomentsParams.setTitle("向你推荐:" + shareGameName); + msg.title = "向你推荐:" + shareGameName; } } - wechatMomentsParams.setShareType(Platform.SHARE_WEBPAGE); - wechatMomentsParams.setImageUrl(shareIcon); - wechatMomentsParams.setUrl(shareUrl); - sharePlatform(wechatMomentsParams, WechatMoments.NAME); + SendMessageToWX.Req req = new SendMessageToWX.Req(); + + req.transaction = buildTransaction("webpage"); + req.message = msg; + req.scene = SendMessageToWX.Req.WXSceneTimeline; + + loadBitMap(shareIcon, msg, req); + popupWindow.dismiss(); } + //新浪微博分享 private void sinaWeiboSahre(){ SinaWeibo.ShareParams sinaWeiboParams = new SinaWeibo.ShareParams(); @@ -299,12 +373,12 @@ public class ShareUtils { sinaWeiboParams.setText(shareNewsTitle); }else { if (isPlugin){ - sinaWeiboParams.setText("向你推荐:" + shareGameName + "(光环加速版)"); + sinaWeiboParams.setText("向你推荐:" + shareGameName + "(光环加速版)" + shareUrl); }else { - sinaWeiboParams.setText("向你推荐:" + shareGameName); + sinaWeiboParams.setText("向你推荐:" + shareGameName + shareUrl); } } - + sinaWeiboParams.setImageUrl(shareIcon); sharePlatform(sinaWeiboParams, SinaWeibo.NAME); } @@ -330,8 +404,10 @@ public class ShareUtils { //分享平台回调 private void sharePlatform(Platform.ShareParams params, String name) { Utils.toast(context,"分享跳转中..."); - Platform platform = ShareSDK.getPlatform(name); + if (platform.getName().equals(SinaWeibo.NAME)){ + platform.SSOSetting(true); + } platform.setPlatformActionListener(new PlatformActionListener() { @Override public void onComplete(Platform platform, int i, HashMap hashMap) { @@ -352,6 +428,10 @@ public class ShareUtils { popupWindow.dismiss(); } + private String buildTransaction(final String type) { + return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis(); + } + //复制文字链接 private void copyLink(String copyContent) { ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); @@ -360,4 +440,30 @@ public class ShareUtils { Utils.toast(context,"复制成功"); } + + private void loadBitMap(final String iconUrl, final WXMediaMessage msg, final SendMessageToWX.Req req){ + ImageUtils.getInstance(context).loadBitmap(iconUrl, new ImageLoadingListener() { + @Override + public void onLoadingStarted(String s, View view) { + + } + + @Override + public void onLoadingFailed(String s, View view, FailReason failReason) { + + } + + @Override + public void onLoadingComplete(String s, View view, Bitmap bitmap) { + msg.thumbData = Util.bmpToByteArray(bitmap, true); + api.sendReq(req); + } + + @Override + public void onLoadingCancelled(String s, View view) { + + } + }); + } + } diff --git a/app/src/main/java/com/gh/common/view/DownloadDialog.java b/app/src/main/java/com/gh/common/view/DownloadDialog.java index 71e8fe498b..663e5d0189 100644 --- a/app/src/main/java/com/gh/common/view/DownloadDialog.java +++ b/app/src/main/java/com/gh/common/view/DownloadDialog.java @@ -147,9 +147,15 @@ public class DownloadDialog { private ViewPager collectionViewPager; private LinearLayout collectionLinearLayout; + //两个全局变量用来定位收缩集合 + private int colseCollectionPosition; + private int colseAdapterPosition; + private int row; private int column; + private List collectionPositionlist;//存储集合位置 + public void showPopupWindow(View view, GameEntity game, String entrance, @@ -314,6 +320,10 @@ public class DownloadDialog { // 合并ApkCollection private void mergeApkCollection(GameEntity game) { + colseAdapterPosition = -1; + colseCollectionPosition = -1; + collectionPositionlist = new ArrayList<>(); + collectionAdapterMap = new SparseArray<>(); gameCollection = new ArrayList<>(); gameCollectionApk = new ArrayList<>(); @@ -601,8 +611,9 @@ public class DownloadDialog { private TextView download_item_tv_status; private TextView download_item_tv_hint; private ImageView download_item_open_collection; - private ProgressBar download_item_progressbar; + private ImageView download_item_colse_collection; private ImageView download_item_iv_pic; + private ProgressBar download_item_progressbar; public RecyclerViewHolder(View convertView) { super(convertView); @@ -619,6 +630,8 @@ public class DownloadDialog { .findViewById(R.id.download_item_tv_hint); download_item_open_collection = (ImageView) convertView .findViewById(R.id.download_item_open_collection); + download_item_colse_collection = (ImageView) convertView + .findViewById(R.id.download_item_colse_collection); } } @@ -650,20 +663,19 @@ public class DownloadDialog { private class RecyclerViewAdapter extends RecyclerView.Adapter { private List platforms; - private int position; + private int adapterPosition; private int count; - private int colseCollectionPosition = -1; - private int clickCollectionPosition = -1; + public RecyclerViewAdapter(List list, int p) { platforms = list; - position = p; + adapterPosition = p; if (platforms.size() <= (row * column)) { count = platforms.size(); - } else if (platforms.size() - (row * column) * position >= (row * column)) { + } else if (platforms.size() - (row * column) * adapterPosition >= (row * column)) { count = (row * column); } else { - count = platforms.size() - (row * column) * position; + count = platforms.size() - (row * column) * adapterPosition; } } @@ -674,25 +686,29 @@ public class DownloadDialog { @SuppressWarnings("deprecation") @Override - public void onBindViewHolder(final RecyclerViewHolder viewHolder, int position) { + public void onBindViewHolder(final RecyclerViewHolder viewHolder, final int position) { - final ApkEntity apkEntity = platforms.get((row * column) * this.position + position); + final ApkEntity apkEntity = platforms.get((row * column) * adapterPosition + position); viewHolder.itemView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (apkEntity.getApkCollection() != null){ - if (llCollection.getVisibility() == View.GONE - || clickCollectionPosition != viewHolder.getPosition() && clickCollectionPosition != -1){ + if (viewHolder.download_item_open_collection.getVisibility() == View.VISIBLE){ llCollection.setVisibility(View.VISIBLE); showCollectionLayout(apkEntity.getApkCollection()); - viewHolder.download_item_open_collection.setImageResource(R.drawable.collection_colse); + viewHolder.download_item_open_collection.setVisibility(View.GONE); + viewHolder.download_item_colse_collection.setVisibility(View.VISIBLE); colseCollectionPosition = viewHolder.getPosition(); - notifyDataSetChanged(); + colseAdapterPosition = adapterPosition; + for (int[] ints : collectionPositionlist) { + adapterMap.get(ints[0]).notifyItemChanged(ints[1]); + } } else { llCollection.setVisibility(View.GONE); - viewHolder.download_item_open_collection.setImageResource(R.drawable.collection_open); + viewHolder.download_item_open_collection.setVisibility(View.VISIBLE); + viewHolder.download_item_colse_collection.setVisibility(View.GONE); } - clickCollectionPosition = viewHolder.getPosition(); + } else if (viewHolder.download_item_tv_status.getVisibility() == View.GONE) { //下载游戏 if (NetworkUtils.isWifiConnected(context)) { @@ -925,10 +941,16 @@ public class DownloadDialog { if (apkEntity.getApkCollection() != null){ ImageUtils.getInstance(context).display(apkEntity.getApkCollection().getIcon(),viewHolder.download_item_iv_pic); viewHolder.download_item_open_collection.setVisibility(View.VISIBLE); - if (colseCollectionPosition == position){ - viewHolder.download_item_open_collection.setImageResource(R.drawable.collection_colse); + + int[] arrCollectionPosition= {adapterPosition, position}; + collectionPositionlist.add(arrCollectionPosition); + + if (colseCollectionPosition == position && adapterPosition == colseAdapterPosition){ + viewHolder.download_item_open_collection.setVisibility(View.GONE); + viewHolder.download_item_colse_collection.setVisibility(View.VISIBLE); }else { - viewHolder.download_item_open_collection.setImageResource(R.drawable.collection_open); + viewHolder.download_item_open_collection.setVisibility(View.VISIBLE); + viewHolder.download_item_colse_collection.setVisibility(View.GONE ); } } } diff --git a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java index c3271fb23b..b60f2c0478 100644 --- a/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/GameDetailActivity.java @@ -186,6 +186,7 @@ public class GameDetailActivity extends BaseActivity implements View.OnClickList isInstalled = true; } if (isInstalled) { + gamedetail_tv_download.setBackgroundResource(R.drawable.game_item_btn_launch_style); if (adapter.getGameDetailEntity() == null || TextUtils.isEmpty(adapter.getGameDetailEntity().getDownloadAddWord())) { gamedetail_tv_download.setText(String.format("启动《%s》", diff --git a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java index a7ed9c89dd..8d715e87d9 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java @@ -526,8 +526,8 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener private void getGameDetail(String gameId) { if (TextUtils.isEmpty(gameId)) { - newsdetail_ll_bottom.setVisibility(View.GONE); - newsdetail_rv_show.setPadding(0, 0, 0, 0); + newsdetail_ll_bottom.setVisibility(View.GONE); + newsdetail_rv_show.setPadding(0, 0, 0, 0); return; } JsonObjectExtendedRequest gameRequest = new JsonObjectExtendedRequest( @@ -541,7 +541,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener gameEntity = gson.fromJson(response.toString(), GameEntity.class); adapter.setGameEntity(gameEntity); adapter.notifyDataSetChanged(); - initDownload(); + initDownload(); } }, null); AppController.addToRequestQueue(gameRequest, NewsDetailActivity.class); @@ -705,6 +705,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener newsdetail_tv_download.setVisibility(View.VISIBLE); newsdetail_progressbar.setVisibility(View.GONE); newsdetail_tv_per.setVisibility(View.GONE); + newsdetail_tv_download.setBackgroundResource( R.drawable.game_item_btn_launch_style); if (TextUtils.isEmpty(gameEntity.getDownloadAddWord())) { newsdetail_tv_download.setText(String.format("启动《%s》", gameEntity.getName())); } else { diff --git a/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java b/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java index 6b58ccade5..f47efa3880 100644 --- a/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java +++ b/app/src/main/java/com/gh/gamecenter/NewsSearchActivity.java @@ -247,20 +247,17 @@ public class NewsSearchActivity extends BaseActivity { }else { LinearLayout linearLayout = new LinearLayout(getApplicationContext()); linearLayout.setOrientation(LinearLayout.HORIZONTAL); + linearLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); linearLayout.setBackgroundResource(R.drawable.cardview_item_style); - TextView tvType = new TextView(getApplicationContext()); - tvType.setTextSize(12); - tvType.setPadding(DisplayUtils.dip2px(NewsSearchActivity.this,1), 0, DisplayUtils.dip2px(NewsSearchActivity.this,1), 0); - TextView textView = new TextView(getApplicationContext()); textView.setPadding(DisplayUtils.dip2px(NewsSearchActivity.this,10),DisplayUtils.dip2px(NewsSearchActivity.this,10) ,0, DisplayUtils.dip2px(NewsSearchActivity.this,10)); textView.setTextColor(Color.parseColor("#3a3a3a")); textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); textView.setSingleLine(); + textView.setTextSize(15); - linearLayout.addView(tvType); linearLayout.addView(textView); return new ViewHolder(linearLayout); @@ -271,21 +268,8 @@ public class NewsSearchActivity extends BaseActivity { public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) { if (holder instanceof ViewHolder){ ViewHolder viewHolder = (ViewHolder) holder; - - if ("活动".equals(newsEntities.get(position).getType())){ - viewHolder.tvType.setTextColor(Color.WHITE); - viewHolder.tvType.setBackgroundResource(R.drawable.textview_orange_style); - } else if ("公告".equals(newsEntities.get(position).getType())){ - viewHolder.tvType.setTextColor(Color.WHITE); - viewHolder.tvType.setBackgroundResource(R.drawable.textview_red_style); - } else { - viewHolder.tvType.setTextColor(Color.WHITE); - viewHolder.tvType.setBackgroundResource(R.drawable.textview_blue_style); - } - viewHolder.tvType.setText(newsEntities.get(position).getType()); - viewHolder.tvTitle.setText(newsEntities.get(position).getTitle()); - viewHolder.tvTitle.setOnClickListener(new View.OnClickListener() { + viewHolder.linearLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(),NewsDetailActivity.class); @@ -332,13 +316,11 @@ public class NewsSearchActivity extends BaseActivity { public class ViewHolder extends RecyclerView.ViewHolder{ LinearLayout linearLayout; - TextView tvType; TextView tvTitle; public ViewHolder(View itemView) { super(itemView); linearLayout = (LinearLayout) itemView; - tvType = (TextView) linearLayout.getChildAt(0); - tvTitle = (TextView) linearLayout.getChildAt(1); + tvTitle = (TextView) linearLayout.getChildAt(0); } } } diff --git a/app/src/main/java/com/gh/gamecenter/adapter/GameNewsAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/GameNewsAdapter.java index 523fc691f2..06f595a401 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/GameNewsAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/GameNewsAdapter.java @@ -169,6 +169,8 @@ public class GameNewsAdapter extends RecyclerView.Adapter { } else if (holder instanceof NewsTextViewHolder) { NewsTextViewHolder viewHolder = (NewsTextViewHolder) holder; + viewHolder.newsType.setVisibility(View.GONE); + // 第一个 if (position - 2 == 0) { viewHolder.news_line.setVisibility(View.GONE); diff --git a/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java b/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java index 69a8af13eb..247dc0471b 100644 --- a/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java +++ b/app/src/main/java/com/gh/gamecenter/news/News4Fragment.java @@ -153,6 +153,9 @@ public class News4Fragment extends BaseFragment implements SwipeRefreshLayout.On if (news_rv_show != null && news_rv_show.getVisibility() == View.GONE) { news_rv_show.setVisibility(View.VISIBLE); } + if (reuse_none_data.getVisibility() == View.VISIBLE){ + reuse_none_data.setVisibility(View.GONE); + } } @Override @@ -163,6 +166,9 @@ public class News4Fragment extends BaseFragment implements SwipeRefreshLayout.On if (news_pb_loading != null && news_pb_loading.getVisibility() == View.VISIBLE) { news_pb_loading.setVisibility(View.GONE); } + if (reuse_none_data.getVisibility() == View.VISIBLE){ + reuse_none_data.setVisibility(View.GONE); + } news_rv_show.setVisibility(View.GONE); reuse_no_connection.setVisibility(View.VISIBLE); } @@ -172,8 +178,9 @@ public class News4Fragment extends BaseFragment implements SwipeRefreshLayout.On if (news_pb_loading.getVisibility() == View.VISIBLE) { news_pb_loading.setVisibility(View.GONE); } - news_rv_show.setVisibility(View.GONE); +// news_rv_show.setVisibility(View.GONE); //隐藏列表会导致 空白页面无法刷新 reuse_none_data.setVisibility(View.VISIBLE); + news_swipe_refresh.setRefreshing(false); } } diff --git a/app/src/main/res/drawable-hdpi/ic_actionbar_download.png b/app/src/main/res/drawable-hdpi/ic_actionbar_download.png index b6ea3f9994..4827b83960 100644 Binary files a/app/src/main/res/drawable-hdpi/ic_actionbar_download.png and b/app/src/main/res/drawable-hdpi/ic_actionbar_download.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_actionbar_notification.png b/app/src/main/res/drawable-hdpi/ic_actionbar_notification.png index b121759f52..9366981bf0 100644 Binary files a/app/src/main/res/drawable-hdpi/ic_actionbar_notification.png and b/app/src/main/res/drawable-hdpi/ic_actionbar_notification.png differ diff --git a/app/src/main/res/drawable-hdpi/reuse_btn_back.png b/app/src/main/res/drawable-hdpi/reuse_btn_back.png index 9a5d9a2313..02cb05971d 100644 Binary files a/app/src/main/res/drawable-hdpi/reuse_btn_back.png and b/app/src/main/res/drawable-hdpi/reuse_btn_back.png differ diff --git a/app/src/main/res/drawable-xhdpi/reuse_blank_hint.png b/app/src/main/res/drawable-xhdpi/reuse_blank_hint.png index c50a0530a3..d3be60238a 100644 Binary files a/app/src/main/res/drawable-xhdpi/reuse_blank_hint.png and b/app/src/main/res/drawable-xhdpi/reuse_blank_hint.png differ diff --git a/app/src/main/res/drawable-xhdpi/reuse_network_error.png b/app/src/main/res/drawable-xhdpi/reuse_network_error.png index c434139e03..969e0c2735 100644 Binary files a/app/src/main/res/drawable-xhdpi/reuse_network_error.png and b/app/src/main/res/drawable-xhdpi/reuse_network_error.png differ diff --git a/app/src/main/res/layout/activity_game_news.xml b/app/src/main/res/layout/activity_game_news.xml index 99de210235..e8c6649ab9 100644 --- a/app/src/main/res/layout/activity_game_news.xml +++ b/app/src/main/res/layout/activity_game_news.xml @@ -24,6 +24,8 @@ android:background="@color/background" android:paddingLeft="10dp" android:paddingRight="10dp" + android:paddingTop="3dp" + android:paddingBottom="3dp" android:visibility="gone"> diff --git a/app/src/main/res/layout/activity_gamedetail_news.xml b/app/src/main/res/layout/activity_gamedetail_news.xml index 9a478f52ad..46456c5bcf 100644 --- a/app/src/main/res/layout/activity_gamedetail_news.xml +++ b/app/src/main/res/layout/activity_gamedetail_news.xml @@ -74,8 +74,6 @@ app:cardUseCompatPadding="true" app:contentPaddingLeft="10dp" app:contentPaddingRight="10dp" - app:contentPaddingTop="3dp" - app:contentPaddingBottom="3dp" android:visibility="gone"> + android:background="#80000000" > + \ No newline at end of file diff --git a/app/src/main/res/layout/game_news_search_item.xml b/app/src/main/res/layout/game_news_search_item.xml index 520b9d16fa..76ebc2e5b8 100644 --- a/app/src/main/res/layout/game_news_search_item.xml +++ b/app/src/main/res/layout/game_news_search_item.xml @@ -6,7 +6,7 @@ android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="16dp" - android:layout_marginBottom="11dp"> + android:layout_marginBottom="8dp"> + android:paddingRight="10dp" + android:paddingTop="3dp" + android:paddingBottom="3dp"> \ No newline at end of file diff --git a/app/src/main/res/layout/game_news_type_list_item.xml b/app/src/main/res/layout/game_news_type_list_item.xml index b01ae47949..734431b9b3 100644 --- a/app/src/main/res/layout/game_news_type_list_item.xml +++ b/app/src/main/res/layout/game_news_type_list_item.xml @@ -1,7 +1,7 @@ diff --git a/app/src/main/res/layout/home_list_item_newsnormal_type.xml b/app/src/main/res/layout/home_list_item_newsnormal_type.xml index 8bc1fd20d3..c6e586cab2 100644 --- a/app/src/main/res/layout/home_list_item_newsnormal_type.xml +++ b/app/src/main/res/layout/home_list_item_newsnormal_type.xml @@ -26,14 +26,14 @@ + android:textSize="11sp" /> + android:textSize="15sp" + android:layout_marginTop="17dp"/> + android:textSize="15sp" + android:layout_marginTop="17dp"/> \ No newline at end of file diff --git a/app/src/main/res/layout/search_actionbar.xml b/app/src/main/res/layout/search_actionbar.xml index 52fac246ee..a082e9d5a4 100644 --- a/app/src/main/res/layout/search_actionbar.xml +++ b/app/src/main/res/layout/search_actionbar.xml @@ -14,7 +14,7 @@ android:padding="6dp" >