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
f404fe05
Commit
f404fe05
authored
Sep 06, 2016
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Break/Fix
Wheeeeee
parent
bef43617
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
603 additions
and
218 deletions
+603
-218
BaseModuleFragment.java
...rc/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
+19
-36
BaseRepoFragment.java
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
+5
-21
ModulesFragment.java
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
+32
-5
ReposAdapter.java
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
+64
-25
Module.java
app/src/main/java/com/topjohnwu/magisk/module/Module.java
+92
-29
Repo.java
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
+184
-62
RepoAdapter.java
...rc/main/java/com/topjohnwu/magisk/module/RepoAdapter.java
+20
-32
AnimationHelper.java
...main/java/com/topjohnwu/magisk/utils/AnimationHelper.java
+58
-0
GitAgent.java
app/src/main/java/com/topjohnwu/magisk/utils/GitAgent.java
+8
-0
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+5
-3
WebRequest.java
app/src/main/java/com/topjohnwu/magisk/utils/WebRequest.java
+10
-1
ic_done_black.xml
app/src/main/res/drawable/ic_done_black.xml
+9
-0
list_item_repo.xml
app/src/main/res/layout/list_item_repo.xml
+23
-1
list_item_repo_expanded.xml
app/src/main/res/layout/list_item_repo_expanded.xml
+67
-0
single_module_fragment.xml
app/src/main/res/layout/single_module_fragment.xml
+4
-3
strings.xml
app/src/main/res/values/strings.xml
+3
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/BaseModuleFragment.java
View file @
f404fe05
...
@@ -6,9 +6,7 @@ import android.preference.PreferenceManager;
...
@@ -6,9 +6,7 @@ import android.preference.PreferenceManager;
import
android.support.annotation.Nullable
;
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.v4.widget.SwipeRefreshLayout
;
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
;
...
@@ -19,26 +17,24 @@ import com.topjohnwu.magisk.module.Module;
...
@@ -19,26 +17,24 @@ import com.topjohnwu.magisk.module.Module;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
public
abstract
class
BaseModuleFragment
extends
Fragment
{
public
abstract
class
BaseModuleFragment
extends
Fragment
{
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
recyclerView
)
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
RecyclerView
recyclerView
;
private
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
private
View
view
;
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
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
mSwipeRefreshLayout
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeRefreshLayout
);
mSwipeRefreshLayout
.
setOnRefreshListener
(()
->
{
refreshItems
();
});
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
...
@@ -59,16 +55,19 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -59,16 +55,19 @@ public abstract class BaseModuleFragment extends Fragment {
return
view
;
return
view
;
}
}
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
(
chk
,
position
)
->
{
recyclerView
.
setAdapter
(
new
ModulesAdapter
(
listModules
(),
new
Utils
.
ItemClickListener
()
{
// On Checkbox change listener
@Override
CheckBox
chbox
=
(
CheckBox
)
chk
;
public
void
onItemClick
(
View
chk
,
int
position
)
{
// On Checkbox change listener
if
(!
chbox
.
isChecked
())
{
CheckBox
chbox
=
(
CheckBox
)
chk
;
listModules
().
get
(
position
).
createDisableFile
();
Snackbar
.
make
(
chk
,
R
.
string
.
disable_file_created
,
Snackbar
.
LENGTH_SHORT
).
show
();
if
(!
chbox
.
isChecked
())
{
}
else
{
BaseModuleFragment
.
this
.
listModules
().
get
(
position
).
createDisableFile
();
listModules
().
get
(
position
).
removeDisableFile
();
Snackbar
.
make
(
chk
,
R
.
string
.
disable_file_created
,
Snackbar
.
LENGTH_SHORT
).
show
();
Snackbar
.
make
(
chk
,
R
.
string
.
disable_file_removed
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
else
{
BaseModuleFragment
.
this
.
listModules
().
get
(
position
).
removeDisableFile
();
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
...
@@ -84,22 +83,6 @@ public abstract class BaseModuleFragment extends Fragment {
...
@@ -84,22 +83,6 @@ public abstract class BaseModuleFragment extends Fragment {
return
view
;
return
view
;
}
}
void
refreshItems
()
{
Log
.
d
(
"Magisk"
,
"Calling refreshitems for online"
);
Utils
.
LoadModules
utils
=
new
Utils
.
LoadModules
(
getActivity
(),
true
);
utils
.
execute
();
onItemsLoadComplete
();
view
.
requestLayout
();
}
void
onItemsLoadComplete
()
{
// Update the adapter and notify data set changed
// ...
// Stop refresh animation
mSwipeRefreshLayout
.
setRefreshing
(
false
);
}
protected
abstract
List
<
Module
>
listModules
();
protected
abstract
List
<
Module
>
listModules
();
}
}
app/src/main/java/com/topjohnwu/magisk/BaseRepoFragment.java
View file @
f404fe05
...
@@ -3,17 +3,14 @@ package com.topjohnwu.magisk;
...
@@ -3,17 +3,14 @@ package com.topjohnwu.magisk;
import
android.os.Bundle
;
import
android.os.Bundle
;
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.v
4.widget.SwipeRefreshLayout
;
import
android.support.v
7.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.TextView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.module.Module
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.util.List
;
import
java.util.List
;
...
@@ -26,15 +23,14 @@ public abstract class BaseRepoFragment extends Fragment {
...
@@ -26,15 +23,14 @@ public abstract class BaseRepoFragment extends Fragment {
RecyclerView
recyclerView
;
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
empty_rv
)
@BindView
(
R
.
id
.
empty_rv
)
TextView
emptyTv
;
TextView
emptyTv
;
private
SwipeRefreshLayout
mSwipeRefreshLayout
;
@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
=
inflater
.
inflate
(
R
.
layout
.
single_module_fragment
,
container
,
false
);
mSwipeRefreshLayout
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeRefreshLayout
);
mSwipeRefreshLayout
.
setOnRefreshListener
(()
->
{
refreshItems
();
});
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
...
@@ -51,18 +47,6 @@ public abstract class BaseRepoFragment extends Fragment {
...
@@ -51,18 +47,6 @@ public abstract class BaseRepoFragment extends Fragment {
return
view
;
return
view
;
}
}
void
refreshItems
()
{
Log
.
d
(
"Magisk"
,
"Calling refreshitems for online"
);
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
onItemsLoadComplete
();
}
void
onItemsLoadComplete
()
{
// Update the adapter and notify data set changed
// ...
// Stop refresh animation
mSwipeRefreshLayout
.
setRefreshing
(
false
);
}
protected
abstract
List
<
Repo
>
listRepos
();
protected
abstract
List
<
Repo
>
listRepos
();
}
}
app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java
View file @
f404fe05
...
@@ -14,6 +14,7 @@ import android.support.v4.app.Fragment;
...
@@ -14,6 +14,7 @@ import android.support.v4.app.Fragment;
import
android.support.v4.app.FragmentManager
;
import
android.support.v4.app.FragmentManager
;
import
android.support.v4.app.FragmentPagerAdapter
;
import
android.support.v4.app.FragmentPagerAdapter
;
import
android.support.v4.view.ViewPager
;
import
android.support.v4.view.ViewPager
;
import
android.support.v4.widget.SwipeRefreshLayout
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.Menu
;
...
@@ -40,7 +41,9 @@ public class ModulesFragment extends Fragment {
...
@@ -40,7 +41,9 @@ 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
File
input
;
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
;
...
@@ -51,6 +54,7 @@ public class ModulesFragment extends Fragment {
...
@@ -51,6 +54,7 @@ public class ModulesFragment extends Fragment {
@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
.
modules_fragment
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
modules_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
ButterKnife
.
bind
(
this
,
view
);
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
getActivity
());
if
(
prefs
.
contains
(
"hasCachedRepos"
))
{
if
(
prefs
.
contains
(
"hasCachedRepos"
))
{
...
@@ -58,11 +62,18 @@ public class ModulesFragment extends Fragment {
...
@@ -58,11 +62,18 @@ public class ModulesFragment extends Fragment {
}
else
{
}
else
{
new
Utils
.
LoadModules
(
getActivity
(),
true
).
execute
();
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
)
{
super
.
onCreateOptionsMenu
(
menu
,
inflater
);
super
.
onCreateOptionsMenu
(
menu
,
inflater
);
...
@@ -82,6 +93,8 @@ public class ModulesFragment extends Fragment {
...
@@ -82,6 +93,8 @@ 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:
...
@@ -104,9 +117,10 @@ public class ModulesFragment extends Fragment {
...
@@ -104,9 +117,10 @@ public class ModulesFragment extends Fragment {
listModulesCache
.
clear
();
listModulesCache
.
clear
();
listModulesDownload
.
clear
();
listModulesDownload
.
clear
();
progressBar
.
setVisibility
(
View
.
VISIBLE
);
progressBar
.
setVisibility
(
View
.
VISIBLE
);
viewPager
.
setAdapter
(
new
TabsAdapter
(
getChildFragmentManager
()));
ta
=
new
TabsAdapter
(
getChildFragmentManager
());
viewPager
.
setAdapter
(
ta
);
tabLayout
.
setupWithViewPager
(
viewPager
);
tabLayout
.
setupWithViewPager
(
viewPager
);
new
Utils
.
LoadModules
(
getActivity
(),
fals
e
).
execute
();
new
Utils
.
LoadModules
(
getActivity
(),
tru
e
).
execute
();
new
updateUI
().
execute
();
new
updateUI
().
execute
();
break
;
break
;
}
}
...
@@ -114,6 +128,19 @@ public class ModulesFragment extends Fragment {
...
@@ -114,6 +128,19 @@ 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
...
@@ -141,7 +168,7 @@ public class ModulesFragment extends Fragment {
...
@@ -141,7 +168,7 @@ public class ModulesFragment extends Fragment {
}
}
p
rivate
class
updateUI
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
p
ublic
class
updateUI
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
@Override
@Override
protected
Void
doInBackground
(
Void
...
voids
)
{
protected
Void
doInBackground
(
Void
...
voids
)
{
...
@@ -153,8 +180,8 @@ public class ModulesFragment extends Fragment {
...
@@ -153,8 +180,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
(
new
TabsAdapter
(
getChildFragmentManager
())
);
viewPager
.
setAdapter
(
ta
);
tabLayout
.
setupWithViewPager
(
viewPager
);
tabLayout
.
setupWithViewPager
(
viewPager
);
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ReposAdapter.java
View file @
f404fe05
...
@@ -3,22 +3,21 @@ package com.topjohnwu.magisk;
...
@@ -3,22 +3,21 @@ package com.topjohnwu.magisk;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.support.v7.widget.CardView
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
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.widget.CheckBox
;
import
android.widget.ImageView
;
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.Module
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.AnimationHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
import
org.w3c.dom.Text
;
import
java.io.File
;
import
java.util.List
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -27,22 +26,39 @@ import butterknife.ButterKnife;
...
@@ -27,22 +26,39 @@ import butterknife.ButterKnife;
public
class
ReposAdapter
extends
RecyclerView
.
Adapter
<
ReposAdapter
.
ViewHolder
>
{
public
class
ReposAdapter
extends
RecyclerView
.
Adapter
<
ReposAdapter
.
ViewHolder
>
{
private
final
List
<
Repo
>
mList
;
private
final
List
<
Repo
>
mList
;
private
View
view
;
private
View
view
Main
;
private
Context
context
;
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
)
{
public
ReposAdapter
(
List
<
Repo
>
list
)
{
this
.
mList
=
list
;
this
.
mList
=
list
;
}
}
private
boolean
mIsInstalled
;
@Override
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
view
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_repo
,
parent
,
false
);
viewMain
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
R
.
layout
.
list_item_repo
,
parent
,
false
);
ButterKnife
.
bind
(
this
,
viewMain
);
context
=
parent
.
getContext
();
context
=
parent
.
getContext
();
return
new
ViewHolder
(
viewMain
);
return
new
ViewHolder
(
view
);
}
}
@Override
@Override
...
@@ -50,26 +66,49 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
...
@@ -50,26 +66,49 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
final
Repo
repo
=
mList
.
get
(
position
);
final
Repo
repo
=
mList
.
get
(
position
);
holder
.
title
.
setText
(
repo
.
getName
());
holder
.
title
.
setText
(
repo
.
getName
());
holder
.
versionName
.
setText
(
repo
.
getVersion
());
holder
.
versionName
.
setText
(
repo
.
get
m
Version
());
holder
.
description
.
setText
(
repo
.
getDescription
());
holder
.
description
.
setText
(
repo
.
getDescription
());
view
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
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
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
if
(
isCardExpanded
)
{
if
(!
prefs
.
contains
(
"isInstalled_"
+
repo
.
getName
()))
{
AnimationHelper
.
collapse
(
popupLayout
);
Utils
.
DownloadReceiver
reciever
=
new
Utils
.
DownloadReceiver
()
{
isCardExpanded
=
false
;
@Override
public
void
task
(
File
file
)
{
Log
.
d
(
"Magisk"
,
"Task firing"
);
new
Utils
.
FlashZIP
(
context
,
repo
.
getName
(),
file
.
toString
()).
execute
();
}
};
String
filename
=
repo
.
getName
().
replace
(
" "
,
""
)
+
".zip"
;
Utils
.
downloadAndReceive
(
context
,
reciever
,
repo
.
getZipUrl
(),
filename
);
}
else
{
}
else
{
Toast
.
makeText
(
context
,
repo
.
getName
()
+
" is already installed."
,
Toast
.
LENGTH_SHORT
).
show
();
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();
// }
}
}
});
});
...
...
app/src/main/java/com/topjohnwu/magisk/module/Module.java
View file @
f404fe05
...
@@ -17,58 +17,117 @@ public class Module {
...
@@ -17,58 +17,117 @@ public class Module {
private
String
mName
=
null
;
private
String
mName
=
null
;
private
String
mVersion
=
"(No version provided)"
;
private
String
mVersion
=
"(No version provided)"
;
private
String
mDescription
=
"(No description provided)"
;
private
String
mDescription
=
"(No description provided)"
;
private
String
mUrl
=
null
;
private
String
mUrl
,
mSupportUrl
,
mDonateUrl
,
mZipUrl
,
mBaseUrl
,
mManifestUrl
,
mAuthor
;
private
boolean
mEnable
,
mRemove
,
mUpdateAvailable
,
mIsOnline
;
private
boolean
mEnable
;
private
boolean
mRemove
;
private
String
mId
;
private
String
mId
;
private
int
mVersionCode
;
private
int
mVersionCode
;
public
Module
(
String
path
,
Context
context
)
{
public
Module
(
String
path
,
Context
context
)
{
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
Map
<
String
,?>
keys
=
prefs
.
getAll
();
for
(
Map
.
Entry
<
String
,?>
entry
:
keys
.
entrySet
()){
if
(
entry
.
getValue
().
toString
().
contains
(
path
))
{
Log
.
d
(
"Magisk"
,
"Hey, look a matching path, this guy's name is "
+
entry
.
getKey
().
replace
(
"path_"
,
""
));
}
}
mRemoveFile
=
path
+
"/remove"
;
mRemoveFile
=
path
+
"/remove"
;
mDisableFile
=
path
+
"/disable"
;
mDisableFile
=
path
+
"/disable"
;
for
(
String
line
:
Utils
.
readFile
(
path
+
"/module.prop"
))
{
for
(
String
line
:
Utils
.
readFile
(
path
+
"/module.prop"
))
{
String
[]
p
art
s
=
line
.
split
(
"="
,
2
);
String
[]
p
rop
s
=
line
.
split
(
"="
,
2
);
if
(
p
art
s
.
length
!=
2
)
{
if
(
p
rop
s
.
length
!=
2
)
{
continue
;
continue
;
}
}
String
key
=
p
art
s
[
0
].
trim
();
String
key
=
p
rop
s
[
0
].
trim
();
if
(
key
.
charAt
(
0
)
==
'#'
)
{
if
(
key
.
charAt
(
0
)
==
'#'
)
{
continue
;
continue
;
}
}
String
value
=
parts
[
1
].
trim
();
String
value
=
props
[
1
].
trim
();
switch
(
key
)
{
switch
(
props
[
0
])
{
case
"versionCode"
:
this
.
mVersionCode
=
Integer
.
valueOf
(
props
[
1
]);
break
;
case
"name"
:
case
"name"
:
mName
=
value
;
this
.
mName
=
props
[
1
];
break
;
case
"author"
:
this
.
mAuthor
=
props
[
1
];
break
;
case
"id"
:
this
.
mId
=
props
[
1
];
break
;
break
;
case
"version"
:
case
"version"
:
mVersion
=
value
;
this
.
mVersion
=
props
[
1
]
;
break
;
break
;
case
"description"
:
case
"description"
:
mDescription
=
value
;
this
.
mDescription
=
props
[
1
]
;
break
;
break
;
case
"
id
"
:
case
"
donate
"
:
mId
=
value
;
this
.
mDonateUrl
=
props
[
1
]
;
break
;
break
;
case
"versionCode"
:
case
"support"
:
try
{
this
.
mSupportUrl
=
props
[
1
];
mVersionCode
=
Integer
.
parseInt
(
value
);
break
;
}
catch
(
NumberFormatException
e
)
{
case
"donateUrl"
:
mVersionCode
=
0
;
this
.
mDonateUrl
=
props
[
1
];
}
break
;
case
"zipUrl"
:
this
.
mZipUrl
=
props
[
1
];
break
;
break
;
case
"baseUrl"
:
this
.
mBaseUrl
=
props
[
1
];
break
;
case
"manifestUrl"
:
this
.
mManifestUrl
=
props
[
1
];
break
;
default
:
Log
.
d
(
"Magisk"
,
"Manifest string not recognized: "
+
props
[
0
]);
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
;
String
[]
subStrings
=
entryString
.
split
(
"\n"
);
for
(
String
subKeys
:
subStrings
)
{
String
[]
idEntry
=
subKeys
.
split
(
"="
,
2
);
Log
.
d
(
"Magisk"
,
"Module: Checking entry strings. Key is "
+
idEntry
[
0
]
+
" and value is "
+
idEntry
[
1
]);
if
(
idEntry
[
0
].
equals
(
"id"
))
{
if
(
idEntry
.
length
!=
2
)
{
continue
;
}
if
(
idEntry
[
1
].
equals
(
mId
))
{
Log
.
d
(
"Magisk"
,
"Module: Hey, I know I'm online..."
);
mIsOnline
=
true
;
}
else
mIsOnline
=
false
;
}
if
(
idEntry
[
0
].
equals
(
"versionCode"
))
{
if
(
idEntry
.
length
!=
2
)
{
continue
;
}
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
();
if
(
mIsOnline
)
{
editor
.
putBoolean
(
"repo_isInstalled_"
+
mId
,
true
);
}
else
{
editor
.
putBoolean
(
"repo_isInstalled_"
+
mId
,
false
);
}
editor
.
apply
();
}
}
}
}
...
@@ -86,11 +145,11 @@ public class Module {
...
@@ -86,11 +145,11 @@ public class Module {
public
Module
(
Repo
repo
)
{
public
Module
(
Repo
repo
)
{
mName
=
repo
.
getName
();
mName
=
repo
.
getName
();
mVersion
=
repo
.
getVersion
();
mVersion
=
repo
.
get
m
Version
();
mDescription
=
repo
.
getDescription
();
mDescription
=
repo
.
getDescription
();
mId
=
"foo"
;
mId
=
"foo"
;
mVersionCode
=
111
;
mVersionCode
=
111
;
mUrl
=
repo
.
getZipUrl
();
mUrl
=
repo
.
get
m
ZipUrl
();
mEnable
=
true
;
mEnable
=
true
;
mRemove
=
false
;
mRemove
=
false
;
...
@@ -134,4 +193,8 @@ public class Module {
...
@@ -134,4 +193,8 @@ public class Module {
return
mRemove
;
return
mRemove
;
}
}
public
boolean
isOnline
()
{
return
mIsOnline
;
}
public
boolean
isUpdateAvailable
()
{
return
mUpdateAvailable
;
};
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
View file @
f404fe05
This diff is collapsed.
Click to expand it.
app/src/main/java/com/topjohnwu/magisk/module/RepoAdapter.java
View file @
f404fe05
...
@@ -3,29 +3,39 @@ package com.topjohnwu.magisk.module;
...
@@ -3,29 +3,39 @@ package com.topjohnwu.magisk.module;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.NonNull
;
import
android.util.Log
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.WebRequest
;
import
com.topjohnwu.magisk.utils.WebRequest
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.io.File
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
public
class
RepoAdapter
{
public
class
RepoAdapter
{
private
String
[]
result
;
private
String
[]
result
;
private
static
String
url
=
"https://api.github.com/orgs/Magisk-Modules-Repo/repos"
;
private
static
String
url
=
"https://api.github.com/orgs/Magisk-Modules-Repo/repos"
;
private
static
List
<
Repo
>
repos
=
new
ArrayList
<
Repo
>();
private
static
List
<
Repo
>
repos
=
new
ArrayList
<
Repo
>()
{
};
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
Context
activityContext
;
private
Context
activityContext
;
private
Date
updatedDate
,
currentDate
;
private
Date
updatedDate
,
currentDate
;
...
@@ -36,39 +46,17 @@ public class RepoAdapter {
...
@@ -36,39 +46,17 @@ public class RepoAdapter {
new
MyAsyncTask
().
execute
();
new
MyAsyncTask
().
execute
();
List
<
String
>
out
=
null
;
List
<
String
>
out
=
null
;
}
else
{
}
else
{
Log
.
d
(
"Magisk"
,
"Building from cache"
);
Log
.
d
(
TAG
,
"Building from cache"
);
Map
<
String
,
?>
map
=
prefs
.
getAll
();
Map
<
String
,
?>
map
=
prefs
.
getAll
();
repos
.
clear
();
repos
.
clear
();
for
(
Map
.
Entry
<
String
,
?>
entry
:
map
.
entrySet
())
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
if
(
entry
.
getKey
().
contains
(
"module_"
))
{
map
.
entrySet
().
stream
().
filter
(
entry
->
entry
.
getKey
().
contains
(
"repo_"
)).
forEach
(
entry
->
{
String
repoString
=
entry
.
getValue
().
toString
().
replace
(
"""
,
"\""
);
String
repoString
=
entry
.
getValue
().
toString
();
JSONArray
repoArray
=
null
;
if
(
repoString
.
length
()
>=
0
)
{
try
{
repos
.
add
(
new
Repo
(
repoString
,
context
));
repoArray
=
new
JSONArray
(
repoString
);
for
(
int
f
=
0
;
f
<
repoArray
.
length
();
f
++)
{
JSONObject
jsonobject
=
repoArray
.
getJSONObject
(
f
);
String
name
=
entry
.
getKey
().
replace
(
"module_"
,
""
);
name
=
name
.
replace
(
" "
,
""
);
String
moduleName
,
moduleDescription
,
zipUrl
;
moduleName
=
jsonobject
.
getString
(
"moduleName"
);
moduleDescription
=
jsonobject
.
getString
(
"moduleDescription"
);
zipUrl
=
jsonobject
.
getString
(
"zipUrl"
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss'Z'"
);
try
{
updatedDate
=
format
.
parse
(
jsonobject
.
getString
(
"lastUpdate"
));
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
repos
.
add
(
new
Repo
(
name
,
moduleDescription
,
zipUrl
,
updatedDate
,
activityContext
));
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
}
});
}
}
}
}
...
@@ -120,8 +108,8 @@ public class RepoAdapter {
...
@@ -120,8 +108,8 @@ public class RepoAdapter {
// TODO Auto-generated catch block
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
if
((!
name
.
contains
(
"Repo.github.io"
)))
{
if
(!
name
.
contains
(
"Repo.github.io
"
))
{
//if (!name.contains("Repo.github.io") && name.contains("template
")) {
repos
.
add
(
new
Repo
(
name
,
url
,
updatedDate
,
activityContext
));
repos
.
add
(
new
Repo
(
name
,
url
,
updatedDate
,
activityContext
));
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/AnimationHelper.java
0 → 100644
View file @
f404fe05
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.view.View
;
import
android.view.animation.Animation
;
import
android.view.animation.Transformation
;
import
android.widget.LinearLayout
;
public
class
AnimationHelper
{
public
static
void
expand
(
final
View
v
)
{
v
.
measure
(
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
);
final
int
targetHeight
=
v
.
getMeasuredHeight
();
v
.
getLayoutParams
().
height
=
0
;
v
.
setVisibility
(
View
.
VISIBLE
);
Animation
a
=
new
Animation
()
{
@Override
protected
void
applyTransformation
(
float
interpolatedTime
,
Transformation
t
)
{
v
.
getLayoutParams
().
height
=
interpolatedTime
==
1
?
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
:
(
int
)
(
targetHeight
*
interpolatedTime
);
v
.
requestLayout
();
}
@Override
public
boolean
willChangeBounds
()
{
return
true
;
}
};
// 1dp/ms
a
.
setDuration
((
int
)
(
targetHeight
/
v
.
getContext
().
getResources
().
getDisplayMetrics
().
density
));
v
.
startAnimation
(
a
);
}
public
static
void
collapse
(
final
View
v
)
{
final
int
initialHeight
=
v
.
getMeasuredHeight
();
Animation
a
=
new
Animation
()
{
@Override
protected
void
applyTransformation
(
float
interpolatedTime
,
Transformation
t
)
{
if
(
interpolatedTime
==
1
)
{
v
.
setVisibility
(
View
.
GONE
);
}
else
{
v
.
getLayoutParams
().
height
=
initialHeight
-
(
int
)
(
initialHeight
*
interpolatedTime
);
v
.
requestLayout
();
}
}
@Override
public
boolean
willChangeBounds
()
{
return
true
;
}
};
// 1dp/ms
a
.
setDuration
((
int
)
(
initialHeight
/
v
.
getContext
().
getResources
().
getDisplayMetrics
().
density
));
v
.
startAnimation
(
a
);
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/utils/GitAgent.java
0 → 100644
View file @
f404fe05
package
com
.
topjohnwu
.
magisk
.
utils
;
public
class
GitAgent
{
}
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
f404fe05
...
@@ -41,6 +41,7 @@ import java.net.URL;
...
@@ -41,6 +41,7 @@ import java.net.URL;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
public
class
Utils
{
public
class
Utils
{
...
@@ -394,9 +395,8 @@ public class Utils {
...
@@ -394,9 +395,8 @@ public class Utils {
Log
.
d
(
"Magisk"
,
"Reload called, online mode set to "
+
doReload
);
Log
.
d
(
"Magisk"
,
"Reload called, online mode set to "
+
doReload
);
List
<
String
>
magiskCache
=
getModList
(
MAGISK_CACHE_PATH
);
List
<
String
>
magiskCache
=
getModList
(
MAGISK_CACHE_PATH
);
RepoAdapter
mr
=
new
RepoAdapter
();
RepoAdapter
mr
=
new
RepoAdapter
();
List
<
Repo
>
magiskRepos
=
mr
.
listRepos
(
mContext
,
doReload
);
List
<
Repo
>
magiskRepos
=
mr
.
listRepos
(
mContext
,
doReload
);
for
(
String
mod
:
magisk
)
{
for
(
String
mod
:
magisk
)
{
ModulesFragment
.
listModules
.
add
(
new
Module
(
mod
,
mContext
));
ModulesFragment
.
listModules
.
add
(
new
Module
(
mod
,
mContext
));
}
}
...
@@ -404,7 +404,9 @@ public class Utils {
...
@@ -404,7 +404,9 @@ public class Utils {
ModulesFragment
.
listModulesCache
.
add
(
new
Module
(
mod
,
mContext
));
ModulesFragment
.
listModulesCache
.
add
(
new
Module
(
mod
,
mContext
));
}
}
for
(
Repo
repo
:
magiskRepos
)
{
for
(
Repo
repo
:
magiskRepos
)
{
ModulesFragment
.
listModulesDownload
.
add
(
repo
);
if
(
repo
.
getId
()
!=
null
){
ModulesFragment
.
listModulesDownload
.
add
(
repo
);
}
}
}
return
null
;
return
null
;
...
...
app/src/main/java/com/topjohnwu/magisk/utils/WebRequest.java
View file @
f404fe05
...
@@ -18,6 +18,7 @@ public class WebRequest {
...
@@ -18,6 +18,7 @@ public class WebRequest {
static
String
response
=
null
;
static
String
response
=
null
;
public
final
static
int
GET
=
1
;
public
final
static
int
GET
=
1
;
public
final
static
int
POST
=
2
;
public
final
static
int
POST
=
2
;
private
boolean
addNewLine
;
//Constructor with no parameter
//Constructor with no parameter
public
WebRequest
()
{
public
WebRequest
()
{
...
@@ -31,7 +32,15 @@ public class WebRequest {
...
@@ -31,7 +32,15 @@ public class WebRequest {
* @requestmethod - http request method
* @requestmethod - http request method
*/
*/
public
String
makeWebServiceCall
(
String
url
,
int
requestmethod
)
{
public
String
makeWebServiceCall
(
String
url
,
int
requestmethod
)
{
addNewLine
=
false
;
return
this
.
makeWebServiceCall
(
url
,
requestmethod
,
null
);
return
this
.
makeWebServiceCall
(
url
,
requestmethod
,
null
);
}
public
String
makeWebServiceCall
(
String
url
,
int
requestmethod
,
boolean
addNewLines
)
{
addNewLine
=
addNewLines
;
return
this
.
makeWebServiceCall
(
url
,
requestmethod
,
null
);
}
}
/**
/**
...
@@ -90,7 +99,7 @@ public class WebRequest {
...
@@ -90,7 +99,7 @@ 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
;
response
+=
line
+
"\n"
;
}
}
}
else
{
}
else
{
response
=
""
;
response
=
""
;
...
...
app/src/main/res/drawable/ic_done_black.xml
0 → 100644
View file @
f404fe05
<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=
"M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"
/>
</vector>
app/src/main/res/layout/list_item_repo.xml
View file @
f404fe05
<?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"
...
@@ -13,6 +17,10 @@
...
@@ -13,6 +17,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"
...
@@ -57,8 +65,22 @@
...
@@ -57,8 +65,22 @@
</LinearLayout>
</LinearLayout>
<ImageView
android:id=
"@+id/installed"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<ImageView
android:id=
"@+id/update"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<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
\ No newline at end of file
app/src/main/res/layout/list_item_repo_expanded.xml
0 → 100644
View file @
f404fe05
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width=
"match_parent"
android:id=
"@+id/popup_layout"
android:layout_height=
"wrap_content"
android:minHeight=
"?android:attr/listPreferredItemHeight"
android:orientation=
"horizontal"
android:padding=
"8dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<LinearLayout
android:layout_width=
"0dip"
android:layout_height=
"fill_parent"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"4dip"
android:layout_marginRight=
"4dip"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/description"
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:singleLine=
"false"
android:text=
"Hello"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textIsSelectable=
"false"
/>
<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:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
<TextView
android:id=
"@+id/installedStatus"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
<TextView
android:id=
"@+id/updateStatus"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:textAppearance=
"?android:attr/textAppearanceSmall"
android:textIsSelectable=
"false"
/>
</LinearLayout>
</LinearLayout>
app/src/main/res/layout/single_module_fragment.xml
View file @
f404fe05
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<
android.support.v4.widget.SwipeRefresh
Layout
android:id=
"@+id/swipeRefreshLayout"
<
Linear
Layout
android:id=
"@+id/swipeRefreshLayout"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
layout_height=
""
android:orientation=
"vertical"
xmlns:android=
"http://schemas.android.com/apk/res/android"
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"
>
...
@@ -24,4 +25,4 @@
...
@@ -24,4 +25,4 @@
android:textStyle=
"italic"
android:textStyle=
"italic"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
f404fe05
...
@@ -42,6 +42,9 @@
...
@@ -42,6 +42,9 @@
<!--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=
"mudule_up_to_date"
>
Module is up-to-date
</string>
<string
name=
"module_installed"
>
Module is 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>
...
...
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