Commit d967aac9 authored by peturbg's avatar peturbg
Browse files

Merge remote-tracking branch 'master' into jordibgzashtita

parents 1659997c e69c4666
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@ android {
    defaultConfig {
        minSdk 21
        targetSdk 34
        versionCode 528
        versionName "3.31.3"
        versionCode 532
        versionName "3.32.3"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    flavorDimensions "default"
@@ -109,7 +109,7 @@ allprojects {
    }
}
dependencies {
    implementation 'org.unifiedpush.android:connector:3.0.7'
    implementation 'org.unifiedpush.android:connector:3.0.9'

    playstoreImplementation('org.unifiedpush.android:embedded-fcm-distributor:3.0.0')

+8 −1
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@
        tools:ignore="ScopedStorage" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

    <uses-feature
        android:name="android.hardware.camera"
@@ -70,6 +72,10 @@
                    android:host="*"
                    android:pathPrefix="/@"
                    android:scheme="https" />
                <data
                    android:host="*"
                    android:pathPrefix="/notes"
                    android:scheme="https" />
            </intent-filter>
        </activity>

@@ -228,6 +234,7 @@
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.MediaActivity"
            android:hardwareAccelerated="true"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@style/Transparent" />

+20 −0
Original line number Diff line number Diff line
[
  {
    "version": "3.32.3",
    "code": "532",
    "note": "Fixed:\n- Polls not displayed\n- Pagination with trends\n- Push notifications not working on some devices"
  },
  {
    "version": "3.32.2",
    "code": "531",
    "note": "Added:\n- An outline around media\n\nChanged:\n- Make username, display name in nav drawer clickable\n- Gif media not animated by default\n- Disable by default the mention to the booster when replying. Can be enabled in Settings > Compose (per account)\n\nFixed:\n- Wrong preview picture on share from another app\n- Crash when translating with MinT\n- Refresh and pagination broken for the Trending timeline\n- Fix lags / Crashes"
  },
  {
  "version": "3.32.1",
  "code": "530",
  "note": "Fixed:\n- Fix a crash on some devices\n- Hide quote button\n- Fix a layout issue with pictures in landscape\n- Fix a crash when opening the original message from a picture"
},
  {
    "version": "3.32.0",
    "code": "529",
    "note": "Added:\n- Add option to disable auto hiding compose button\n\nChanged:\n- Add more content descriptions for buttons\n- Update some buttons\n- Update navigation drawer header\n- Squeeze action buttons when needed to prevent overlapping\n\nFixed:\n- Fix crash when media are too heavy\n- Some custom emojis in bio do not render\n- Posting messages does not work on some Friendica instances\n- Fix a crash with auto-split messages\n- Fix a crash when opening conversations\n- Fix a background color issue when displaying media"
  },
  {
    "version": "3.31.3",
    "code": "528",
+47 −47
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.appcompat.widget.TooltipCompat;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
@@ -354,6 +355,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
    };
    private NetworkStateReceiver networkStateReceiver;

    SharedPreferences sharedpreferences;

    public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
        //Fetch some db values to initialize data
@@ -461,7 +464,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
    public static void manageDrawerMenu(Activity activity, NavigationView navigationView, NavHeaderMainBinding headerMainBinding) {
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
        if (headerMenuOpen) {
            headerMainBinding.ownerAccounts.setImageResource(R.drawable.ic_baseline_arrow_drop_up_24);
            headerMainBinding.ownerAccounts.setIconResource(R.drawable.ic_baseline_arrow_drop_up_24);
            new Thread(() -> {
                try {
                    List<BaseAccount> accounts = new Account(activity).getOtherAccounts();
@@ -592,7 +595,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
                                            Intent mainActivity = new Intent(activity, MainActivity.class);
                                            activity.startActivity(mainActivity);
                                            activity.finish();
                                            headerMainBinding.ownerAccounts.setImageResource(R.drawable.ic_baseline_arrow_drop_down_24);
                                            headerMainBinding.ownerAccounts.setIconResource(R.drawable.ic_accounts);
                                            return true;
                                        }
                                        return false;
@@ -624,19 +627,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
            } else if (Helper.getCurrentAccount(activity).peertube_account != null) {
                navigationView.inflateMenu(R.menu.activity_main_drawer_peertube);
            }
            headerMainBinding.ownerAccounts.setImageResource(R.drawable.ic_baseline_arrow_drop_down_24);
            headerMainBinding.ownerAccounts.setIconResource(R.drawable.ic_accounts);
            headerMenuOpen = false;
        }
    }

    public static void headerOptionInfoClick(Activity activity, NavHeaderMainBinding headerMainBinding, FragmentManager fragmentManager) {
        PopupMenu popup = new PopupMenu(activity, headerMainBinding.headerOptionInfo);
        popup.getMenuInflater()
                .inflate(R.menu.main, popup.getMenu());

        popup.setOnMenuItemClickListener(item -> {
            int itemId = item.getItemId();
            if (itemId == R.id.action_logout_account) {
    public static void headerLogoutClick(Activity activity, NavHeaderMainBinding headerMainBinding, FragmentManager fragmentManager) {
        AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(activity);
        alt_bld.setTitle(R.string.action_logout);
        if (Helper.getCurrentAccount(activity).mastodon_account != null && Helper.getCurrentAccount(activity).instance != null) {
@@ -657,14 +653,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
        alt_bld.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
        AlertDialog alert = alt_bld.create();
        alert.show();
                return true;
            } else if (itemId == R.id.action_proxy) {
                (new ProxyActivity()).show(fragmentManager, null);
                return true;
            }
            return true;
        });
        popup.show();
    }

    /**
@@ -1125,7 +1113,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
        sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
        if (!Helper.isLoggedIn(BaseMainActivity.this)) {
            //It is not, the user is redirected to the login page
            Intent myIntent = new Intent(BaseMainActivity.this, LoginActivity.class);
@@ -1464,12 +1452,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
                startActivity(intent);
            } else if (id == R.id.nav_about_instance) {
                (new InstanceActivity()).show(getSupportFragmentManager(), null);
            } else if (id == R.id.nav_instance_info) {
                (new InstanceHealthActivity()).show(getSupportFragmentManager(), null);
            }
            binding.drawerLayout.close();
            return false;
        });

        headerMainBinding.instanceInfo.setOnClickListener(v -> (new InstanceHealthActivity()).show(getSupportFragmentManager(), null));
        headerMainBinding.accountProfilePicture.setOnClickListener(v -> {
            Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class);
            Bundle args = new Bundle();
@@ -1483,13 +1472,16 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt

        });

        headerMainBinding.accountAcc.setOnClickListener(v -> headerMainBinding.changeAccount.callOnClick());
        headerMainBinding.changeAccount.setOnClickListener(v -> {
        TooltipCompat.setTooltipText(headerMainBinding.ownerAccounts, getString(R.string.manage_accounts));
        headerMainBinding.accountName.setOnClickListener(v -> headerMainBinding.ownerAccounts.performClick());
        headerMainBinding.accountAcc.setOnClickListener(v -> headerMainBinding.ownerAccounts.performClick());
        headerMainBinding.ownerAccounts.setOnClickListener(v -> {
            headerMenuOpen = !headerMenuOpen;
            manageDrawerMenu(BaseMainActivity.this, binding.navView, headerMainBinding);
        });

        headerMainBinding.headerOptionInfo.setOnClickListener(v -> headerOptionInfoClick(BaseMainActivity.this, headerMainBinding, getSupportFragmentManager()));
        TooltipCompat.setTooltipText(headerMainBinding.headerLogout,getString(R.string.action_logout));
        headerMainBinding.headerLogout.setOnClickListener(v -> headerLogoutClick(BaseMainActivity.this, headerMainBinding, getSupportFragmentManager()));

        //Toolbar search
        binding.toolbarSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@@ -1605,8 +1597,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
        fetchRecentAccounts(BaseMainActivity.this, headerMainBinding);
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (!sharedpreferences.getBoolean(getString(R.string.SET_AUTO_HIDE_COMPOSE), true) && !getFloatingVisibility())
            manageFloatingButton(true);
    }

    private void manageTopBarScrolling(Toolbar toolbar) {
        final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
        final boolean topBarScrolling = !sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_TOPBAR_SCROLLING), false);

        final AppBarLayout.LayoutParams toolbarLayoutParams = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
@@ -2029,12 +2027,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
    }

    public void manageFloatingButton(boolean display) {
        if (sharedpreferences.getBoolean(getString(R.string.SET_AUTO_HIDE_COMPOSE), true)) {
            if (display) {
                binding.compose.show();
            } else {
                binding.compose.hide();
            }
        }
    }

    @Override
    public boolean onSupportNavigateUp() {
+8 −1
Original line number Diff line number Diff line
@@ -502,6 +502,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana

    private void initializeAfterBundle(Bundle b) {
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);

        new Thread(() -> {
            if (b != null) {
                statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY);
@@ -514,6 +515,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
                if (account == null) {
                    account = Helper.getCurrentAccount(ComposeActivity.this);
                }
                boolean setMentionBooster = sharedpreferences.getBoolean(getString(R.string.SET_MENTION_BOOSTER) + account.user_id + account.instance, false);

                editMessageId = b.getString(Helper.ARG_EDIT_STATUS_ID, null);
                instance = b.getString(Helper.ARG_INSTANCE, null);
                token = b.getString(Helper.ARG_TOKEN, null);
@@ -523,7 +526,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
                } else if (visibility == null && Helper.getCurrentAccount(ComposeActivity.this) != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source != null) {
                    visibility = Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source.privacy;
                }
                if(setMentionBooster) {
                    mentionBooster = (Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
                } else {
                    mentionBooster = null;
                }
                accountMention = (Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
                //Shared elements
                sharedAttachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ATTACHMENTS);
Loading