This commit is contained in:
nuclearfog 2020-11-11 11:55:12 +01:00
parent 5b4edbf944
commit 41a038dc5b
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14

View File

@ -88,6 +88,7 @@ public class ListDetail extends AppCompatActivity implements OnTabSelectedListen
private Dialog unfollowDialog, deleteDialog; private Dialog unfollowDialog, deleteDialog;
private TwitterList twitterList; private TwitterList twitterList;
private long listId;
@Override @Override
protected void onCreate(@Nullable Bundle b) { protected void onCreate(@Nullable Bundle b) {
@ -112,7 +113,7 @@ public class ListDetail extends AppCompatActivity implements OnTabSelectedListen
Bundle param = getIntent().getExtras(); Bundle param = getIntent().getExtras();
if (param != null) { if (param != null) {
long listId = param.getLong(KEY_LISTDETAIL_ID); listId = param.getLong(KEY_LISTDETAIL_ID);
boolean currentUserOwnsList = param.getBoolean(KEY_CURRENT_USER_OWNS, false); boolean currentUserOwnsList = param.getBoolean(KEY_CURRENT_USER_OWNS, false);
adapter.setupListContentPage(listId, currentUserOwnsList); adapter.setupListContentPage(listId, currentUserOwnsList);
Tab tweetTab = tablayout.getTabAt(0); Tab tweetTab = tablayout.getTabAt(0);
@ -265,19 +266,15 @@ public class ListDetail extends AppCompatActivity implements OnTabSelectedListen
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
Bundle param = getIntent().getExtras(); if (USERNAME_PATTERN.matcher(query).matches()) {
if (param != null) { if (userListManager == null || userListManager.getStatus() != RUNNING) {
if (USERNAME_PATTERN.matcher(query).matches()) { Toast.makeText(this, R.string.info_adding_user_to_list, Toast.LENGTH_SHORT).show();
if (userListManager == null || userListManager.getStatus() != RUNNING) { userListManager = new UserListManager(listId, ADD_USER, this, this);
Toast.makeText(this, R.string.info_adding_user_to_list, Toast.LENGTH_SHORT).show(); userListManager.execute(query);
long listId = param.getLong(KEY_LISTDETAIL_ID); return true;
userListManager = new UserListManager(listId, ADD_USER, this, this);
userListManager.execute(query);
return true;
}
} else {
Toast.makeText(this, R.string.error_username_format, Toast.LENGTH_SHORT).show();
} }
} else {
Toast.makeText(this, R.string.error_username_format, Toast.LENGTH_SHORT).show();
} }
return false; return false;
} }
@ -341,6 +338,11 @@ public class ListDetail extends AppCompatActivity implements OnTabSelectedListen
public void onFailure(EngineException err) { public void onFailure(EngineException err) {
ErrorHandler.handleFailure(this, err); ErrorHandler.handleFailure(this, err);
if (twitterList == null) { if (twitterList == null) {
if (err.resourceNotFound()) {
Intent result = new Intent();
result.putExtra(RESULT_REMOVED_LIST_ID, listId);
setResult(RETURN_LIST_REMOVED, result);
}
finish(); finish();
} }
} }