Merge pull request #6613 from thundernest/remove_unused_code

Remove unused code/resources
This commit is contained in:
cketti 2023-02-01 14:24:03 +01:00 committed by GitHub
commit 550b2844cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 0 additions and 234 deletions

View file

@ -1,5 +0,0 @@
package com.fsck.k9
fun interface SettingsChangeListener {
fun onSettingsChanged()
}

View file

@ -21,7 +21,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Process;
import android.os.SystemClock;
@ -131,7 +130,6 @@ public class MessagingController {
private final NotificationOperations notificationOperations;
private MessagingListener checkMailListener = null;
private volatile boolean stopped = false;
@ -1182,16 +1180,6 @@ public class MessagingController {
}
}
public void clearAllPending(final Account account) {
try {
Timber.w("Clearing pending commands!");
LocalStore localStore = localStoreProvider.getInstance(account);
localStore.removePendingCommands();
} catch (MessagingException me) {
Timber.e(me, "Unable to clear pending command");
}
}
public void loadMessageRemotePartial(Account account, long folderId, String uid, MessagingListener listener) {
put("loadMessageRemotePartial", listener, () ->
loadMessageRemoteSynchronous(account, folderId, uid, listener, true)
@ -1977,35 +1965,6 @@ public class MessagingController {
});
}
@SuppressLint("NewApi") // used for debugging only
public void debugClearMessagesLocally(final List<MessageReference> messages) {
if (!K9.DEVELOPER_MODE) {
throw new AssertionError("method must only be used in developer mode!");
}
actOnMessagesGroupedByAccountAndFolder(messages, new MessageActor() {
@Override
public void act(final Account account, final LocalFolder messageFolder,
final List<LocalMessage> accountMessages) {
putBackground("debugClearLocalMessages", null, new Runnable() {
@Override
public void run() {
for (LocalMessage message : accountMessages) {
try {
message.debugClearLocalData();
} catch (MessagingException e) {
throw new AssertionError("clearing local message content failed!", e);
}
}
}
});
}
});
}
private void deleteMessagesSynchronous(Account account, long folderId, List<LocalMessage> messages, boolean skipTrashFolder) {
try {
List<LocalMessage> localOnlyMessages = new ArrayList<>();
@ -2492,20 +2451,6 @@ public class MessagingController {
}
}
public MessagingListener getCheckMailListener() {
return checkMailListener;
}
public void setCheckMailListener(MessagingListener checkMailListener) {
if (this.checkMailListener != null) {
removeListener(this.checkMailListener);
}
this.checkMailListener = checkMailListener;
if (this.checkMailListener != null) {
addListener(this.checkMailListener);
}
}
public void clearNotifications(LocalSearch search) {
put("clearNotifications", null, () -> {
notificationOperations.clearNotifications(search);

View file

@ -324,10 +324,6 @@ public class LockableDatabase {
delete(false);
}
public void recreate() {
delete(true);
}
/**
* @param recreate
* <code>true</code> if the DB should be recreated after delete

View file

@ -1,23 +0,0 @@
package com.fsck.k9.mailstore
import android.database.Cursor
internal fun <T> LockableDatabase.query(
table: String,
columns: Array<String>,
selection: String?,
vararg selectionArgs: String,
block: (Cursor) -> T
): T {
return execute(false) { db ->
val cursor = db.query(table, columns, selection, selectionArgs, null, null, null)
cursor.use(block)
}
}
internal fun <T> LockableDatabase.rawQuery(sql: String, vararg selectionArgs: String, block: (Cursor) -> T): T {
return execute(false) { db ->
val cursor = db.rawQuery(sql, selectionArgs)
cursor.use(block)
}
}

View file

@ -49,15 +49,4 @@ object HtmlConverter {
fun textToHtmlFragment(text: String): String {
return TextToHtml.toHtmlFragment(text, retainOriginalWhitespace = false)
}
/**
* Convert a plain text string into an HTML fragment.
*
* This does not convert consecutive spaces to a series of non-breaking spaces followed by a regular space.
* Only use this in combination with CSS to properly display the whitespace.
*/
@JvmStatic
fun textToHtmlFragmentWithOriginalWhitespace(text: String): String {
return TextToHtml.toHtmlFragment(text, retainOriginalWhitespace = true)
}
}

View file

@ -31,8 +31,6 @@ interface NotificationResourceProvider {
fun certificateErrorTitle(accountName: String): String
fun certificateErrorBody(): String
fun newMailTitle(): String
fun newMailUnreadMessageCount(unreadMessageCount: Int, accountName: String): String
fun newMessagesTitle(newMessagesCount: Int): String
fun additionalMessages(overflowMessagesCount: Int, accountName: String): String
fun previewEncrypted(): String

View file

@ -41,11 +41,6 @@ class TestNotificationResourceProvider : NotificationResourceProvider {
override fun certificateErrorBody(): String = "Check your server settings"
override fun newMailTitle(): String = "New mail"
override fun newMailUnreadMessageCount(unreadMessageCount: Int, accountName: String): String =
"$unreadMessageCount Unread ($accountName)"
override fun newMessagesTitle(newMessagesCount: Int): String = when (newMessagesCount) {
1 -> "1 new message"
else -> "$newMessagesCount new messages"

View file

@ -47,11 +47,6 @@ class K9NotificationResourceProvider(private val context: Context) : Notificatio
override fun certificateErrorBody(): String = context.getString(R.string.notification_certificate_error_text)
override fun newMailTitle(): String = context.getString(R.string.notification_new_title)
override fun newMailUnreadMessageCount(unreadMessageCount: Int, accountName: String): String =
context.getString(R.string.notification_new_one_account_fmt, unreadMessageCount, accountName)
override fun newMessagesTitle(newMessagesCount: Int): String =
context.resources.getQuantityString(
R.plurals.notification_new_messages_title,

View file

@ -1,38 +0,0 @@
package com.fsck.k9.activity.misc;
import android.app.Activity;
public interface NonConfigurationInstance {
/**
* Decide whether to retain this {@code NonConfigurationInstance} and clean up resources if
* necessary.
*
* <p>
* This needs to be called when the current activity is being destroyed during an activity
* restart due to a configuration change.<br>
* Implementations should make sure that references to the {@code Activity} instance that is
* about to be destroyed are cleared to avoid memory leaks. This includes all UI elements that
* are bound to an activity (e.g. dialogs). They can be re-created in
* {@link #restore(Activity)}.
* </p>
*
* @return {@code true} if this instance should be retained; {@code false} otherwise.
*
* @see Activity#onRetainNonConfigurationInstance()
*/
boolean retain();
/**
* Connect this retained {@code NonConfigurationInstance} to the new {@link Activity} instance
* after the activity was restarted due to a configuration change.
*
* <p>
* This also creates a new progress dialog that is bound to the new activity.
* </p>
*
* @param activity
* The new {@code Activity} instance. Never {@code null}.
*/
void restore(Activity activity);
}

View file

@ -90,21 +90,6 @@ public class ContactBadge extends CircleImageView implements OnClickListener {
onContactUriChanged();
}
/**
* Assign a contact based on an email address. This should only be used when
* the contact's URI is not available, as an extra query will have to be
* performed to lookup the URI based on the email.
*
* @param emailAddress
* The email address of the contact.
* @param lazyLookup
* If this is true, the lookup query will not be performed
* until this view is clicked.
*/
public void assignContactFromEmail(String emailAddress, boolean lazyLookup) {
assignContactFromEmail(emailAddress, lazyLookup, null);
}
/**
* Assign a contact based on an email address. This should only be used when
* the contact's URI is not available, as an extra query will have to be

View file

@ -4,7 +4,6 @@ import android.content.res.Resources
import android.util.TypedValue
import com.fsck.k9.mailstore.FolderType
import com.fsck.k9.ui.R
import com.fsck.k9.mail.FolderType as LegacyFolderType
class FolderIconProvider(private val theme: Resources.Theme) {
private val iconFolderInboxResId: Int
@ -46,15 +45,4 @@ class FolderIconProvider(private val theme: Resources.Theme) {
FolderType.SPAM -> iconFolderSpamResId
else -> iconFolderResId
}
fun getFolderIcon(type: LegacyFolderType): Int = when (type) {
LegacyFolderType.INBOX -> iconFolderInboxResId
LegacyFolderType.OUTBOX -> iconFolderOutboxResId
LegacyFolderType.SENT -> iconFolderSentResId
LegacyFolderType.TRASH -> iconFolderTrashResId
LegacyFolderType.DRAFTS -> iconFolderDraftsResId
LegacyFolderType.ARCHIVE -> iconFolderArchiveResId
LegacyFolderType.SPAM -> iconFolderSpamResId
else -> iconFolderResId
}
}

View file

@ -1,7 +1,6 @@
package com.fsck.k9.ui.settings
import androidx.preference.ListPreference
import androidx.preference.MultiSelectListPreference
import androidx.preference.Preference
inline fun Preference.onClick(crossinline action: () -> Unit) = setOnPreferenceClickListener {
@ -17,12 +16,6 @@ fun ListPreference.removeEntry(entryValue: String) {
entryValues = entryValues.filterIndexed { index, _ -> index != deleteIndex }.toTypedArray()
}
fun MultiSelectListPreference.removeEntry(entryValue: String) {
val deleteIndex = entryValues.indexOf(entryValue)
entries = entries.filterIndexed { index, _ -> index != deleteIndex }.toTypedArray()
entryValues = entryValues.filterIndexed { index, _ -> index != deleteIndex }.toTypedArray()
}
inline fun Preference.oneTimeClickListener(clickHandled: Boolean = true, crossinline block: () -> Unit) {
onPreferenceClickListener = Preference.OnPreferenceClickListener { preference ->
preference.onPreferenceClickListener = null

View file

@ -184,10 +184,6 @@ public class RecipientSelectView extends TokenCompleteTextView<Recipient> implem
return new Recipient(parsedAddresses[0]);
}
public boolean isEmpty() {
return getObjects().isEmpty();
}
public void setLoaderManager(@Nullable LoaderManager loaderManager) {
this.loaderManager = loaderManager;
}

View file

@ -31,7 +31,6 @@ import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.widget.ViewAnimator;
import com.fsck.k9.ui.R;
@ -82,23 +81,6 @@ public class ToolableViewAnimator extends ViewAnimator {
}
}
public void setDisplayedChild(int whichChild, boolean animate) {
if (animate) {
setDisplayedChild(whichChild);
return;
}
Animation savedInAnim = getInAnimation();
Animation savedOutAnim = getOutAnimation();
setInAnimation(null);
setOutAnimation(null);
setDisplayedChild(whichChild);
setInAnimation(savedInAnim);
setOutAnimation(savedOutAnim);
}
public void setDisplayedChildId(int id) {
if (getDisplayedChildId() == id) {
return;

View file

@ -96,7 +96,6 @@ Please submit bug reports, contribute new features and ask questions at
<string name="actionbar_selected"><xliff:g id="selection_count">%d</xliff:g> selected</string>
<string name="next_action">Next</string>
<string name="previous_action">Previous</string>
<!-- Used to confirm acceptance of dialog boxes, warnings, errors, etc. -->
<string name="okay_action">OK</string>
<string name="cancel_action">Cancel</string>
@ -177,12 +176,10 @@ Please submit bug reports, contribute new features and ask questions at
<string name="size_format_kilobytes">%.1f kB</string>
<string name="size_format_bytes">%d B</string>
<string name="notification_new_title">New mail</string>
<plurals name="notification_new_messages_title">
<item quantity="one"><xliff:g id="new_message_count">%d</xliff:g> new message</item>
<item quantity="other"><xliff:g id="new_message_count">%d</xliff:g> new messages</item>
</plurals>
<string name="notification_new_one_account_fmt"><xliff:g id="unread_message_count">%1$d</xliff:g> Unread (<xliff:g id="account">%2$s</xliff:g>)</string>
<string name="notification_additional_messages">+ <xliff:g id="additional_messages">%1$d</xliff:g> more on <xliff:g id="account">%2$s</xliff:g></string>
<string name="notification_action_reply">Reply</string>
@ -270,7 +267,6 @@ Please submit bug reports, contribute new features and ask questions at
<string name="message_view_sender_label">via %1$s</string>
<string name="from_same_sender">More from this sender</string>
<string name="search_from_format">From <xliff:g id="sender">%s</xliff:g></string>
<string name="message_discarded_toast">Message discarded</string>
<string name="message_saved_toast">Message saved as draft</string>

View file

@ -232,21 +232,6 @@ public class MessageExtractor {
return getParts(viewableParts);
}
/**
* Collect attachment parts of a message.
* @return A list of parts regarded as attachments.
* @throws MessagingException In case of an error.
*/
public static List<Part> collectAttachments(Message message) throws MessagingException {
try {
List<Part> attachments = new ArrayList<>();
findViewablesAndAttachments(message, new ArrayList<>(), attachments);
return attachments;
} catch (Exception e) {
throw new MessagingException("Couldn't collect attachment parts", e);
}
}
/**
* Collect the viewable textual parts of a message.
* @return A set of viewable parts of the message.

View file

@ -1,11 +0,0 @@
package com.fsck.k9.mail.oauth;
public class AuthorizationException extends Exception {
public AuthorizationException(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
}
public AuthorizationException(String detailMessage) {
super(detailMessage);
}
}