說明,在sd卡中放入theme_thumbs資料夾,裡面存放主題風格的縮圖,然後在theme檔案下存放主題的資源檔案,例如/theme/sport等等,裡面圖示命名規則是主題key_
加上快捷方式的類名(下劃線取代點),例如sport_com_android_browser_browseractivity.png,這樣就可以自動掃瞄載入主題風格了。
public class themepickeractivity extends activity
android.os.process.killprocess(android.os.process.mypid());
}e.printstacktrace();
}android.os.process.killprocess(android.os.process.mypid());
}else
}});
} private listmthemesnames = null;
private listmthemesbitmaps = null;
private class imageadapter extends baseadapter
@override
public int getcount()
@override
public object getitem(int position)
@override
public long getitemid(int position)
@override
public view getview(int position, view convertview, viewgroup parent) else
if(position == mthemesnames.size())
imageview.setimagebitmap(bitmapfactory. decoderesource (themepickeractivity.this.getresources(), r.drawable.default_scene));
else
imageview.setimagebitmap(mthemesbitmaps.get(position));
return imageview;
} }
private void getthemebitmaps(string path)}}
}}private string trimextension(string filename)
}
return null;
}private boolean isfileeffect(string name)
}+ themekeyname + "_workspace_bg.png";
if(new file(workbgpath).exists())
}if(d!=null)
setbackgrounddrawable(d);
*/mtransposelayoutwithorientation =
r.getboolean(r.bool.hotseat_transpose_layout_with_orientation);
mislandscape = context.getresources().getconfiguration().orientation ==
configuration.orientation_landscape;
}if (!themekeyname.equals("default")) catch (resources.notfoundexception e)
return (d != null) ? d : getfullresdefaultactivityicon();
}public drawable getfullresicon(string packagename, int iconid)
}// add by xuxin
public drawable getfullresicon(activityinfo info) else}}
//add by xuxin
private cacheentry cachelocked(componentname componentname, resolveinfo info,
hashmaplabelcache) elseelse
}}else
//add by xuxin
private string converttoiconresname(string input)
private bitmap addthemelogo(bitmap srcbitmap)
bitmap b3 = bitmap.createbitmap(srcbitmap.getwidth()+5, srcbitmap.getheight()+5, srcbitmap.getconfig());
canvas canvas = new canvas(b3);
canvas.drawbitmap(srcbitmap,0,0,new paint(paint.filter_bitmap_flag));
canvas.drawbitmap(b2,0,math.abs(srcbitmap.getheight()-b2.getheight()),new paint(paint.filter_bitmap_flag));
return b3;
} android:launchmode="singletask"
android:cleartaskonlaunch="true">
在Launcher3中增加主題切換功能
說明,在sd卡中放入theme thumbs資料夾,裡面存放主題風格的縮圖,然後在theme檔案下存放主題的資源檔案,例如 theme sport等等,裡面圖示命名規則是主題key 加上快捷方式的類名 下劃線取代點 例如sport com android browser browseractivit...
Launcher3禁止拖動和刪除
1 刪除操作是由長按時間觸發,所以我們只要在launcher的onlongclick view v 方法中直接返回就可以。如果是部分禁止,可以通過v獲取到iteminfo,gettag中包含類別 位置和類名,從中過濾即可。if v.gettag instanceof iteminfo 2 單純禁止自...
Launcher3分析篇 (一 前導篇)
launcher作為android手機啟動後給使用者展示的第乙個應用,我想一步一步對launcher3的原始碼進行分析並記錄,也是為了讓自己遺忘的時候可以看看。下面正式開始launcher3的分析,首先介紹一下主要的幾個類 接下來我們看下launcher的主ui是怎麼樣的 當然launcher不止有...