Lambda
This commit is contained in:
parent
7bd52ca212
commit
a9bccdeadd
|
@ -16,7 +16,6 @@ package app.fedilab.android.activities;
|
|||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
|
@ -63,6 +62,8 @@ import com.bumptech.glide.request.transition.Transition;
|
|||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -231,30 +232,17 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
account_note = findViewById(R.id.account_note);
|
||||
|
||||
|
||||
header_edit_profile.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
header_edit_profile.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(ShowAccountActivity.this, EditProfileActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
final ImageView account_menu = findViewById(R.id.account_menu);
|
||||
ImageView action_more = findViewById(R.id.action_more);
|
||||
ImageView reload_tabs = findViewById(R.id.reload_tabs);
|
||||
ImageView action_back = findViewById(R.id.action_back);
|
||||
account_menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showMenu(account_menu);
|
||||
}
|
||||
});
|
||||
action_more.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showMenu(account_menu);
|
||||
}
|
||||
});
|
||||
account_menu.setOnClickListener(v -> showMenu(account_menu));
|
||||
action_more.setOnClickListener(v -> showMenu(account_menu));
|
||||
reload_tabs.setOnClickListener(view -> {
|
||||
|
||||
if (mPager != null && mPager
|
||||
|
@ -285,12 +273,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
}
|
||||
});
|
||||
action_back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
action_back.setOnClickListener(v -> finish());
|
||||
if (account != null) {
|
||||
ManageAccount();
|
||||
}
|
||||
|
@ -381,13 +364,10 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(ShowAccountActivity.this, R.color.cyanea_accent_reference)), 0, content.length(),
|
||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
warning_message.setText(content);
|
||||
warning_message.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
warning_message.setOnClickListener(view -> {
|
||||
if (!accountUrl.toLowerCase().startsWith("http://") && !accountUrl.toLowerCase().startsWith("https://"))
|
||||
accountUrl = "http://" + accountUrl;
|
||||
Helper.openBrowser(ShowAccountActivity.this, accountUrl);
|
||||
}
|
||||
});
|
||||
//Timed muted account
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
|
@ -403,14 +383,11 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
SpannableString content_temp_mute = new SpannableString(getString(R.string.timed_mute_profile, account.getAcct(), date_mute));
|
||||
content_temp_mute.setSpan(new UnderlineSpan(), 0, content_temp_mute.length(), 0);
|
||||
temp_mute.setText(content_temp_mute);
|
||||
temp_mute.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
temp_mute.setOnClickListener(view -> {
|
||||
new TempMuteDAO(getApplicationContext(), db).remove(authenticatedAccount, accountId);
|
||||
mutedAccount.remove(accountId);
|
||||
Toasty.success(getApplicationContext(), getString(R.string.toast_unmute), Toast.LENGTH_LONG).show();
|
||||
temp_mute.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -433,9 +410,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
warning_message.setVisibility(View.VISIBLE);
|
||||
else
|
||||
warning_message.setVisibility(View.GONE);
|
||||
appBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
||||
appBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
||||
LinearLayout toolbarContent = findViewById(R.id.toolbar_content);
|
||||
if (toolbarContent != null) {
|
||||
if (Math.abs(verticalOffset) - appBar.getTotalScrollRange() == 0) {
|
||||
|
@ -470,7 +445,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
else
|
||||
warning_message.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mPager = findViewById(R.id.account_viewpager);
|
||||
if (!peertubeAccount) {
|
||||
|
@ -599,18 +573,12 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
valueView = findViewById(R.id.value3);
|
||||
verifiedView = findViewById(R.id.value3BG);
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
field = findViewById(R.id.field4);
|
||||
labelView = findViewById(R.id.label4);
|
||||
valueView = findViewById(R.id.value4);
|
||||
verifiedView = findViewById(R.id.value4BG);
|
||||
break;
|
||||
default:
|
||||
field = findViewById(R.id.field1);
|
||||
labelView = findViewById(R.id.label1);
|
||||
valueView = findViewById(R.id.value1);
|
||||
verifiedView = findViewById(R.id.value1BG);
|
||||
break;
|
||||
}
|
||||
if (field != null && labelView != null && valueView != null) {
|
||||
field.setVisibility(View.VISIBLE);
|
||||
|
@ -627,9 +595,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
if (!ischannel || account.getAcct().split("-").length < 4) {
|
||||
account_un.setText(String.format("@%s", account.getAcct()));
|
||||
account_un.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
account_un.setOnLongClickListener(v -> {
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
String account_id = account.getAcct();
|
||||
if (account_id.split("@").length == 1)
|
||||
|
@ -639,7 +605,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
assert clipboard != null;
|
||||
clipboard.setPrimaryClip(clip);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
account_un.setVisibility(View.GONE);
|
||||
|
@ -660,9 +625,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
|
||||
//Allows to filter by long click
|
||||
final LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
|
||||
tabStrip.getChildAt(0).setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
tabStrip.getChildAt(0).setOnLongClickListener(v -> {
|
||||
PopupMenu popup = new PopupMenu(ShowAccountActivity.this, tabStrip.getChildAt(0));
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.option_filter_toots_account, popup.getMenu());
|
||||
|
@ -679,9 +642,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
itemShowBoosts.setChecked(show_boosts);
|
||||
itemShowReplies.setChecked(show_replies);
|
||||
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu menu) {
|
||||
popup.setOnDismissListener(menu1 -> {
|
||||
if (mPager != null && mPager
|
||||
.getAdapter() != null) {
|
||||
if (mPager
|
||||
|
@ -704,10 +665,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
item.setActionView(new View(getApplicationContext()));
|
||||
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||
|
@ -739,26 +698,22 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
if (tabLayout.getTabAt(0) != null)
|
||||
//noinspection ConstantConditions
|
||||
tabLayout.getTabAt(0).select();
|
||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
PagerAdapter mPagerAdapter1 = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter1);
|
||||
itemShowMedia.setChecked(showMediaOnly);
|
||||
itemShowPined.setChecked(showPinned);
|
||||
itemShowReplies.setChecked(show_replies);
|
||||
itemShowBoosts.setChecked(show_boosts);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), account_pp);
|
||||
account_pp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
account_pp.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(ShowAccountActivity.this, SlideMediaActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
Attachment attachment = new Attachment();
|
||||
|
@ -773,16 +728,13 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
b.putInt("position", 1);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
//Follow button
|
||||
String target = account.getId();
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
||||
target = account.getAcct();
|
||||
String finalTarget = target;
|
||||
account_follow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
account_follow.setOnClickListener(v -> {
|
||||
if (doAction == action.NOTHING) {
|
||||
Toasty.info(getApplicationContext(), getString(R.string.nothing_to_do), Toast.LENGTH_LONG).show();
|
||||
} else if (doAction == action.FOLLOW) {
|
||||
|
@ -794,19 +746,11 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
AlertDialog.Builder unfollowConfirm = new AlertDialog.Builder(ShowAccountActivity.this, style);
|
||||
unfollowConfirm.setTitle(getString(R.string.unfollow_confirm));
|
||||
unfollowConfirm.setMessage(account.getAcct());
|
||||
unfollowConfirm.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
unfollowConfirm.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
unfollowConfirm.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.UNFOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
unfollowConfirm.show();
|
||||
} else {
|
||||
|
@ -818,14 +762,10 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.UNBLOCK, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
});
|
||||
account_follow.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
account_follow.setOnLongClickListener(v -> {
|
||||
CrossActions.doCrossAction(ShowAccountActivity.this, null, null, account, API.StatusAction.FOLLOW, null, ShowAccountActivity.this, false);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
UserNote userNote = new NotesDAO(getApplicationContext(), db).getUserNote(account.getAcct());
|
||||
|
@ -844,29 +784,21 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
input.setText(userNote.getNote());
|
||||
input.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
|
||||
builderInner.setView(input);
|
||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
builderInner.setPositiveButton(R.string.validate, (dialog, which) -> {
|
||||
UserNote userNote1 = new NotesDAO(getApplicationContext(), db).getUserNote(account.getAcct());
|
||||
if (userNote1 == null) {
|
||||
userNote1 = new UserNote();
|
||||
userNote1.setAcct(account.getAcct());
|
||||
}
|
||||
});
|
||||
builderInner.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
UserNote userNote = new NotesDAO(getApplicationContext(), db).getUserNote(account.getAcct());
|
||||
if (userNote == null) {
|
||||
userNote = new UserNote();
|
||||
userNote.setAcct(account.getAcct());
|
||||
}
|
||||
userNote.setNote(input.getText().toString());
|
||||
new NotesDAO(getApplicationContext(), db).insertInstance(userNote);
|
||||
userNote1.setNote(input.getText().toString());
|
||||
new NotesDAO(getApplicationContext(), db).insertInstance(userNote1);
|
||||
if (input.getText().toString().trim().length() > 0) {
|
||||
account_personal_note.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
account_personal_note.setVisibility(View.GONE);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.show();
|
||||
});
|
||||
|
@ -875,18 +807,15 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
TextView account_date = findViewById(R.id.account_date);
|
||||
account_date.setText(Helper.shortDateToString(account.getCreated_at()));
|
||||
account_date.setVisibility(View.VISIBLE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new Thread(() -> {
|
||||
|
||||
String instance = getLiveInstance(getApplicationContext());
|
||||
String instance1 = getLiveInstance(getApplicationContext());
|
||||
if (account.getAcct().split("@").length > 1) {
|
||||
instance = account.getAcct().split("@")[1];
|
||||
instance1 = account.getAcct().split("@")[1];
|
||||
}
|
||||
InstanceNodeInfo instanceNodeInfo = new API(ShowAccountActivity.this).displayNodeInfo(instance);
|
||||
String finalInstance = instance;
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
InstanceNodeInfo instanceNodeInfo = new API(ShowAccountActivity.this).displayNodeInfo(instance1);
|
||||
String finalInstance = instance1;
|
||||
runOnUiThread(() -> {
|
||||
if (instanceNodeInfo != null && instanceNodeInfo.getName() != null) {
|
||||
TextView instance_info = findViewById(R.id.instance_info);
|
||||
instance_info.setText(instanceNodeInfo.getName());
|
||||
|
@ -901,11 +830,9 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
@ -1089,12 +1016,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
||||
if (!disableAnimatedEmoji) {
|
||||
scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
|
||||
scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
account_dn.invalidate();
|
||||
}
|
||||
}, 0, 130, TimeUnit.MILLISECONDS);
|
||||
scheduledExecutorService.scheduleAtFixedRate(() -> account_dn.invalidate(), 0, 130, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1165,8 +1087,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
}
|
||||
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
AlertDialog.Builder builderInner;
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
|
@ -1193,9 +1114,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (!peertubeAccount) {
|
||||
//Here we can't know if the instance is a Mastodon one or not
|
||||
|
@ -1208,8 +1127,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
} else
|
||||
new HttpsConnection(ShowAccountActivity.this, null).get("https://" + finalInstanceName + "/api/v1/videos/", 10, null, null);
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
runOnUiThread(() -> {
|
||||
if (!peertubeAccount)
|
||||
new InstancesDAO(ShowAccountActivity.this, db).insertInstance(finalInstanceName, "MASTODON");
|
||||
else
|
||||
|
@ -1221,16 +1139,10 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
bundle.putString(Helper.INSTANCE_NAME, finalInstanceName);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
Toasty.warning(getApplicationContext(), getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
runOnUiThread(() -> Toasty.warning(getApplicationContext(), getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show());
|
||||
}
|
||||
}).start();
|
||||
return true;
|
||||
|
@ -1248,24 +1160,21 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
int checkedposition = 0;
|
||||
int i = 0;
|
||||
for (String _t : tags) {
|
||||
if (tag != null && _t.equals(tag))
|
||||
if (_t.equals(tag))
|
||||
checkedposition = i;
|
||||
i++;
|
||||
}
|
||||
filterTagDialog.setSingleChoiceItems(tagsString, checkedposition, new DialogInterface
|
||||
.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
String tag;
|
||||
if (item == 0) {
|
||||
tag = null;
|
||||
filterTagDialog.setSingleChoiceItems(tagsString, checkedposition, (dialog, item1) -> {
|
||||
String tag1;
|
||||
if (item1 == 0) {
|
||||
tag1 = null;
|
||||
} else {
|
||||
tag = finalTags.get(item);
|
||||
tag1 = finalTags.get(item1);
|
||||
}
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.SET_FEATURED_TAG_ACTION, tag);
|
||||
editor.putString(Helper.SET_FEATURED_TAG_ACTION, tag1);
|
||||
editor.apply();
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
filterTagDialog.show();
|
||||
return true;
|
||||
|
@ -1295,7 +1204,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
return true;
|
||||
case R.id.action_add_to_list:
|
||||
if (timelines != null) {
|
||||
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(ShowAccountActivity.this, android.R.layout.select_dialog_item);
|
||||
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(ShowAccountActivity.this, android.R.layout.select_dialog_item);
|
||||
boolean hasLists = false;
|
||||
for (ManageTimelines timeline : timelines) {
|
||||
if (timeline.getListTimeline() != null) {
|
||||
|
@ -1309,16 +1218,9 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(ShowAccountActivity.this, style);
|
||||
builderSingle.setTitle(getString(R.string.action_lists_add_to));
|
||||
builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderSingle.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
|
||||
builderSingle.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
builderSingle.setAdapter(arrayAdapter, (dialog, which) -> {
|
||||
String listTitle = arrayAdapter.getItem(which);
|
||||
for (ManageTimelines timeline : timelines) {
|
||||
if (timeline.getListTimeline() != null && timeline.getListTimeline().getTitle().equals(listTitle)) {
|
||||
|
@ -1332,7 +1234,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
builderSingle.show();
|
||||
}
|
||||
|
@ -1373,22 +1274,14 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
input.setLayoutParams(lp);
|
||||
builderInner.setView(input);
|
||||
doActionAccount = API.StatusAction.REPORT;
|
||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||
String targetedId;
|
||||
String comment = null;
|
||||
if (input.getText() != null)
|
||||
comment = input.getText().toString();
|
||||
new PostActionAsyncTask(getApplicationContext(), doActionAccount, account.getId(), null, comment, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.show();
|
||||
return true;
|
||||
|
@ -1407,29 +1300,21 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
input.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
|
||||
builderInner.setView(input);
|
||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
builderInner.setPositiveButton(R.string.validate, (dialog, which) -> {
|
||||
UserNote userNote1 = new NotesDAO(getApplicationContext(), db).getUserNote(account.getAcct());
|
||||
if (userNote1 == null) {
|
||||
userNote1 = new UserNote();
|
||||
userNote1.setAcct(account.getAcct());
|
||||
}
|
||||
});
|
||||
builderInner.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
UserNote userNote = new NotesDAO(getApplicationContext(), db).getUserNote(account.getAcct());
|
||||
if (userNote == null) {
|
||||
userNote = new UserNote();
|
||||
userNote.setAcct(account.getAcct());
|
||||
}
|
||||
userNote.setNote(input.getText().toString());
|
||||
new NotesDAO(getApplicationContext(), db).insertInstance(userNote);
|
||||
userNote1.setNote(input.getText().toString());
|
||||
new NotesDAO(getApplicationContext(), db).insertInstance(userNote1);
|
||||
if (input.getText().toString().trim().length() > 0) {
|
||||
account_personal_note.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
account_personal_note.setVisibility(View.GONE);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.show();
|
||||
return true;
|
||||
|
@ -1447,15 +1332,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
default:
|
||||
return true;
|
||||
}
|
||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||
String targetedId;
|
||||
if (item.getItemId() == R.id.action_block_instance) {
|
||||
targetedId = account.getAcct().split("@")[1];
|
||||
|
@ -1464,11 +1342,9 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
new PostActionAsyncTask(getApplicationContext(), doActionAccount, targetedId, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
|
@ -1590,12 +1466,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
builder.setView(identityProofsView);
|
||||
builder
|
||||
.setTitle(R.string.identity_proofs)
|
||||
.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss())
|
||||
.show();
|
||||
});
|
||||
|
||||
|
@ -1619,6 +1490,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
super(fm);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -1667,7 +1539,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
return displayAccountsFragment;
|
||||
}
|
||||
|
||||
case 2:
|
||||
default:
|
||||
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
|
||||
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.FOLLOWERS);
|
||||
bundle.putString("targetedid", account.getId());
|
||||
|
@ -1675,7 +1547,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
return displayAccountsFragment;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue