Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
launcher
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lihuaikun
launcher
Commits
3eecf6d3
Commit
3eecf6d3
authored
May 08, 2020
by
lihuaikun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:
parent
76f2f54a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
4 deletions
+79
-4
build.gradle
Launcher3/build.gradle
+1
-1
Launcher.java
Launcher3/src/main/java/com/android/launcher3/Launcher.java
+70
-3
LauncherManager.java
...n/java/com/android/launcher3/manager/LauncherManager.java
+8
-0
No files found.
Launcher3/build.gradle
View file @
3eecf6d3
...
@@ -104,7 +104,7 @@ ext {
...
@@ -104,7 +104,7 @@ ext {
GITHUB_REPO_PATH
=
"../../androidlibrary"
GITHUB_REPO_PATH
=
"../../androidlibrary"
PUBLISH_GROUP_ID
=
'cn.dankal.android'
PUBLISH_GROUP_ID
=
'cn.dankal.android'
PUBLISH_ARTIFACT_ID
=
'launcher'
PUBLISH_ARTIFACT_ID
=
'launcher'
PUBLISH_VERSION
=
'1.3.9'
PUBLISH_VERSION
=
'1.3.9
.1
'
}
}
uploadArchives
{
uploadArchives
{
...
...
Launcher3/src/main/java/com/android/launcher3/Launcher.java
View file @
3eecf6d3
...
@@ -2374,6 +2374,57 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
...
@@ -2374,6 +2374,57 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
/**
/**
* 找一个空位放cell
*
* @param cellXY
* @param spanX
* @param spanY
* @return
*/
public
boolean
findEmptyCellForSpan
(
ItemInfo
lastItenInfo
,
int
[]
cellXY
,
int
spanX
,
int
spanY
)
{
int
numColumns
=
getDeviceProfile
().
inv
.
numColumns
;
int
numRows
=
getDeviceProfile
().
inv
.
numRows
;
ItemInfo
itemInfo
=
lastItenInfo
;
if
(
itemInfo
.
cellX
>=
0
)
{
if
(
itemInfo
.
cellY
+
itemInfo
.
spanY
-
1
+
spanY
>=
numRows
&&
itemInfo
.
cellX
+
itemInfo
.
spanX
-
1
+
spanX
>=
numColumns
)
{
// 需要添加的cell长度已经不足以放下
Logger
.
e
(
TAG
,
"itemInfo.cellY("
+
itemInfo
.
cellY
+
") + itemInfo.spanY("
+
itemInfo
.
spanY
+
") - 1 + "
+
spanY
+
" >= "
+
numRows
);
return
false
;
}
if
(
itemInfo
.
cellX
+
itemInfo
.
spanX
-
1
+
spanX
<
numColumns
)
{
cellXY
[
0
]
=
itemInfo
.
cellX
+
itemInfo
.
spanX
;
if
(
spanY
==
1
)
{
cellXY
[
1
]
=
itemInfo
.
cellY
;
return
true
;
}
else
if
(
itemInfo
.
cellY
+
itemInfo
.
spanY
-
1
+
spanY
>=
numRows
)
{
return
false
;
}
}
else
if
(
itemInfo
.
cellY
+
itemInfo
.
spanY
-
1
+
spanY
<
numRows
)
{
cellXY
[
0
]
=
0
;
cellXY
[
1
]
=
itemInfo
.
cellY
+
1
;
return
true
;
// 在最后一个cell的末尾添加不了 那就在下一行计算
}
}
else
{
// 一个空屏
if
(
spanX
<
numColumns
&&
spanY
<
numRows
)
{
cellXY
[
0
]
=
0
;
cellXY
[
1
]
=
0
;
return
true
;
}
}
return
false
;
}
/**
* 新增的app快捷方式 在这里workspace中的坐标会重新计算
* 新增的app快捷方式 在这里workspace中的坐标会重新计算
*
*
* @param added
* @param added
...
@@ -2395,6 +2446,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
...
@@ -2395,6 +2446,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
long
lastScreenId
=
currentLastScreenId
;
long
lastScreenId
=
currentLastScreenId
;
// 在新的CellLayout创建快捷方式的位置
// 在新的CellLayout创建快捷方式的位置
int
index
=
0
;
int
index
=
0
;
// 是否是第一次添加桌面图标
boolean
isFirst
=
true
;
// 上一个添加Cell的位置信息
ItemInfo
lastInfo
=
new
ItemInfo
();
CellLayout
lastCellLayout
=
(
CellLayout
)
mWorkspace
.
getChildAt
(
mWorkspace
.
getChildCount
()
-
1
);
CellLayout
lastCellLayout
=
(
CellLayout
)
mWorkspace
.
getChildAt
(
mWorkspace
.
getChildCount
()
-
1
);
final
ContentWriter
writer
=
new
ContentWriter
(
getApplicationContext
());
final
ContentWriter
writer
=
new
ContentWriter
(
getApplicationContext
());
final
ContentResolver
cr
=
getApplicationContext
().
getContentResolver
();
final
ContentResolver
cr
=
getApplicationContext
().
getContentResolver
();
...
@@ -2403,7 +2458,14 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
...
@@ -2403,7 +2458,14 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
for
(
int
i
=
0
;
i
<
shortcutInfos
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
shortcutInfos
.
size
();
i
++)
{
ShortcutInfo
shortcutInfo
=
shortcutInfos
.
get
(
i
);
ShortcutInfo
shortcutInfo
=
shortcutInfos
.
get
(
i
);
int
[]
cell
=
new
int
[
2
];
int
[]
cell
=
new
int
[
2
];
boolean
finded
=
lastCellLayout
.
findEmptyCellForSpan
(
cell
,
1
,
1
);
boolean
finded
=
false
;
if
(
isFirst
)
{
finded
=
lastCellLayout
.
findEmptyCellForSpan
(
cell
,
1
,
1
);
isFirst
=
false
;
}
else
{
finded
=
findEmptyCellForSpan
(
lastInfo
,
cell
,
1
,
1
);
}
long
itemId
=
LauncherSettings
.
Settings
.
call
(
cr
,
LauncherSettings
.
Settings
.
METHOD_NEW_ITEM_ID
).
getLong
(
LauncherSettings
.
Settings
.
EXTRA_VALUE
);
long
itemId
=
LauncherSettings
.
Settings
.
call
(
cr
,
LauncherSettings
.
Settings
.
METHOD_NEW_ITEM_ID
).
getLong
(
LauncherSettings
.
Settings
.
EXTRA_VALUE
);
if
(
finded
)
{
if
(
finded
)
{
...
@@ -2411,6 +2473,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
...
@@ -2411,6 +2473,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
shortcutInfo
.
cellX
=
cell
[
0
];
shortcutInfo
.
cellX
=
cell
[
0
];
shortcutInfo
.
cellY
=
cell
[
1
];
shortcutInfo
.
cellY
=
cell
[
1
];
lastInfo
=
shortcutInfo
;
}
else
{
}
else
{
// 将图标放在下一屏
// 将图标放在下一屏
lastScreenId
=
LauncherSettings
.
Settings
.
call
(
cr
,
lastScreenId
=
LauncherSettings
.
Settings
.
call
(
cr
,
...
@@ -2424,6 +2488,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
...
@@ -2424,6 +2488,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
index
+=
1
;
index
+=
1
;
lastInfo
=
shortcutInfo
;
}
}
shortcutInfo
.
container
=
LauncherSettings
.
Favorites
.
CONTAINER_DESKTOP
;
shortcutInfo
.
container
=
LauncherSettings
.
Favorites
.
CONTAINER_DESKTOP
;
...
@@ -2449,7 +2515,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
...
@@ -2449,7 +2515,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
ops
.
add
(
ContentProviderOperation
.
newInsert
(
favoritesUri
).
withValues
(
values
).
build
());
ops
.
add
(
ContentProviderOperation
.
newInsert
(
favoritesUri
).
withValues
(
values
).
build
());
Logger
.
e
(
TAG
,
"bindShortcutsAdd\t"
+
shortcutInfo
.
toString
());
// cr.insert(favoritesUri,values);
Logger
.
e
(
TAG
,
"bindShortcutsAdd\t"
+
shortcutInfo
.
toString
());
}
}
...
@@ -2459,7 +2526,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
...
@@ -2459,7 +2526,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
LauncherModel
.
updateWorkspaceScreenOrder
(
getApplicationContext
(),
workspaceScreens
);
LauncherModel
.
updateWorkspaceScreenOrder
(
getApplicationContext
(),
workspaceScreens
);
Logger
.
e
(
TAG
,
"bindShortcutsAdd insertNewWorkspaceScreen"
);
Logger
.
e
(
TAG
,
"bindShortcutsAdd insertNewWorkspaceScreen"
);
}
}
return
shortcutInfos
;
return
shortcutInfos
;
...
...
Launcher3/src/main/java/com/android/launcher3/manager/LauncherManager.java
View file @
3eecf6d3
...
@@ -871,12 +871,20 @@ public class LauncherManager {
...
@@ -871,12 +871,20 @@ public class LauncherManager {
}
}
/**
* 跳转debug信息页面
* @param context
*/
public
void
jumpDebugInfo
(
Context
context
){
public
void
jumpDebugInfo
(
Context
context
){
Intent
intent
=
new
Intent
(
context
,
DebugInfoActivity
.
class
);
Intent
intent
=
new
Intent
(
context
,
DebugInfoActivity
.
class
);
context
.
startActivity
(
intent
);
context
.
startActivity
(
intent
);
}
}
/**
* 跳转查询app是否可用页面
* @param context
*/
public
void
jumpSearchAppCanUse
(
Context
context
){
public
void
jumpSearchAppCanUse
(
Context
context
){
Intent
intent
=
new
Intent
(
context
,
SearchAppCanUseActivity
.
class
);
Intent
intent
=
new
Intent
(
context
,
SearchAppCanUseActivity
.
class
);
context
.
startActivity
(
intent
);
context
.
startActivity
(
intent
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment