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
da9d00be
Commit
da9d00be
authored
Jan 30, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Topic
parent
454abc38
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
Topic.java
app-core/src/main/java/com/topjohnwu/magisk/utils/Topic.java
+6
-9
BaseActivity.java
...ll/java/com/topjohnwu/magisk/components/BaseActivity.java
+3
-0
BaseFragment.java
...ll/java/com/topjohnwu/magisk/components/BaseFragment.java
+4
-1
No files found.
app-core/src/main/java/com/topjohnwu/magisk/utils/Topic.java
View file @
da9d00be
...
@@ -15,16 +15,15 @@ public class Topic {
...
@@ -15,16 +15,15 @@ public class Topic {
public
static
final
int
MODULE_LOAD_DONE
=
1
;
public
static
final
int
MODULE_LOAD_DONE
=
1
;
public
static
final
int
REPO_LOAD_DONE
=
2
;
public
static
final
int
REPO_LOAD_DONE
=
2
;
public
static
final
int
UPDATE_CHECK_DONE
=
3
;
public
static
final
int
UPDATE_CHECK_DONE
=
3
;
public
static
final
int
SNET_CHECK_DONE
=
4
;
public
static
final
int
LOCALE_FETCH_DONE
=
4
;
public
static
final
int
LOCALE_FETCH_DONE
=
5
;
@IntDef
({
MAGISK_HIDE_DONE
,
MODULE_LOAD_DONE
,
REPO_LOAD_DONE
,
@IntDef
({
MAGISK_HIDE_DONE
,
MODULE_LOAD_DONE
,
REPO_LOAD_DONE
,
UPDATE_CHECK_DONE
,
SNET_CHECK_DONE
,
LOCALE_FETCH_DONE
})
UPDATE_CHECK_DONE
,
LOCALE_FETCH_DONE
})
@Retention
(
RetentionPolicy
.
SOURCE
)
@Retention
(
RetentionPolicy
.
SOURCE
)
public
@interface
TopicID
{}
public
@interface
TopicID
{}
// We will not dynamically add topics, so use arrays instead of hash tables
// We will not dynamically add topics, so use arrays instead of hash tables
private
static
Store
[]
topicList
=
new
Store
[
6
];
private
static
Store
[]
topicList
=
new
Store
[
5
];
public
static
void
subscribe
(
Subscriber
sub
,
@TopicID
int
...
topics
)
{
public
static
void
subscribe
(
Subscriber
sub
,
@TopicID
int
...
topics
)
{
for
(
int
topic
:
topics
)
{
for
(
int
topic
:
topics
)
{
...
@@ -38,8 +37,7 @@ public class Topic {
...
@@ -38,8 +37,7 @@ public class Topic {
}
}
public
static
void
subscribe
(
AutoSubscriber
sub
)
{
public
static
void
subscribe
(
AutoSubscriber
sub
)
{
if
(
sub
instanceof
Subscriber
)
subscribe
(
sub
,
sub
.
getSubscribedTopics
());
subscribe
((
Subscriber
)
sub
,
sub
.
getSubscribedTopics
());
}
}
public
static
void
unsubscribe
(
Subscriber
sub
,
@TopicID
int
...
topics
)
{
public
static
void
unsubscribe
(
Subscriber
sub
,
@TopicID
int
...
topics
)
{
...
@@ -51,8 +49,7 @@ public class Topic {
...
@@ -51,8 +49,7 @@ public class Topic {
}
}
public
static
void
unsubscribe
(
AutoSubscriber
sub
)
{
public
static
void
unsubscribe
(
AutoSubscriber
sub
)
{
if
(
sub
instanceof
Subscriber
)
unsubscribe
(
sub
,
sub
.
getSubscribedTopics
());
unsubscribe
((
Subscriber
)
sub
,
sub
.
getSubscribedTopics
());
}
}
public
static
void
publish
(
@TopicID
int
topic
,
Object
...
results
)
{
public
static
void
publish
(
@TopicID
int
topic
,
Object
...
results
)
{
...
@@ -100,7 +97,7 @@ public class Topic {
...
@@ -100,7 +97,7 @@ public class Topic {
void
onPublish
(
int
topic
,
Object
[]
result
);
void
onPublish
(
int
topic
,
Object
[]
result
);
}
}
public
interface
AutoSubscriber
{
public
interface
AutoSubscriber
extends
Subscriber
{
@TopicID
@TopicID
int
[]
getSubscribedTopics
();
int
[]
getSubscribedTopics
();
}
}
...
...
app/src/full/java/com/topjohnwu/magisk/components/BaseActivity.java
View file @
da9d00be
...
@@ -43,6 +43,9 @@ public abstract class BaseActivity extends AppCompatActivity implements Topic.Au
...
@@ -43,6 +43,9 @@ public abstract class BaseActivity extends AppCompatActivity implements Topic.Au
return
EMPTY_INT_ARRAY
;
return
EMPTY_INT_ARRAY
;
}
}
@Override
public
void
onPublish
(
int
topic
,
Object
[]
result
)
{}
@StyleRes
@StyleRes
public
int
getDarkTheme
()
{
public
int
getDarkTheme
()
{
return
-
1
;
return
-
1
;
...
...
app/src/full/java/com/topjohnwu/magisk/components/BaseFragment.java
View file @
da9d00be
...
@@ -8,7 +8,7 @@ import com.topjohnwu.magisk.utils.Topic;
...
@@ -8,7 +8,7 @@ import com.topjohnwu.magisk.utils.Topic;
import
androidx.fragment.app.Fragment
;
import
androidx.fragment.app.Fragment
;
import
butterknife.Unbinder
;
import
butterknife.Unbinder
;
public
class
BaseFragment
extends
Fragment
implements
Topic
.
AutoSubscriber
{
public
abstract
class
BaseFragment
extends
Fragment
implements
Topic
.
AutoSubscriber
{
public
App
app
=
App
.
self
;
public
App
app
=
App
.
self
;
protected
Unbinder
unbinder
=
null
;
protected
Unbinder
unbinder
=
null
;
...
@@ -49,4 +49,7 @@ public class BaseFragment extends Fragment implements Topic.AutoSubscriber {
...
@@ -49,4 +49,7 @@ public class BaseFragment extends Fragment implements Topic.AutoSubscriber {
public
int
[]
getSubscribedTopics
()
{
public
int
[]
getSubscribedTopics
()
{
return
BaseActivity
.
EMPTY_INT_ARRAY
;
return
BaseActivity
.
EMPTY_INT_ARRAY
;
}
}
@Override
public
void
onPublish
(
int
topic
,
Object
[]
result
)
{}
}
}
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