Compare commits
11 Commits
v1.2.3+for
...
v1.2.3+for
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56a93288c4 | ||
|
|
02e3421f98 | ||
|
|
1ce49c68fe | ||
|
|
d37e880993 | ||
|
|
6fdb81a01f | ||
|
|
f9d6827572 | ||
|
|
10bf72b9ff | ||
|
|
800f929a15 | ||
|
|
07ca5a8b77 | ||
|
|
6926a212f4 | ||
|
|
936f39161b |
@@ -15,8 +15,8 @@ android {
|
||||
applicationId "org.joinmastodon.android.sk"
|
||||
minSdk 23
|
||||
targetSdk 33
|
||||
versionCode 86
|
||||
versionName "1.2.3+fork.86"
|
||||
versionCode 87
|
||||
versionName "1.2.3+fork.87"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resourceConfigurations += ['ar-rSA', 'ar-rDZ', 'be-rBY', 'bn-rBD', 'bs-rBA', 'ca-rES', 'cs-rCZ', 'da-rDK', 'de-rDE', 'el-rGR', 'es-rES', 'eu-rES', 'fa-rIR', 'fi-rFI', 'fil-rPH', 'fr-rFR', 'ga-rIE', 'gd-rGB', 'gl-rES', 'hi-rIN', 'hr-rHR', 'hu-rHU', 'hy-rAM', 'ig-rNG', 'in-rID', 'is-rIS', 'it-rIT', 'iw-rIL', 'ja-rJP', 'kab', 'ko-rKR', 'my-rMM', 'nl-rNL', 'no-rNO', 'oc-rFR', 'pl-rPL', 'pt-rBR', 'pt-rPT', 'ro-rRO', 'ru-rRU', 'si-rLK', 'sl-rSI', 'sv-rSE', 'th-rTH', 'tr-rTR', 'uk-rUA', 'ur-rIN', 'vi-rVN', 'zh-rCN', 'zh-rTW']
|
||||
}
|
||||
|
||||
@@ -19,41 +19,40 @@ public class ThreadFragmentTest {
|
||||
return status;
|
||||
}
|
||||
|
||||
private ThreadFragment.NeighborAncestryInfo fakeInfo(Status s, Status d, Status a) {
|
||||
ThreadFragment.NeighborAncestryInfo info = new ThreadFragment.NeighborAncestryInfo(s);
|
||||
info.descendantNeighbor = d;
|
||||
info.ancestoringNeighbor = a;
|
||||
return info;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void countAncestryLevels() {
|
||||
public void mapNeighborhoodAncestry() {
|
||||
StatusContext context = new StatusContext();
|
||||
context.ancestors = List.of(
|
||||
fakeStatus("oldest ancestor", null),
|
||||
fakeStatus("younger ancestor", "oldest ancestor")
|
||||
);
|
||||
Status mainStatus = fakeStatus("main status", "younger ancestor");
|
||||
context.descendants = List.of(
|
||||
fakeStatus("first reply", "main status"),
|
||||
fakeStatus("reply to first reply", "first reply"),
|
||||
fakeStatus("third level reply", "reply to first reply"),
|
||||
fakeStatus("another reply", "main status")
|
||||
);
|
||||
List<Pair<String, Integer>> actual =
|
||||
ThreadFragment.countAncestryLevels("main status", context);
|
||||
|
||||
List<Pair<String, Integer>> expected = List.of(
|
||||
Pair.create("oldest ancestor", -2),
|
||||
Pair.create("younger ancestor", -1),
|
||||
Pair.create("main status", 0),
|
||||
Pair.create("first reply", 1),
|
||||
Pair.create("reply to first reply", 2),
|
||||
Pair.create("third level reply", 3),
|
||||
Pair.create("another reply", 1)
|
||||
);
|
||||
assertEquals(
|
||||
"status ids are in the right order",
|
||||
expected.stream().map(p -> p.first).collect(Collectors.toList()),
|
||||
actual.stream().map(p -> p.first).collect(Collectors.toList())
|
||||
);
|
||||
assertEquals(
|
||||
"counted levels match",
|
||||
expected.stream().map(p -> p.second).collect(Collectors.toList()),
|
||||
actual.stream().map(p -> p.second).collect(Collectors.toList())
|
||||
);
|
||||
List<ThreadFragment.NeighborAncestryInfo> neighbors =
|
||||
ThreadFragment.mapNeighborhoodAncestry(mainStatus, context);
|
||||
|
||||
assertEquals(List.of(
|
||||
fakeInfo(context.ancestors.get(0), context.ancestors.get(1), null),
|
||||
fakeInfo(context.ancestors.get(1), mainStatus, context.ancestors.get(0)),
|
||||
fakeInfo(mainStatus, context.descendants.get(0), context.ancestors.get(1)),
|
||||
fakeInfo(context.descendants.get(0), context.descendants.get(1), mainStatus),
|
||||
fakeInfo(context.descendants.get(1), context.descendants.get(2), context.descendants.get(0)),
|
||||
fakeInfo(context.descendants.get(2), null, context.descendants.get(1)),
|
||||
fakeInfo(context.descendants.get(3), null, null)
|
||||
), neighbors);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.jsoup.internal.StringUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import me.grishka.appkit.FragmentStackActivity;
|
||||
@@ -29,8 +30,8 @@ public class ExternalShareActivity extends FragmentStackActivity{
|
||||
super.onCreate(savedInstanceState);
|
||||
if(savedInstanceState==null){
|
||||
|
||||
String text = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
||||
boolean isMastodonURL = UiUtils.looksLikeMastodonUrl(text);
|
||||
Optional<String> text = Optional.ofNullable(getIntent().getStringExtra(Intent.EXTRA_TEXT));
|
||||
boolean isMastodonURL = text.map(UiUtils::looksLikeMastodonUrl).orElse(false);
|
||||
|
||||
List<AccountSession> sessions=AccountSessionManager.getInstance().getLoggedInAccounts();
|
||||
if(sessions.isEmpty()){
|
||||
@@ -40,8 +41,8 @@ public class ExternalShareActivity extends FragmentStackActivity{
|
||||
openComposeFragment(sessions.get(0).getID());
|
||||
}else{
|
||||
new AccountSwitcherSheet(this, null, true, isMastodonURL, (accountId, open) -> {
|
||||
if (open) {
|
||||
UiUtils.lookupURL(this, accountId, text, false, (clazz, args) -> {
|
||||
if (open && text.isPresent()) {
|
||||
UiUtils.lookupURL(this, accountId, text.get(), false, (clazz, args) -> {
|
||||
if (clazz == null) {
|
||||
finish();
|
||||
return;
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.ImageButton;
|
||||
@@ -26,7 +27,6 @@ import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.api.requests.accounts.GetAccountRelationships;
|
||||
import org.joinmastodon.android.api.requests.polls.SubmitPollVote;
|
||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||
import org.joinmastodon.android.events.PollUpdatedEvent;
|
||||
import org.joinmastodon.android.model.Account;
|
||||
import org.joinmastodon.android.model.DisplayItemsParent;
|
||||
@@ -35,7 +35,6 @@ import org.joinmastodon.android.model.Relationship;
|
||||
import org.joinmastodon.android.model.Status;
|
||||
import org.joinmastodon.android.ui.BetterItemAnimator;
|
||||
import org.joinmastodon.android.ui.displayitems.ExtendedFooterStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.FooterStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.GapStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.HeaderStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.MediaGridStatusDisplayItem;
|
||||
@@ -207,7 +206,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||
@Override
|
||||
public boolean startPhotoViewTransition(int index, @NonNull Rect outRect, @NonNull int[] outCornerRadius){
|
||||
MediaAttachmentViewController holder=findPhotoViewHolder(index);
|
||||
if(holder!=null){
|
||||
if(holder!=null && list!=null){
|
||||
transitioningHolder=holder;
|
||||
View view=transitioningHolder.photo;
|
||||
int[] pos={0, 0};
|
||||
@@ -339,6 +338,8 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||
private Rect tmpRect=new Rect();
|
||||
@Override
|
||||
public void getSelectorBounds(View view, Rect outRect){
|
||||
boolean hasDescendant = false, hasAncestor = false, isWarning = false;
|
||||
int lastIndex = -1, firstIndex = -1;
|
||||
list.getDecoratedBoundsWithMargins(view, outRect);
|
||||
RecyclerView.ViewHolder holder=list.getChildViewHolder(view);
|
||||
if(holder instanceof StatusDisplayItem.Holder){
|
||||
@@ -350,23 +351,40 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||
for(int i=0;i<list.getChildCount();i++){
|
||||
View child=list.getChildAt(i);
|
||||
holder=list.getChildViewHolder(child);
|
||||
if(holder instanceof StatusDisplayItem.Holder){
|
||||
if(holder instanceof StatusDisplayItem.Holder<?> h){
|
||||
String otherID=((StatusDisplayItem.Holder<?>) holder).getItemID();
|
||||
if(otherID.equals(id)){
|
||||
if (firstIndex < 0) firstIndex = i;
|
||||
lastIndex = i;
|
||||
StatusDisplayItem item = h.getItem();
|
||||
hasDescendant = item.hasDescendantNeighbor();
|
||||
// no for direct descendants because main status (right above) is
|
||||
// being displayed with an extended footer - no connected layout
|
||||
hasAncestor = item.hasAncestoringNeighbor() && !item.isDirectDescendant;
|
||||
list.getDecoratedBoundsWithMargins(child, tmpRect);
|
||||
outRect.left=Math.min(outRect.left, tmpRect.left);
|
||||
outRect.top=Math.min(outRect.top, tmpRect.top);
|
||||
outRect.right=Math.max(outRect.right, tmpRect.right);
|
||||
int bottom = tmpRect.bottom;
|
||||
if (holder instanceof FooterStatusDisplayItem.Holder fh
|
||||
&& fh.getItem().hasDescendantSibling) {
|
||||
bottom += V.dp(8);
|
||||
outRect.bottom=Math.max(outRect.bottom, tmpRect.bottom);
|
||||
if (holder instanceof WarningFilteredStatusDisplayItem.Holder) {
|
||||
isWarning = true;
|
||||
}
|
||||
outRect.bottom=Math.max(outRect.bottom, bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// shifting the selection box down
|
||||
// see also: FooterStatusDisplayItem#onBind (setMargins)
|
||||
if (isWarning || firstIndex < 0 || lastIndex < 0) return;
|
||||
int prevIndex = firstIndex - 1, nextIndex = lastIndex + 1;
|
||||
boolean prevIsWarning = prevIndex > 0 && prevIndex < list.getChildCount() &&
|
||||
list.getChildViewHolder(list.getChildAt(prevIndex))
|
||||
instanceof WarningFilteredStatusDisplayItem.Holder;
|
||||
boolean nextIsWarning = nextIndex > 0 && nextIndex < list.getChildCount() &&
|
||||
list.getChildViewHolder(list.getChildAt(nextIndex))
|
||||
instanceof WarningFilteredStatusDisplayItem.Holder;
|
||||
if (!prevIsWarning && hasAncestor) outRect.top += V.dp(4);
|
||||
if (!nextIsWarning && hasDescendant) outRect.bottom += V.dp(4);
|
||||
}
|
||||
});
|
||||
list.setItemAnimator(new BetterItemAnimator());
|
||||
@@ -779,7 +797,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||
RecyclerView.ViewHolder siblingHolder=parent.getChildViewHolder(bottomSibling);
|
||||
if(holder instanceof StatusDisplayItem.Holder<?> ih && siblingHolder instanceof StatusDisplayItem.Holder<?> sh
|
||||
&& (!ih.getItemID().equals(sh.getItemID()) || sh instanceof ExtendedFooterStatusDisplayItem.Holder) && ih.getItem().getType()!=StatusDisplayItem.Type.GAP){
|
||||
if (ih.getItem().descendantLevel != 0 && ih.getItem().hasDescendantSibling) continue;
|
||||
if (!ih.getItem().isMainStatus && ih.getItem().hasDescendantNeighbor()) continue;
|
||||
drawDivider(child, bottomSibling, holder, siblingHolder, parent, c, dividerPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.os.Bundle;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.api.requests.statuses.GetStatusContext;
|
||||
import org.joinmastodon.android.events.StatusCreatedEvent;
|
||||
@@ -17,6 +19,7 @@ import org.joinmastodon.android.ui.displayitems.FooterStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.ReblogOrReplyLineStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.StatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.TextStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.displayitems.WarningFilteredStatusDisplayItem;
|
||||
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
import org.joinmastodon.android.utils.ProvidesAssistContent;
|
||||
@@ -30,8 +33,10 @@ import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import me.grishka.appkit.api.SimpleCallback;
|
||||
|
||||
@@ -55,6 +60,7 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
||||
* confused? good. /j
|
||||
*/
|
||||
private final List<Pair<String, Integer>> levels = new ArrayList<>();
|
||||
private final HashMap<String, NeighborAncestryInfo> ancestryMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState){
|
||||
@@ -74,23 +80,27 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
||||
// "what the fuck is a deque"? yes
|
||||
// (it's just so the last-added item automatically comes first when looping over it)
|
||||
Deque<Integer> deleteTheseItems = new ArrayDeque<>();
|
||||
for(int i = 0; i < items.size(); i++){
|
||||
StatusDisplayItem item = items.get(i);
|
||||
|
||||
Optional<Pair<String, Integer>> levelForStatus =
|
||||
levels.stream().filter(p -> p.first.equals(s.id)).findAny();
|
||||
item.descendantLevel = levelForStatus.map(p -> p.second).orElse(0);
|
||||
if (levelForStatus.isPresent()) {
|
||||
int idx = levels.indexOf(levelForStatus.get());
|
||||
item.hasDescendantSibling = (levels.size() > idx + 1)
|
||||
&& levels.get(idx + 1).second > levelForStatus.get().second;
|
||||
item.isDescendantSibling = (idx - 1 >= 0)
|
||||
&& levels.get(idx - 1).second < levelForStatus.get().second;
|
||||
// modifying hidden filtered items if status is displayed as a warning
|
||||
List<StatusDisplayItem> itemsToModify =
|
||||
(items.get(0) instanceof WarningFilteredStatusDisplayItem warning)
|
||||
? warning.filteredItems
|
||||
: items;
|
||||
|
||||
for(int i = 0; i < itemsToModify.size(); i++){
|
||||
StatusDisplayItem item = itemsToModify.get(i);
|
||||
NeighborAncestryInfo ancestryInfo = ancestryMap.get(s.id);
|
||||
if (ancestryInfo != null) {
|
||||
item.setAncestryInfo(
|
||||
ancestryInfo,
|
||||
s.id.equals(mainStatus.id),
|
||||
ancestryInfo.getAncestoringNeighbor()
|
||||
.map(ancestor -> ancestor.id.equals(mainStatus.id))
|
||||
.orElse(false)
|
||||
);
|
||||
}
|
||||
|
||||
if (item instanceof ReblogOrReplyLineStatusDisplayItem
|
||||
&& item.isDescendantSibling
|
||||
&& item.descendantLevel != 1) {
|
||||
if (item instanceof ReblogOrReplyLineStatusDisplayItem && !item.isDirectDescendant) {
|
||||
deleteTheseItems.add(i);
|
||||
}
|
||||
|
||||
@@ -101,7 +111,7 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
||||
footer.hideCounts=true;
|
||||
}
|
||||
}
|
||||
for (int deleteThisItem : deleteTheseItems) items.remove(deleteThisItem);
|
||||
for (int deleteThisItem : deleteTheseItems) itemsToModify.remove(deleteThisItem);
|
||||
if(s.id.equals(mainStatus.id)) {
|
||||
items.add(new ExtendedFooterStatusDisplayItem(s.id, this, s.getContentStatus()));
|
||||
}
|
||||
@@ -117,7 +127,7 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
||||
if (getActivity() == null) return;
|
||||
if(refreshing){
|
||||
data.clear();
|
||||
levels.clear();
|
||||
ancestryMap.clear();
|
||||
displayItems.clear();
|
||||
data.add(mainStatus);
|
||||
onAppendItems(Collections.singletonList(mainStatus));
|
||||
@@ -129,7 +139,9 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
||||
result.descendants=filterStatuses(result.descendants);
|
||||
result.ancestors=filterStatuses(result.ancestors);
|
||||
|
||||
levels.addAll(countAncestryLevels(mainStatus.id, result));
|
||||
for (NeighborAncestryInfo i : mapNeighborhoodAncestry(mainStatus, result)) {
|
||||
ancestryMap.put(i.status.id, i);
|
||||
}
|
||||
|
||||
if(footerProgress!=null)
|
||||
footerProgress.setVisibility(View.GONE);
|
||||
@@ -156,26 +168,35 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
||||
.exec(accountID);
|
||||
}
|
||||
|
||||
public static List<Pair<String, Integer>> countAncestryLevels(String mainStatusID, StatusContext context) {
|
||||
List<Pair<String, Integer>> levels = new ArrayList<>();
|
||||
public static List<NeighborAncestryInfo> mapNeighborhoodAncestry(Status mainStatus, StatusContext context) {
|
||||
List<NeighborAncestryInfo> ancestry = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < context.ancestors.size(); i++) {
|
||||
levels.add(Pair.create(
|
||||
context.ancestors.get(i).id,
|
||||
-context.ancestors.size() + i // -3, -2, -1
|
||||
));
|
||||
List<Status> statuses = new ArrayList<>(context.ancestors);
|
||||
statuses.add(mainStatus);
|
||||
statuses.addAll(context.descendants);
|
||||
|
||||
int count = statuses.size();
|
||||
for (int index = 0; index < count; index++) {
|
||||
Status current = statuses.get(index);
|
||||
NeighborAncestryInfo item = new NeighborAncestryInfo(current);
|
||||
|
||||
item.descendantNeighbor = Optional
|
||||
.ofNullable(count > index + 1 ? statuses.get(index + 1) : null)
|
||||
.filter(s -> s.inReplyToId.equals(current.id))
|
||||
.orElse(null);
|
||||
|
||||
item.ancestoringNeighbor = Optional.ofNullable(index > 0 ? ancestry.get(index - 1) : null)
|
||||
.filter(ancestor -> ancestor
|
||||
.getDescendantNeighbor()
|
||||
.map(ancestorsDescendant -> ancestorsDescendant.id.equals(current.id))
|
||||
.orElse(false))
|
||||
.flatMap(NeighborAncestryInfo::getStatus)
|
||||
.orElse(null);
|
||||
|
||||
ancestry.add(item);
|
||||
}
|
||||
|
||||
levels.add(Pair.create(mainStatusID, 0));
|
||||
Map<String, Integer> levelPerStatus = new HashMap<>();
|
||||
|
||||
// sum up the amounts of descendants per status
|
||||
context.descendants.forEach(s -> levelPerStatus.put(s.id,
|
||||
levelPerStatus.getOrDefault(s.inReplyToId, 0) + 1));
|
||||
context.descendants.forEach(s ->
|
||||
levels.add(Pair.create(s.id, levelPerStatus.get(s.id))));
|
||||
|
||||
return levels;
|
||||
return ancestry;
|
||||
}
|
||||
|
||||
public static void sortStatusContext(Status mainStatus, StatusContext context) {
|
||||
@@ -275,4 +296,47 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist
|
||||
public Uri getWebUri(Uri.Builder base) {
|
||||
return Uri.parse(mainStatus.url);
|
||||
}
|
||||
|
||||
public static class NeighborAncestryInfo {
|
||||
protected Status status, descendantNeighbor, ancestoringNeighbor;
|
||||
|
||||
public NeighborAncestryInfo(@NonNull Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Optional<Status> getStatus() {
|
||||
return Optional.ofNullable(status);
|
||||
}
|
||||
|
||||
public Optional<Status> getDescendantNeighbor() {
|
||||
return Optional.ofNullable(descendantNeighbor);
|
||||
}
|
||||
|
||||
public Optional<Status> getAncestoringNeighbor() {
|
||||
return Optional.ofNullable(ancestoringNeighbor);
|
||||
}
|
||||
|
||||
public boolean hasDescendantNeighbor() {
|
||||
return getDescendantNeighbor().isPresent();
|
||||
}
|
||||
|
||||
public boolean hasAncestoringNeighbor() {
|
||||
return getAncestoringNeighbor().isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
NeighborAncestryInfo that = (NeighborAncestryInfo) o;
|
||||
return status.equals(that.status)
|
||||
&& Objects.equals(descendantNeighbor, that.descendantNeighbor)
|
||||
&& Objects.equals(ancestoringNeighbor, that.ancestoringNeighbor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(status, descendantNeighbor, ancestoringNeighbor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class AccountSwitcherSheet extends BottomSheet{
|
||||
private UsableRecyclerView list;
|
||||
private List<WrappedAccount> accounts;
|
||||
private ListImageLoaderWrapper imgLoader;
|
||||
private AccountsAdapter accountsAdapter;
|
||||
|
||||
public AccountSwitcherSheet(@NonNull Activity activity, @Nullable HomeFragment fragment){
|
||||
this(activity, fragment, false, false, null);
|
||||
@@ -101,7 +102,7 @@ public class AccountSwitcherSheet extends BottomSheet{
|
||||
setOnDismissListener((d) -> activity.finish());
|
||||
}
|
||||
|
||||
adapter.addAdapter(new AccountsAdapter());
|
||||
adapter.addAdapter(accountsAdapter = new AccountsAdapter());
|
||||
|
||||
if (!externalShare) {
|
||||
adapter.addAdapter(new ClickableSingleViewRecyclerAdapter(makeSimpleListItem(R.string.add_account, R.drawable.ic_fluent_add_24_regular), () -> {
|
||||
@@ -201,7 +202,10 @@ public class AccountSwitcherSheet extends BottomSheet{
|
||||
activity.finish();
|
||||
activity.startActivity(new Intent(activity, MainActivity.class));
|
||||
} else {
|
||||
dismiss();
|
||||
accounts.stream().filter(w -> accountID.equals(w.session.getID())).findAny().ifPresent(w -> {
|
||||
accountsAdapter.notifyItemRemoved(accounts.indexOf(w));
|
||||
accounts.remove(w);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,16 +136,23 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
||||
bindButton(favorite, item.status.favouritesCount);
|
||||
// in thread view, direct descendant posts display one direct reply to themselves,
|
||||
// hence in that case displaying whether there is another reply
|
||||
reply.setSelected(item.status.repliesCount > (item.descendantLevel > 0 ? 1 : 0));
|
||||
int compareTo = item.isMainStatus || !item.hasDescendantNeighbor() ? 0 : 1;
|
||||
reply.setSelected(item.status.repliesCount > compareTo);
|
||||
boost.setSelected(item.status.reblogged);
|
||||
favorite.setSelected(item.status.favourited);
|
||||
bookmark.setSelected(item.status.bookmarked);
|
||||
boost.setEnabled(item.status.visibility==StatusPrivacy.PUBLIC || item.status.visibility==StatusPrivacy.UNLISTED || item.status.visibility==StatusPrivacy.LOCAL
|
||||
|| (item.status.visibility==StatusPrivacy.PRIVATE && item.status.account.id.equals(AccountSessionManager.getInstance().getAccount(item.accountID).self.id)));
|
||||
|
||||
int nextPos = getAbsoluteAdapterPosition() + 1;
|
||||
boolean nextIsWarning = item.parentFragment.getDisplayItems().size() > nextPos &&
|
||||
item.parentFragment.getDisplayItems().get(nextPos) instanceof WarningFilteredStatusDisplayItem;
|
||||
boolean condenseBottom = !item.isMainStatus && item.hasDescendantNeighbor() &&
|
||||
!nextIsWarning;
|
||||
|
||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) itemView.getLayoutParams();
|
||||
params.setMargins(params.leftMargin, params.topMargin, params.rightMargin,
|
||||
item.descendantLevel != 0 && item.hasDescendantSibling ? V.dp(-6) : 0);
|
||||
condenseBottom ? V.dp(-8) : 0);
|
||||
|
||||
itemView.requestLayout();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.view.ViewGroup;
|
||||
|
||||
import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.api.session.AccountSession;
|
||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
||||
import org.joinmastodon.android.fragments.HashtagTimelineFragment;
|
||||
@@ -22,7 +21,6 @@ import org.joinmastodon.android.model.Account;
|
||||
import org.joinmastodon.android.model.Attachment;
|
||||
import org.joinmastodon.android.model.DisplayItemsParent;
|
||||
import org.joinmastodon.android.model.Filter;
|
||||
import org.joinmastodon.android.model.Instance;
|
||||
import org.joinmastodon.android.model.Notification;
|
||||
import org.joinmastodon.android.model.Poll;
|
||||
import org.joinmastodon.android.model.ScheduledStatus;
|
||||
@@ -49,8 +47,32 @@ public abstract class StatusDisplayItem{
|
||||
public final BaseStatusListFragment parentFragment;
|
||||
public boolean inset;
|
||||
public int index;
|
||||
public int descendantLevel;
|
||||
public boolean hasDescendantSibling, isDescendantSibling;
|
||||
private ThreadFragment.NeighborAncestryInfo ancestryInfo;
|
||||
public boolean
|
||||
isMainStatus = true,
|
||||
isDirectDescendant = false;
|
||||
|
||||
public boolean hasDescendantNeighbor() {
|
||||
return Optional.ofNullable(ancestryInfo)
|
||||
.map(ThreadFragment.NeighborAncestryInfo::hasDescendantNeighbor)
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
public boolean hasAncestoringNeighbor() {
|
||||
return Optional.ofNullable(ancestryInfo)
|
||||
.map(ThreadFragment.NeighborAncestryInfo::hasAncestoringNeighbor)
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
public void setAncestryInfo(
|
||||
ThreadFragment.NeighborAncestryInfo ancestryInfo,
|
||||
boolean isMainStatus,
|
||||
boolean isDirectDescendant
|
||||
) {
|
||||
this.ancestryInfo = ancestryInfo;
|
||||
this.isMainStatus = isMainStatus;
|
||||
this.isDirectDescendant = isDirectDescendant;
|
||||
}
|
||||
|
||||
public StatusDisplayItem(String parentID, BaseStatusListFragment parentFragment){
|
||||
this.parentID=parentID;
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<item quantity="one">%d জন ব্যক্তি বলছেন</item>
|
||||
<item quantity="other">%d jon ব্যক্তিরা বলছেন</item>
|
||||
</plurals>
|
||||
<string name="sending_report">রিপোর্ট পাঠানো হচ্ছে…</string>
|
||||
<!-- %s is the email address -->
|
||||
<!-- translators: %,d is a valid placeholder, it formats the number with locale-dependent grouping separators -->
|
||||
<!-- %s is version like 1.2.3 -->
|
||||
@@ -96,4 +97,8 @@
|
||||
<!-- %s is server domain -->
|
||||
<!-- Shown in a progress dialog when you tap "follow all" -->
|
||||
<!-- %1$s is server domain, %2$s is email domain. You can reorder these placeholders to fit your language better. -->
|
||||
<string name="welcome_to_mastodon">Mastodon - এ আপনাকে স্বাগত জানাই</string>
|
||||
<string name="welcome_paragraph1">Mastodon হল একটি বিকেন্দ্রীভূত সামাজিক নেটওয়ার্ক, যার মানে কোনো একক কোম্পানি এটিকে নিয়ন্ত্রণ করে না। এটি অনেকগুলি স্বাধীনভাবে চালিত সার্ভারের সমন্বয়ে গঠিত, যেখানে সব সার্ভারগুলি একসাথে সংযুক্ত৷</string>
|
||||
<string name="what_are_servers">সার্ভার কি?</string>
|
||||
<string name="welcome_paragraph2"><![CDATA[প্রতিটি Mastodon অ্যাকাউন্টকে একটি সার্ভারে হোস্ট করা হয় — প্রত্যেকটির নিজস্ব মান, নিয়ম এবং প্রশাসক (অ্যাডমিন) রয়েছে। আপনি যে কোনো সার্ভারই বেছে নিন না কেন তা বিবেচ্য নয়, আপনি যেকোনো সার্ভারের লোকেদের সাথে যোগাযোগ করতে এবং তাদের ফলো করতে পারেন।]]></string>
|
||||
</resources>
|
||||
|
||||
@@ -438,8 +438,11 @@
|
||||
<string name="show">Anzeigen</string>
|
||||
<string name="hide">Ausblenden</string>
|
||||
<string name="join_default_server">%s beitreten</string>
|
||||
<string name="pick_server">Wähle einen anderen Server</string>
|
||||
<string name="signup_or_login">oder</string>
|
||||
<string name="learn_more">Mehr erfahren</string>
|
||||
<string name="welcome_to_mastodon">Willkommen auf Mastodon</string>
|
||||
<string name="welcome_paragraph1">Mastodon ist ein dezentrales, soziales Netzwerk. Das bedeutet, dass es nicht von einem einzigen Unternehmen kontrolliert wird. Das Netzwerk besteht aus unabhängig voneinander betriebenen Servern, die miteinander verbunden sind.</string>
|
||||
<string name="what_are_servers">Was sind Server?</string>
|
||||
<string name="welcome_paragraph2"><![CDATA[Jedes Mastodon-Konto wird auf einem Server gehostet. Jeder Server hat dabei seine eigenen Werte, Regeln und Administrator*innen. Aber egal, für welchen Server Du Dich entscheidest: Du kannst mit Leuten von anderen Servern interagieren und ihnen folgen.]]></string>
|
||||
</resources>
|
||||
|
||||
@@ -287,4 +287,10 @@
|
||||
<string name="sk_content_type_unspecified">Non spécifié</string>
|
||||
<string name="sk_settings_content_types_explanation">Permet de définir un type de contenu comme Markdown lors de la création d\'un message. Gardez à l\'esprit que toutes les instances ne le prennent pas en charge.</string>
|
||||
<string name="sk_settings_default_content_type">Type de contenu par défaut</string>
|
||||
<string name="sk_open_in_app">Ouvrir dans l\'application</string>
|
||||
<string name="sk_external_share_title">Partager avec le compte</string>
|
||||
<string name="sk_external_share_or_open_title">Partager ou ouvrir avec le compte</string>
|
||||
<string name="sk_bubble_timeline_info_banner">Ce sont les publications les plus récentes des personnes présentes dans la bulle de votre serveur Akkoma.</string>
|
||||
<string name="sk_timeline_bubble">Bulle</string>
|
||||
<string name="sk_instance_info_unavailable">Informations sur l\'instance temporairement indisponibles</string>
|
||||
</resources>
|
||||
@@ -287,4 +287,10 @@
|
||||
<string name="sk_content_type">Jenis konten</string>
|
||||
<string name="sk_content_type_unspecified">Tidak ditentukan</string>
|
||||
<string name="sk_settings_content_types_explanation">Memperbolehkan menetapkan jenis konten seperti Markdown ketika membuat kiriman. Perlu diingat bahwa tidak semua server mendukung ini.</string>
|
||||
<string name="sk_open_in_app">Buka dalam aplikasi</string>
|
||||
<string name="sk_external_share_title">Bagikan dengan akun</string>
|
||||
<string name="sk_bubble_timeline_info_banner">Ini adalah kiriman yamg paling terkini oleh orang-orang dalam gelembung server Akkoma Anda.</string>
|
||||
<string name="sk_timeline_bubble">Gelembung</string>
|
||||
<string name="sk_instance_info_unavailable">Info server sementara tidak tersedia</string>
|
||||
<string name="sk_external_share_or_open_title">Bagikan atau buka dengan akun</string>
|
||||
</resources>
|
||||
@@ -286,4 +286,10 @@
|
||||
<string name="sk_settings_default_content_type_explanation">Це дозволяє вам попередньо вибрати тип вмісту під час написання нових дописів, замінивши значення, встановлене в «Налаштуваннях постингу».</string>
|
||||
<string name="sk_content_type_markdown">Markdown</string>
|
||||
<string name="sk_settings_content_types_explanation">Дозволяє налаштувати тип вмісту, наприклад, Markdown, під час написання допису. Зауважте, що не всі сервери підтримують цю функцію.</string>
|
||||
<string name="sk_open_in_app">Відкрити у застосунку</string>
|
||||
<string name="sk_external_share_title">Поділитися через обліковий запис</string>
|
||||
<string name="sk_bubble_timeline_info_banner">Це найновіші дописи людей у бульбашці вашого сервера Akkoma.</string>
|
||||
<string name="sk_timeline_bubble">Бульбашка</string>
|
||||
<string name="sk_instance_info_unavailable">Сервер тимчасово недоступний</string>
|
||||
<string name="sk_external_share_or_open_title">Поділитися або відкрити за допомогою облікового запису</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user