Commit fa100ab2 authored by Thomas's avatar Thomas
Browse files

Fix #145 #146 #147 - Issue with Pleroma

parent aa35bb2b
Loading
Loading
Loading
Loading
+43 −28
Original line number Diff line number Diff line
@@ -736,18 +736,25 @@ public class ProfileActivity extends BaseActivity {
            //Get pinned instances
            reorderVM.getPinned().observe(ProfileActivity.this, pinned -> {
                boolean alreadyPinned = false;
                boolean present = true;
                if (pinned == null) {
                    pinned = new Pinned();
                    pinned.pinnedTimelines = new ArrayList<>();
                    present = false;
                } else {
                    for (PinnedTimeline pinnedTimeline : pinned.pinnedTimelines) {
                        if (pinnedTimeline.remoteInstance != null && pinnedTimeline.remoteInstance.host.compareToIgnoreCase(finalInstanceName) == 0) {
                            alreadyPinned = true;
                            break;
                        }
                    }
                }
                if (alreadyPinned) {
                    Toasty.info(ProfileActivity.this, getString(R.string.toast_instance_already_added), Toast.LENGTH_LONG).show();
                    return;
                }
                if (nodeInfo != null) {
                RemoteInstance.InstanceType instanceType;
                if (nodeInfo != null) {
                    if (nodeInfo.software.name.compareToIgnoreCase("peertube") == 0) {
                        instanceType = RemoteInstance.InstanceType.PEERTUBE;
                    } else if (nodeInfo.software.name.compareToIgnoreCase("pixelfed") == 0) {
@@ -759,6 +766,9 @@ public class ProfileActivity extends BaseActivity {
                    } else {
                        instanceType = RemoteInstance.InstanceType.MASTODON;
                    }
                } else {
                    instanceType = RemoteInstance.InstanceType.MASTODON;
                }
                RemoteInstance remoteInstance = new RemoteInstance();
                remoteInstance.type = instanceType;
                remoteInstance.host = finalInstanceName;
@@ -768,9 +778,15 @@ public class ProfileActivity extends BaseActivity {
                pinnedTimeline.type = Timeline.TimeLineEnum.REMOTE;
                pinnedTimeline.position = pinned.pinnedTimelines.size();
                pinned.pinnedTimelines.add(pinnedTimeline);
                Pinned finalPinned = pinned;
                boolean finalPresent = present;
                new Thread(() -> {
                    try {
                            new Pinned(ProfileActivity.this).updatePinned(pinned);
                        if (finalPresent) {
                            new Pinned(ProfileActivity.this).updatePinned(finalPinned);
                        } else {
                            new Pinned(ProfileActivity.this).insertPinned(finalPinned);
                        }
                        runOnUiThread(() -> {
                            Bundle b = new Bundle();
                            b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
@@ -782,7 +798,6 @@ public class ProfileActivity extends BaseActivity {
                        e.printStackTrace();
                    }
                }).start();
                }

            });
            return true;
+5 −4
Original line number Diff line number Diff line
@@ -59,11 +59,12 @@ public class TagAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

        int stat = 0;


        if (historyList != null) {
            for (History history : historyList) {
                trendsEntry.add(0, new Entry(Float.parseFloat(history.day), Float.parseFloat(history.uses)));
                stat += Integer.parseInt(history.accounts);
            }
        }
        tagViewHolder.binding.tagStats.setText(context.getString(R.string.talking_about, stat));
        LineDataSet dataTrending = new LineDataSet(trendsEntry, context.getString(R.string.trending));
        dataTrending.setColor(ContextCompat.getColor(context, R.color.cyanea_accent_reference));