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
1a1d37a2
Commit
1a1d37a2
authored
Sep 09, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Looking good...
parent
214649ec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
467 additions
and
155 deletions
+467
-155
BaseModuleFragment.java
...rc/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
+115
-9
BaseRepoFragment.java
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
+171
-56
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+12
-6
RepoHelper.java
...src/main/java/com/topjohnwu/magisk/module/RepoHelper.java
+34
-29
ic_system_update_alt_black.xml
app/src/main/res/drawable/ic_system_update_alt_black.xml
+1
-1
list_item_module.xml
app/src/main/res/layout/list_item_module.xml
+22
-0
list_item_repo.xml
app/src/main/res/layout/list_item_repo.xml
+45
-3
modules_fragment.xml
app/src/main/res/layout/modules_fragment.xml
+62
-49
dimens.xml
app/src/main/res/values/dimens.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+4
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
View file @
1a1d37a2
package
com
.
topjohnwu
.
magisk
;
package
com
.
topjohnwu
.
magisk
;
import
android.animation.Animator
;
import
android.animation.ValueAnimator
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
...
@@ -7,18 +10,23 @@ import android.support.annotation.Nullable;
...
@@ -7,18 +10,23 @@ import android.support.annotation.Nullable;
import
android.support.design.widget.Snackbar
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.view.ViewTreeObserver
;
import
android.view.WindowManager
;
import
android.widget.CheckBox
;
import
android.widget.CheckBox
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -35,17 +43,17 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -35,17 +43,17 @@ public abstract class BaseModuleFragment extends Fragment {
@Nullable
@Nullable
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
View
view
Main
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
Main
);
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
prefs
.
registerOnSharedPreferenceChangeListener
(
new
SharedPreferences
.
OnSharedPreferenceChangeListener
()
{
prefs
.
registerOnSharedPreferenceChangeListener
(
new
SharedPreferences
.
OnSharedPreferenceChangeListener
()
{
@Override
@Override
public
void
onSharedPreferenceChanged
(
SharedPreferences
sharedPreferences
,
String
s
)
{
public
void
onSharedPreferenceChanged
(
SharedPreferences
sharedPreferences
,
String
s
)
{
if
(
s
.
contains
(
"updated"
))
{
if
(
s
.
contains
(
"updated"
))
{
view
.
invalidate
();
view
Main
.
invalidate
();
view
.
requestLayout
();
view
Main
.
requestLayout
();
}
}
}
}
...
@@ -54,7 +62,7 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -54,7 +62,7 @@ public abstract class BaseModuleFragment extends Fragment {
emptyTv
.
setVisibility
(
View
.
VISIBLE
);
emptyTv
.
setVisibility
(
View
.
VISIBLE
);
recyclerView
.
setVisibility
(
View
.
GONE
);
recyclerView
.
setVisibility
(
View
.
GONE
);
return
view
;
return
view
Main
;
}
}
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
(
chk
,
position
)
->
{
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
(
chk
,
position
)
->
{
...
@@ -79,7 +87,7 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -79,7 +87,7 @@ public abstract class BaseModuleFragment extends Fragment {
listModules
().
get
(
position
).
deleteRemoveFile
();
listModules
().
get
(
position
).
deleteRemoveFile
();
Snackbar
.
make
(
undeleteBtn
,
R
.
string
.
remove_file_deleted
,
Snackbar
.
LENGTH_SHORT
).
show
();
Snackbar
.
make
(
undeleteBtn
,
R
.
string
.
remove_file_deleted
,
Snackbar
.
LENGTH_SHORT
).
show
();
}));
}));
return
view
;
return
view
Main
;
}
}
...
@@ -88,12 +96,21 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -88,12 +96,21 @@ public abstract class BaseModuleFragment extends Fragment {
public
class
ModulesAdapter
extends
RecyclerView
.
Adapter
<
ModulesAdapter
.
ViewHolder
>
{
public
class
ModulesAdapter
extends
RecyclerView
.
Adapter
<
ModulesAdapter
.
ViewHolder
>
{
private
final
List
<
Module
>
mList
;
private
final
List
<
Module
>
mList
;
List
<
Boolean
>
mExpandedList
;
@BindView
(
R
.
id
.
expand_layout
)
LinearLayout
expandedLayout
;
private
View
viewMain
;
private
Context
context
;
private
final
Utils
.
ItemClickListener
chboxListener
;
private
final
Utils
.
ItemClickListener
chboxListener
;
private
final
Utils
.
ItemClickListener
deleteBtnListener
;
private
final
Utils
.
ItemClickListener
deleteBtnListener
;
private
final
Utils
.
ItemClickListener
unDeleteBtnListener
;
private
final
Utils
.
ItemClickListener
unDeleteBtnListener
;
public
ModulesAdapter
(
List
<
Module
>
list
,
Utils
.
ItemClickListener
chboxListener
,
Utils
.
ItemClickListener
deleteBtnListener
,
Utils
.
ItemClickListener
undeleteBtnListener
)
{
public
ModulesAdapter
(
List
<
Module
>
list
,
Utils
.
ItemClickListener
chboxListener
,
Utils
.
ItemClickListener
deleteBtnListener
,
Utils
.
ItemClickListener
undeleteBtnListener
)
{
this
.
mList
=
list
;
this
.
mList
=
list
;
mExpandedList
=
new
ArrayList
<>(
mList
.
size
());
for
(
int
i
=
0
;
i
<
mList
.
size
();
i
++)
{
mExpandedList
.
add
(
false
);
}
this
.
chboxListener
=
chboxListener
;
this
.
chboxListener
=
chboxListener
;
this
.
deleteBtnListener
=
deleteBtnListener
;
this
.
deleteBtnListener
=
deleteBtnListener
;
this
.
unDeleteBtnListener
=
undeleteBtnListener
;
this
.
unDeleteBtnListener
=
undeleteBtnListener
;
...
@@ -101,9 +118,10 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -101,9 +118,10 @@ public abstract class BaseModuleFragment extends Fragment {
@Override
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_module
,
parent
,
false
);
viewMain
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_module
,
parent
,
false
);
context
=
parent
.
getContext
();
return
new
ViewHolder
(
view
);
ButterKnife
.
bind
(
this
,
viewMain
);
return
new
ViewHolder
(
viewMain
);
}
}
@Override
@Override
...
@@ -158,15 +176,103 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -158,15 +176,103 @@ public abstract class BaseModuleFragment extends Fragment {
@BindView
(
R
.
id
.
checkbox
)
CheckBox
checkBox
;
@BindView
(
R
.
id
.
checkbox
)
CheckBox
checkBox
;
@BindView
(
R
.
id
.
delete
)
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
ImageView
delete
;
@BindView
(
R
.
id
.
expand_layout
)
LinearLayout
expandLayout
;
private
ValueAnimator
mAnimator
;
private
int
mMeasuredHeight
;
public
ViewHolder
(
View
itemView
)
{
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
super
(
itemView
);
WindowManager
windowmanager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
ButterKnife
.
bind
(
this
,
itemView
);
ButterKnife
.
bind
(
this
,
itemView
);
DisplayMetrics
dimension
=
new
DisplayMetrics
();
windowmanager
.
getDefaultDisplay
().
getMetrics
(
dimension
);
final
int
mHeight
=
dimension
.
heightPixels
;
expandLayout
.
getViewTreeObserver
().
addOnPreDrawListener
(
new
ViewTreeObserver
.
OnPreDrawListener
()
{
@Override
public
boolean
onPreDraw
()
{
expandLayout
.
getViewTreeObserver
().
removeOnPreDrawListener
(
this
);
expandLayout
.
setVisibility
(
View
.
GONE
);
final
int
widthSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
0
,
View
.
MeasureSpec
.
UNSPECIFIED
);
final
int
heightSpec
=
View
.
MeasureSpec
.
makeMeasureSpec
(
0
,
View
.
MeasureSpec
.
UNSPECIFIED
);
expandLayout
.
measure
(
widthSpec
,
heightSpec
);
mAnimator
=
slideAnimator
(
0
,
expandLayout
.
getMeasuredHeight
());
return
true
;
}
});
viewMain
.
setOnClickListener
(
view
->
{
int
position
=
getAdapterPosition
();
Log
.
d
(
"Magisk"
,
"BaseRepoFragment: CLICK. "
+
position
+
" and "
+
mExpandedList
.
get
(
position
));
if
(
mExpandedList
.
get
(
position
))
{
collapse
(
expandLayout
);
}
else
{
expand
(
expandLayout
);
}
mExpandedList
.
set
(
position
,
!
mExpandedList
.
get
(
position
));
});
if
(!
Shell
.
rootAccess
())
{
if
(!
Shell
.
rootAccess
())
{
checkBox
.
setEnabled
(
false
);
checkBox
.
setEnabled
(
false
);
delete
.
setEnabled
(
false
);
delete
.
setEnabled
(
false
);
}
}
}
}
private
void
expand
(
View
view
)
{
// set Visible
Log
.
d
(
"Magisk"
,
"BaseRepoFragment: Expand anim called "
+
mMeasuredHeight
+
" and "
+
view
.
getId
());
view
.
setVisibility
(
View
.
VISIBLE
);
mAnimator
.
start
();
}
private
void
collapse
(
View
view
)
{
int
finalHeight
=
view
.
getHeight
();
ValueAnimator
mAnimator
=
slideAnimator
(
finalHeight
,
0
);
Log
.
d
(
"Magisk"
,
"BaseRepoFragment: Collapse anim called "
+
finalHeight
+
" and "
+
view
.
getId
());
mAnimator
.
addListener
(
new
Animator
.
AnimatorListener
()
{
@Override
public
void
onAnimationEnd
(
Animator
animator
)
{
// Height=0, but it set visibility to GONE
view
.
setVisibility
(
View
.
GONE
);
}
@Override
public
void
onAnimationStart
(
Animator
animator
)
{
}
@Override
public
void
onAnimationCancel
(
Animator
animator
)
{
}
@Override
public
void
onAnimationRepeat
(
Animator
animator
)
{
}
});
mAnimator
.
start
();
}
private
ValueAnimator
slideAnimator
(
int
start
,
int
end
)
{
ValueAnimator
animator
=
ValueAnimator
.
ofInt
(
start
,
end
);
animator
.
addUpdateListener
(
valueAnimator
->
{
// Update Height
int
value
=
(
Integer
)
valueAnimator
.
getAnimatedValue
();
ViewGroup
.
LayoutParams
layoutParams
=
expandLayout
.
getLayoutParams
();
layoutParams
.
height
=
value
;
expandLayout
.
setLayoutParams
(
layoutParams
);
});
return
animator
;
}
}
}
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
View file @
1a1d37a2
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
1a1d37a2
...
@@ -41,9 +41,7 @@ public class ModulesFragment extends Fragment {
...
@@ -41,9 +41,7 @@ public class ModulesFragment extends Fragment {
public
static
List
<
Module
>
listModulesCache
=
new
ArrayList
<>();
public
static
List
<
Module
>
listModulesCache
=
new
ArrayList
<>();
public
static
List
<
Repo
>
listModulesDownload
=
new
ArrayList
<>();
public
static
List
<
Repo
>
listModulesDownload
=
new
ArrayList
<>();
private
static
final
int
FILE_SELECT_CODE
=
0
;
private
static
final
int
FILE_SELECT_CODE
=
0
;
private
TabsAdapter
ta
;
private
int
viewPagePosition
;
private
File
input
;
private
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
progressBar
)
ProgressBar
progressBar
;
@BindView
(
R
.
id
.
progressBar
)
ProgressBar
progressBar
;
@BindView
(
R
.
id
.
fab
)
FloatingActionButton
fabio
;
@BindView
(
R
.
id
.
fab
)
FloatingActionButton
fabio
;
...
@@ -56,7 +54,7 @@ public class ModulesFragment extends Fragment {
...
@@ -56,7 +54,7 @@ public class ModulesFragment extends Fragment {
View
view
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
//
new Utils.LoadModules(getActivity(),false).execute();
new
Utils
.
LoadModules
(
getActivity
(),
false
).
execute
();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
new
updateUI
().
execute
();
new
updateUI
().
execute
();
setHasOptionsMenu
(
true
);
setHasOptionsMenu
(
true
);
...
@@ -101,12 +99,14 @@ public class ModulesFragment extends Fragment {
...
@@ -101,12 +99,14 @@ public class ModulesFragment extends Fragment {
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
force_reload
:
case
R
.
id
.
force_reload
:
viewPagePosition
=
tabLayout
.
getSelectedTabPosition
();
listModules
.
clear
();
listModules
.
clear
();
listModulesCache
.
clear
();
listModulesCache
.
clear
();
listModulesDownload
.
clear
();
listModulesDownload
.
clear
();
progressBar
.
setVisibility
(
View
.
VISIBLE
);
progressBar
.
setVisibility
(
View
.
VISIBLE
);
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
tabLayout
.
setupWithViewPager
(
viewPager
);
tabLayout
.
setupWithViewPager
(
viewPager
);
viewPager
.
setCurrentItem
(
viewPagePosition
);
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
new
updateUI
().
execute
();
new
updateUI
().
execute
();
break
;
break
;
...
@@ -115,6 +115,11 @@ public class ModulesFragment extends Fragment {
...
@@ -115,6 +115,11 @@ public class ModulesFragment extends Fragment {
return
super
.
onOptionsItemSelected
(
item
);
return
super
.
onOptionsItemSelected
(
item
);
}
}
void
selectPage
(
int
pageIndex
){
tabLayout
.
setScrollPosition
(
pageIndex
,
0
f
,
true
);
viewPager
.
setCurrentItem
(
pageIndex
);
}
public
static
class
NormalModuleFragment
extends
BaseModuleFragment
{
public
static
class
NormalModuleFragment
extends
BaseModuleFragment
{
@Override
@Override
...
@@ -154,9 +159,10 @@ public class ModulesFragment extends Fragment {
...
@@ -154,9 +159,10 @@ public class ModulesFragment extends Fragment {
super
.
onPostExecute
(
v
);
super
.
onPostExecute
(
v
);
progressBar
.
setVisibility
(
View
.
GONE
);
progressBar
.
setVisibility
(
View
.
GONE
);
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
tabLayout
.
setupWithViewPager
(
viewPager
);
tabLayout
.
setupWithViewPager
(
viewPager
);
selectPage
(
viewPagePosition
);
}
}
}
}
...
@@ -186,7 +192,7 @@ public class ModulesFragment extends Fragment {
...
@@ -186,7 +192,7 @@ public class ModulesFragment extends Fragment {
return
new
NormalModuleFragment
();
return
new
NormalModuleFragment
();
}
else
if
(
position
==
1
)
{
}
else
if
(
position
==
1
)
{
return
new
CacheModuleFragment
();
return
new
CacheModuleFragment
();
}
else
{
}
else
{
return
new
DownloadModuleFragment
();
return
new
DownloadModuleFragment
();
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/module/RepoHelper.java
View file @
1a1d37a2
...
@@ -29,7 +29,7 @@ public class RepoHelper {
...
@@ -29,7 +29,7 @@ public class RepoHelper {
private
static
final
String
TAG_ID
=
"id"
;
private
static
final
String
TAG_ID
=
"id"
;
private
static
final
String
TAG_NAME
=
"name"
;
private
static
final
String
TAG_NAME
=
"name"
;
private
static
String
TAG
=
"Magisk"
;
private
static
String
TAG
=
"Magisk"
;
private
String
mName
,
mId
,
mUrl
;
private
String
mName
,
mId
,
mUrl
;
private
Context
activityContext
;
private
Context
activityContext
;
private
Date
updatedDate
,
currentDate
;
private
Date
updatedDate
,
currentDate
;
private
SharedPreferences
prefs
;
private
SharedPreferences
prefs
;
...
@@ -44,41 +44,44 @@ public class RepoHelper {
...
@@ -44,41 +44,44 @@ public class RepoHelper {
List
<
String
>
out
=
null
;
List
<
String
>
out
=
null
;
}
else
{
}
else
{
Log
.
d
(
TAG
,
"RepoHelper: Building from cache"
);
Log
.
d
(
TAG
,
"RepoHelper: Building from cache"
);
repos
.
clear
();
BuildFromCache
();
Map
<
String
,
?>
map
=
prefs
.
getAll
();
for
(
Map
.
Entry
<
String
,?>
entry
:
map
.
entrySet
()){
if
(
entry
.
getKey
().
contains
(
"repo_"
))
{
}
Log
.
d
(
"Magisk"
,
"RepoHelper: found entry for repo "
+
entry
.
getKey
());
String
repoString
=
entry
.
getValue
().
toString
().
replace
(
"""
,
"\""
);
String
[]
repoStrings
=
repoString
.
split
(
"\n"
);
for
(
String
string
:
repoStrings
)
{
String
[]
splitStrings
=
string
.
split
(
"="
);
switch
(
splitStrings
[
0
])
{
case
(
"id"
):
mId
=
splitStrings
[
1
];
break
;
case
(
"baseUrl"
):
mUrl
=
splitStrings
[
1
];
break
;
default
:
break
;
}
}
Log
.
d
(
"Magisk"
,
"RepoHelper: adding repo with id of "
+
mId
);
repos
.
add
(
new
Repo
(
repoString
,
activityContext
));
return
repos
;
}
private
void
BuildFromCache
()
{
repos
.
clear
();
Map
<
String
,
?>
map
=
prefs
.
getAll
();
for
(
Map
.
Entry
<
String
,
?>
entry
:
map
.
entrySet
())
{
if
(
entry
.
getKey
().
contains
(
"repo_"
))
{
Log
.
d
(
"Magisk"
,
"RepoHelper: found entry for repo "
+
entry
.
getKey
());
String
repoString
=
entry
.
getValue
().
toString
().
replace
(
"""
,
"\""
);
String
[]
repoStrings
=
repoString
.
split
(
"\n"
);
for
(
String
string
:
repoStrings
)
{
String
[]
splitStrings
=
string
.
split
(
"="
);
switch
(
splitStrings
[
0
])
{
case
(
"id"
):
mId
=
splitStrings
[
1
];
break
;
case
(
"baseUrl"
):
mUrl
=
splitStrings
[
1
];
break
;
default
:
break
;
}
}
}
}
Log
.
d
(
"Magisk"
,
"RepoHelper: adding repo with id of "
+
mId
);
repos
.
add
(
new
Repo
(
repoString
,
activityContext
));
}
}
}
return
repos
;
}
}
...
@@ -105,9 +108,9 @@ public class RepoHelper {
...
@@ -105,9 +108,9 @@ public class RepoHelper {
// Making a request to url and getting response
// Making a request to url and getting response
String
token
=
activityContext
.
getString
(
R
.
string
.
some_string
);
String
token
=
activityContext
.
getString
(
R
.
string
.
some_string
);
String
jsonStr
=
webreq
.
makeWebServiceCall
(
url
+
Utils
.
procFile
(
token
,
activityContext
),
WebRequest
.
GET
);
String
jsonStr
=
webreq
.
makeWebServiceCall
(
url
+
Utils
.
procFile
(
token
,
activityContext
),
WebRequest
.
GET
);
Log
.
d
(
"Magisk"
,
"doInBackground Running, String: "
+
jsonStr
+
" Url: "
+
url
);
Log
.
d
(
"Magisk"
,
"doInBackground Running, String: "
+
jsonStr
+
" Url: "
+
url
);
if
(
jsonStr
!=
null
&&
!
jsonStr
.
isEmpty
())
{
if
(
jsonStr
!=
null
&&
!
jsonStr
.
isEmpty
())
{
try
{
try
{
repos
.
clear
();
repos
.
clear
();
...
@@ -185,7 +188,9 @@ public class RepoHelper {
...
@@ -185,7 +188,9 @@ public class RepoHelper {
protected
void
onPostExecute
(
Void
v
)
{
protected
void
onPostExecute
(
Void
v
)
{
if
(
apiFail
)
{
if
(
apiFail
)
{
Toast
.
makeText
(
activityContext
,
"GitHub API Limit reached, please try refreshing again in an hour."
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activityContext
,
"GitHub API Limit reached, please try refreshing again in an hour."
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
BuildFromCache
();
}
}
}
// protected void onPostExecute(Void v)
}
// protected void onPostExecute(Void v)
...
...
app/src/main/res/drawable/ic_system_update_alt_black.xml
View file @
1a1d37a2
...
@@ -4,6 +4,6 @@
...
@@ -4,6 +4,6 @@
android:viewportWidth=
"24.0"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
android:viewportHeight=
"24.0"
>
<path
<path
android:fillColor=
"#
FF000000
"
android:fillColor=
"#
757575
"
android:pathData=
"M12,16.5l4,-4h-3v-9h-2v9L8,12.5l4,4zM21,3.5h-6v1.99h6v14.03L3,19.52L3,5.49h6L9,3.5L3,3.5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2v-14c0,-1.1 -0.9,-2 -2,-2z"
/>
android:pathData=
"M12,16.5l4,-4h-3v-9h-2v9L8,12.5l4,4zM21,3.5h-6v1.99h6v14.03L3,19.52L3,5.49h6L9,3.5L3,3.5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2v-14c0,-1.1 -0.9,-2 -2,-2z"
/>
</vector>
</vector>
app/src/main/res/layout/list_item_module.xml
View file @
1a1d37a2
...
@@ -13,6 +13,10 @@
...
@@ -13,6 +13,10 @@
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:minHeight=
"?android:attr/listPreferredItemHeight"
card_view:cardCornerRadius=
"2dp"
card_view:cardCornerRadius=
"2dp"
card_view:cardElevation=
"2dp"
>
card_view:cardElevation=
"2dp"
>
<LinearLayout
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -64,9 +68,24 @@
...
@@ -64,9 +68,24 @@
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@color/red500"
android:textColor=
"@color/red500"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
<LinearLayout
android:id=
"@+id/expand_layout"
android:minHeight=
"100dp"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/author"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<CheckBox
<CheckBox
android:id=
"@+id/checkbox"
android:id=
"@+id/checkbox"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -86,6 +105,9 @@
...
@@ -86,6 +105,9 @@
android:padding=
"3dp"
android:padding=
"3dp"
android:src=
"@drawable/ic_delete"
android:src=
"@drawable/ic_delete"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/list_item_repo.xml
View file @
1a1d37a2
...
@@ -60,22 +60,64 @@
...
@@ -60,22 +60,64 @@
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
android:textIsSelectable=
"false"
/>
<LinearLayout
android:id=
"@+id/expand_layout"
android:minHeight=
"100dp"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/author"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textColor=
"@android:color/tertiary_text_dark"
android:textIsSelectable=
"false"
android:textStyle=
"bold|italic"
/>
<TextView
android:id=
"@+id/log"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
<TextView
android:id=
"@+id/installedStatus"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
<TextView
android:id=
"@+id/updateStatus"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
<ImageView
android:id=
"@+id/installed"
android:id=
"@+id/installed"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"match_parent"
android:focusable=
"false"
android:gravity=
"center"
android:padding=
"5dp"
/>
<ImageView
<ImageView
android:id=
"@+id/update"
android:id=
"@+id/update"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"match_parent"
android:focusable=
"false"
android:gravity=
"center"
android:padding=
"5dp"
/>
</LinearLayout>
</LinearLayout>
<!-- <include layout="@layout/list_item_repo_expanded" />-->
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
...
...
app/src/main/res/layout/modules_fragment.xml
View file @
1a1d37a2
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<android.support.design.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/main_content"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/main_content"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
<RelativeLayout
android:id=
"@+id/llayout"
android:layout_width=
"fill_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"match_parent"
android:layout_marginTop=
"?attr/actionBarSize"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
>
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/llayout"
<android.support.design.widget.TabLayout
android:layout_width=
"match_parent"
android:id=
"@+id/tab_layout"
android:layout_height=
"fill_parent"
android:layout_width=
"match_parent"
android:layout_marginTop=
"?attr/actionBarSize"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
android:background=
"?attr/colorPrimary"
android:elevation=
"4dp"
<android.support.design.widget.TabLayout
android:minHeight=
"?attr/actionBarSize"
android:id=
"@+id/tab_layout"
app:tabGravity=
"fill"
android:layout_width=
"match_parent"
app:tabIndicatorColor=
"?attr/colorAccent"
android:layout_height=
"wrap_content"
app:tabMode=
"fixed"
android:background=
"?attr/colorPrimary"
app:tabTextAppearance=
"@style/TextAppearance.Design.Tab"
/>
android:elevation=
"4dp"
android:minHeight=
"?attr/actionBarSize"
<ProgressBar
app:tabGravity=
"fill"
android:id=
"@+id/progressBar"
app:tabIndicatorColor=
"?attr/colorAccent"
android:layout_width=
"wrap_content"
app:tabMode=
"fixed"
android:layout_height=
"wrap_content"
app:tabTextAppearance=
"@style/TextAppearance.Design.Tab"
/>
android:layout_gravity=
"center"
/>
<ProgressBar
<android.support.v4.view.ViewPager
android:id=
"@+id/progressBar"
android:id=
"@+id/pager"
android:layout_width=
"wrap_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
/>
android:layout_gravity=
"center"
/>
<android.support.v4.view.ViewPager
android:id=
"@+id/pager"
android:layout_width=
"match_parent"
</LinearLayout>
android:layout_height=
"match_parent"
<android.support.design.widget.FloatingActionButton
android:animateLayoutChanges=
"true"
/>
android:id=
"@+id/fab"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"right"
android:layout_margin=
"16dp"
</LinearLayout>
android:clickable=
"true"
<LinearLayout
app:layout_anchor=
"@id/llayout"
android:id=
"@+id/ly_bar_bottom"
android:src=
"@drawable/ic_add"
android:layout_width=
"fill_parent"
app:layout_anchorGravity=
"bottom|right|end"
android:layout_height=
"wrap_content"
/>
android:layout_alignParentBottom=
"true"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"16dp"
android:baselineAlignBottom=
"false"
android:clickable=
"true"
android:src=
"@drawable/ic_add"
app:layout_anchorGravity=
"bottom|right|end"
/>
</LinearLayout>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
1a1d37a2
...
@@ -2,4 +2,5 @@
...
@@ -2,4 +2,5 @@
<resources>
<resources>
<dimen
name=
"floating_height"
>
650dp
</dimen>
<dimen
name=
"floating_height"
>
650dp
</dimen>
<dimen
name=
"floating_width"
>
500dp
</dimen>
<dimen
name=
"floating_width"
>
500dp
</dimen>
<dimen
name=
"min_rowheight"
>
100dp
</dimen>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
1a1d37a2
...
@@ -42,13 +42,15 @@
...
@@ -42,13 +42,15 @@
<!--Module Fragment-->
<!--Module Fragment-->
<string
name=
"cache_modules"
>
Cache modules
</string>
<string
name=
"cache_modules"
>
Cache modules
</string>
<string
name=
"no_modules_found"
>
No modules found
</string>
<string
name=
"no_modules_found"
>
No modules found
</string>
<string
name=
"module_update_available"
>
Update
available
</string>
<string
name=
"module_update_available"
>
An update is
available
</string>
<string
name=
"m
u
dule_up_to_date"
>
Module is up-to-date
</string>
<string
name=
"m
o
dule_up_to_date"
>
Module is up-to-date
</string>
<string
name=
"module_installed"
>
Module is installed
</string>
<string
name=
"module_installed"
>
Module is installed
</string>
<string
name=
"module_not_installed"
>
Module is not installed
</string>
<string
name=
"remove_file_created"
>
Module will be removed at next reboot
</string>
<string
name=
"remove_file_created"
>
Module will be removed at next reboot
</string>
<string
name=
"remove_file_deleted"
>
Module will not be removed at next reboot
</string>
<string
name=
"remove_file_deleted"
>
Module will not be removed at next reboot
</string>
<string
name=
"disable_file_created"
>
Module will be disabled at next reboot
</string>
<string
name=
"disable_file_created"
>
Module will be disabled at next reboot
</string>
<string
name=
"disable_file_removed"
>
Module will be enabled at next reboot
</string>
<string
name=
"disable_file_removed"
>
Module will be enabled at next reboot
</string>
<string
name=
"author"
>
Created by
</string>
<!--Log Fragment-->
<!--Log Fragment-->
<string
name=
"menuSaveToSd"
>
Save to SD
</string>
<string
name=
"menuSaveToSd"
>
Save to SD
</string>
...
...
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