【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android開發(fā)中Launcher3常見默認(rèn)配置修改的示例分析_第1頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android開發(fā)中Launcher3常見默認(rèn)配置修改的示例分析_第2頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android開發(fā)中Launcher3常見默認(rèn)配置修改的示例分析_第3頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android開發(fā)中Launcher3常見默認(rèn)配置修改的示例分析_第4頁
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android開發(fā)中Launcher3常見默認(rèn)配置修改的示例分析_第5頁
免費(fèi)預(yù)覽已結(jié)束,剩余2頁可下載查看

下載本文檔

版權(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論