-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cc6e71
commit 5282345
Showing
73 changed files
with
3,515 additions
and
96 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
Binary file modified
BIN
+1.11 KB
(100%)
app_pojavlauncher/src/main/assets/components/forge_installer/forge_installer.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
app_pojavlauncher/src/main/assets/components/forge_installer/version
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 |
---|---|---|
@@ -1 +1 @@ | ||
1688133008591 | ||
1692525087345 |
67 changes: 67 additions & 0 deletions
67
app_pojavlauncher/src/main/java/com/kdt/SimpleArrayAdapter.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,67 @@ | ||
package com.kdt; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.BaseAdapter; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* Basic adapter, expect it uses the what is passed by the code, no the resources | ||
* @param <T> | ||
*/ | ||
public class SimpleArrayAdapter<T> extends BaseAdapter { | ||
private List<T> mObjects; | ||
public SimpleArrayAdapter(List<T> objects) { | ||
setObjects(objects); | ||
} | ||
|
||
public void setObjects(@Nullable List<T> objects) { | ||
if(objects == null){ | ||
if(mObjects != Collections.emptyList()) { | ||
mObjects = Collections.emptyList(); | ||
notifyDataSetChanged(); | ||
} | ||
} else { | ||
if(objects != mObjects){ | ||
mObjects = objects; | ||
notifyDataSetChanged(); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return mObjects.size(); | ||
} | ||
|
||
@Override | ||
public T getItem(int position) { | ||
return mObjects.get(position); | ||
} | ||
|
||
@Override | ||
public long getItemId(int position) { | ||
return position; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { | ||
if(convertView == null){ | ||
convertView = LayoutInflater.from(parent.getContext()).inflate(android.R.layout.simple_list_item_1, parent, false); | ||
} | ||
|
||
TextView v = (TextView) convertView; | ||
v.setText(mObjects.get(position).toString()); | ||
return v; | ||
} | ||
} |
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
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
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
75 changes: 75 additions & 0 deletions
75
app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/ShowErrorActivity.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,75 @@ | ||
package net.kdt.pojavlaunch; | ||
|
||
import android.app.Activity; | ||
import android.app.NotificationManager; | ||
import android.app.PendingIntent; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.core.app.NotificationCompat; | ||
|
||
import net.kdt.pojavlaunch.contextexecutor.ContextExecutorTask; | ||
import net.kdt.pojavlaunch.value.NotificationConstants; | ||
|
||
import java.io.Serializable; | ||
|
||
public class ShowErrorActivity extends Activity { | ||
|
||
private static final String ERROR_ACTIVITY_REMOTE_TASK = "remoteTask"; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
Intent intent = getIntent(); | ||
if(intent == null) { | ||
finish(); | ||
return; | ||
} | ||
RemoteErrorTask remoteErrorTask = (RemoteErrorTask) intent.getSerializableExtra(ERROR_ACTIVITY_REMOTE_TASK); | ||
if(remoteErrorTask == null) { | ||
finish(); | ||
return; | ||
} | ||
remoteErrorTask.executeWithActivity(this); | ||
} | ||
|
||
|
||
public static class RemoteErrorTask implements ContextExecutorTask, Serializable { | ||
private final Throwable mThrowable; | ||
private final String mRolledMsg; | ||
|
||
public RemoteErrorTask(Throwable mThrowable, String mRolledMsg) { | ||
this.mThrowable = mThrowable; | ||
this.mRolledMsg = mRolledMsg; | ||
} | ||
@Override | ||
public void executeWithActivity(Activity activity) { | ||
Tools.showError(activity, mRolledMsg, mThrowable); | ||
} | ||
|
||
@Override | ||
public void executeWithApplication(Context context) { | ||
sendNotification(context, this); | ||
} | ||
} | ||
private static void sendNotification(Context context, RemoteErrorTask remoteErrorTask) { | ||
|
||
Intent showErrorIntent = new Intent(context, ShowErrorActivity.class); | ||
showErrorIntent.putExtra(ERROR_ACTIVITY_REMOTE_TASK, remoteErrorTask); | ||
|
||
PendingIntent pendingIntent = PendingIntent.getActivity(context, NotificationConstants.PENDINGINTENT_CODE_SHOW_ERROR, showErrorIntent, | ||
Build.VERSION.SDK_INT >=23 ? PendingIntent.FLAG_IMMUTABLE : 0); | ||
|
||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); | ||
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, context.getString(R.string.notif_channel_id)) | ||
.setContentTitle(context.getString(R.string.notif_error_occured)) | ||
.setContentText(context.getString(R.string.notif_error_occured_desc)) | ||
.setSmallIcon(R.drawable.notif_icon) | ||
.setContentIntent(pendingIntent); | ||
notificationManager.notify(NotificationConstants.NOTIFICATION_ID_SHOW_ERROR, notificationBuilder.build()); | ||
} | ||
|
||
} |
Oops, something went wrong.