mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-04-06 07:00:01 +03:00
Edit scheduled threads
This commit is contained in:
parent
7d9d2346cc
commit
7e78b5da6e
3 changed files with 12 additions and 7 deletions
|
@ -35,7 +35,6 @@ import android.os.Looper;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -685,13 +684,13 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
}
|
}
|
||||||
if (statusReply.spoiler_text != null) {
|
if (statusReply.spoiler_text != null) {
|
||||||
statusDraftList.get(0).spoiler_text = statusReply.spoiler_text;
|
statusDraftList.get(0).spoiler_text = statusReply.spoiler_text;
|
||||||
if (statusReply.spoiler_text.trim().length() > 0) {
|
if (!statusReply.spoiler_text.trim().isEmpty()) {
|
||||||
statusDraftList.get(0).spoilerChecked = true;
|
statusDraftList.get(0).spoilerChecked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statusReply.language != null && !statusReply.language.isEmpty()) {
|
if (statusReply.language != null && !statusReply.language.isEmpty()) {
|
||||||
Set<String> storedLanguages = sharedpreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null);
|
Set<String> storedLanguages = sharedpreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null);
|
||||||
if (storedLanguages == null || storedLanguages.size() == 0) {
|
if (storedLanguages == null || storedLanguages.isEmpty()) {
|
||||||
statusDraftList.get(0).language = statusReply.language;
|
statusDraftList.get(0).language = statusReply.language;
|
||||||
} else {
|
} else {
|
||||||
if (storedLanguages.contains(statusReply.language)) {
|
if (storedLanguages.contains(statusReply.language)) {
|
||||||
|
@ -851,6 +850,9 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
if(scheduledStatus != null && scheduledStatus.scheduled_at != null) {
|
if(scheduledStatus != null && scheduledStatus.scheduled_at != null) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(Helper.SCHEDULE_DATE_FORMAT, Locale.getDefault());
|
SimpleDateFormat sdf = new SimpleDateFormat(Helper.SCHEDULE_DATE_FORMAT, Locale.getDefault());
|
||||||
scheduledDate = sdf.format(scheduledStatus.scheduled_at.getTime());
|
scheduledDate = sdf.format(scheduledStatus.scheduled_at.getTime());
|
||||||
|
} else if(statusDraft != null && statusDraft.scheduled_at != null) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(Helper.SCHEDULE_DATE_FORMAT, Locale.getDefault());
|
||||||
|
scheduledDate = sdf.format(statusDraft.scheduled_at.getTime());
|
||||||
}
|
}
|
||||||
storeDraft(sendMessage, scheduledDate);
|
storeDraft(sendMessage, scheduledDate);
|
||||||
}
|
}
|
||||||
|
@ -874,7 +876,12 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
} else {
|
} else {
|
||||||
//Draft previously and date is changed
|
//Draft previously and date is changed
|
||||||
if (statusDraft.scheduled_at != null && scheduledDate != null && statusDraft.workerUuid != null) {
|
if (statusDraft.scheduled_at != null && scheduledDate != null && statusDraft.workerUuid != null) {
|
||||||
|
try {
|
||||||
|
new StatusDraft(ComposeActivity.this).removeScheduled(statusDraft);
|
||||||
WorkManager.getInstance(ComposeActivity.this).cancelWorkById(statusDraft.workerUuid);
|
WorkManager.getInstance(ComposeActivity.this).cancelWorkById(statusDraft.workerUuid);
|
||||||
|
} catch (DBException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!statusReplies.isEmpty()) {
|
if (!statusReplies.isEmpty()) {
|
||||||
|
@ -903,7 +910,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
materialAlertDialogBuilder.setPositiveButton(R.string.send_anyway, (dialog, id) -> {
|
materialAlertDialogBuilder.setPositiveButton(R.string.send_anyway, (dialog, id) -> {
|
||||||
sendMessage(true, scheduledDate);
|
sendMessage(true, scheduledDate);
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
||||||
});
|
});
|
||||||
materialAlertDialogBuilder.setNegativeButton(R.string.add_description, (dialog, id) -> {
|
materialAlertDialogBuilder.setNegativeButton(R.string.add_description, (dialog, id) -> {
|
||||||
composeAdapter.openMissingDescription();
|
composeAdapter.openMissingDescription();
|
||||||
|
|
|
@ -25,7 +25,6 @@ import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static app.fedilab.android.mastodon.helper.Helper.TAG;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.lifecycle.AndroidViewModel;
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
|
|
Loading…
Reference in a new issue