From 6bb407b739ea5a153f84b9d7f133ce281aa3a16c Mon Sep 17 00:00:00 2001 From: handsomezhou Date: Sun, 11 Oct 2015 21:03:52 +0800 Subject: [PATCH] fix appsearch crash bug in some cases --- .../handsomezhou/appsearch/fragment/QwertySearchFragment.java | 4 ++++ .../com/handsomezhou/appsearch/fragment/T9SearchFragment.java | 4 ++++ .../src/com/handsomezhou/appsearch/helper/AppInfoHelper.java | 3 +++ 3 files changed, 11 insertions(+) diff --git a/AppSearch/src/com/handsomezhou/appsearch/fragment/QwertySearchFragment.java b/AppSearch/src/com/handsomezhou/appsearch/fragment/QwertySearchFragment.java index 01e21f2..a96edaf 100644 --- a/AppSearch/src/com/handsomezhou/appsearch/fragment/QwertySearchFragment.java +++ b/AppSearch/src/com/handsomezhou/appsearch/fragment/QwertySearchFragment.java @@ -98,6 +98,10 @@ public void refreshView() { } public void updateSearch(){ + if(null==mSearchBox){ + return; + } + updateSearch(mSearchBox.getSearchEtInput()); } diff --git a/AppSearch/src/com/handsomezhou/appsearch/fragment/T9SearchFragment.java b/AppSearch/src/com/handsomezhou/appsearch/fragment/T9SearchFragment.java index 8e2899f..f119b1b 100644 --- a/AppSearch/src/com/handsomezhou/appsearch/fragment/T9SearchFragment.java +++ b/AppSearch/src/com/handsomezhou/appsearch/fragment/T9SearchFragment.java @@ -143,6 +143,10 @@ public void refreshView() { } public void updateSearch(){ + if(null==mT9TelephoneDialpadView){ + return; + } + updateSearch(mT9TelephoneDialpadView.getT9Input()); } diff --git a/AppSearch/src/com/handsomezhou/appsearch/helper/AppInfoHelper.java b/AppSearch/src/com/handsomezhou/appsearch/helper/AppInfoHelper.java index 511012c..7bbfc0a 100644 --- a/AppSearch/src/com/handsomezhou/appsearch/helper/AppInfoHelper.java +++ b/AppSearch/src/com/handsomezhou/appsearch/helper/AppInfoHelper.java @@ -174,6 +174,9 @@ public List loadAppInfo(Context context){ boolean canLaunchTheMainActivity=AppUtil.appCanLaunchTheMainActivity(mContext, pi.packageName); if(true==canLaunchTheMainActivity){ AppInfo appInfo=getAppInfo(pm, pi); + if(TextUtils.isEmpty(appInfo.getLabel())){ + continue; + } PinyinUtil.chineseStringToPinyinUnit(appInfo.getLabel(), appInfo.getLabelPinyinUnits()); String sortKey=PinyinUtil.getSortKey(appInfo.getLabelPinyinUnits()).toUpperCase();