Skip to content

Commit 47d5696

Browse files
committed
修复bugly的问题
1 parent cc20f8d commit 47d5696

22 files changed

+229
-155
lines changed

app/build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ android {
2727
compileSdkVersion rootProject.ext.compileSdkVersion
2828
buildToolsVersion rootProject.ext.buildToolsVersion
2929

30-
dexOptions {
31-
javaMaxHeapSize '2g'
32-
}
30+
// dexOptions {
31+
// javaMaxHeapSize '2g'
32+
// }
3333

3434
signingConfigs {
3535
release {
@@ -64,6 +64,12 @@ android {
6464
manifestPlaceholders = [
6565
UMENG_APPKEY: umengAppKey
6666
]
67+
68+
ndk {
69+
// fix bug #504 64位系统webView问题
70+
abiFilters "armeabi"
71+
abiFilters "armeabi-v7a"
72+
}
6773
}
6874
buildTypes {
6975
debug {
@@ -104,6 +110,7 @@ android {
104110
productFlavors.all { flavor ->
105111
flavor.manifestPlaceholders = [UMENG_CHANNEL: name, BUGLY_CHANNEL: name]
106112
}
113+
107114
}
108115

109116
dependencies {

app/src/main/java/com/rae/cnblogs/ThemeCompat.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ public View createView(@NonNull Context context, String name, @NonNull Attribute
4040
} catch (Throwable e) {
4141
e.printStackTrace();
4242
}
43-
return new RaeSkinImageViewV4(context, attributeSet);
43+
44+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
45+
return new RaeSkinImageViewV4(context, attributeSet);
46+
}
4447
}
4548
return null;
4649
}

app/src/main/java/com/rae/cnblogs/adapter/BaseItemAdapter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public void onBindViewHolder(VH holder, int position) {
7373
}
7474

7575
protected void onBindItemClickListener(VH holder, int position, final T dataItem) {
76+
77+
// 加载中点击事件不处理
78+
if (getItemViewType(position) == VIEW_TYPE_LOADING) return;
79+
7680
holder.itemView.setOnClickListener(new View.OnClickListener() {
7781
@Override
7882
public void onClick(View v) {

app/src/main/java/com/rae/cnblogs/adapter/MomentAdapter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ public SimpleViewHolder onCreateViewHolder(LayoutInflater inflater, ViewGroup pa
9797
return new MomentHolder(inflateView(parent, R.layout.item_moment_list));
9898
}
9999

100-
@Override
101-
protected void onBindItemClickListener(SimpleViewHolder holder, int position, MomentBean dataItem) {
102-
if (getItemViewType(position) == VIEW_TYPE_LOADING) return;
103-
super.onBindItemClickListener(holder, position, dataItem);
104-
}
105-
106100
@Override
107101
public void onBindViewHolder(SimpleViewHolder viewHolder, int position, MomentBean m) {
108102
int viewType = getItemViewType(position);

app/src/main/java/com/rae/cnblogs/adapter/MomentDetailAdapter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ private void onBindCommentViewHolder(MomentCommentHolder holder, MomentCommentBe
164164
SpannableString content = new SpannableString(m.getContent());
165165

166166
if (!TextUtils.isEmpty(m.getAtAuthorName())) {
167-
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(holder.itemView.getContext(), R.color.colorPrimary)), 0, m.getAtAuthorName().length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
167+
content.setSpan(
168+
new ForegroundColorSpan(ContextCompat.getColor(holder.itemView.getContext(), R.color.colorPrimary)),
169+
0,
170+
// fix bug #762
171+
Math.min(m.getAtAuthorName().length() + 1, content.length()),
172+
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
168173
}
169174
if (!TextUtils.isEmpty(m.getAvatar())) {
170175
RaeImageLoader.displayHeaderImage(m.getAvatar(), holder.avatarView);

app/src/main/java/com/rae/cnblogs/adapter/MomentMessageAdapter.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ public int getItemViewType(int position) {
4343
return super.getItemViewType(position);
4444
}
4545

46-
@Override
47-
protected void onBindItemClickListener(SimpleViewHolder holder, int position, MomentCommentBean dataItem) {
48-
if (getItemViewType(position) == VIEW_TYPE_LOADING) return;
49-
super.onBindItemClickListener(holder, position, dataItem);
50-
}
51-
52-
5346
@Override
5447
public SimpleViewHolder onCreateViewHolder(LayoutInflater inflater, ViewGroup parent, int viewType) {
5548
if (viewType == VIEW_TYPE_LOADING) {

app/src/main/java/com/rae/cnblogs/dialog/impl/ShareDialog.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.rae.cnblogs.dialog.IAppDialogClickListener;
3030
import com.tencent.bugly.crashreport.CrashReport;
3131
import com.umeng.socialize.ShareAction;
32+
import com.umeng.socialize.UMShareAPI;
3233
import com.umeng.socialize.bean.SHARE_MEDIA;
3334
import com.umeng.socialize.media.UMImage;
3435
import com.umeng.socialize.media.UMWeb;
@@ -245,6 +246,15 @@ protected void share(SHARE_MEDIA type) {
245246
}
246247

247248
try {
249+
250+
UMShareAPI umShareAPI = UMShareAPI.get(getContext());
251+
252+
// fix bug #536 没有安装应用
253+
if (getContext() instanceof Activity && !umShareAPI.isInstall((Activity) getContext(), type)) {
254+
AppUI.failed(getContext(), "请安装" + type);
255+
return;
256+
}
257+
248258
mShareAction.setPlatform(type);
249259
mShareAction.share();
250260
} catch (Exception e) {

app/src/main/java/com/rae/cnblogs/fragment/BaseFragment.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
3737
@Override
3838
public void onDestroy() {
3939
super.onDestroy();
40-
if (mUnbinder != null) {
41-
mUnbinder.unbind();
42-
mUnbinder = null;
43-
}
4440
}
4541

4642
protected void onCreateView(View view) {
@@ -53,7 +49,8 @@ protected void onLoadData() {
5349
protected abstract int getLayoutId();
5450

5551
protected CnblogSdkConfig config() {
56-
return CnblogSdkConfig.getsInstance(getContext().getApplicationContext());
52+
// fix bug #478
53+
return CnblogSdkConfig.getsInstance(getContext());
5754
}
5855

5956
protected int parseInt(String text) {

app/src/main/java/com/rae/cnblogs/fragment/BlogContentFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public BlogBean getBlog() {
215215
@Override
216216
public void onLoadContentSuccess(String content) {
217217
// 可能会处于非主线程中,这里提交到主线程中去。
218-
// fix bugly #354
218+
// fix bugly #354 #562
219219
mContentLayout.post(new Runnable() {
220220
@Override
221221
public void run() {

app/src/main/java/com/rae/cnblogs/fragment/BlogListFragment.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,16 @@ protected void onMobclickAgent(CategoryBean category) {
112112

113113
@Override
114114
public void onDestroy() {
115-
mItemAdapter.destroy();
116-
mAppLayout.removeAllViews();
117-
mRecyclerView.removeAllViews();
115+
// fix bug #772
116+
if (mBlogListPresenter != null)
117+
mBlogListPresenter.destroy();
118+
if (mItemAdapter != null)
119+
mItemAdapter.destroy();
120+
// fix bug #732
121+
if (mAppLayout != null)
122+
mAppLayout.removeAllViews();
123+
if (mRecyclerView != null)
124+
mRecyclerView.removeAllViews();
118125
EventBus.getDefault().unregister(this);
119126
super.onDestroy();
120127
}

0 commit comments

Comments
 (0)