Commit 113db92c authored by Thomas's avatar Thomas
Browse files

Some fixes

parent 3b1b46cb
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -729,10 +729,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt

    private void manageFilters(int position) {
        View view = binding.bottomNavView.findViewById(R.id.nav_home);
        if (position == 1) {
        boolean showExtendedFilter = true;
        if (position == BottomMenu.getPosition(bottomMenu, R.id.nav_local)) {
            view = binding.bottomNavView.findViewById(R.id.nav_local);
        } else if (position == 2) {
            showExtendedFilter = false;
        } else if (position == BottomMenu.getPosition(bottomMenu, R.id.nav_public)) {
            view = binding.bottomNavView.findViewById(R.id.nav_public);
            showExtendedFilter = false;
        }
        PopupMenu popup = new PopupMenu(new ContextThemeWrapper(BaseMainActivity.this, Helper.popupStyle()), view, Gravity.TOP);
        popup.getMenuInflater()
@@ -741,7 +744,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
        final MenuItem itemShowBoosts = menu.findItem(R.id.action_show_boosts);
        final MenuItem itemShowReplies = menu.findItem(R.id.action_show_replies);
        final MenuItem itemFilter = menu.findItem(R.id.action_filter);
        if (position > 0) {
        if (!showExtendedFilter) {
            itemShowBoosts.setVisible(false);
            itemShowReplies.setVisible(false);
        } else {
@@ -751,13 +754,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt

        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
        String show_filtered = null;
        if (position == 0) {
        if (position == BottomMenu.getPosition(bottomMenu, R.id.nav_home)) {
            show_filtered = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_HOME) + currentUserID + currentInstance, null);
        } else if (position == 1) {
        } else if (position == BottomMenu.getPosition(bottomMenu, R.id.nav_local)) {
            show_filtered = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_LOCAL) + currentUserID + currentInstance, null);
        } else if (position == 2) {
        } else if (position == BottomMenu.getPosition(bottomMenu, R.id.nav_public)) {
            show_filtered = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_PUBLIC) + currentUserID + currentInstance, null);
        }

        itemShowBoosts.setChecked(show_boosts);
        itemShowReplies.setChecked(show_replies);
        if (show_filtered != null && show_filtered.length() > 0) {
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class Account implements Serializable {
    public List<Account> getPushNotificationAccounts() {

        try {
            Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, "(" + Sqlite.COL_API + " = 'MASTODON' OR " + Sqlite.COL_API + " = 'PLEROMA') AND " + Sqlite.COL_TOKEN + " IS NOT NULL", null, null, null, Sqlite.COL_INSTANCE + " ASC", null);
            Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, "(" + Sqlite.COL_API + " = 'MASTODON' OR " + Sqlite.COL_API + " = 'PLEROMA' OR " + Sqlite.COL_API + " = 'FRIENDICA') AND " + Sqlite.COL_TOKEN + " IS NOT NULL", null, null, null, Sqlite.COL_INSTANCE + " ASC", null);
            return cursorToListUserWithOwner(c);
        } catch (Exception e) {
            return null;
+26 −24
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ public class MastodonHelper {
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
        boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
        @DrawableRes int placeholder = type == MediaAccountType.AVATAR ? R.drawable.ic_person : R.drawable.default_banner;
        if (Helper.isValidContextForGlide(view.getContext())) {
            if (account == null) {
                Glide.with(view.getContext())
                        .asDrawable()
@@ -228,6 +229,7 @@ public class MastodonHelper {
                        .into(view);
            }
        }
    }

    /**
     * Convert a date in String -> format yyyy-MM-dd HH:mm:ss
+5 −4
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ public class PinnedTimelineHelper {
            int finalI = i;
            Pinned finalPinned = pinned;
            tabStrip.getChildAt(i).setOnLongClickListener(v -> {
                switch (pinnedTimelineVisibleList.get(finalI - BOTTOM_TIMELINE_COUNT).type) {
                switch (pinnedTimelineVisibleList.get(finalI - (BOTTOM_TIMELINE_COUNT - toRemove)).type) {
                    case LIST:

                        break;
@@ -288,9 +288,9 @@ public class PinnedTimelineHelper {
     * @param position - int position of the tab
     */
    public static void tagClick(Context context, Pinned pinned, View view, ActivityMainBinding activityMainBinding, int position) {

        int toRemove = itemToRemoveInBottomMenu(context);
        PopupMenu popup = new PopupMenu(new ContextThemeWrapper(context, Helper.popupStyle()), view);
        int offSetPosition = position - BOTTOM_TIMELINE_COUNT;
        int offSetPosition = position - (BOTTOM_TIMELINE_COUNT - toRemove);
        String tag;
        TagTimeline tagTimeline = pinned.pinnedTimelines.get(offSetPosition).tagTimeline;
        if (tagTimeline == null)
@@ -503,7 +503,8 @@ public class PinnedTimelineHelper {
    public static void instanceClick(Context context, Pinned pinned, View view, ActivityMainBinding activityMainBinding, int position) {

        PopupMenu popup = new PopupMenu(new ContextThemeWrapper(context, Helper.popupStyle()), view);
        int offSetPosition = position - BOTTOM_TIMELINE_COUNT;
        int toRemove = itemToRemoveInBottomMenu(context);
        int offSetPosition = position - (BOTTOM_TIMELINE_COUNT - toRemove);
        RemoteInstance remoteInstance = pinned.pinnedTimelines.get(offSetPosition).remoteInstance;
        if (remoteInstance == null)
            return;
+3 −1
Original line number Diff line number Diff line
@@ -111,7 +111,9 @@ public class PushHelper {


    private static void registerAppWithDialog(Context context, List<Account> accounts) {

        if (accounts == null) {
            return;
        }
        List<String> distributors = UnifiedPush.getDistributors(context, new ArrayList<>());
        if (distributors.size() == 1 || !UnifiedPush.getDistributor(context).isEmpty()) {
            if (distributors.size() == 1) {
Loading