




下載本文檔
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】Android開(kāi)發(fā)中Launcher3常見(jiàn)默認(rèn)配置修改的示例分析
Launcher概述Launcher3默認(rèn)配置修改1.如何設(shè)置默認(rèn)頁(yè)<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);//在原來(lái)排序的基礎(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);//在原來(lái)排序的基礎(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的開(kāi)機(jī)引導(dǎo)頁(yè)面?class
Launche
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 員工j就職合同范本
- 買(mǎi)房交訂金合同范本
- 刑事代理訴訟合同范本
- 合同范例幾個(gè)部分
- 個(gè)人購(gòu)買(mǎi)古董合同范本
- 關(guān)于醫(yī)院合作合同范本
- 兵團(tuán)勞動(dòng)合同范本
- 單位修建公路合同范本
- 知識(shí)產(chǎn)權(quán)保護(hù)高地的推進(jìn)方案與實(shí)施路線
- 便民攤位招租合同范本
- 融合智慧數(shù)據(jù)的圖書(shū)館數(shù)智服務(wù)平臺(tái)研究
- 員工外宿免責(zé)協(xié)議書(shū)(2篇)
- IT科技產(chǎn)業(yè)云計(jì)算服務(wù)平臺(tái)開(kāi)發(fā)方案
- 2025年中國(guó)航天科工招聘筆試參考題庫(kù)含答案解析
- 兒童教育總經(jīng)理聘任合同
- 血透室停電停水應(yīng)急預(yù)案
- 4《公民的基本權(quán)利和義務(wù)》(第2課時(shí))教學(xué)實(shí)錄-2024-2025學(xué)年道德與法治六年級(jí)上冊(cè)統(tǒng)編版
- 人教版小學(xué)數(shù)學(xué)三年級(jí)下冊(cè)第一單元《位置與方向(一)》單元測(cè)試
- 電力變壓器聲紋檢測(cè)技術(shù)導(dǎo)則
- 公司前臺(tái)接待禮儀培訓(xùn)
- (完整版)施工現(xiàn)場(chǎng)機(jī)械設(shè)備維修保養(yǎng)記錄表
評(píng)論
0/150
提交評(píng)論