mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-06 22:13:21 +01:00
renamed dialog enum types, added comments
This commit is contained in:
parent
e74e65a876
commit
cb5cf885ac
@ -53,8 +53,8 @@ import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static org.nuclearfog.twidda.activity.MainActivity.RETURN_APP_LOGOUT;
|
||||
import static org.nuclearfog.twidda.activity.MainActivity.RETURN_DB_CLEARED;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.APP_LOG_OUT;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.DEL_DATABASE;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.LOGOUT_APP;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.WRONG_PROXY;
|
||||
|
||||
/**
|
||||
@ -175,7 +175,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
|
||||
connectDialog = DialogBuilder.create(this, WRONG_PROXY, this);
|
||||
databaseDialog = DialogBuilder.create(this, DEL_DATABASE, this);
|
||||
logoutDialog = DialogBuilder.create(this, LOGOUT_APP, this);
|
||||
logoutDialog = DialogBuilder.create(this, APP_LOG_OUT, this);
|
||||
appInfo = DialogBuilder.createInfoDialog(this);
|
||||
|
||||
for (Button btn : colorButtons)
|
||||
@ -246,24 +246,23 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
|
||||
@Override
|
||||
public void onConfirm(DialogBuilder.DialogType type) {
|
||||
switch (type) {
|
||||
case LOGOUT_APP:
|
||||
settings.logout();
|
||||
TwitterEngine.resetTwitter();
|
||||
DatabaseAdapter.deleteDatabase(getApplicationContext());
|
||||
setResult(RETURN_APP_LOGOUT);
|
||||
finish();
|
||||
break;
|
||||
|
||||
case DEL_DATABASE:
|
||||
DatabaseAdapter.deleteDatabase(getApplicationContext());
|
||||
setResult(RETURN_DB_CLEARED);
|
||||
break;
|
||||
|
||||
case WRONG_PROXY:
|
||||
// exit without saving proxy settings
|
||||
finish();
|
||||
break;
|
||||
// confirm log out
|
||||
if (type == APP_LOG_OUT) {
|
||||
settings.logout();
|
||||
TwitterEngine.resetTwitter();
|
||||
DatabaseAdapter.deleteDatabase(getApplicationContext());
|
||||
setResult(RETURN_APP_LOGOUT);
|
||||
finish();
|
||||
}
|
||||
// confirm delete database
|
||||
else if (type == DEL_DATABASE) {
|
||||
DatabaseAdapter.deleteDatabase(getApplicationContext());
|
||||
setResult(RETURN_DB_CLEARED);
|
||||
}
|
||||
// confirm leaving without saving proxy changes
|
||||
else if (type == WRONG_PROXY) {
|
||||
// exit without saving proxy settings
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,16 +254,15 @@ public class ListDetail extends AppCompatActivity implements OnTabSelectedListen
|
||||
|
||||
@Override
|
||||
public void onConfirm(DialogBuilder.DialogType type) {
|
||||
switch (type) {
|
||||
case LIST_DELETE:
|
||||
listLoaderTask = new ListAction(this, DELETE);
|
||||
listLoaderTask.execute(listId);
|
||||
break;
|
||||
|
||||
case LIST_UNFOLLOW:
|
||||
listLoaderTask = new ListAction(this, UNFOLLOW);
|
||||
listLoaderTask.execute(listId);
|
||||
break;
|
||||
// delete user list
|
||||
if (type == LIST_DELETE) {
|
||||
listLoaderTask = new ListAction(this, DELETE);
|
||||
listLoaderTask.execute(listId);
|
||||
}
|
||||
// unfollow user list
|
||||
else if (type == LIST_UNFOLLOW) {
|
||||
listLoaderTask = new ListAction(this, UNFOLLOW);
|
||||
listLoaderTask.execute(listId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ import static org.nuclearfog.twidda.activity.TweetEditor.KEY_TWEETPOPUP_TEXT;
|
||||
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_ID;
|
||||
import static org.nuclearfog.twidda.activity.UserDetail.KEY_USERDETAIL_MODE;
|
||||
import static org.nuclearfog.twidda.activity.UserDetail.USERLIST_RETWEETS;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.DELETE_TWEET;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.TWEET_DELETE;
|
||||
import static org.nuclearfog.twidda.fragment.TweetFragment.INTENT_TWEET_REMOVED_ID;
|
||||
import static org.nuclearfog.twidda.fragment.TweetFragment.INTENT_TWEET_UPDATE_DATA;
|
||||
import static org.nuclearfog.twidda.fragment.TweetFragment.RETURN_TWEET_NOT_FOUND;
|
||||
@ -166,7 +166,7 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
|
||||
retweeter.setCompoundDrawablesWithIntrinsicBounds(R.drawable.retweet, 0, 0, 0);
|
||||
tweetText.setMovementMethod(LinkAndScrollMovement.getInstance());
|
||||
tweetText.setLinkTextColor(settings.getHighlightColor());
|
||||
deleteDialog = DialogBuilder.create(this, DELETE_TWEET, this);
|
||||
deleteDialog = DialogBuilder.create(this, TWEET_DELETE, this);
|
||||
toolbar.setTitle("");
|
||||
setSupportActionBar(toolbar);
|
||||
AppStyles.setTheme(settings, root);
|
||||
@ -385,12 +385,14 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
public void onConfirm(DialogBuilder.DialogType type) {
|
||||
if (type == DELETE_TWEET && tweet != null) {
|
||||
long tweetId = tweet.getId();
|
||||
if (tweet.getEmbeddedTweet() != null)
|
||||
tweetId = tweet.getEmbeddedTweet().getId();
|
||||
statusAsync = new TweetAction(this, tweetId);
|
||||
statusAsync.execute(Action.DELETE);
|
||||
if (type == TWEET_DELETE) {
|
||||
if (tweet != null) {
|
||||
long tweetId = tweet.getId();
|
||||
if (tweet.getEmbeddedTweet() != null)
|
||||
tweetId = tweet.getEmbeddedTweet().getId();
|
||||
statusAsync = new TweetAction(this, tweetId);
|
||||
statusAsync.execute(Action.DELETE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,25 +30,25 @@ public final class DialogBuilder {
|
||||
* types of dialogs, every dialog has its own message and title
|
||||
*/
|
||||
public enum DialogType {
|
||||
DEL_MESSAGE,
|
||||
WRONG_PROXY,
|
||||
DEL_DATABASE,
|
||||
LOGOUT_APP,
|
||||
LIST_EDITOR_LEAVE,
|
||||
LIST_EDITOR_ERROR,
|
||||
APP_LOG_OUT,
|
||||
TWEET_DELETE,
|
||||
TWEET_EDITOR_LEAVE,
|
||||
TWEET_EDITOR_ERROR,
|
||||
MESSAGE_DELETE,
|
||||
MESSAGE_EDITOR_LEAVE,
|
||||
MESSAGE_EDITOR_ERROR,
|
||||
PROFILE_EDITOR_LEAVE,
|
||||
PROFILE_EDITOR_ERROR,
|
||||
DELETE_TWEET,
|
||||
PROFILE_UNFOLLOW,
|
||||
PROFILE_BLOCK,
|
||||
PROFILE_MUTE,
|
||||
DEL_USER_LIST,
|
||||
LIST_REMOVE_USER,
|
||||
LIST_UNFOLLOW,
|
||||
LIST_DELETE
|
||||
LIST_DELETE,
|
||||
LIST_EDITOR_LEAVE,
|
||||
LIST_EDITOR_ERROR
|
||||
}
|
||||
|
||||
private DialogBuilder() {
|
||||
@ -69,7 +69,7 @@ public final class DialogBuilder {
|
||||
int message = 0;
|
||||
|
||||
switch (type) {
|
||||
case DEL_MESSAGE:
|
||||
case MESSAGE_DELETE:
|
||||
message = R.string.confirm_delete_message;
|
||||
break;
|
||||
|
||||
@ -84,7 +84,7 @@ public final class DialogBuilder {
|
||||
message = R.string.confirm_delete_database;
|
||||
break;
|
||||
|
||||
case LOGOUT_APP:
|
||||
case APP_LOG_OUT:
|
||||
message = R.string.confirm_log_lout;
|
||||
break;
|
||||
|
||||
@ -110,7 +110,7 @@ public final class DialogBuilder {
|
||||
message = R.string.confirm_cancel_message;
|
||||
break;
|
||||
|
||||
case DELETE_TWEET:
|
||||
case TWEET_DELETE:
|
||||
message = R.string.confirm_delete_tweet;
|
||||
break;
|
||||
|
||||
@ -126,7 +126,7 @@ public final class DialogBuilder {
|
||||
message = R.string.confirm_mute;
|
||||
break;
|
||||
|
||||
case DEL_USER_LIST:
|
||||
case LIST_REMOVE_USER:
|
||||
message = R.string.confirm_remove_user_from_list;
|
||||
posButton = R.string.dialog_button_ok;
|
||||
negButton = R.string.dialog_button_cancel;
|
||||
@ -220,6 +220,9 @@ public final class DialogBuilder {
|
||||
*/
|
||||
public interface OnProgressStopListener {
|
||||
|
||||
/**
|
||||
* called when the progress stop button was clicked
|
||||
*/
|
||||
void stopProgress();
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@ import static org.nuclearfog.twidda.activity.TweetActivity.KEY_TWEET_ID;
|
||||
import static org.nuclearfog.twidda.activity.TweetActivity.KEY_TWEET_NAME;
|
||||
import static org.nuclearfog.twidda.activity.TweetActivity.LINK_PATTERN;
|
||||
import static org.nuclearfog.twidda.activity.UserProfile.KEY_PROFILE_DATA;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.DEL_MESSAGE;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.MESSAGE_DELETE;
|
||||
|
||||
/**
|
||||
* Fragment class for direct message lists
|
||||
@ -50,7 +50,7 @@ public class MessageFragment extends ListFragment implements OnItemSelected, OnD
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
deleteDialog = DialogBuilder.create(requireContext(), DEL_MESSAGE, this);
|
||||
deleteDialog = DialogBuilder.create(requireContext(), MESSAGE_DELETE, this);
|
||||
}
|
||||
|
||||
|
||||
@ -162,8 +162,10 @@ public class MessageFragment extends ListFragment implements OnItemSelected, OnD
|
||||
|
||||
@Override
|
||||
public void onConfirm(DialogBuilder.DialogType type) {
|
||||
messageTask = new MessageLoader(this, MessageLoader.Action.DEL, null);
|
||||
messageTask.execute(deleteId);
|
||||
if (type == MESSAGE_DELETE) {
|
||||
messageTask = new MessageLoader(this, MessageLoader.Action.DEL, null);
|
||||
messageTask.execute(deleteId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ import static android.os.AsyncTask.Status.RUNNING;
|
||||
import static org.nuclearfog.twidda.activity.UserProfile.KEY_PROFILE_DATA;
|
||||
import static org.nuclearfog.twidda.backend.ListManager.Action.DEL_USER;
|
||||
import static org.nuclearfog.twidda.backend.UserLoader.NO_CURSOR;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.DEL_USER_LIST;
|
||||
import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.LIST_REMOVE_USER;
|
||||
|
||||
/**
|
||||
* Fragment class for lists a list of users
|
||||
@ -129,7 +129,7 @@ public class UserFragment extends ListFragment implements UserClickListener,
|
||||
search = param.getString(KEY_FRAG_USER_SEARCH, "");
|
||||
delUser = param.getBoolean(KEY_FRAG_DEL_USER, false);
|
||||
}
|
||||
deleteDialog = DialogBuilder.create(requireContext(), DEL_USER_LIST, this);
|
||||
deleteDialog = DialogBuilder.create(requireContext(), LIST_REMOVE_USER, this);
|
||||
}
|
||||
|
||||
|
||||
@ -217,7 +217,7 @@ public class UserFragment extends ListFragment implements UserClickListener,
|
||||
|
||||
@Override
|
||||
public void onConfirm(DialogBuilder.DialogType type) {
|
||||
if (type == DEL_USER_LIST) {
|
||||
if (type == LIST_REMOVE_USER) {
|
||||
if (listTask == null || listTask.getStatus() != RUNNING) {
|
||||
listTask = new ListManager(id, DEL_USER, requireContext(), this);
|
||||
listTask.execute(deleteUserName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user