forked from REAndroid/APKEditor
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to install APK after successfully merging and signing Sort installed app list alphabetically Show icon of apps in the app list
- Loading branch information
1 parent
9a55685
commit 69b8836
Showing
25 changed files
with
1,109 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
773 changes: 773 additions & 0 deletions
773
app/src/main/java/android/support/v4/content/FileProvider.java
Large diffs are not rendered by default.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/AppInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.abdurazaaqmohammed.AntiSplit.main; | ||
|
||
import android.graphics.drawable.Drawable; | ||
|
||
public class AppInfo { | ||
String name; | ||
String packageName; | ||
Drawable icon; | ||
|
||
public AppInfo(String name, Drawable icon, String packageName) { | ||
this.name = name; | ||
this.icon = icon; | ||
this.packageName = packageName; | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/AppListArrayAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package com.abdurazaaqmohammed.AntiSplit.main; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.Filter; | ||
import android.widget.Filterable; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import com.abdurazaaqmohammed.AntiSplit.R; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class AppListArrayAdapter extends ArrayAdapter<AppInfo> implements Filterable { | ||
private final Context context; | ||
private final List<AppInfo> originalAppInfoList; | ||
public List<AppInfo> filteredAppInfoList; | ||
private final int textColor; | ||
private final boolean showIcon; | ||
private AppInfoFilter filter; | ||
|
||
public AppListArrayAdapter(Context context, List<AppInfo> appInfoList, int textColor, boolean showIcon) { | ||
super(context, R.layout.list_item, appInfoList); | ||
this.context = context; | ||
this.originalAppInfoList = new ArrayList<>(appInfoList); | ||
this.filteredAppInfoList = new ArrayList<>(appInfoList); | ||
this.textColor = textColor; | ||
this.showIcon = showIcon; | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return filteredAppInfoList.size(); | ||
} | ||
|
||
@Override | ||
public AppInfo getItem(int position) { | ||
return filteredAppInfoList.get(position); | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
if (convertView == null) { | ||
convertView = LayoutInflater.from(context).inflate(R.layout.list_item, parent, false); | ||
} | ||
|
||
TextView textView = convertView.findViewById(R.id.text_view); | ||
ImageView iconView = convertView.findViewById(R.id.icon_view); | ||
|
||
AppInfo appInfo = getItem(position); | ||
textView.setText(appInfo.name); | ||
textView.setTextColor(textColor); | ||
|
||
if (showIcon) { | ||
iconView.setImageDrawable(appInfo.icon); | ||
iconView.setVisibility(View.VISIBLE); | ||
} else { | ||
iconView.setVisibility(View.GONE); | ||
} | ||
|
||
return convertView; | ||
} | ||
|
||
@Override | ||
public Filter getFilter() { | ||
if (filter == null) { | ||
filter = new AppInfoFilter(); | ||
} | ||
return filter; | ||
} | ||
|
||
private class AppInfoFilter extends Filter { | ||
@Override | ||
protected FilterResults performFiltering(CharSequence constraint) { | ||
FilterResults results = new FilterResults(); | ||
if (constraint == null || constraint.length() == 0) { | ||
results.values = new ArrayList<>(originalAppInfoList); | ||
results.count = originalAppInfoList.size(); | ||
} else { | ||
List<AppInfo> filteredItems = new ArrayList<>(); | ||
String filterPattern = constraint.toString().toLowerCase().trim(); | ||
for (AppInfo appInfo : originalAppInfoList) { | ||
if (appInfo.name.toLowerCase().contains(filterPattern)) { | ||
filteredItems.add(appInfo); | ||
} | ||
} | ||
results.values = filteredItems; | ||
results.count = filteredItems.size(); | ||
} | ||
return results; | ||
} | ||
|
||
@Override | ||
protected void publishResults(CharSequence constraint, FilterResults results) { | ||
filteredAppInfoList.clear(); | ||
filteredAppInfoList.addAll((List<AppInfo>) results.values); | ||
notifyDataSetChanged(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/abdurazaaqmohammed/AntiSplit/main/IconsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.abdurazaaqmohammed.AntiSplit.main; | ||
import static com.aefyr.pseudoapksigner.Base64.DEFAULT; | ||
import static com.aefyr.pseudoapksigner.Base64.encodeToString; | ||
|
||
import android.graphics.Bitmap; | ||
import android.graphics.Canvas; | ||
import android.graphics.drawable.BitmapDrawable; | ||
import android.graphics.drawable.Drawable; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
|
||
public class IconsHelper { | ||
static Bitmap drawableToBitmap(Drawable drawable) { | ||
if (drawable instanceof BitmapDrawable) { | ||
return ((BitmapDrawable) drawable).getBitmap(); | ||
} | ||
Bitmap bitmap = Bitmap.createBitmap( | ||
drawable.getIntrinsicWidth(), | ||
drawable.getIntrinsicHeight(), | ||
Bitmap.Config.ARGB_8888 | ||
); | ||
Canvas canvas = new Canvas(bitmap); | ||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); | ||
drawable.draw(canvas); | ||
return bitmap; | ||
} | ||
|
||
static String bitmapToBase64(Bitmap bitmap) { | ||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | ||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); | ||
byte[] byteArray = byteArrayOutputStream.toByteArray(); | ||
return encodeToString(byteArray, DEFAULT); | ||
} | ||
} |
Oops, something went wrong.