




下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android開發(fā)中Launcher3常見默認(rèn)配置修改的示例分析
Launcher概述Launcher3默認(rèn)配置修改1.如何設(shè)置默認(rèn)頁<integer
name="config_workspaceDefaultScreen">0</integer>2.如何隱藏launcher3中的搜索框public
View
getQsbBar()
{
if
(mQsbBar
==
null)
{
mQsbBar
=
mInflater.inflate(R.layout.search_bar,
mSearchDropTargetBar,
false);
-
mSearchDropTargetBar.addView(mQsbBar);
}
+
mQsbBar.setVisibility(View.GONE);
return
mQsbBar;
}
@Override
public
void
bindSearchablesChanged()
{
//注釋該方法內(nèi)容
/*
boolean
searchVisible
=
updateGlobalSearchIcon();
boolean
voiceVisible
=
updateVoiceSearchIcon(searchVisible);
if
(mSearchDropTargetBar
!=
null)
{
mSearchDropTargetBar.onSearchPackagesChanged(searchVisible,
voiceVisible);
}
*/
}//
Layout
the
search
bar
//注釋如下內(nèi)容
/*
View
qsbBar
=
launcher.getQsbBar();
LayoutParams
vglp
=
qsbBar.getLayoutParams();
vglp.width
=
LayoutParams.MATCH_PARENT;
vglp.height
=
LayoutParams.MATCH_PARENT;
qsbBar.setLayoutParams(vglp);
*/<?xml
version="1.0"
encoding="utf-8"?>
<resources>
<string-array
name="apps_componentName"
translatable="false">
<item>ComponentInfo{com.android.vending/com.android.vending.AssetBrowserActivity}</item>
<item>ComponentInfo{com.android.browser/com.android.browser.BrowserActivity}</item>
<item>ComponentInfo{com.android.settings/com.android.settings.Settings}</item>
<item>ComponentInfo{com.android.camera2/com.android.camera.CameraLauncher}</item>
<item>ComponentInfo{com.android.mms/com.android.mms.ui.ConversationList}</item>
</string-array>
</resources>
import
java.util.Arrays;
import
java.util.List;
public
static
List<String>
getAppsComponentName(final
Context
context)
{
return
Arrays.asList(context.getResources().getStringArray(R.array.apps_componentName));
}
src/com/android/launcher3/LauncherModel.java
protected
int
mPreviousConfigMcc;
static
List<String>
appArray
=
new
ArrayList<String>();
LauncherModel(LauncherAppState
app,
IconCache
iconCache,
AppFilter
appFilter)
{
mUserManager
=
UserManagerCompat.getInstance(context);
appArray
=
Utilities.getAppsComponentName(context);
}public
static
final
void
sortApps(ArrayList<AppInfo>
apps)
{
int
length
=
appArray.size();
List<AppInfo>
assignApps
=
new
ArrayList<AppInfo>();
for(int
i=0;i<length;i++)
{
assignApps.add(i,
null);
}
for(AppInfo
app
:
apps){
for(int
k=0;
k<length;
k++){
if
(ponentName.toString().equals(appArray.get(k)))
{
assignApps.set(k,app
);
continue;
}
}
}
for
(int
i
=length
-1;i
>
-1
;i--)
{
AppInfo
app
=
assignApps.get(i);
if(app
!=
null){
apps.remove(app);
apps.add(0,
app);
}
}
Log.d(TAG
,"The
Apps
List
after
Sort!");
}public
void
setApps(ArrayList<AppInfo>
list)
{
if
(!LauncherAppState.isDisableAllApps())
{
SprdAppSortAddonStub.getInstance().sortApps(mApps);
LauncherModel.sortApps(mApps);//在原來排序的基礎(chǔ)上,再將arrays.xml中配置的應(yīng)用按順序排在前面。
updatePageCountsAndInvalidateData();
}
}
private
void
addAppsWithoutInvalidate(ArrayList<AppInfo>
list)
{
//
SPRD:
bug375932
2014-12-02
Feature
customize
app
icon
sort.
SprdAppSortAddonStub.getInstance().sortApps(mApps);
LauncherModel.sortApps(mApps);//在原來排序的基礎(chǔ)上,再將arrays.xml中配置的應(yīng)用按順序排在前面。
}5.如何確定待機(jī)HOME界面布局使用的是哪個(gè)default_workspace文件?deviceProfiles.add(new
DeviceProfile("Super
Short
Stubby",
255,
300,
2,
3,
48,
13,
(hasAA
?
3
:
5),
48,
R.xml.default_workspace_4x4));
deviceProfiles.add(new
DeviceProfile("Shorter
Stubby",
255,
400,
3,
3,
48,
13,
(hasAA
?
3
:
5),
48,
R.xml.default_workspace_4x4));
deviceProfiles.add(new
DeviceProfile("Short
Stubby",
275,
420,
3,
4,
48,
13,
(hasAA
?
5
:
5),
48,
R.xml.default_workspace_4x4));
deviceProfiles.add(new
DeviceProfile("Stubby",
255,
450,
3,
4,
48,
13,
(hasAA
?
5
:
5),
48,
R.xml.default_workspace_4x4));
deviceProfiles.add(new
DeviceProfile("Nexus
S",
296,
491.33f,
4,
4,
48,
13,
(hasAA
?
5
:
5),
48,
R.xml.default_workspace_4x4));
deviceProfiles.add(new
DeviceProfile("Nexus
4",
335,
567,
4,
4,
DEFAULT_ICON_SIZE_DP,
13,
(hasAA
?
5
:
5),
56,
R.xml.default_workspace_4x4));
deviceProfiles.add(new
DeviceProfile("Nexus
5",
359,
567,
4,
4,
DEFAULT_ICON_SIZE_DP,
13,
(hasAA
?
5
:
5),
56,
R.xml.default_workspace_4x4));
deviceProfiles.add(new
DeviceProfile("Large
Phone",
406,
694,
5,
5,
64,
14.4f,
5,
56,
R.xml.default_workspace_5x5));
//
The
tablet
profile
is
odd
in
that
the
landscape
orientation
//
also
includes
the
nav
bar
on
the
side
deviceProfiles.add(new
DeviceProfile("Nexus
7",
575,
904,
5,
6,
72,
14.4f,
7,
60,
R.xml.default_workspace_5x6));
//
Larger
tablet
profiles
always
have
system
bars
on
the
top
&
bottom
deviceProfiles.add(new
DeviceProfile("Nexus
10",
727,
1207,
5,
6,
76,
14.4f,
7,
64,
R.xml.default_workspace_5x6));
deviceProfiles.add(new
DeviceProfile("20-inch
Tablet",
1527,
2527,
7,
7,
100,
20,
7,
72,
R.xml.default_workspace_4x4));mMinWidth
=
dpiFromPx(minWidthPx,
dm);
mMinHeight
=
dpiFromPx(minHeightPx,
dm);mProfile
=
new
DeviceProfile(context,
deviceProfiles,
mMinWidth,
mMinHeight,
widthPx,
heightPx,
awPx,
ahPx,
resources);
src/com/android/launcher3/DeviceProfile.java
DeviceProfile(Context
context,
ArrayList<DeviceProfile>
profiles,
float
minWidth,
float
minHeight,
int
wPx,
int
hPx,
int
awPx,
int
ahPx,
Resources
res)
{DeviceProfile
closestProfile
=
findClosestDeviceProfile(minWidth,
minHeight,
points);
defaultLayoutId
=
closestProfile.defaultLayoutId;6.如何替換第三方應(yīng)用在launcher上顯示的圖標(biāo)?private
CacheEntry
cacheLocked(ComponentName
componentName,
ResolveInfo
info,
private
CacheEntry
cacheLocked(ComponentName
componentName,
ResolveInfo
info,
HashMap<Object,
CharSequence>
labelCache)
{
CacheEntry
entry
=
mCache.get(componentName);
if
(entry
==
null)
{
entry
=
new
CacheEntry();
mCache.put(componentName,
entry);
ComponentName
key
=
LauncherModel.getComponentNameFromResolveInfo(info);
if
(labelCache
!=
null
&&
labelCache.containsKey(key))
{
entry.title
=
labelCache.get(key).toString();
}
else
{
entry.title
=
info.loadLabel(mPackageManager).toString();
if
(labelCache
!=
null)
{
labelCache.put(key,
entry.title);
}
}
if
(entry.title
==
null)
{
entry.title
=
info.activityI;
}
Drawable
icon;
int
index
=
sysIndexOf(componentName.getClassName());
Log.i("jxt",
"index:"+index+",Name:"+componentName.getClassName());
icon
=
getFullResIcon(info);
if
(index
>=
0)
{
entry.icon
=
Utilities.createIconBitmap(icon,
mContext);
}
else
{
entry.icon
=
Utilities.createIconBitmap(
/*
SPRD:
Feature
253522,
Remove
the
application
drawer
view
@{
*/
//
getFullResIcon(info),
mContext);
icon,
mContext,
true);
}
/*
此處即為替換圖標(biāo)代碼
{@*/
if("第三方應(yīng)用的componentName".equals(componentName.toString())){
entry.icon
=
BitmapFactory.decodeResource(mContext.getResources(),
R.drawable.xxx);
}
/*
@}
*/
}
return
entry;
}7.如何去掉Launcher3的開機(jī)引導(dǎo)頁面?class
Launche
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 初中生社會(huì)實(shí)踐能力的多元化發(fā)展與評(píng)價(jià)考核試卷
- 保健食品營(yíng)養(yǎng)需求分析與滿足策略實(shí)施效果考核試卷
- 合成氣制合成油考核試卷
- 國(guó)際貿(mào)易信用證條款解析與應(yīng)用考核試卷
- 網(wǎng)購(gòu)家具合同范本
- 簡(jiǎn)單的工傷合同范本
- 賣車簡(jiǎn)單合同范本
- 農(nóng)業(yè)訂單合同范本
- 電視購(gòu)物產(chǎn)品退換政策協(xié)議
- 瑜伽培訓(xùn)合同協(xié)議書
- 醫(yī)學(xué)教材成人高尿酸血癥與痛風(fēng)食養(yǎng)指南(2024年版)解讀課件
- 小學(xué)數(shù)學(xué)北師大版三年級(jí)下長(zhǎng)方形的面積教案
- DGJ32 J 67-2008 商業(yè)建筑設(shè)計(jì)防火規(guī)范
- 2024年上海交通大學(xué)招考聘用高頻考題難、易錯(cuò)點(diǎn)模擬試題(共500題)附帶答案詳解
- 2024年江西省中考生物·地理合卷試卷真題(含答案逐題解析)
- 2024年山東省濰坊市中考數(shù)學(xué)真題試題(含答案及解析)
- 開票稅點(diǎn)自動(dòng)計(jì)算器
- 2024年江蘇農(nóng)牧科技職業(yè)學(xué)院?jiǎn)握新殬I(yè)適應(yīng)性測(cè)試題庫及參考答案
- 醫(yī)療器械質(zhì)量安全風(fēng)險(xiǎn)會(huì)商管理制度
- 焦慮自評(píng)量表(SAS)
- 患者轉(zhuǎn)運(yùn)意外應(yīng)急預(yù)案
評(píng)論
0/150
提交評(píng)論