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
e3866eeb
Commit
e3866eeb
authored
Sep 08, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I think it won't break anything?
parent
f404fe05
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
569 additions
and
558 deletions
+569
-558
BaseModuleFragment.java
...rc/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
+102
-18
BaseRepoFragment.java
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
+121
-2
ModulesAdapter.java
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
+0
-101
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+5
-31
ReposAdapter.java
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
+0
-140
WelcomeActivity.java
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
+11
-1
Module.java
app/src/main/java/com/topjohnwu/magisk/module/Module.java
+59
-51
Repo.java
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
+34
-26
RepoAdapter.java
...rc/main/java/com/topjohnwu/magisk/module/RepoAdapter.java
+0
-135
RepoHelper.java
...src/main/java/com/topjohnwu/magisk/module/RepoHelper.java
+197
-0
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+19
-46
WebRequest.java
app/src/main/java/com/topjohnwu/magisk/utils/WebRequest.java
+10
-1
ic_system_update_alt_black.xml
app/src/main/res/drawable/ic_system_update_alt_black.xml
+9
-0
list_item_repo.xml
app/src/main/res/layout/list_item_repo.xml
+2
-6
No files found.
app/src/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
View file @
e3866eeb
...
@@ -7,13 +7,16 @@ import android.support.annotation.Nullable;
...
@@ -7,13 +7,16 @@ 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.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.widget.CheckBox
;
import
android.widget.CheckBox
;
import
android.widget.ImageView
;
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.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,17 +26,16 @@ import butterknife.ButterKnife;
...
@@ -23,17 +26,16 @@ import butterknife.ButterKnife;
public
abstract
class
BaseModuleFragment
extends
Fragment
{
public
abstract
class
BaseModuleFragment
extends
Fragment
{
@BindView
(
R
.
id
.
recyclerView
)
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
private
View
view
;
private
SharedPreferences
prefs
;
private
SharedPreferences
prefs
;
@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
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
...
@@ -55,19 +57,16 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -55,19 +57,16 @@ public abstract class BaseModuleFragment extends Fragment {
return
view
;
return
view
;
}
}
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
new
Utils
.
ItemClickListener
()
{
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
(
chk
,
position
)
->
{
@Override
// On Checkbox change listener
public
void
onItemClick
(
View
chk
,
int
position
)
{
CheckBox
chbox
=
(
CheckBox
)
chk
;
// On Checkbox change listener
CheckBox
chbox
=
(
CheckBox
)
chk
;
if
(!
chbox
.
isChecked
())
{
if
(!
chbox
.
isChecked
())
{
BaseModuleFragment
.
this
.
listModules
().
get
(
position
).
createDisableFile
();
listModules
().
get
(
position
).
createDisableFile
();
Snackbar
.
make
(
chk
,
R
.
string
.
disable_file_created
,
Snackbar
.
LENGTH_SHORT
).
show
();
Snackbar
.
make
(
chk
,
R
.
string
.
disable_file_created
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
else
{
}
else
{
BaseModuleFragment
.
this
.
listModules
().
get
(
position
).
removeDisableFile
();
listModules
().
get
(
position
).
removeDisableFile
();
Snackbar
.
make
(
chk
,
R
.
string
.
disable_file_removed
,
Snackbar
.
LENGTH_SHORT
).
show
();
Snackbar
.
make
(
chk
,
R
.
string
.
disable_file_removed
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
}
}
},
(
deleteBtn
,
position
)
->
{
},
(
deleteBtn
,
position
)
->
{
// On delete button click listener
// On delete button click listener
...
@@ -85,4 +84,89 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -85,4 +84,89 @@ public abstract class BaseModuleFragment extends Fragment {
protected
abstract
List
<
Module
>
listModules
();
protected
abstract
List
<
Module
>
listModules
();
public
class
ModulesAdapter
extends
RecyclerView
.
Adapter
<
ModulesAdapter
.
ViewHolder
>
{
private
final
List
<
Module
>
mList
;
private
final
Utils
.
ItemClickListener
chboxListener
;
private
final
Utils
.
ItemClickListener
deleteBtnListener
;
private
final
Utils
.
ItemClickListener
unDeleteBtnListener
;
public
ModulesAdapter
(
List
<
Module
>
list
,
Utils
.
ItemClickListener
chboxListener
,
Utils
.
ItemClickListener
deleteBtnListener
,
Utils
.
ItemClickListener
undeleteBtnListener
)
{
this
.
mList
=
list
;
this
.
chboxListener
=
chboxListener
;
this
.
deleteBtnListener
=
deleteBtnListener
;
this
.
unDeleteBtnListener
=
undeleteBtnListener
;
}
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_module
,
parent
,
false
);
return
new
ViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
final
ViewHolder
holder
,
int
position
)
{
final
Module
module
=
mList
.
get
(
position
);
Log
.
d
(
"Magisk"
,
"ModulesAdapter: Trying set up bindview from list pos "
+
position
+
" and "
+
module
.
getName
()
);
holder
.
title
.
setText
(
module
.
getName
());
holder
.
versionName
.
setText
(
module
.
getVersion
());
holder
.
description
.
setText
(
module
.
getDescription
());
holder
.
checkBox
.
setChecked
(
module
.
isEnabled
());
holder
.
checkBox
.
setOnCheckedChangeListener
((
compoundButton
,
b
)
->
chboxListener
.
onItemClick
(
compoundButton
,
holder
.
getAdapterPosition
()));
holder
.
delete
.
setOnClickListener
(
view
->
{
if
(
module
.
willBeRemoved
())
{
unDeleteBtnListener
.
onItemClick
(
holder
.
delete
,
holder
.
getAdapterPosition
());
}
else
{
deleteBtnListener
.
onItemClick
(
holder
.
delete
,
holder
.
getAdapterPosition
());
}
updateDeleteButton
(
holder
,
module
);
});
updateDeleteButton
(
holder
,
module
);
}
private
void
updateDeleteButton
(
ViewHolder
holder
,
Module
module
)
{
holder
.
warning
.
setVisibility
(
module
.
willBeRemoved
()
?
View
.
VISIBLE
:
View
.
GONE
);
if
(
module
.
willBeRemoved
())
{
holder
.
delete
.
setImageResource
(
R
.
drawable
.
ic_undelete
);
}
else
{
holder
.
delete
.
setImageResource
(
R
.
drawable
.
ic_delete
);
}
}
@Override
public
int
getItemCount
()
{
return
mList
.
size
();
}
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
@BindView
(
R
.
id
.
title
)
TextView
title
;
@BindView
(
R
.
id
.
version_name
)
TextView
versionName
;
@BindView
(
R
.
id
.
description
)
TextView
description
;
@BindView
(
R
.
id
.
warning
)
TextView
warning
;
@BindView
(
R
.
id
.
checkbox
)
CheckBox
checkBox
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ButterKnife
.
bind
(
this
,
itemView
);
if
(!
Shell
.
rootAccess
())
{
checkBox
.
setEnabled
(
false
);
delete
.
setEnabled
(
false
);
}
}
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
View file @
e3866eeb
package
com
.
topjohnwu
.
magisk
;
package
com
.
topjohnwu
.
magisk
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.widget.CardView
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
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.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.AnimationHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
import
java.util.List
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -26,6 +35,7 @@ public abstract class BaseRepoFragment extends Fragment {
...
@@ -26,6 +35,7 @@ public abstract class BaseRepoFragment 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
)
{
...
@@ -40,7 +50,7 @@ public abstract class BaseRepoFragment extends Fragment {
...
@@ -40,7 +50,7 @@ public abstract class BaseRepoFragment extends Fragment {
return
view
;
return
view
;
}
}
Log
.
d
(
"Magisk"
,
"BaseRepoFragment: ListRepos size is "
+
listRepos
().
size
());
recyclerView
.
setAdapter
(
new
ReposAdapter
(
listRepos
())
{
recyclerView
.
setAdapter
(
new
ReposAdapter
(
listRepos
())
{
});
});
...
@@ -49,4 +59,113 @@ public abstract class BaseRepoFragment extends Fragment {
...
@@ -49,4 +59,113 @@ public abstract class BaseRepoFragment extends Fragment {
protected
abstract
List
<
Repo
>
listRepos
();
protected
abstract
List
<
Repo
>
listRepos
();
public
class
ReposAdapter
extends
RecyclerView
.
Adapter
<
ReposAdapter
.
ViewHolder
>
{
private
final
List
<
Repo
>
mList
;
private
View
viewMain
;
private
Context
context
;
@BindView
(
R
.
id
.
update
)
ImageView
updateImage
;
@BindView
(
R
.
id
.
installed
)
ImageView
installedImage
;
// @BindView(R.id.popup_layout)
// LinearLayout popupLayout;
private
boolean
isCardExpanded
;
private
boolean
mIsInstalled
,
mCanUpdate
;
public
ReposAdapter
(
List
<
Repo
>
list
)
{
this
.
mList
=
list
;
}
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
viewMain
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_repo
,
parent
,
false
);
ButterKnife
.
bind
(
this
,
viewMain
);
context
=
parent
.
getContext
();
return
new
ViewHolder
(
viewMain
);
}
@Override
public
void
onBindViewHolder
(
final
ViewHolder
holder
,
int
position
)
{
final
Repo
repo
=
mList
.
get
(
position
);
Log
.
d
(
"Magisk"
,
"ReposAdapter: Trying set up bindview from list pos "
+
position
+
" out of a total of "
+
mList
.
size
()
+
" and "
+
repo
.
getId
()
);
if
(
repo
.
getId
()
!=
null
)
{
holder
.
title
.
setText
(
repo
.
getName
());
holder
.
versionName
.
setText
(
repo
.
getmVersion
());
holder
.
description
.
setText
(
repo
.
getDescription
());
Log
.
d
(
"Magisk"
,
"ReposAdapter: Setting up info "
+
repo
.
getId
()
+
" and "
+
repo
.
getDescription
()
+
" and "
+
repo
.
getmVersion
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
if
(
prefs
.
contains
(
"repo-isInstalled_"
+
repo
.
getId
()))
{
mIsInstalled
=
prefs
.
getBoolean
(
"repo-isInstalled_"
+
repo
.
getId
(),
false
);
if
(
mIsInstalled
)
{
installedImage
.
setImageResource
(
R
.
drawable
.
ic_done_black
);
}
mCanUpdate
=
prefs
.
getBoolean
(
"repo-isInstalled_"
+
repo
.
getId
(),
false
);
if
(
mCanUpdate
)
{
updateImage
.
setImageResource
(
R
.
drawable
.
ic_system_update_alt_black
);
}
}
isCardExpanded
=
false
;
// AnimationHelper.collapse(popupLayout);
viewMain
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
isCardExpanded
)
{
// AnimationHelper.expand(popupLayout);
isCardExpanded
=
false
;
}
else
{
// AnimationHelper.collapse(popupLayout);
isCardExpanded
=
true
;
}
// if (!mIsInstalled | mCanUpdate) {
//
// Utils.DownloadReceiver reciever = new Utils.DownloadReceiver() {
// @Override
// public void task(File file) {
// Log.d("Magisk", "Task firing");
// new Utils.FlashZIP(context, repo.getId(), file.toString()).execute();
// }
// };
// String filename = repo.getId().replace(" ", "") + ".zip";
// Utils.downloadAndReceive(context, reciever, repo.getmZipUrl(), filename);
// } else {
// Toast.makeText(context,repo.getId() + " is already installed.", Toast.LENGTH_SHORT).show();
// }
}
});
}
}
@Override
public
int
getItemCount
()
{
return
mList
.
size
();
}
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
@BindView
(
R
.
id
.
title
)
TextView
title
;
@BindView
(
R
.
id
.
version_name
)
TextView
versionName
;
@BindView
(
R
.
id
.
description
)
TextView
description
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ButterKnife
.
bind
(
this
,
itemView
);
}
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java
deleted
100644 → 0
View file @
f404fe05
package
com
.
topjohnwu
.
magisk
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.CheckBox
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
public
class
ModulesAdapter
extends
RecyclerView
.
Adapter
<
ModulesAdapter
.
ViewHolder
>
{
private
final
List
<
Module
>
mList
;
private
final
Utils
.
ItemClickListener
chboxListener
;
private
final
Utils
.
ItemClickListener
deleteBtnListener
;
private
final
Utils
.
ItemClickListener
unDeleteBtnListener
;
public
ModulesAdapter
(
List
<
Module
>
list
,
Utils
.
ItemClickListener
chboxListener
,
Utils
.
ItemClickListener
deleteBtnListener
,
Utils
.
ItemClickListener
undeleteBtnListener
)
{
this
.
mList
=
list
;
this
.
chboxListener
=
chboxListener
;
this
.
deleteBtnListener
=
deleteBtnListener
;
this
.
unDeleteBtnListener
=
undeleteBtnListener
;
}
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_module
,
parent
,
false
);
return
new
ViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
final
ViewHolder
holder
,
int
position
)
{
final
Module
module
=
mList
.
get
(
position
);
holder
.
title
.
setText
(
module
.
getName
());
holder
.
versionName
.
setText
(
module
.
getVersion
());
holder
.
description
.
setText
(
module
.
getDescription
());
holder
.
checkBox
.
setChecked
(
module
.
isEnabled
());
holder
.
checkBox
.
setOnCheckedChangeListener
((
compoundButton
,
b
)
->
chboxListener
.
onItemClick
(
compoundButton
,
holder
.
getAdapterPosition
()));
holder
.
delete
.
setOnClickListener
(
view
->
{
if
(
module
.
willBeRemoved
())
{
unDeleteBtnListener
.
onItemClick
(
holder
.
delete
,
holder
.
getAdapterPosition
());
}
else
{
deleteBtnListener
.
onItemClick
(
holder
.
delete
,
holder
.
getAdapterPosition
());
}
updateDeleteButton
(
holder
,
module
);
});
updateDeleteButton
(
holder
,
module
);
}
private
void
updateDeleteButton
(
ViewHolder
holder
,
Module
module
)
{
holder
.
warning
.
setVisibility
(
module
.
willBeRemoved
()
?
View
.
VISIBLE
:
View
.
GONE
);
if
(
module
.
willBeRemoved
())
{
holder
.
delete
.
setImageResource
(
R
.
drawable
.
ic_undelete
);
}
else
{
holder
.
delete
.
setImageResource
(
R
.
drawable
.
ic_delete
);
}
}
@Override
public
int
getItemCount
()
{
return
mList
.
size
();
}
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
@BindView
(
R
.
id
.
title
)
TextView
title
;
@BindView
(
R
.
id
.
version_name
)
TextView
versionName
;
@BindView
(
R
.
id
.
description
)
TextView
description
;
@BindView
(
R
.
id
.
warning
)
TextView
warning
;
@BindView
(
R
.
id
.
checkbox
)
CheckBox
checkBox
;
@BindView
(
R
.
id
.
delete
)
ImageView
delete
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ButterKnife
.
bind
(
this
,
itemView
);
if
(!
Shell
.
rootAccess
())
{
checkBox
.
setEnabled
(
false
);
delete
.
setEnabled
(
false
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
e3866eeb
...
@@ -56,23 +56,13 @@ public class ModulesFragment extends Fragment {
...
@@ -56,23 +56,13 @@ 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();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
if
(
prefs
.
contains
(
"hasCachedRepos"
))
{
new
Utils
.
LoadModules
(
getActivity
(),
false
).
execute
();
}
else
{
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
}
new
updateUI
().
execute
();
new
updateUI
().
execute
();
setHasOptionsMenu
(
true
);
setHasOptionsMenu
(
true
);
return
view
;
return
view
;
}
}
public
void
updateThisShit
()
{
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
new
updateUI
().
execute
();
setHasOptionsMenu
(
true
);
}
@Override
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
...
@@ -93,8 +83,6 @@ public class ModulesFragment extends Fragment {
...
@@ -93,8 +83,6 @@ public class ModulesFragment extends Fragment {
}
}
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
switch
(
requestCode
)
{
switch
(
requestCode
)
{
case
FILE_SELECT_CODE:
case
FILE_SELECT_CODE:
...
@@ -117,8 +105,7 @@ public class ModulesFragment extends Fragment {
...
@@ -117,8 +105,7 @@ public class ModulesFragment extends Fragment {
listModulesCache
.
clear
();
listModulesCache
.
clear
();
listModulesDownload
.
clear
();
listModulesDownload
.
clear
();
progressBar
.
setVisibility
(
View
.
VISIBLE
);
progressBar
.
setVisibility
(
View
.
VISIBLE
);
ta
=
new
TabsAdapter
(
getChildFragmentManager
());
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
viewPager
.
setAdapter
(
ta
);
tabLayout
.
setupWithViewPager
(
viewPager
);
tabLayout
.
setupWithViewPager
(
viewPager
);
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
new
updateUI
().
execute
();
new
updateUI
().
execute
();
...
@@ -128,19 +115,6 @@ public class ModulesFragment extends Fragment {
...
@@ -128,19 +115,6 @@ public class ModulesFragment extends Fragment {
return
super
.
onOptionsItemSelected
(
item
);
return
super
.
onOptionsItemSelected
(
item
);
}
}
public
void
redrawLayout
()
{
listModules
.
clear
();
listModulesCache
.
clear
();
listModulesDownload
.
clear
();
progressBar
.
setVisibility
(
View
.
VISIBLE
);
ta
=
new
TabsAdapter
(
getChildFragmentManager
());
viewPager
.
setAdapter
(
ta
);
tabLayout
.
setupWithViewPager
(
viewPager
);
new
Utils
.
LoadModules
(
getActivity
(),
false
).
execute
();
new
updateUI
().
execute
();
}
public
static
class
NormalModuleFragment
extends
BaseModuleFragment
{
public
static
class
NormalModuleFragment
extends
BaseModuleFragment
{
@Override
@Override
...
@@ -168,7 +142,7 @@ public class ModulesFragment extends Fragment {
...
@@ -168,7 +142,7 @@ public class ModulesFragment extends Fragment {
}
}
p
ublic
class
updateUI
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
p
rivate
class
updateUI
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
@Override
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
protected
Void
doInBackground
(
Void
...
voids
)
{
...
@@ -180,8 +154,8 @@ public class ModulesFragment extends Fragment {
...
@@ -180,8 +154,8 @@ public class ModulesFragment extends Fragment {
super
.
onPostExecute
(
v
);
super
.
onPostExecute
(
v
);
progressBar
.
setVisibility
(
View
.
GONE
);
progressBar
.
setVisibility
(
View
.
GONE
);
ta
=
new
TabsAdapter
(
getChildFragmentManager
());
viewPager
.
setAdapter
(
ta
);
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
())
);
tabLayout
.
setupWithViewPager
(
viewPager
);
tabLayout
.
setupWithViewPager
(
viewPager
);
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
deleted
100644 → 0
View file @
f404fe05
package
com
.
topjohnwu
.
magisk
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.preference.PreferenceManager
;
import
android.support.v7.widget.CardView
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.AnimationHelper
;
import
org.w3c.dom.Text
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
public
class
ReposAdapter
extends
RecyclerView
.
Adapter
<
ReposAdapter
.
ViewHolder
>
{
private
final
List
<
Repo
>
mList
;
private
View
viewMain
;
private
Context
context
;
@BindView
(
R
.
id
.
update
)
ImageView
updateImage
;
@BindView
(
R
.
id
.
installed
)
ImageView
installedImage
;
@BindView
(
R
.
id
.
popup_layout
)
LinearLayout
popupLayout
;
@BindView
(
R
.
id
.
author
)
TextView
authorText
;
@BindView
(
R
.
id
.
log
)
TextView
logText
;
@BindView
(
R
.
id
.
updateStatus
)
TextView
updateStatus
;
@BindView
(
R
.
id
.
installedStatus
)
TextView
installedStatus
;
private
boolean
isCardExpanded
;
public
ReposAdapter
(
List
<
Repo
>
list
)
{
this
.
mList
=
list
;
}
private
boolean
mIsInstalled
;
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
viewMain
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_repo
,
parent
,
false
);
ButterKnife
.
bind
(
this
,
viewMain
);
context
=
parent
.
getContext
();
return
new
ViewHolder
(
viewMain
);
}
@Override
public
void
onBindViewHolder
(
final
ViewHolder
holder
,
int
position
)
{
final
Repo
repo
=
mList
.
get
(
position
);
holder
.
title
.
setText
(
repo
.
getName
());
holder
.
versionName
.
setText
(
repo
.
getmVersion
());
holder
.
description
.
setText
(
repo
.
getDescription
());
Log
.
d
(
"Magisk"
,
"ReposAdapter: Setting up info "
+
repo
.
getId
()
+
" and "
+
repo
.
getDescription
()
+
" and "
+
repo
.
getmVersion
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
if
(
prefs
.
contains
(
"repo_isInstalled_"
+
repo
.
getId
()))
{
mIsInstalled
=
prefs
.
getBoolean
(
"repo_isInstalled_"
+
repo
.
getId
(),
false
);
if
(
mIsInstalled
)
{
installedImage
.
setImageResource
(
R
.
drawable
.
ic_done_black
);
installedStatus
.
setText
(
R
.
string
.
module_installed
);
}
}
isCardExpanded
=
false
;
AnimationHelper
.
collapse
(
popupLayout
);
viewMain
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
isCardExpanded
)
{
AnimationHelper
.
collapse
(
popupLayout
);
isCardExpanded
=
false
;
}
else
{
AnimationHelper
.
expand
(
popupLayout
);
isCardExpanded
=
true
;
}
// if (!mIsInstalled) {
//
// Utils.DownloadReceiver reciever = new Utils.DownloadReceiver() {
// @Override
// public void task(File file) {
// Log.d("Magisk", "Task firing");
// new Utils.FlashZIP(context, repo.getId(), file.toString()).execute();
// }
// };
// String filename = repo.getId().replace(" ", "") + ".zip";
// Utils.downloadAndReceive(context, reciever, repo.getmZipUrl(), filename);
// } else {
// Toast.makeText(context,repo.getId() + " is already installed.",Toast.LENGTH_SHORT).show();
// }
}
});
}
@Override
public
int
getItemCount
()
{
return
mList
.
size
();
}
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
@BindView
(
R
.
id
.
title
)
TextView
title
;
@BindView
(
R
.
id
.
version_name
)
TextView
versionName
;
@BindView
(
R
.
id
.
description
)
TextView
description
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ButterKnife
.
bind
(
this
,
itemView
);
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/WelcomeActivity.java
View file @
e3866eeb
...
@@ -4,10 +4,12 @@ import android.Manifest;
...
@@ -4,10 +4,12 @@ import android.Manifest;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.IdRes
;
import
android.support.annotation.IdRes
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.NonNull
;
import
android.support.design.widget.NavigationView
;
import
android.support.design.widget.NavigationView
;
...
@@ -58,7 +60,15 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
...
@@ -58,7 +60,15 @@ public class WelcomeActivity extends AppCompatActivity implements NavigationView
}
}
new
Utils
.
Initialize
(
this
).
execute
();
new
Utils
.
Initialize
(
this
).
execute
();
new
Utils
.
CheckUpdates
(
this
).
execute
();
new
Utils
.
CheckUpdates
(
this
).
execute
();
new
Utils
.
LoadModules
(
getApplication
(),
false
).
execute
();
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
);
if
(!
prefs
.
contains
(
"oauth_key"
))
{
}
if
(!
prefs
.
contains
(
"hasCachedRepos"
))
{
new
Utils
.
LoadModules
(
this
,
true
).
execute
();
}
else
{
new
Utils
.
LoadModules
(
getApplication
(),
false
).
execute
();
}
setSupportActionBar
(
toolbar
);
setSupportActionBar
(
toolbar
);
...
...
app/src/main/java/com/topjohnwu/magisk/module/Module.java
View file @
e3866eeb
...
@@ -45,90 +45,98 @@ public class Module {
...
@@ -45,90 +45,98 @@ public class Module {
this
.
mVersionCode
=
Integer
.
valueOf
(
props
[
1
]);
this
.
mVersionCode
=
Integer
.
valueOf
(
props
[
1
]);
break
;
break
;
case
"name"
:
case
"name"
:
this
.
mName
=
props
[
1
]
;
this
.
mName
=
value
;
break
;
break
;
case
"author"
:
case
"author"
:
this
.
mAuthor
=
props
[
1
]
;
this
.
mAuthor
=
value
;
break
;
break
;
case
"id"
:
case
"id"
:
this
.
mId
=
props
[
1
]
;
this
.
mId
=
value
;
break
;
break
;
case
"version"
:
case
"version"
:
this
.
mVersion
=
props
[
1
]
;
this
.
mVersion
=
value
;
break
;
break
;
case
"description"
:
case
"description"
:
this
.
mDescription
=
props
[
1
]
;
this
.
mDescription
=
value
;
break
;
break
;
case
"donate"
:
case
"donate"
:
this
.
mDonateUrl
=
props
[
1
]
;
this
.
mDonateUrl
=
value
;
break
;
break
;
case
"support"
:
case
"support"
:
this
.
mSupportUrl
=
props
[
1
]
;
this
.
mSupportUrl
=
value
;
break
;
break
;
case
"donateUrl"
:
case
"donateUrl"
:
this
.
mDonateUrl
=
props
[
1
]
;
this
.
mDonateUrl
=
value
;
break
;
break
;
case
"zipUrl"
:
case
"zipUrl"
:
this
.
mZipUrl
=
props
[
1
]
;
this
.
mZipUrl
=
value
;
break
;
break
;
case
"baseUrl"
:
case
"baseUrl"
:
this
.
mBaseUrl
=
props
[
1
]
;
this
.
mBaseUrl
=
value
;
break
;
break
;
case
"manifestUrl"
:
case
"manifestUrl"
:
this
.
mManifestUrl
=
props
[
1
]
;
this
.
mManifestUrl
=
value
;
break
;
break
;
default
:
default
:
Log
.
d
(
"Magisk"
,
"Manifest string not recognized: "
+
props
[
0
]);
Log
.
d
(
"Magisk"
,
"M
odule: M
anifest string not recognized: "
+
props
[
0
]);
break
;
break
;
}
}
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
if
(
mId
!=
null
)
{
Log
.
d
(
"Magisk"
,
"Module: Checking for preference named repo_"
+
mId
);
if
(
prefs
.
contains
(
"repo_"
+
mId
))
{
String
entryString
=
prefs
.
getString
(
"repo_"
+
mId
,
""
);
}
String
entryName
=
"repo"
+
mId
;
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
String
[]
subStrings
=
entryString
.
split
(
"\n"
);
if
(
this
.
mId
!=
null
&&
!
this
.
mId
.
isEmpty
())
{
for
(
String
subKeys
:
subStrings
)
{
String
preferenceString
=
"repo_"
+
this
.
mId
;
String
[]
idEntry
=
subKeys
.
split
(
"="
,
2
);
String
preferenceKey
=
prefs
.
getString
(
preferenceString
,
"nope"
);
Log
.
d
(
"Magisk"
,
"Module: Checking entry strings. Key is "
+
idEntry
[
0
]
+
" and value is "
+
idEntry
[
1
]);
Log
.
d
(
"Magisk"
,
"Module: Checking for preference named "
+
preferenceString
);
if
(
idEntry
[
0
].
equals
(
"id"
))
{
if
(!
preferenceKey
.
equals
(
"nope"
))
{
if
(
idEntry
.
length
!=
2
)
{
Log
.
d
(
"Magisk"
,
"Module: repo_"
+
mId
+
" found."
);
continue
;
String
entryString
=
prefs
.
getString
(
"repo_"
+
mId
,
""
);
}
String
[]
subStrings
=
entryString
.
split
(
"\n"
);
if
(
idEntry
[
1
].
equals
(
mId
))
{
for
(
String
subKeys
:
subStrings
)
{
Log
.
d
(
"Magisk"
,
"Module: Hey, I know I'm online..."
);
String
[]
idEntry
=
subKeys
.
split
(
"="
,
2
);
mIsOnline
=
true
;
if
(
idEntry
[
0
].
equals
(
"id"
))
{
}
else
mIsOnline
=
false
;
if
(
idEntry
.
length
!=
2
)
{
continue
;
}
}
if
(
idEntry
[
0
].
equals
(
"versionCode"
))
{
if
(
idEntry
.
length
!=
2
)
{
if
(
idEntry
[
1
].
equals
(
mId
)
)
{
continue
;
Log
.
d
(
"Magisk"
,
"Module: Hey, I know I'm online..."
)
;
}
mIsOnline
=
true
;
}
else
mIsOnline
=
false
;
if
(
Integer
.
valueOf
(
idEntry
[
1
])
>
mVersionCode
)
{
}
mUpdateAvailable
=
true
;
if
(
idEntry
[
0
].
equals
(
"versionCode"
))
{
Log
.
d
(
"Magisk"
,
"Module: Hey, I have an update..."
);
if
(
idEntry
.
length
!=
2
)
{
}
else
mUpdateAvailable
=
fals
e
;
continu
e
;
}
}
if
(
Integer
.
valueOf
(
idEntry
[
1
])
>
mVersionCode
)
{
mUpdateAvailable
=
true
;
Log
.
d
(
"Magisk"
,
"Module: Hey, I have an update..."
);
}
else
mUpdateAvailable
=
false
;
}
}
}
}
}
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
if
(
mIsOnline
)
{
if
(
mIsOnline
)
{
editor
.
putBoolean
(
"repo_
isInstalled_"
+
mId
,
true
);
editor
.
putBoolean
(
"repo-
isInstalled_"
+
mId
,
true
);
}
else
{
}
else
{
editor
.
putBoolean
(
"repo_isInstalled_"
+
mId
,
false
);
editor
.
putBoolean
(
"repo-isInstalled_"
+
mId
,
false
);
}
}
editor
.
apply
();
if
(
mUpdateAvailable
)
{
editor
.
putBoolean
(
"repo-canUpdate_"
+
mId
,
true
);
}
else
{
editor
.
putBoolean
(
"repo-canUpdate_"
+
mId
,
false
);
}
}
editor
.
apply
();
}
}
if
(
mName
==
null
)
{
if
(
mName
==
null
)
{
...
@@ -147,8 +155,8 @@ public class Module {
...
@@ -147,8 +155,8 @@ public class Module {
mName
=
repo
.
getName
();
mName
=
repo
.
getName
();
mVersion
=
repo
.
getmVersion
();
mVersion
=
repo
.
getmVersion
();
mDescription
=
repo
.
getDescription
();
mDescription
=
repo
.
getDescription
();
mId
=
"foo"
;
mId
=
repo
.
getId
()
;
mVersionCode
=
111
;
mVersionCode
=
repo
.
getmVersionCode
()
;
mUrl
=
repo
.
getmZipUrl
();
mUrl
=
repo
.
getmZipUrl
();
mEnable
=
true
;
mEnable
=
true
;
mRemove
=
false
;
mRemove
=
false
;
...
...
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
View file @
e3866eeb
...
@@ -28,21 +28,23 @@ public class Repo {
...
@@ -28,21 +28,23 @@ public class Repo {
private
String
mVersionCode
;
private
String
mVersionCode
;
private
String
mSupportUrl
;
private
String
mSupportUrl
;
private
String
mDonateUrl
;
private
String
mDonateUrl
;
private
Date
lastUpdate
;
private
String
lastUpdate
;
private
Context
appContext
;
private
Context
appContext
;
private
boolean
mIsInstalled
;
private
boolean
mIsInstalled
,
mCanUpdate
;
public
Repo
(
String
manifestString
,
Context
context
)
{
public
Repo
(
String
manifestString
,
Context
context
)
{
ParseProps
(
manifestString
);
appContext
=
context
;
appContext
=
context
;
ParseProps
(
manifestString
);
}
}
public
Repo
(
String
name
,
String
url
,
Date
updated
,
Context
context
)
{
public
Repo
(
String
name
,
String
url
,
Date
updated
,
Context
context
)
{
appContext
=
context
;
appContext
=
context
;
this
.
mName
=
name
;
this
.
mName
=
name
;
this
.
mBaseUrl
=
url
;
this
.
mBaseUrl
=
url
;
this
.
lastUpdate
=
updated
;
this
.
lastUpdate
=
updated
.
toString
()
;
this
.
fetch
();
this
.
fetch
();
}
}
...
@@ -52,28 +54,16 @@ public class Repo {
...
@@ -52,28 +54,16 @@ public class Repo {
this
.
mZipUrl
=
zipUrl
;
this
.
mZipUrl
=
zipUrl
;
this
.
mDescription
=
moduleDescription
;
this
.
mDescription
=
moduleDescription
;
this
.
mName
=
moduleName
;
this
.
mName
=
moduleName
;
this
.
lastUpdate
=
lastUpdated
;
this
.
lastUpdate
=
lastUpdated
.
toString
()
;
this
.
fetch
();
this
.
fetch
();
}
}
private
void
fetch
()
{
public
void
fetch
()
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
appContext
);
if
(
prefs
.
contains
(
"repo_"
+
this
.
mId
))
{
String
repoString
=
prefs
.
getString
(
"repo_"
+
this
.
mId
,
""
);
if
(!
repoString
.
equals
(
""
))
{
ParseProps
(
repoString
);
}
}
if
(
prefs
.
contains
(
"repo_isInstalled_"
+
this
.
mId
))
{
mIsInstalled
=
prefs
.
getBoolean
(
"repo_isInstalled_"
+
this
.
mId
,
false
);
}
WebRequest
webreq
=
new
WebRequest
();
WebRequest
webreq
=
new
WebRequest
();
// Construct initial url for contents
// Construct initial url for contents
Log
.
d
(
"Magisk"
,
"
Manifest string is: "
+
mBaseUrl
+
"/contents/
"
);
Log
.
d
(
"Magisk"
,
"
Repo: Fetch called, Manifest string is: "
+
mBaseUrl
+
"/contents?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65
"
);
String
repoString
=
webreq
.
makeWebServiceCall
(
mBaseUrl
+
"/contents
/
"
,
WebRequest
.
GET
);
String
repoString
=
webreq
.
makeWebServiceCall
(
mBaseUrl
+
"/contents
?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65
"
,
WebRequest
.
GET
);
try
{
try
{
JSONArray
repoArray
=
new
JSONArray
(
repoString
);
JSONArray
repoArray
=
new
JSONArray
(
repoString
);
for
(
int
f
=
0
;
f
<
repoArray
.
length
();
f
++)
{
for
(
int
f
=
0
;
f
<
repoArray
.
length
();
f
++)
{
...
@@ -91,9 +81,11 @@ public class Repo {
...
@@ -91,9 +81,11 @@ public class Repo {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
Log
.
d
(
"Magisk"
,
"
Inner fetch: "
+
repoString
);
Log
.
d
(
"Magisk"
,
"
Repo: Inner fetch: "
+
mManifestUrl
+
"?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65"
);
WebRequest
propReq
=
new
WebRequest
();
WebRequest
propReq
=
new
WebRequest
();
String
manifestString
=
propReq
.
makeWebServiceCall
(
this
.
mManifestUrl
,
WebRequest
.
GET
,
true
);
String
manifestString
=
propReq
.
makeWebServiceCall
(
mManifestUrl
,
WebRequest
.
GET
,
true
);
Log
.
d
(
"Magisk"
,
"Repo: parseprops called from fetch for string "
+
manifestString
);
if
(
ParseProps
(
manifestString
))
{
if
(
ParseProps
(
manifestString
))
{
PutProps
(
manifestString
);
PutProps
(
manifestString
);
}
}
...
@@ -111,7 +103,7 @@ public class Repo {
...
@@ -111,7 +103,7 @@ public class Repo {
editor
.
apply
();
editor
.
apply
();
}
}
private
boolean
ParseProps
(
String
string
)
{
private
boolean
ParseProps
(
String
string
)
{
Log
.
d
(
"Magisk"
,
"Repo: parseprops called for string "
+
string
);
if
((
string
.
length
()
<=
1
)
|
(!
string
.
contains
(
"id"
)))
{
if
((
string
.
length
()
<=
1
)
|
(!
string
.
contains
(
"id"
)))
{
return
false
;
return
false
;
}
else
{
}
else
{
...
@@ -119,7 +111,6 @@ public class Repo {
...
@@ -119,7 +111,6 @@ public class Repo {
for
(
String
line
:
lines
)
{
for
(
String
line
:
lines
)
{
if
(
line
!=
""
)
{
if
(
line
!=
""
)
{
String
props
[]
=
line
.
split
(
"="
);
String
props
[]
=
line
.
split
(
"="
);
Log
.
d
(
"Magisk"
,
"Repo: Split values are "
+
props
[
0
]
+
" and "
+
props
[
1
]);
switch
(
props
[
0
])
{
switch
(
props
[
0
])
{
case
"versionCode"
:
case
"versionCode"
:
this
.
mVersionCode
=
props
[
1
];
this
.
mVersionCode
=
props
[
1
];
...
@@ -157,6 +148,9 @@ public class Repo {
...
@@ -157,6 +148,9 @@ public class Repo {
case
"manifestUrl"
:
case
"manifestUrl"
:
this
.
mManifestUrl
=
props
[
1
];
this
.
mManifestUrl
=
props
[
1
];
break
;
break
;
case
"logUrl"
:
this
.
mLogUrl
=
props
[
1
];
break
;
default
:
default
:
Log
.
d
(
"Magisk"
,
"Manifest string not recognized: "
+
props
[
0
]);
Log
.
d
(
"Magisk"
,
"Manifest string not recognized: "
+
props
[
0
]);
break
;
break
;
...
@@ -164,7 +158,20 @@ public class Repo {
...
@@ -164,7 +158,20 @@ public class Repo {
}
}
}
}
return
this
.
mName
!=
null
;
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
appContext
);
if
(
prefs
.
contains
(
"repo-isInstalled_"
+
this
.
mId
))
{
mIsInstalled
=
prefs
.
getBoolean
(
"repo-isInstalled_"
+
this
.
mId
,
false
);
}
if
(
prefs
.
contains
(
"repo-canUpdate_"
+
this
.
mId
))
{
mCanUpdate
=
prefs
.
getBoolean
(
"repo-canUpdate_"
+
this
.
mId
,
false
);
}
if
(
prefs
.
contains
(
"updated_"
+
this
.
mId
))
{
lastUpdate
=
prefs
.
getString
(
"updated_"
+
this
.
mId
,
""
);
}
return
this
.
mId
!=
null
;
}
}
}
}
...
@@ -241,10 +248,11 @@ public class Repo {
...
@@ -241,10 +248,11 @@ public class Repo {
return
mSupportUrl
;
return
mSupportUrl
;
}
}
public
Date
getLastUpdate
()
{
public
String
getLastUpdate
()
{
return
lastUpdate
;
return
lastUpdate
;
}
}
public
boolean
isInstalled
()
{
return
mIsInstalled
;
}
public
boolean
isInstalled
()
{
return
mIsInstalled
;
}
public
boolean
canUpdate
()
{
return
mCanUpdate
;
}
}
}
app/src/main/java/com/topjohnwu/magisk/module/RepoAdapter.java
deleted
100644 → 0
View file @
f404fe05
package
com
.
topjohnwu
.
magisk
.
module
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.NonNull
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.WebRequest
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.File
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
public
class
RepoAdapter
{
private
String
[]
result
;
private
static
String
url
=
"https://api.github.com/orgs/Magisk-Modules-Repo/repos"
;
private
static
List
<
Repo
>
repos
=
new
ArrayList
<
Repo
>()
{
};
private
static
final
String
TAG_ID
=
"id"
;
private
static
final
String
TAG_NAME
=
"name"
;
private
static
String
TAG
=
"Magisk"
;
private
Context
activityContext
;
private
Date
updatedDate
,
currentDate
;
public
List
<
Repo
>
listRepos
(
Context
context
,
boolean
refresh
)
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
if
(!
prefs
.
contains
(
"hasCachedRepos"
)
|
refresh
)
{
activityContext
=
context
;
new
MyAsyncTask
().
execute
();
List
<
String
>
out
=
null
;
}
else
{
Log
.
d
(
TAG
,
"Building from cache"
);
Map
<
String
,
?>
map
=
prefs
.
getAll
();
repos
.
clear
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
map
.
entrySet
().
stream
().
filter
(
entry
->
entry
.
getKey
().
contains
(
"repo_"
)).
forEach
(
entry
->
{
String
repoString
=
entry
.
getValue
().
toString
();
if
(
repoString
.
length
()
>=
0
)
{
repos
.
add
(
new
Repo
(
repoString
,
context
));
}
});
}
}
return
repos
;
}
class
MyAsyncTask
extends
AsyncTask
<
String
,
String
,
Void
>
{
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
}
@Override
protected
void
onProgressUpdate
(
String
...
values
)
{
super
.
onProgressUpdate
(
values
);
Toast
.
makeText
(
activityContext
,
"Refreshing online modules"
,
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
protected
Void
doInBackground
(
String
...
params
)
{
publishProgress
();
// Creating service handler class instance
WebRequest
webreq
=
new
WebRequest
();
// Making a request to url and getting response
String
jsonStr
=
webreq
.
makeWebServiceCall
(
url
,
WebRequest
.
GET
);
Log
.
d
(
"Magisk"
,
"doInBackground Running, String: "
+
jsonStr
+
" Url: "
+
url
);
try
{
repos
.
clear
();
JSONArray
jsonArray
=
new
JSONArray
(
jsonStr
);
for
(
int
i
=
0
;
i
<
jsonArray
.
length
();
i
++)
{
JSONObject
jsonobject
=
jsonArray
.
getJSONObject
(
i
);
String
name
=
jsonobject
.
getString
(
"name"
);
String
url
=
jsonobject
.
getString
(
"url"
);
String
lastUpdate
=
jsonobject
.
getString
(
"updated_at"
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss'Z'"
);
try
{
updatedDate
=
format
.
parse
(
lastUpdate
);
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
if
((!
name
.
contains
(
"Repo.github.io"
)))
{
//if (!name.contains("Repo.github.io") && name.contains("template")) {
repos
.
add
(
new
Repo
(
name
,
url
,
updatedDate
,
activityContext
));
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
protected
void
onPostExecute
(
Void
v
)
{
}
// protected void onPostExecute(Void v)
}
//class MyAsyncTask extends AsyncTask<String, String, Void>
protected
void
onPreExecute
()
{
}
}
app/src/main/java/com/topjohnwu/magisk/module/RepoHelper.java
0 → 100644
View file @
e3866eeb
package
com
.
topjohnwu
.
magisk
.
module
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.utils.WebRequest
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
public
class
RepoHelper
{
private
String
[]
result
;
private
static
String
url
=
"https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65"
;
private
static
List
<
Repo
>
repos
=
new
ArrayList
<
Repo
>();
private
static
final
String
TAG_ID
=
"id"
;
private
static
final
String
TAG_NAME
=
"name"
;
private
static
String
TAG
=
"Magisk"
;
private
String
mName
,
mId
,
mUrl
;
private
Context
activityContext
;
private
Date
updatedDate
,
currentDate
;
private
SharedPreferences
prefs
;
private
boolean
apiFail
;
public
List
<
Repo
>
listRepos
(
Context
context
,
boolean
refresh
)
{
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
activityContext
=
context
;
if
(!
prefs
.
contains
(
"hasCachedRepos"
)
|
refresh
)
{
Log
.
d
(
TAG
,
"RepoHelper: Building from web"
);
new
MyAsyncTask
().
execute
();
List
<
String
>
out
=
null
;
}
else
{
Log
.
d
(
TAG
,
"RepoHelper: Building from cache"
);
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
;
}
class
MyAsyncTask
extends
AsyncTask
<
String
,
String
,
Void
>
{
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
}
@Override
protected
void
onProgressUpdate
(
String
...
values
)
{
super
.
onProgressUpdate
(
values
);
Toast
.
makeText
(
activityContext
,
"Refreshing online modules"
,
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
protected
Void
doInBackground
(
String
...
params
)
{
publishProgress
();
// Creating service handler class instance
WebRequest
webreq
=
new
WebRequest
();
// Making a request to url and getting response
String
jsonStr
=
webreq
.
makeWebServiceCall
(
url
,
WebRequest
.
GET
);
Log
.
d
(
"Magisk"
,
"doInBackground Running, String: "
+
jsonStr
+
" Url: "
+
url
);
if
(
jsonStr
!=
null
&&
!
jsonStr
.
isEmpty
())
{
try
{
repos
.
clear
();
JSONArray
jsonArray
=
new
JSONArray
(
jsonStr
);
for
(
int
i
=
0
;
i
<
jsonArray
.
length
();
i
++)
{
JSONObject
jsonobject
=
jsonArray
.
getJSONObject
(
i
);
String
name
=
jsonobject
.
getString
(
"name"
);
String
url
=
jsonobject
.
getString
(
"url"
);
String
lastUpdate
=
jsonobject
.
getString
(
"updated_at"
);
String
mId
=
""
;
String
cacheUpdate
=
""
;
String
manifestString
=
""
;
boolean
doUpdate
=
true
;
boolean
hasCachedDate
=
false
;
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss'Z'"
);
Map
<
String
,
?>
map
=
prefs
.
getAll
();
for
(
Map
.
Entry
<
String
,
?>
entry
:
map
.
entrySet
())
{
if
(
entry
.
getValue
().
toString
().
contains
(
url
))
{
Log
.
d
(
"Magisk"
,
"RepoHelper: found matching URL"
);
manifestString
=
entry
.
getValue
().
toString
();
String
[]
entryStrings
=
entry
.
getValue
().
toString
().
split
(
"\n"
);
for
(
String
valueString
:
entryStrings
)
{
String
[]
valueSub
=
valueString
.
split
(
"="
);
if
(
valueSub
[
0
].
equals
(
"id"
))
{
mId
=
valueSub
[
1
];
Log
.
d
(
"Magisk"
,
"RepoHelper: Got id for package of "
+
mId
);
if
(
prefs
.
contains
(
"updated_"
+
mId
))
{
cacheUpdate
=
prefs
.
getString
(
"updated_"
+
mId
,
""
);
hasCachedDate
=
true
;
}
}
}
}
}
try
{
updatedDate
=
format
.
parse
(
lastUpdate
);
Log
.
d
(
"Magisk"
,
"RepoHelper: Dates found, online is "
+
updatedDate
+
" and cached is "
+
cacheUpdate
);
if
(
hasCachedDate
)
{
doUpdate
=
!
cacheUpdate
.
equals
(
updatedDate
.
toString
());
Log
.
d
(
"Magisk"
,
"RepoHelper: DoUpdate is "
+
doUpdate
);
}
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
if
(!
name
.
contains
(
"Repo.github.io"
))
{
if
(
doUpdate
)
{
repos
.
add
(
new
Repo
(
name
,
url
,
updatedDate
,
activityContext
));
Log
.
d
(
TAG
,
"RepoHelper: Trying to add new repo for online refresh - "
+
name
);
}
else
{
repos
.
add
(
new
Repo
(
manifestString
,
activityContext
));
Log
.
d
(
TAG
,
"RepoHelper: Trying to add new repo using manifestString of "
+
mId
);
}
}
for
(
int
f
=
0
;
f
<
repos
.
size
();
f
++)
{
repos
.
get
(
f
).
fetch
();
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
apiFail
=
false
;
}
else
{
apiFail
=
true
;
}
return
null
;
}
protected
void
onPostExecute
(
Void
v
)
{
if
(
apiFail
)
{
Toast
.
makeText
(
activityContext
,
"GitHub API Limit reached, please try refreshing again in an hour."
,
Toast
.
LENGTH_LONG
).
show
();
}
}
// protected void onPostExecute(Void v)
}
//class MyAsyncTask extends AsyncTask<String, String, Void>
protected
void
onPreExecute
()
{
}
}
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
e3866eeb
...
@@ -25,7 +25,7 @@ import android.widget.Toast;
...
@@ -25,7 +25,7 @@ import android.widget.Toast;
import
com.topjohnwu.magisk.ModulesFragment
;
import
com.topjohnwu.magisk.ModulesFragment
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Repo
Adapt
er
;
import
com.topjohnwu.magisk.module.Repo
Help
er
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.module.Repo
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
...
@@ -38,16 +38,14 @@ import java.io.IOException;
...
@@ -38,16 +38,14 @@ import java.io.IOException;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
public
class
Utils
{
public
class
Utils
{
public
static
int
magiskVersion
,
remoteMagiskVersion
=
-
1
,
remoteAppVersion
=
-
1
;
public
static
int
magiskVersion
,
remoteMagiskVersion
=
-
1
,
remoteAppVersion
=
-
1
;
public
static
String
magiskLink
,
magiskChangelog
,
appChangelog
,
appLink
,
phhLink
,
supersuLink
;
public
static
String
magiskLink
,
magiskChangelog
,
appChangelog
,
appLink
,
phhLink
,
supersuLink
;
private
Context
appContext
;
private
Context
appContext
;
private
static
final
String
TAG
=
"Magisk"
;
public
static
final
String
MAGISK_PATH
=
"/magisk"
;
public
static
final
String
MAGISK_PATH
=
"/magisk"
;
public
static
final
String
MAGISK_CACHE_PATH
=
"/cache/magisk"
;
public
static
final
String
MAGISK_CACHE_PATH
=
"/cache/magisk"
;
...
@@ -373,17 +371,25 @@ public class Utils {
...
@@ -373,17 +371,25 @@ public class Utils {
}
}
}
}
public
static
class
AuthGithub
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
private
static
String
mClientToken
=
"5c9f47a299d48a6a649af3587bc97200bafcac65"
;
public
AuthGithub
(
Context
context
)
{}
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
return
null
;
}
}
public
static
class
LoadModules
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
public
static
class
LoadModules
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
private
Context
mContext
;
private
Context
mContext
;
private
boolean
doReload
;
private
boolean
doReload
;
public
LoadModules
(
Context
context
,
boolean
reload
)
{
public
LoadModules
(
Context
context
,
boolean
reload
)
{
Log
.
d
(
"Magisk"
,
"LoadModules created, online is "
+
reload
);
mContext
=
context
;
mContext
=
context
;
doReload
=
reload
;
doReload
=
reload
;
}
}
@Override
@Override
...
@@ -392,30 +398,26 @@ public class Utils {
...
@@ -392,30 +398,26 @@ public class Utils {
ModulesFragment
.
listModulesCache
.
clear
();
ModulesFragment
.
listModulesCache
.
clear
();
ModulesFragment
.
listModulesDownload
.
clear
();
ModulesFragment
.
listModulesDownload
.
clear
();
List
<
String
>
magisk
=
getModList
(
MAGISK_PATH
);
List
<
String
>
magisk
=
getModList
(
MAGISK_PATH
);
Log
.
d
(
"Magisk"
,
"
Reload called, online mode set to "
+
doReload
);
Log
.
d
(
"Magisk"
,
"
Utils: Reload called, loading modules from"
+
(
doReload
?
" the internet "
:
" cache"
)
);
List
<
String
>
magiskCache
=
getModList
(
MAGISK_CACHE_PATH
);
List
<
String
>
magiskCache
=
getModList
(
MAGISK_CACHE_PATH
);
Repo
Adapter
mr
=
new
RepoAdapt
er
();
Repo
Helper
mr
=
new
RepoHelp
er
();
List
<
Repo
>
magiskRepos
=
mr
.
listRepos
(
mContext
,
doReload
);
List
<
Repo
>
magiskRepos
=
mr
.
listRepos
(
mContext
,
doReload
);
for
(
String
mod
:
magisk
)
{
for
(
String
mod
:
magisk
)
{
Log
.
d
(
"Magisk"
,
"Utils: Adding module from string "
+
mod
);
ModulesFragment
.
listModules
.
add
(
new
Module
(
mod
,
mContext
));
ModulesFragment
.
listModules
.
add
(
new
Module
(
mod
,
mContext
));
}
}
for
(
String
mod
:
magiskCache
)
{
for
(
String
mod
:
magiskCache
)
{
Log
.
d
(
"Magisk"
,
"Utils: Adding cache module from string "
+
mod
);
ModulesFragment
.
listModulesCache
.
add
(
new
Module
(
mod
,
mContext
));
ModulesFragment
.
listModulesCache
.
add
(
new
Module
(
mod
,
mContext
));
}
}
for
(
Repo
repo
:
magiskRepos
)
{
for
(
Repo
repo
:
magiskRepos
)
{
if
(
repo
.
getId
()
!=
null
){
Log
.
d
(
"Magisk"
,
"Utils: Adding repo from string "
+
repo
.
getId
());
ModulesFragment
.
listModulesDownload
.
add
(
repo
);
ModulesFragment
.
listModulesDownload
.
add
(
repo
);
}
}
}
return
null
;
return
null
;
}
}
@Override
protected
void
onPostExecute
(
Void
aVoid
)
{
super
.
onPostExecute
(
aVoid
);
}
}
}
public
static
class
FlashZIP
extends
AsyncTask
<
Void
,
Void
,
Boolean
>
{
public
static
class
FlashZIP
extends
AsyncTask
<
Void
,
Void
,
Boolean
>
{
...
@@ -462,35 +464,6 @@ public class Utils {
...
@@ -462,35 +464,6 @@ public class Utils {
if
(!
result
)
{
if
(!
result
)
{
Toast
.
makeText
(
mContext
,
mContext
.
getString
(
R
.
string
.
manual_install
,
mPath
),
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
mContext
,
mContext
.
getString
(
R
.
string
.
manual_install
,
mPath
),
Toast
.
LENGTH_LONG
).
show
();
return
;
return
;
}
else
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
mContext
);
String
jsonString
=
prefs
.
getString
(
"module_"
+
mName
,
""
);
String
retSplit
[]
=
ret
.
toString
().
split
(
"Using path:"
);
String
ret2Split
[]
=
retSplit
[
1
].
split
(
","
);
String
ret3Split
[]
=
ret2Split
[
0
].
split
(
"/"
);
String
finalSplit
=
"/"
+
ret3Split
[
1
]
+
"/"
+
ret3Split
[
2
];
Log
.
d
(
"Magisk"
,
"Damn, all that work for one path "
+
finalSplit
);
if
(!
jsonString
.
equals
(
""
))
{
JSONArray
repoArray
=
null
;
try
{
repoArray
=
new
JSONArray
(
jsonString
);
for
(
int
f
=
0
;
f
<
repoArray
.
length
();
f
++)
{
JSONObject
jsonobject
=
repoArray
.
getJSONObject
(
f
);
String
name
=
mName
;
Boolean
installed
=
true
;
SharedPreferences
.
Editor
editor
=
prefs
.
edit
();
editor
.
putBoolean
(
"isInstalled_"
+
mName
,
true
);
editor
.
putString
(
"path_"
+
mName
,
finalSplit
);
editor
.
apply
();
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
}
}
done
();
done
();
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/WebRequest.java
View file @
e3866eeb
package
com
.
topjohnwu
.
magisk
.
utils
;
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.util.Log
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
...
@@ -33,12 +35,15 @@ public class WebRequest {
...
@@ -33,12 +35,15 @@ public class WebRequest {
*/
*/
public
String
makeWebServiceCall
(
String
url
,
int
requestmethod
)
{
public
String
makeWebServiceCall
(
String
url
,
int
requestmethod
)
{
addNewLine
=
false
;
addNewLine
=
false
;
Log
.
d
(
"Magisk"
,
"WebRequest: Service call received for URL "
+
url
);
return
this
.
makeWebServiceCall
(
url
,
requestmethod
,
null
);
return
this
.
makeWebServiceCall
(
url
,
requestmethod
,
null
);
}
}
public
String
makeWebServiceCall
(
String
url
,
int
requestmethod
,
boolean
addNewLines
)
{
public
String
makeWebServiceCall
(
String
url
,
int
requestmethod
,
boolean
addNewLines
)
{
addNewLine
=
addNewLines
;
addNewLine
=
addNewLines
;
Log
.
d
(
"Magisk"
,
"WebRequest: Service call(bool) received for URL "
+
url
);
return
this
.
makeWebServiceCall
(
url
,
requestmethod
,
null
);
return
this
.
makeWebServiceCall
(
url
,
requestmethod
,
null
);
}
}
...
@@ -99,7 +104,11 @@ public class WebRequest {
...
@@ -99,7 +104,11 @@ public class WebRequest {
String
line
;
String
line
;
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
()));
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
()));
while
((
line
=
br
.
readLine
())
!=
null
)
{
while
((
line
=
br
.
readLine
())
!=
null
)
{
response
+=
line
+
"\n"
;
if
(
addNewLine
)
{
response
+=
line
+
"\n"
;
}
else
{
response
+=
line
;
}
}
}
}
else
{
}
else
{
response
=
""
;
response
=
""
;
...
...
app/src/main/res/drawable/ic_system_update_alt_black.xml
0 → 100644
View file @
e3866eeb
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
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>
app/src/main/res/layout/list_item_repo.xml
View file @
e3866eeb
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
...
@@ -78,9 +75,8 @@
...
@@ -78,9 +75,8 @@
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</LinearLayout>
<include
layout=
"@layout/list_item_repo_expanded"
/
>
<!-- <include layout="@layout/list_item_repo_expanded" />--
>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
</LinearLayout>
\ No newline at end of file
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