Add Swipe-to-refresh for Modules, Code Cleanup, Stylizations
Moar updates. Modules now swipe to refresh and indicate properly-ish. Cleanup minor code stuff. Colorize icons to match, set global color variable so it can be changed...
This commit is contained in:
parent
e690f6d487
commit
b3ba79a3ba
@ -9,6 +9,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.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -23,6 +24,7 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.module.Module;
|
import com.topjohnwu.magisk.module.Module;
|
||||||
|
import com.topjohnwu.magisk.module.RepoHelper;
|
||||||
import com.topjohnwu.magisk.utils.Shell;
|
import com.topjohnwu.magisk.utils.Shell;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
import com.topjohnwu.magisk.utils.WebWindow;
|
import com.topjohnwu.magisk.utils.WebWindow;
|
||||||
@ -34,13 +36,18 @@ import butterknife.BindView;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public abstract class BaseModuleFragment extends Fragment {
|
public abstract class BaseModuleFragment extends Fragment {
|
||||||
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
@BindView(R.id.empty_rv) TextView emptyTv;
|
@BindView(R.id.empty_rv) TextView emptyTv;
|
||||||
|
|
||||||
|
private RepoHelper.TaskDelegate mDelegate;
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
|
public BaseModuleFragment SetDelegate(RepoHelper.TaskDelegate delegate) {
|
||||||
|
mDelegate = delegate;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@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) {
|
||||||
@ -48,16 +55,19 @@ public abstract class BaseModuleFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
ButterKnife.bind(this, viewMain);
|
ButterKnife.bind(this, viewMain);
|
||||||
|
mSwipeRefreshLayout.setOnRefreshListener(() -> {
|
||||||
|
Log.d("Magisk","ModulesFragment: SWIPE");
|
||||||
|
mDelegate.taskCompletionResult("OK");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
prefs.registerOnSharedPreferenceChangeListener(new SharedPreferences.OnSharedPreferenceChangeListener() {
|
prefs.registerOnSharedPreferenceChangeListener((sharedPreferences, s) -> {
|
||||||
@Override
|
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
|
|
||||||
if (s.contains("updated")) {
|
if (s.contains("updated")) {
|
||||||
viewMain.invalidate();
|
viewMain.invalidate();
|
||||||
viewMain.requestLayout();
|
viewMain.requestLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (listModules().size() == 0) {
|
if (listModules().size() == 0) {
|
||||||
emptyTv.setVisibility(View.VISIBLE);
|
emptyTv.setVisibility(View.VISIBLE);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.topjohnwu.magisk;
|
package com.topjohnwu.magisk;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorSet;
|
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -9,18 +8,13 @@ import android.content.SharedPreferences;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.text.util.Linkify;
|
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.animation.Animation;
|
|
||||||
import android.view.animation.AnimationUtils;
|
|
||||||
import android.view.animation.TranslateAnimation;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -119,11 +113,10 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
|
|
||||||
Log.d("Magisk", "ReposAdapter: Setting up info " + repo.getId() + " and " + repo.getDescription() + " and " + repo.getmVersion());
|
Log.d("Magisk", "ReposAdapter: Setting up info " + repo.getId() + " and " + repo.getDescription() + " and " + repo.getmVersion());
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
mHolder.updateImage.setImageResource(R.drawable.ic_file_download_black);
|
|
||||||
mCanUpdate = prefs.getBoolean("repo-isInstalled_" + repo.getId(), false);
|
mCanUpdate = prefs.getBoolean("repo-isInstalled_" + repo.getId(), false);
|
||||||
|
|
||||||
View.OnClickListener oCl = view -> {
|
View.OnClickListener oCl = view -> {
|
||||||
Log.d("Magisk","Onlick captured, view is " + view.getId());
|
Log.d("Magisk", "Onlick captured, view is " + view.getId());
|
||||||
|
|
||||||
if (view.getId() == mHolder.updateImage.getId()) {
|
if (view.getId() == mHolder.updateImage.getId()) {
|
||||||
if (!mIsInstalled | mCanUpdate) {
|
if (!mIsInstalled | mCanUpdate) {
|
||||||
@ -140,12 +133,15 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, repo.getId() + " is already installed.", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, repo.getId() + " is already installed.", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} if (view.getId() == mHolder.changeLog.getId()) {
|
}
|
||||||
new WebWindow("Changelog",repo.getmLogUrl(),this.context);
|
if (view.getId() == mHolder.changeLog.getId()) {
|
||||||
} if (view.getId() == mHolder.authorLink.getId()) {
|
new WebWindow("Changelog", repo.getmLogText(), this.context);
|
||||||
new WebWindow("Donate",repo.getmDonateUrl(),this.context);
|
}
|
||||||
} if (view.getId() == mHolder.supportLink.getId()) {
|
if (view.getId() == mHolder.authorLink.getId()) {
|
||||||
new WebWindow("Support",repo.getmSupportUrl(),this.context);
|
new WebWindow("Donate", repo.getmDonateUrl(), this.context);
|
||||||
|
}
|
||||||
|
if (view.getId() == mHolder.supportLink.getId()) {
|
||||||
|
new WebWindow("Support", repo.getmSupportUrl(), this.context);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mHolder.changeLog.setOnClickListener(oCl);
|
mHolder.changeLog.setOnClickListener(oCl);
|
||||||
@ -160,7 +156,6 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return mList.size();
|
return mList.size();
|
||||||
@ -215,8 +210,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
holder.expandLayout.measure(widthSpec, heightSpec);
|
holder.expandLayout.measure(widthSpec, heightSpec);
|
||||||
final int holderHeight = holder.expandLayout.getMeasuredHeight();
|
final int holderHeight = holder.expandLayout.getMeasuredHeight();
|
||||||
mAnimator = slideAnimator(0, holderHeight);
|
mAnimator = slideAnimator(0, holderHeight);
|
||||||
animY2 = ObjectAnimator.ofFloat(holder.updateImage, "translationY", holderHeight/2);
|
animY2 = ObjectAnimator.ofFloat(holder.updateImage, "translationY", holderHeight / 2);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ public class ReposFragment extends Fragment {
|
|||||||
TextView emptyTv;
|
TextView emptyTv;
|
||||||
@BindView(R.id.swipeRefreshLayout)
|
@BindView(R.id.swipeRefreshLayout)
|
||||||
SwipeRefreshLayout swipeRefreshLayout;
|
SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private RepoHelper.TaskDelegate taskDelegate;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
||||||
@ -57,18 +56,17 @@ public class ReposFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void LoadRepo (boolean doReload) {
|
private void LoadRepo (boolean doReload) {
|
||||||
taskDelegate = result -> {
|
RepoHelper.TaskDelegate taskDelegate = result -> {
|
||||||
if (result.equals("Complete")) {
|
if (result.equals("Complete")) {
|
||||||
Log.d("Magisk", "ReposFragment, got delegate");
|
Log.d("Magisk", "ReposFragment, got delegate");
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
Log.d("Magisk","ReposFragment, LoadRepo called");
|
Log.d("Magisk","ReposFragment, LoadRepo called");
|
||||||
mListRepos.clear();
|
mListRepos.clear();
|
||||||
RepoHelper mr = new RepoHelper();
|
RepoHelper mr = new RepoHelper();
|
||||||
List<Repo> magiskRepos = mr.listRepos(getActivity(), doReload,taskDelegate);
|
List<Repo> magiskRepos = mr.listRepos(getActivity(), doReload, taskDelegate);
|
||||||
|
|
||||||
for (Repo repo : magiskRepos) {
|
for (Repo repo : magiskRepos) {
|
||||||
Log.d("Magisk", "ReposFragment: Adding repo from string " + repo.getId());
|
Log.d("Magisk", "ReposFragment: Adding repo from string " + repo.getId());
|
||||||
|
@ -18,7 +18,7 @@ import java.util.Date;
|
|||||||
public class Repo {
|
public class Repo {
|
||||||
private String mBaseUrl;
|
private String mBaseUrl;
|
||||||
private String mZipUrl;
|
private String mZipUrl;
|
||||||
private String mLogUrl;
|
private String mLogText;
|
||||||
private String mManifestUrl;
|
private String mManifestUrl;
|
||||||
private String mVersion;
|
private String mVersion;
|
||||||
private String mName;
|
private String mName;
|
||||||
@ -77,7 +77,9 @@ public class Repo {
|
|||||||
} else if (name.equals("module.prop")) {
|
} else if (name.equals("module.prop")) {
|
||||||
this.mManifestUrl = jsonobject.getString("download_url");
|
this.mManifestUrl = jsonobject.getString("download_url");
|
||||||
} else if (name.equals("changelog.txt")) {
|
} else if (name.equals("changelog.txt")) {
|
||||||
this.mLogUrl = jsonobject.getString("download_url");
|
String logUrl = jsonobject.getString("download_url");;
|
||||||
|
String logText = webreq.makeWebServiceCall(logUrl,WebRequest.GET);
|
||||||
|
this.mLogText = logText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
@ -94,9 +96,10 @@ public class Repo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void PutProps(String manifestString) {
|
private void PutProps(String manifestString) {
|
||||||
manifestString = manifestString + "zipUrl=" + mZipUrl + "\nbaseUrl=" + mBaseUrl + "\nlogUrl=" + mLogUrl + "\nmanifestUrl=" + mManifestUrl;
|
manifestString = manifestString + "zipUrl=" + mZipUrl + "\nbaseUrl=" + mBaseUrl + "\nmanifestUrl=" + mManifestUrl;
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
editor.putString("log_" + mId, mLogText);
|
||||||
editor.putString("repo_" + mId, manifestString);
|
editor.putString("repo_" + mId, manifestString);
|
||||||
editor.putBoolean("hasCachedRepos", true);
|
editor.putBoolean("hasCachedRepos", true);
|
||||||
editor.putString("updated_" + mId, this.lastUpdate);
|
editor.putString("updated_" + mId, this.lastUpdate);
|
||||||
@ -151,9 +154,6 @@ 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;
|
||||||
@ -171,7 +171,9 @@ public class Repo {
|
|||||||
if (prefs.contains("updated_" + this.mId)) {
|
if (prefs.contains("updated_" + this.mId)) {
|
||||||
lastUpdate = prefs.getString("updated_" + this.mId,"");
|
lastUpdate = prefs.getString("updated_" + this.mId,"");
|
||||||
}
|
}
|
||||||
|
if (prefs.contains("log_" + this.mId)) {
|
||||||
|
mLogText = prefs.getString("log_" + this.mId,"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return this.mId != null;
|
return this.mId != null;
|
||||||
@ -237,8 +239,8 @@ public class Repo {
|
|||||||
return mBaseUrl;
|
return mBaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getmLogUrl() {
|
public String getmLogText() {
|
||||||
return mLogUrl;
|
return mLogText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,36 +18,31 @@ import org.json.JSONObject;
|
|||||||
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.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class RepoHelper {
|
public class RepoHelper {
|
||||||
private String[] result;
|
private static List<Repo> repos = new ArrayList<>();
|
||||||
private static String url = "https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=";
|
|
||||||
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 static String TAG = "Magisk";
|
||||||
private String mName, mId, mUrl;
|
|
||||||
private Context activityContext;
|
private Context activityContext;
|
||||||
private Date updatedDate, currentDate;
|
private Date updatedDate;
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
private boolean apiFail;
|
private boolean apiFail;
|
||||||
|
|
||||||
|
public RepoHelper() {
|
||||||
|
}
|
||||||
|
|
||||||
public List<Repo> listRepos(Context context, boolean refresh, TaskDelegate delegate) {
|
public List<Repo> listRepos(Context context, boolean refresh, TaskDelegate delegate) {
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
activityContext = context;
|
activityContext = context;
|
||||||
TaskDelegate mDelegate = delegate;
|
|
||||||
|
|
||||||
|
|
||||||
if (!prefs.contains("hasCachedRepos") | refresh) {
|
if (!prefs.contains("hasCachedRepos") | refresh) {
|
||||||
Log.d(TAG, "RepoHelper: Building from web");
|
Log.d(TAG, "RepoHelper: Building from web");
|
||||||
new MyAsyncTask(delegate).execute();
|
new BuildFromWeb(delegate).execute();
|
||||||
List<String> out = null;
|
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "RepoHelper: Building from cache");
|
Log.d(TAG, "RepoHelper: Building from cache");
|
||||||
BuildFromCache();
|
BuildFromCache();
|
||||||
@ -63,40 +58,25 @@ public class RepoHelper {
|
|||||||
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
||||||
if (entry.getKey().contains("repo_")) {
|
if (entry.getKey().contains("repo_")) {
|
||||||
String repoString = entry.getValue().toString().replace(""", "\"");
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repos.add(new Repo(repoString, activityContext));
|
repos.add(new Repo(repoString, activityContext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BuildFromWeb extends AsyncTask<String, String, Void> {
|
||||||
class MyAsyncTask extends AsyncTask<String, String, Void> {
|
|
||||||
|
|
||||||
private TaskDelegate delegate;
|
private TaskDelegate delegate;
|
||||||
public MyAsyncTask(TaskDelegate delegate) {
|
|
||||||
|
public BuildFromWeb(TaskDelegate delegate) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onProgressUpdate(String... values) {
|
protected void onProgressUpdate(String... values) {
|
||||||
super.onProgressUpdate(values);
|
super.onProgressUpdate(values);
|
||||||
@ -112,7 +92,8 @@ public class RepoHelper {
|
|||||||
|
|
||||||
// Making a request to url and getting response
|
// Making a request to url and getting response
|
||||||
String token = activityContext.getString(R.string.some_string);
|
String token = activityContext.getString(R.string.some_string);
|
||||||
String jsonStr = webreq.makeWebServiceCall(url + Utils.procFile(token, activityContext), WebRequest.GET);
|
String url1 = activityContext.getString(R.string.url_main);
|
||||||
|
String jsonStr = webreq.makeWebServiceCall(url1 + Utils.procFile(token, activityContext), WebRequest.GET);
|
||||||
if (jsonStr != null && !jsonStr.isEmpty()) {
|
if (jsonStr != null && !jsonStr.isEmpty()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -128,7 +109,7 @@ public class RepoHelper {
|
|||||||
String manifestString = "";
|
String manifestString = "";
|
||||||
boolean doUpdate = true;
|
boolean doUpdate = true;
|
||||||
boolean hasCachedDate = false;
|
boolean hasCachedDate = false;
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
|
||||||
Map<String, ?> map = prefs.getAll();
|
Map<String, ?> map = prefs.getAll();
|
||||||
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
||||||
if (entry.getValue().toString().contains(url)) {
|
if (entry.getValue().toString().contains(url)) {
|
||||||
@ -158,7 +139,6 @@ public class RepoHelper {
|
|||||||
Log.d("Magisk", "RepoHelper: DoUpdate is " + doUpdate);
|
Log.d("Magisk", "RepoHelper: DoUpdate is " + doUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -185,14 +165,13 @@ public class RepoHelper {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPostExecute(Void v) {
|
protected void onPostExecute(Void v) {
|
||||||
if (apiFail) {
|
if (apiFail) {
|
||||||
Toast.makeText(activityContext, "GitHub API Limit reached, please try refreshing again in an hour.", Toast.LENGTH_LONG).show();
|
Toast.makeText(activityContext, "GitHub API Limit reached, please try refreshing again in an hour.", Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
Log.d("Magisk","RepoHelper: postExecute fired");
|
Log.d("Magisk", "RepoHelper: postExecute fired");
|
||||||
delegate.taskCompletionResult("Complete");
|
delegate.taskCompletionResult("Complete");
|
||||||
BuildFromCache();
|
BuildFromCache();
|
||||||
|
|
||||||
@ -200,12 +179,9 @@ public class RepoHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected void onPreExecute() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface TaskDelegate {
|
public interface TaskDelegate {
|
||||||
public void taskCompletionResult(String result);
|
void taskCompletionResult(String result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CustomComparator implements Comparator<Repo> {
|
public class CustomComparator implements Comparator<Repo> {
|
||||||
@ -215,5 +191,4 @@ public class RepoHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,10 @@
|
|||||||
card_view:cardCornerRadius="2dp"
|
card_view:cardCornerRadius="2dp"
|
||||||
card_view:cardElevation="2dp">
|
card_view:cardElevation="2dp">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp">
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="10dp"
|
||||||
android:layout_gravity="center_vertical">
|
android:layout_gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -78,7 +72,7 @@
|
|||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<!--TODO - Work in an auto-update notifier, make this fly around like magic -->
|
||||||
<!--<ImageView-->
|
<!--<ImageView-->
|
||||||
<!--android:id="@+id/update"-->
|
<!--android:id="@+id/update"-->
|
||||||
<!--android:layout_width="wrap_content"-->
|
<!--android:layout_width="wrap_content"-->
|
||||||
@ -155,6 +149,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
android:backgroundTint="@color/icon_grey"
|
||||||
android:background="@drawable/ic_changelog" />
|
android:background="@drawable/ic_changelog" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -163,6 +158,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
android:backgroundTint="@color/icon_grey"
|
||||||
android:background="@drawable/ic_author" />
|
android:background="@drawable/ic_author" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -171,6 +167,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
android:backgroundTint="@color/icon_grey"
|
||||||
android:background="@drawable/ic_support" />
|
android:background="@drawable/ic_support" />
|
||||||
|
|
||||||
|
|
||||||
@ -181,6 +178,6 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
@ -14,16 +14,12 @@
|
|||||||
card_view:cardCornerRadius="2dp"
|
card_view:cardCornerRadius="2dp"
|
||||||
card_view:cardElevation="2dp">
|
card_view:cardElevation="2dp">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
android:padding="8dp">
|
android:padding="10dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -59,10 +55,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:background="@drawable/ic_file_download_black"
|
android:background="@drawable/ic_file_download_black"
|
||||||
android:layout_marginEnd="10dp"
|
android:backgroundTint="@color/icon_grey"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="end"
|
||||||
android:layout_alignBaseline="@id/title"
|
android:layout_alignBaseline="@id/title"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
/>
|
/>
|
||||||
@ -128,6 +124,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
|
android:backgroundTint="@color/icon_grey"
|
||||||
android:background="@drawable/ic_changelog"/>
|
android:background="@drawable/ic_changelog"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/authorLink"
|
android:id="@+id/authorLink"
|
||||||
@ -135,6 +132,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
|
android:backgroundTint="@color/icon_grey"
|
||||||
android:background="@drawable/ic_author"/>
|
android:background="@drawable/ic_author"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/supportLink"
|
android:id="@+id/supportLink"
|
||||||
@ -142,6 +140,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
|
android:backgroundTint="@color/icon_grey"
|
||||||
android:background="@drawable/ic_support"/>
|
android:background="@drawable/ic_support"/>
|
||||||
|
|
||||||
|
|
||||||
@ -159,14 +158,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:gravity="right"
|
android:gravity="end"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout android:id="@+id/swipeRefreshLayout"
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
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"
|
||||||
|
android:id="@+id/swipeRefreshLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
@ -25,4 +26,4 @@
|
|||||||
android:textStyle="italic"
|
android:textStyle="italic"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
@ -6,7 +6,7 @@
|
|||||||
<color name="accent">#FFC107</color>
|
<color name="accent">#FFC107</color>
|
||||||
<color name="primary_text">#212121</color>
|
<color name="primary_text">#212121</color>
|
||||||
<color name="icons">#FFFFFF</color>
|
<color name="icons">#FFFFFF</color>
|
||||||
|
<color name="icon_grey">#757575</color>
|
||||||
<color name="red500">#F44336</color>
|
<color name="red500">#F44336</color>
|
||||||
<color name="green500">#4CAF50</color>
|
<color name="green500">#4CAF50</color>
|
||||||
<color name="blue500">#2196F3</color>
|
<color name="blue500">#2196F3</color>
|
||||||
|
@ -97,4 +97,5 @@
|
|||||||
<string name="pass">MagiskRox666</string>
|
<string name="pass">MagiskRox666</string>
|
||||||
<string name="some_string">GTYybRBTYf5his9kQ16ZNO7qgkBJ/5MyVe4CGceAOIoXgSnnk8FTd4F1dE9p5Eus</string>
|
<string name="some_string">GTYybRBTYf5his9kQ16ZNO7qgkBJ/5MyVe4CGceAOIoXgSnnk8FTd4F1dE9p5Eus</string>
|
||||||
<string name="downloads">Downloads</string>
|
<string name="downloads">Downloads</string>
|
||||||
|
<string name="url_main">https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user