Skip to content

Commit

Permalink
Update EmbedOptions.java
Browse files Browse the repository at this point in the history
  • Loading branch information
areteruhiro authored Nov 20, 2024
1 parent f5d24c2 commit b43bf4a
Showing 1 changed file with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ public void onClick(View v) {
}
}
});

Button MuteGroups_Button = new Button(context);
MuteGroups_Button.setLayoutParams(buttonParams);
MuteGroups_Button.setText("通知を無効にしているグループ");
MuteGroups_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MuteGroups_Button(context);
}
});

layout.addView(MuteGroups_Button);



buttonLayout.addView(pasteButton);

Expand All @@ -160,6 +174,8 @@ public void onClick(View v) {

builder.setView(scrollView);



builder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Expand Down Expand Up @@ -394,4 +410,64 @@ public void onClick(View view) {
}
);
}

private void MuteGroups_Button(Context context) {

File dir = context.getFilesDir();
File file = new File(dir, "Notification.txt");

StringBuilder fileContent = new StringBuilder();
if (file.exists()) {
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
while ((line = reader.readLine()) != null) {
fileContent.append(line).append("\n");
}
} catch (IOException e) {
XposedBridge.log("Error reading the file: " + e.getMessage());
}
}

final EditText editText = new EditText(context);
editText.setText(fileContent.toString());
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
editText.setMinLines(10);
editText.setGravity(Gravity.TOP);


LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
buttonParams.setMargins(16, 16, 16, 16);


Button saveButton = new Button(context);
saveButton.setText("Save");
saveButton.setLayoutParams(buttonParams);
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
writer.write(editText.getText().toString());
XposedBridge.log("File saved successfully.");
} catch (IOException e) {
XposedBridge.log("Error saving the file: " + e.getMessage());
}
}
});


LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(editText);
layout.addView(saveButton);


AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("通知を無効にしているグループ");
builder.setView(layout);
builder.setNegativeButton("キャンセル", null);
builder.show();
}

}

0 comments on commit b43bf4a

Please sign in to comment.