Break/Fix

Wheeeeee
This commit is contained in:
d8ahazard
2016-09-06 16:54:08 -05:00
parent bef4361736
commit f404fe0570
16 changed files with 607 additions and 222 deletions
@@ -0,0 +1,58 @@
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);
}
}
@@ -0,0 +1,8 @@
package com.topjohnwu.magisk.utils;
public class GitAgent {
}
@@ -41,6 +41,7 @@ import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Set;
public class Utils {
@@ -394,9 +395,8 @@ public class Utils {
Log.d("Magisk", "Reload called, online mode set to " + doReload);
List<String> magiskCache = getModList(MAGISK_CACHE_PATH);
RepoAdapter mr = new RepoAdapter();
List<Repo> magiskRepos = mr.listRepos(mContext, doReload);
for (String mod : magisk) {
ModulesFragment.listModules.add(new Module(mod,mContext));
}
@@ -404,7 +404,9 @@ public class Utils {
ModulesFragment.listModulesCache.add(new Module(mod,mContext));
}
for (Repo repo : magiskRepos) {
ModulesFragment.listModulesDownload.add(repo);
if (repo.getId() != null){
ModulesFragment.listModulesDownload.add(repo);
}
}
return null;
@@ -18,6 +18,7 @@ public class WebRequest {
static String response = null;
public final static int GET = 1;
public final static int POST = 2;
private boolean addNewLine;
//Constructor with no parameter
public WebRequest() {
@@ -31,7 +32,15 @@ public class WebRequest {
* @requestmethod - http request method
*/
public String makeWebServiceCall(String url, int requestmethod) {
addNewLine=false;
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 {
String line;
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = br.readLine()) != null) {
response += line;
response += line + "\n";
}
} else {
response = "";