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
2c043621
Commit
2c043621
authored
Sep 18, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent null strings in modules/repos
Close #620, close #621
parent
017fbf26
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
ModulesAdapter.java
...ll/java/com/topjohnwu/magisk/adapters/ModulesAdapter.java
+3
-3
ReposAdapter.java
...full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
+9
-4
BaseModule.java
.../full/java/com/topjohnwu/magisk/container/BaseModule.java
+14
-8
Repo.java
app/src/full/java/com/topjohnwu/magisk/container/Repo.java
+2
-1
No files found.
app/src/full/java/com/topjohnwu/magisk/adapters/ModulesAdapter.java
View file @
2c043621
...
...
@@ -45,9 +45,9 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
String
noInfo
=
context
.
getString
(
R
.
string
.
no_info_provided
);
holder
.
title
.
setText
(
module
.
getName
());
holder
.
versionName
.
setText
(
TextUtils
.
isEmpty
(
version
)
?
noInfo
:
version
);
holder
.
author
.
setText
(
TextUtils
.
isEmpty
(
author
)
?
noInfo
:
context
.
getString
(
R
.
string
.
author
,
author
));
holder
.
description
.
setText
(
TextUtils
.
isEmpty
(
description
)
?
noInfo
:
description
);
holder
.
versionName
.
setText
(
TextUtils
.
isEmpty
(
version
)
?
noInfo
:
version
);
holder
.
author
.
setText
(
TextUtils
.
isEmpty
(
author
)
?
noInfo
:
context
.
getString
(
R
.
string
.
author
,
author
));
holder
.
description
.
setText
(
TextUtils
.
isEmpty
(
description
)
?
noInfo
:
description
);
holder
.
checkBox
.
setOnCheckedChangeListener
(
null
);
holder
.
checkBox
.
setChecked
(
module
.
isEnabled
());
...
...
app/src/full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
View file @
2c043621
...
...
@@ -88,11 +88,16 @@ public class ReposAdapter extends SectionedAdapter<ReposAdapter.SectionHolder, R
Repo
repo
=
repoPairs
.
get
(
section
).
second
.
get
(
position
);
Context
context
=
holder
.
itemView
.
getContext
();
holder
.
title
.
setText
(
repo
.
getName
()
);
holder
.
versionName
.
setText
(
repo
.
getVersion
()
);
String
name
=
repo
.
getName
(
);
String
version
=
repo
.
getVersion
(
);
String
author
=
repo
.
getAuthor
();
holder
.
author
.
setText
(
TextUtils
.
isEmpty
(
author
)
?
null
:
context
.
getString
(
R
.
string
.
author
,
author
));
holder
.
description
.
setText
(
repo
.
getDescription
());
String
description
=
repo
.
getDescription
();
String
noInfo
=
context
.
getString
(
R
.
string
.
no_info_provided
);
holder
.
title
.
setText
(
TextUtils
.
isEmpty
(
name
)
?
noInfo
:
name
);
holder
.
versionName
.
setText
(
TextUtils
.
isEmpty
(
version
)
?
noInfo
:
version
);
holder
.
author
.
setText
(
TextUtils
.
isEmpty
(
author
)
?
noInfo
:
context
.
getString
(
R
.
string
.
author
,
author
));
holder
.
description
.
setText
(
TextUtils
.
isEmpty
(
description
)
?
noInfo
:
description
);
holder
.
updateTime
.
setText
(
context
.
getString
(
R
.
string
.
updated_on
,
repo
.
getLastUpdateString
()));
holder
.
infoLayout
.
setOnClickListener
(
v
->
...
...
app/src/full/java/com/topjohnwu/magisk/container/BaseModule.java
View file @
2c043621
package
com
.
topjohnwu
.
magisk
.
container
;
import
android.content.ContentValues
;
import
android.database.Cursor
;
import
android.text.TextUtils
;
import
java.util.List
;
...
...
@@ -10,21 +10,27 @@ import androidx.annotation.NonNull;
public
abstract
class
BaseModule
implements
Comparable
<
BaseModule
>
{
private
String
mId
=
null
,
mName
,
mVersion
,
mAuthor
,
mDescription
;
private
String
mId
,
mName
,
mVersion
,
mAuthor
,
mDescription
;
private
int
mVersionCode
=
-
1
,
minMagiskVersion
=
-
1
;
protected
BaseModule
()
{}
protected
BaseModule
()
{
mId
=
mName
=
mVersion
=
mAuthor
=
mDescription
=
""
;
}
protected
BaseModule
(
Cursor
c
)
{
mId
=
c
.
getString
(
c
.
getColumnIndex
(
"id"
));
mName
=
c
.
getString
(
c
.
getColumnIndex
(
"name"
));
mVersion
=
c
.
getString
(
c
.
getColumnIndex
(
"version"
));
mId
=
nonNull
(
c
.
getString
(
c
.
getColumnIndex
(
"id"
)
));
mName
=
nonNull
(
c
.
getString
(
c
.
getColumnIndex
(
"name"
)
));
mVersion
=
nonNull
(
c
.
getString
(
c
.
getColumnIndex
(
"version"
)
));
mVersionCode
=
c
.
getInt
(
c
.
getColumnIndex
(
"versionCode"
));
mAuthor
=
c
.
getString
(
c
.
getColumnIndex
(
"author"
));
mDescription
=
c
.
getString
(
c
.
getColumnIndex
(
"description"
));
mAuthor
=
nonNull
(
c
.
getString
(
c
.
getColumnIndex
(
"author"
)
));
mDescription
=
nonNull
(
c
.
getString
(
c
.
getColumnIndex
(
"description"
)
));
minMagiskVersion
=
c
.
getInt
(
c
.
getColumnIndex
(
"minMagisk"
));
}
private
String
nonNull
(
String
s
)
{
return
s
==
null
?
""
:
s
;
}
public
ContentValues
getContentValues
()
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
"id"
,
mId
);
...
...
app/src/full/java/com/topjohnwu/magisk/container/Repo.java
View file @
2c043621
...
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.container;
import
android.content.ContentValues
;
import
android.database.Cursor
;
import
android.text.TextUtils
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.utils.Download
;
...
...
@@ -35,7 +36,7 @@ public class Repo extends BaseModule {
throw
new
IllegalRepoException
(
"Repo ["
+
repoName
+
"] parse error: "
+
e
.
getMessage
());
}
if
(
getId
()
==
null
)
{
if
(
TextUtils
.
isEmpty
(
getId
())
)
{
throw
new
IllegalRepoException
(
"Repo ["
+
repoName
+
"] does not contain id"
);
}
if
(
getVersionCode
()
<
0
)
{
...
...
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