Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
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
Administrator
Magisk
Commits
07d1a20f
Commit
07d1a20f
authored
Dec 30, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve StringListAdapter
parent
76491cbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
StringListAdapter.java
...java/com/topjohnwu/magisk/adapters/StringListAdapter.java
+5
-2
No files found.
app/src/full/java/com/topjohnwu/magisk/adapters/StringListAdapter.java
View file @
07d1a20f
...
@@ -21,6 +21,7 @@ public abstract class StringListAdapter<VH extends StringListAdapter.ViewHolder>
...
@@ -21,6 +21,7 @@ public abstract class StringListAdapter<VH extends StringListAdapter.ViewHolder>
private
boolean
dynamic
;
private
boolean
dynamic
;
private
int
screenWidth
;
private
int
screenWidth
;
private
int
txtWidth
=
-
1
;
private
int
txtWidth
=
-
1
;
private
int
padding
;
protected
List
<
String
>
mList
;
protected
List
<
String
>
mList
;
...
@@ -53,16 +54,17 @@ public abstract class StringListAdapter<VH extends StringListAdapter.ViewHolder>
...
@@ -53,16 +54,17 @@ public abstract class StringListAdapter<VH extends StringListAdapter.ViewHolder>
protected
void
onUpdateTextWidth
(
VH
vh
)
{
protected
void
onUpdateTextWidth
(
VH
vh
)
{
if
(
txtWidth
<
0
)
{
if
(
txtWidth
<
0
)
{
txtWidth
=
screenWidth
;
txtWidth
=
screenWidth
-
padding
;
}
else
{
}
else
{
vh
.
txt
.
measure
(
0
,
0
);
vh
.
txt
.
measure
(
0
,
0
);
int
width
=
vh
.
txt
.
getMeasuredWidth
();
int
width
=
vh
.
txt
.
getMeasuredWidth
();
if
(
width
>
txtWidth
)
{
if
(
width
>
txtWidth
)
{
txtWidth
=
width
;
txtWidth
=
width
;
vh
.
txt
.
getLayoutParams
().
width
=
txtWidth
;
vh
.
txt
.
getLayoutParams
().
width
=
txtWidth
;
rv
.
requestLayout
();
}
}
}
}
if
(
rv
.
getWidth
()
!=
txtWidth
+
padding
)
rv
.
requestLayout
();
}
}
@Override
@Override
...
@@ -71,6 +73,7 @@ public abstract class StringListAdapter<VH extends StringListAdapter.ViewHolder>
...
@@ -71,6 +73,7 @@ public abstract class StringListAdapter<VH extends StringListAdapter.ViewHolder>
((
Activity
)
rv
.
getContext
()).
getWindowManager
()
((
Activity
)
rv
.
getContext
()).
getWindowManager
()
.
getDefaultDisplay
().
getMetrics
(
displayMetrics
);
.
getDefaultDisplay
().
getMetrics
(
displayMetrics
);
screenWidth
=
displayMetrics
.
widthPixels
;
screenWidth
=
displayMetrics
.
widthPixels
;
padding
=
rv
.
getPaddingStart
()
+
rv
.
getPaddingEnd
();
this
.
rv
=
rv
;
this
.
rv
=
rv
;
}
}
...
...
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