Merge branch 'develop'

This commit is contained in:
Thomas 2024-01-16 17:54:54 +01:00
commit 1f2e6c4327
115 changed files with 3768 additions and 1817 deletions

View file

@ -36,6 +36,5 @@ Android version:
<!-- If you read our contributing advice -->
[ ] - I read
the [contributing page](https://codeberg.org/tom79/Fedilab/src/branch/main/CONTRIBUTING.md)
- [ ] I read the [contributing page](https://codeberg.org/tom79/Fedilab/src/branch/main/CONTRIBUTING.md)

View file

@ -22,5 +22,4 @@ labels:
<!-- If you read our contributing advice -->
[ ] - I read
the [contributing page](https://codeberg.org/tom79/Fedilab/src/branch/main/CONTRIBUTING.md)
- [ ] I read the [contributing page](https://codeberg.org/tom79/Fedilab/src/branch/main/CONTRIBUTING.md)

View file

@ -13,8 +13,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 34
versionCode 505
versionName "3.26.0"
versionCode 510
versionName "3.27.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "default"

View file

@ -1,4 +1,9 @@
[
{
"version": "3.27.0",
"code": "510",
"note": "Added:\n- Fixed top bar (default: disabled)\n- Usage frequency of tags when composing\n\nChanged:\n- Markdown support disabled by default\n\nFixed:\n- Fix crashes during interactions or when opening a new screen\n- Fix color of dialogs in Settings\n- Some minor crashes"
},
{
"version": "3.26.0",
"code": "505",

View file

@ -36,7 +36,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.database.MatrixCursor;
import android.graphics.PorterDuff;
import android.graphics.drawable.BitmapDrawable;
@ -72,8 +71,8 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
import androidx.cursoradapter.widget.CursorAdapter;
@ -81,7 +80,7 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;
import androidx.multidex.BuildConfig;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
@ -99,6 +98,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.navigation.NavigationView;
@ -163,6 +163,7 @@ import app.fedilab.android.mastodon.client.entities.api.Tag;
import app.fedilab.android.mastodon.client.entities.app.Account;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.BottomMenu;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.MutedAccounts;
import app.fedilab.android.mastodon.client.entities.app.Pinned;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
@ -222,11 +223,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
private final BroadcastReceiver broadcast_error_message = new BroadcastReceiver() {
@Override
public void onReceive(android.content.Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
if (b.getBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, false)) {
String errorMessage = b.getString(Helper.RECEIVE_ERROR_MESSAGE);
StatusDraft statusDraft = (StatusDraft) b.getSerializable(Helper.ARG_STATUS_DRAFT);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(BaseMainActivity.this).getBundle(bundleId, currentAccount, bundle -> {
if (bundle.getBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, false)) {
String errorMessage = bundle.getString(Helper.RECEIVE_ERROR_MESSAGE);
StatusDraft statusDraft = (StatusDraft) bundle.getSerializable(Helper.ARG_STATUS_DRAFT);
Snackbar snackbar = Snackbar.make(binding.getRoot(), errorMessage, 5000);
View snackbarView = snackbar.getView();
TextView textView = snackbarView.findViewById(com.google.android.material.R.id.snackbar_text);
@ -234,12 +237,20 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
snackbar
.setAction(getString(R.string.open_draft), view -> {
Intent intentCompose = new Intent(context, ComposeActivity.class);
intentCompose.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft);
Bundle args2 = new Bundle();
args2.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
new CachedBundle(BaseMainActivity.this).insertBundle(args2, currentAccount, bundleId2 -> {
Bundle bundle2 = new Bundle();
bundle2.putLong(Helper.ARG_INTENT_ID, bundleId2);
intentCompose.putExtras(bundle2);
intentCompose.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intentCompose);
});
})
.show();
}
});
}
}
};
@ -248,13 +259,15 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
private final BroadcastReceiver broadcast_data = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
if (b.getBoolean(Helper.RECEIVE_REDRAW_TOPBAR, false)) {
List<MastodonList> mastodonLists = (List<MastodonList>) b.getSerializable(Helper.RECEIVE_MASTODON_LIST);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(BaseMainActivity.this).getBundle(bundleId, currentAccount, bundle -> {
if (bundle.getBoolean(Helper.RECEIVE_REDRAW_TOPBAR, false)) {
List<MastodonList> mastodonLists = (List<MastodonList>) bundle.getSerializable(Helper.RECEIVE_MASTODON_LIST);
redrawPinned(mastodonLists);
}
if (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) {
if (bundle.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) {
bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(currentAccount, binding.bottomNavView);
if (bottomMenu != null) {
//ManageClick on bottom menu items
@ -298,17 +311,23 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
return true;
});
}
} else if (b.getBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, false)) {
} else if (bundle.getBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, false)) {
recreate();
} else if (b.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) {
Status statusSent = (Status) b.getSerializable(Helper.RECEIVE_STATUS_ACTION);
String statusEditId = b.getString(Helper.ARG_EDIT_STATUS_ID, null);
} else if (bundle.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) {
Status statusSent = (Status) bundle.getSerializable(Helper.RECEIVE_STATUS_ACTION);
String statusEditId = bundle.getString(Helper.ARG_EDIT_STATUS_ID, null);
Snackbar.make(binding.displaySnackBar, getString(R.string.message_has_been_sent), Snackbar.LENGTH_LONG)
.setAction(getString(R.string.display), view -> {
Intent intentContext = new Intent(BaseMainActivity.this, ContextActivity.class);
intentContext.putExtra(Helper.ARG_STATUS, statusSent);
Bundle args2 = new Bundle();
args2.putSerializable(Helper.ARG_STATUS, statusSent);
new CachedBundle(BaseMainActivity.this).insertBundle(args2, currentAccount, bundleId2 -> {
Bundle bundle2 = new Bundle();
bundle2.putLong(Helper.ARG_INTENT_ID, bundleId2);
intentContext.putExtras(bundle2);
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentContext);
});
})
.show();
//The message was edited, we need to update the timeline
@ -330,6 +349,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
sendAction(context, Helper.ARG_STATUS_UPDATED, statusSent, null);
}
}
});
}
}
};
@ -359,6 +379,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
//Delete cache older than 7 days
new StatusCache(activity).deleteForAllAccountAfter7Days();
new TimelineCacheLogs(activity).deleteForAllAccountAfter7Days();
new CachedBundle(activity).deleteOldIntent();
} catch (DBException e) {
e.printStackTrace();
}
@ -659,16 +680,26 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
Status status = (Status) bundle.getSerializable(Helper.INTENT_TARGETED_STATUS);
if (account != null) {
Intent intentAccount = new Intent(activity, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intentAccount.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundleCached = new Bundle();
bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId);
intentAccount.putExtras(bundleCached);
intentAccount.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intentAccount);
});
} else if (status != null) {
Intent intentContext = new Intent(activity, ContextActivity.class);
intentContext.putExtra(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundleCached = new Bundle();
bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId);
intentContext.putExtras(bundleCached);
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intentContext);
});
}
}
final Handler handler = new Handler();
@ -693,12 +724,17 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
}
viewPager.setCurrentItem(position);
}
Bundle b = new Bundle();
b.putBoolean(ARG_REFRESH_NOTFICATION, true);
Bundle args = new Bundle();
args.putBoolean(ARG_REFRESH_NOTFICATION, true);
Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION);
intentBC.setPackage(BuildConfig.APPLICATION_ID);
intentBC.putExtras(b);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBC.putExtras(bundle);
activity.sendBroadcast(intentBC);
});
}
}, 1000);
intent.removeExtra(Helper.INTENT_ACTION);
@ -774,9 +810,15 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
public void federatedStatus(Status status) {
if (status != null) {
Intent intent = new Intent(activity, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
});
}
}
@ -1013,9 +1055,15 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
public void federatedStatus(Status status) {
if (status != null) {
Intent intent = new Intent(activity, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
});
} else {
Toasty.error(activity, activity.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
}
@ -1035,11 +1083,15 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
public void federatedAccount(app.fedilab.android.mastodon.client.entities.api.Account account) {
if (account != null) {
Intent intent = new Intent(activity, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
});
} else {
Toasty.error(activity, activity.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
}
@ -1327,6 +1379,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
}
manageTopBarScrolling(binding.toolbar);
rateThisApp();
binding.compose.setOnClickListener(v -> startActivity(new Intent(this, ComposeActivity.class)));
@ -1418,12 +1471,17 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
headerMainBinding.instanceInfo.setOnClickListener(v -> (new InstanceHealthActivity()).show(getSupportFragmentManager(), null));
headerMainBinding.accountProfilePicture.setOnClickListener(v -> {
Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, currentAccount.mastodon_account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, currentAccount.mastodon_account);
new CachedBundle(BaseMainActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent);
});
});
headerMainBinding.accountAcc.setOnClickListener(v -> headerMainBinding.changeAccount.callOnClick());
headerMainBinding.changeAccount.setOnClickListener(v -> {
headerMenuOpen = !headerMenuOpen;
@ -1545,6 +1603,23 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
fetchRecentAccounts(BaseMainActivity.this, headerMainBinding);
}
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();
int scrollFlags = toolbarLayoutParams.getScrollFlags();
if (topBarScrolling) {
scrollFlags |= AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL;
} else {
scrollFlags &= ~AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL;
}
toolbarLayoutParams.setScrollFlags(scrollFlags);
}
private void manageFilters(int position) {
View view = binding.bottomNavView.findViewById(R.id.nav_home);
boolean showExtendedFilter = true;
@ -1605,8 +1680,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
if (binding.viewPager.getAdapter() != null) {
int tabPosition = binding.tabLayout.getSelectedTabPosition();
Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, Math.max(tabPosition, 0));
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
if (fragment instanceof FragmentMastodonTimeline fragmentMastodonTimeline && fragment.isVisible()) {
fragmentMastodonTimeline.refreshAllAdapters();
}
}
@ -1901,14 +1975,11 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
int position = binding.tabLayout.getSelectedTabPosition();
if (binding.viewPager.getAdapter() != null) {
Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, Math.max(position, 0));
if (fragment instanceof FragmentMastodonTimeline) {
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
if (fragment instanceof FragmentMastodonTimeline fragmentMastodonTimeline) {
fragmentMastodonTimeline.scrollToTop();
} else if (fragment instanceof FragmentMastodonConversation) {
FragmentMastodonConversation fragmentMastodonConversation = ((FragmentMastodonConversation) fragment);
} else if (fragment instanceof FragmentMastodonConversation fragmentMastodonConversation) {
fragmentMastodonConversation.scrollToTop();
} else if (fragment instanceof FragmentNotificationContainer) {
FragmentNotificationContainer fragmentNotificationContainer = ((FragmentNotificationContainer) fragment);
} else if (fragment instanceof FragmentNotificationContainer fragmentNotificationContainer) {
fragmentNotificationContainer.scrollToTop();
}
}

View file

@ -15,6 +15,8 @@ package app.fedilab.android.activities;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
@ -26,7 +28,6 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.ViewModelProvider;
import java.util.ArrayList;
@ -40,6 +41,7 @@ import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.CrossActionHelper;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -119,11 +121,15 @@ public class AboutActivity extends BaseBarActivity {
binding.accountUn.setText(account.acct);
binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AboutActivity.this, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(AboutActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent);
});
});
AccountsVM accountsVM = new ViewModelProvider(AboutActivity.this).get(AccountsVM.class);
List<String> ids = new ArrayList<>();
ids.add(account.id);

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Activity;
import android.graphics.PorterDuff;
import android.os.Bundle;
@ -35,6 +37,7 @@ import app.fedilab.android.databinding.ActivityAdminReportBinding;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminReport;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.ThemeHelper;
import app.fedilab.android.mastodon.ui.drawer.StatusReportAdapter;
@ -48,6 +51,7 @@ public class AccountReportActivity extends BaseBarActivity {
private AdminReport report;
private ActivityAdminReportBinding binding;
private AdminVM adminVM;
private AdminAccount targeted_account;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -61,12 +65,22 @@ public class AccountReportActivity extends BaseBarActivity {
}
report = null;
AdminAccount targeted_account = null;
Bundle b = getIntent().getExtras();
if (b != null) {
account_id = b.getString(Helper.ARG_ACCOUNT_ID, null);
targeted_account = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT);
report = (AdminReport) b.getSerializable(Helper.ARG_REPORT);
targeted_account = null;
Bundle args = getIntent().getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(AccountReportActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
account_id = bundle.getString(Helper.ARG_ACCOUNT_ID, null);
targeted_account = (AdminAccount) bundle.getSerializable(Helper.ARG_ACCOUNT);
report = (AdminReport) bundle.getSerializable(Helper.ARG_REPORT);
}
binding.allow.getBackground().setColorFilter(ThemeHelper.getAttColor(this, R.attr.colorPrimary), PorterDuff.Mode.MULTIPLY);
@ -103,7 +117,6 @@ public class AccountReportActivity extends BaseBarActivity {
account_id = targeted_account.username;
}
}
private void fillReport(AdminAccount accountAdmin, actionType type) {

View file

@ -100,24 +100,12 @@ public class ActionActivity extends BaseBarActivity {
}
switch (type) {
case MUTED_TIMELINE:
setTitle(R.string.muted_menu);
break;
case FAVOURITE_TIMELINE:
setTitle(R.string.favourite);
break;
case BLOCKED_TIMELINE:
setTitle(R.string.blocked_menu);
break;
case BOOKMARK_TIMELINE:
setTitle(R.string.bookmarks);
break;
case BLOCKED_DOMAIN_TIMELINE:
setTitle(R.string.blocked_domains);
break;
case MUTED_TIMELINE_HOME:
setTitle(R.string.muted_menu_home);
break;
case MUTED_TIMELINE -> setTitle(R.string.muted_menu);
case FAVOURITE_TIMELINE -> setTitle(R.string.favourite);
case BLOCKED_TIMELINE -> setTitle(R.string.blocked_menu);
case BOOKMARK_TIMELINE -> setTitle(R.string.bookmarks);
case BLOCKED_DOMAIN_TIMELINE -> setTitle(R.string.blocked_domains);
case MUTED_TIMELINE_HOME -> setTitle(R.string.muted_menu_home);
}
}

View file

@ -39,7 +39,6 @@ import org.conscrypt.Conscrypt;
import java.security.Security;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.ThemeHelper;

View file

@ -50,7 +50,6 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.work.Data;
@ -88,6 +87,7 @@ import app.fedilab.android.mastodon.client.entities.api.Mention;
import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.DividerDecorationSimple;
@ -120,9 +120,13 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(android.content.Context context, Intent intent) {
String imgpath = intent.getStringExtra("imgpath");
float focusX = intent.getFloatExtra("focusX", -2);
float focusY = intent.getFloatExtra("focusY", -2);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(ComposeActivity.this).getBundle(bundleId, currentAccount, bundle -> {
String imgpath = bundle.getString("imgpath");
float focusX = bundle.getFloat("focusX", -2);
float focusY = bundle.getFloat("focusY", -2);
if (imgpath != null) {
int position = 0;
for (Status status : statusList) {
@ -132,7 +136,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
if (focusX != -2) {
attachment.focus = focusX + "," + focusY;
}
composeAdapter.notifyItemChanged(position);
break;
}
@ -141,6 +144,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
position++;
}
}
});
}
}
};
private boolean promptSaveDraft;
@ -484,6 +489,21 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
statusList = new ArrayList<>();
Bundle b = getIntent().getExtras();
if (b != null) {
long bundleId = b.getLong(Helper.ARG_INTENT_ID, -1);
if (bundleId != -1) {
new CachedBundle(ComposeActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(b);
}
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle b) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
new Thread(() -> {
if (b != null) {
statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY);
statusQuoted = (Status) b.getSerializable(Helper.ARG_QUOTED_MESSAGE);
@ -515,7 +535,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
sharedDescription = b.getString(Helper.ARG_SHARE_DESCRIPTION, null);
shareURL = b.getString(Helper.ARG_SHARE_URL, null);
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
if (sharedContent != null && shareURL != null && sharedContent.compareTo(shareURL) == 0) {
sharedContent = "";
}
@ -774,8 +795,12 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
}
}
});
};
mainHandler.post(myRunnable);
}).start();
}
@Override
public void onItemDraftAdded(int position, String initialContent) {
Status status = new Status();

View file

@ -30,10 +30,13 @@ import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import com.google.android.material.appbar.AppBarLayout;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
@ -44,6 +47,7 @@ import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityConversationBinding;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
@ -64,12 +68,13 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
private Status focusedStatus;
private String focusedStatusURI;
private boolean checkRemotely;
private ActivityConversationBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityConversationBinding binding = ActivityConversationBinding.inflate(getLayoutInflater());
binding = ActivityConversationBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar();
@ -86,14 +91,25 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
Bundle b = getIntent().getExtras();
manageTopBarScrolling(binding.toolbar, sharedpreferences);
displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false);
focusedStatus = null; // or other values
if (b != null) {
focusedStatus = (Status) b.getSerializable(Helper.ARG_STATUS);
remote_instance = b.getString(Helper.ARG_REMOTE_INSTANCE, null);
focusedStatusURI = b.getString(Helper.ARG_FOCUSED_STATUS_URI, null);
Bundle args = getIntent().getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(ContextActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
focusedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
remote_instance = bundle.getString(Helper.ARG_REMOTE_INSTANCE, null);
focusedStatusURI = bundle.getString(Helper.ARG_FOCUSED_STATUS_URI, null);
}
if (focusedStatus == null || currentAccount == null || currentAccount.mastodon_account == null) {
finish();
@ -102,7 +118,7 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
if (focusedStatusURI == null && remote_instance == null) {
focusedStatusURI = focusedStatus.uri;
}
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
checkRemotely = sharedpreferences.getBoolean(getString(R.string.SET_CONVERSATION_REMOTELY), false);
if (!checkRemotely) {
@ -111,7 +127,11 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
loadRemotelyConversation(true);
invalidateOptionsMenu();
}
if(currentAccount != null) {
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
}
}
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
@ -119,10 +139,29 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
outState.clear();
}
private void manageTopBarScrolling(Toolbar toolbar, SharedPreferences sharedpreferences) {
final boolean topBarScrolling = !sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_TOPBAR_SCROLLING), false);
final AppBarLayout.LayoutParams toolbarLayoutParams = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
int scrollFlags = toolbarLayoutParams.getScrollFlags();
if (topBarScrolling) {
scrollFlags |= AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL;
} else {
scrollFlags &= ~AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL;
}
toolbarLayoutParams.setScrollFlags(scrollFlags);
}
private void loadLocalConversation() {
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, focusedStatus);
args.putString(Helper.ARG_REMOTE_INSTANCE, remote_instance);
new CachedBundle(ContextActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_STATUS, focusedStatus);
bundle.putString(Helper.ARG_REMOTE_INSTANCE, remote_instance);
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
FragmentMastodonContext fragmentMastodonContext = new FragmentMastodonContext();
fragmentMastodonContext.firstMessage = this;
currentFragment = Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_content_main, fragmentMastodonContext, bundle, null, null);
@ -151,6 +190,7 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
}
});
}
});
}
@Override
@ -245,13 +285,17 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
String finalInstance = instance;
statusesVM.getStatus(instance, null, remoteId).observe(ContextActivity.this, status -> {
if (status != null) {
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
args.putString(Helper.ARG_REMOTE_INSTANCE, finalInstance);
args.putString(Helper.ARG_FOCUSED_STATUS_URI, focusedStatusURI);
new CachedBundle(ContextActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_STATUS, status);
bundle.putString(Helper.ARG_REMOTE_INSTANCE, finalInstance);
bundle.putString(Helper.ARG_FOCUSED_STATUS_URI, focusedStatusURI);
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
FragmentMastodonContext fragmentMastodonContext = new FragmentMastodonContext();
fragmentMastodonContext.firstMessage = ContextActivity.this;
currentFragment = Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_content_main, fragmentMastodonContext, bundle, null, null);
});
} else {
loadLocalConversation();
}
@ -293,11 +337,17 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
statusesVM.getStatus(instance, null, remoteId).observe(ContextActivity.this, status -> {
if (status != null) {
Intent intentContext = new Intent(ContextActivity.this, ContextActivity.class);
intentContext.putExtra(Helper.ARG_STATUS, status);
intentContext.putExtra(Helper.ARG_FOCUSED_STATUS_URI, focusedStatusURI);
intentContext.putExtra(Helper.ARG_REMOTE_INSTANCE, finalInstance);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
args.putString(Helper.ARG_FOCUSED_STATUS_URI, focusedStatusURI);
args.putString(Helper.ARG_REMOTE_INSTANCE, finalInstance);
new CachedBundle(ContextActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentContext.putExtras(bundle);
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentContext);
});
} else {
Toasty.warning(ContextActivity.this, getString(R.string.toast_error_fetch_message), Toasty.LENGTH_SHORT).show();
}

View file

@ -37,6 +37,7 @@ import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Emoji;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.api.Tag;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.customsharing.CustomSharingAsyncTask;
import app.fedilab.android.mastodon.helper.customsharing.CustomSharingResponse;
@ -65,23 +66,34 @@ public class CustomSharingActivity extends BaseBarActivity implements OnCustomSh
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(CustomSharingActivity.this);
binding = ActivityCustomSharingBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
Bundle b = getIntent().getExtras();
Bundle args = getIntent().getExtras();
status = null;
if (b != null) {
status = (Status) b.getSerializable(Helper.ARG_STATUS);
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(CustomSharingActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}
if (status == null) {
finish();
return;
}
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(CustomSharingActivity.this);
bundle_creator = status.account.acct;
bundle_url = status.url;
bundle_id = status.uri;

View file

@ -39,6 +39,7 @@ import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityDirectMessageBinding;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
@ -71,31 +72,48 @@ public class DirectMessageActivity extends BaseActivity implements FragmentMasto
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
Bundle b = getIntent().getExtras();
Bundle args = getIntent().getExtras();
displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false);
Status focusedStatus = null; // or other values
if (b != null) {
focusedStatus = (Status) b.getSerializable(Helper.ARG_STATUS);
remote_instance = b.getString(Helper.ARG_REMOTE_INSTANCE, null);
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(DirectMessageActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
Status focusedStatus = null; // or other values
if (bundle != null) {
focusedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
remote_instance = bundle.getString(Helper.ARG_REMOTE_INSTANCE, null);
}
if (focusedStatus == null || currentAccount == null || currentAccount.mastodon_account == null) {
finish();
return;
}
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_STATUS, focusedStatus);
bundle.putString(Helper.ARG_REMOTE_INSTANCE, remote_instance);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, focusedStatus);
args.putString(Helper.ARG_REMOTE_INSTANCE, remote_instance);
Status finalFocusedStatus = focusedStatus;
new CachedBundle(DirectMessageActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle args2 = new Bundle();
args2.putLong(Helper.ARG_INTENT_ID, bundleId);
FragmentMastodonDirectMessage FragmentMastodonDirectMessage = new FragmentMastodonDirectMessage();
FragmentMastodonDirectMessage.firstMessage = this;
currentFragment = (FragmentMastodonDirectMessage) Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_content_main, FragmentMastodonDirectMessage, bundle, null, null);
currentFragment = (FragmentMastodonDirectMessage) Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_content_main, FragmentMastodonDirectMessage, args2, null, null);
StatusesVM timelinesVM = new ViewModelProvider(DirectMessageActivity.this).get(StatusesVM.class);
timelinesVM.getStatus(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, focusedStatus.id).observe(DirectMessageActivity.this, status -> {
timelinesVM.getStatus(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, finalFocusedStatus.id).observe(DirectMessageActivity.this, status -> {
if (status != null) {
StatusCache statusCache = new StatusCache();
statusCache.instance = BaseMainActivity.currentInstance;
@ -116,8 +134,9 @@ public class DirectMessageActivity extends BaseActivity implements FragmentMasto
}).start();
}
});
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {

View file

@ -33,7 +33,6 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider;
import com.bumptech.glide.Glide;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textfield.TextInputEditText;
@ -50,6 +49,7 @@ import app.fedilab.android.databinding.AccountFieldItemBinding;
import app.fedilab.android.databinding.ActivityEditProfileBinding;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Field;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -259,13 +259,18 @@ public class EditProfileActivity extends BaseBarActivity {
}
private void sendBroadCast(Account account) {
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_PROFILE, true);
b.putSerializable(Helper.ARG_ACCOUNT, account);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_PROFILE, true);
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(EditProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
}
private Intent prepareIntent() {

View file

@ -40,7 +40,6 @@ import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityFollowedTagsBinding;
import app.fedilab.android.databinding.PopupAddFollowedTagtBinding;
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
import app.fedilab.android.mastodon.client.entities.api.Tag;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper;

View file

@ -29,7 +29,6 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList;
@ -42,6 +41,7 @@ import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityHashtagBinding;
import app.fedilab.android.mastodon.client.entities.api.Filter;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Pinned;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
@ -70,20 +70,31 @@ public class HashTagActivity extends BaseActivity {
private Filter.KeywordsAttributes keyword;
private PinnedTimeline pinnedTimeline;
private Pinned pinned;
private ActivityHashtagBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityHashtagBinding binding = ActivityHashtagBinding.inflate(getLayoutInflater());
binding = ActivityHashtagBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
Bundle b = getIntent().getExtras();
if (b != null) {
tag = b.getString(Helper.ARG_SEARCH_KEYWORD, null);
Bundle args = getIntent().getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(HashTagActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
if (tag == null)
}
private void initializeAfterBundle(Bundle bundle) {
if( bundle != null) {
tag = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null);
}
if (tag == null) {
finish();
return;
}
pinnedTag = null;
followedTag = null;
mutedTag = null;
@ -147,10 +158,10 @@ public class HashTagActivity extends BaseActivity {
invalidateOptionsMenu();
}
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TAG);
bundle.putString(Helper.ARG_SEARCH_KEYWORD, tag);
Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_tags, new FragmentMastodonTimeline(), bundle, null, null);
Bundle bundleFragment = new Bundle();
bundleFragment.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TAG);
bundleFragment.putString(Helper.ARG_SEARCH_KEYWORD, tag);
Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_tags, new FragmentMastodonTimeline(), bundleFragment, null, null);
binding.compose.setOnClickListener(v -> {
Intent intentToot = new Intent(HashTagActivity.this, ComposeActivity.class);
StatusDraft statusDraft = new StatusDraft();
@ -159,11 +170,15 @@ public class HashTagActivity extends BaseActivity {
List<Status> statuses = new ArrayList<>();
statuses.add(status);
statusDraft.statusDraftList = statuses;
Bundle _b = new Bundle();
_b.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
intentToot.putExtras(_b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
new CachedBundle(HashTagActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundleCached = new Bundle();
bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId);
intentToot.putExtras(bundleCached);
startActivity(intentToot);
});
});
}
@Override
@ -189,14 +204,19 @@ public class HashTagActivity extends BaseActivity {
}
pinnedTag = false;
invalidateOptionsMenu();
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(HashTagActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
dialog.dismiss();
});
});
unpinConfirm.show();
} else {
new Thread(() -> {
@ -244,12 +264,16 @@ public class HashTagActivity extends BaseActivity {
} else {
new Pinned(HashTagActivity.this).insertPinned(pinned);
}
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(HashTagActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
pinnedTag = true;
invalidateOptionsMenu();
} catch (DBException e) {

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
@ -32,7 +34,6 @@ import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -46,12 +47,12 @@ import java.util.Objects;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityListBinding;
import app.fedilab.android.databinding.PopupAddListBinding;
import app.fedilab.android.databinding.PopupManageAccountsListBinding;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Pinned;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
@ -176,7 +177,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
timelinesVM.getAccountsInList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mastodonList.id, null, null, 0)
.observe(MastodonListActivity.this, accounts -> {
if (accounts != null && accounts.size() > 0) {
accountsVM.muteAccountsHome(MainActivity.currentAccount, accounts);
accountsVM.muteAccountsHome(currentAccount, accounts);
}
});
dialog.dismiss();
@ -308,14 +309,18 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
} else {
binding.notContent.setVisibility(View.GONE);
}
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList);
intentBD.putExtras(b);
args.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList);
new CachedBundle(MastodonListActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
});
alt_bld.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
AlertDialog alert = alt_bld.create();
alert.show();
@ -344,14 +349,18 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
} else {
Toasty.error(MastodonListActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
}
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList);
intentBD.putExtras(b);
args.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList);
new CachedBundle(MastodonListActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
});
dialog.dismiss();
} else {
popupAddListBinding.addList.setError(getString(R.string.not_valid_list_name));
@ -393,12 +402,16 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
new Thread(() -> {
try {
new Pinned(MastodonListActivity.this).updatePinned(pinned);
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(MastodonListActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
} catch (
DBException e) {
e.printStackTrace();

View file

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.activities;
* see <http://www.gnu.org/licenses>. */
import static android.util.Patterns.WEB_URL;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.Manifest;
import android.app.DownloadManager;
@ -63,6 +64,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityMediaPagerBinding;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MediaHelper;
import app.fedilab.android.mastodon.helper.TranslateHelper;
@ -82,10 +84,10 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
private final BroadcastReceiver onDownloadComplete = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
if (downloadID == id) {
DownloadManager manager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
assert manager != null;
Uri uri = manager.getUriForDownloadedFile(downloadID);
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
@ -124,13 +126,26 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
fullscreen = false;
flags = getWindow().getDecorView().getSystemUiVisibility();
Bundle b = getIntent().getExtras();
if (b != null) {
mediaPosition = b.getInt(Helper.ARG_MEDIA_POSITION, 1);
attachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ARRAY);
mediaFromProfile = b.getBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, false);
status = (Status) b.getSerializable(Helper.ARG_STATUS);
Bundle args = getIntent().getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(MediaActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
mediaPosition = bundle.getInt(Helper.ARG_MEDIA_POSITION, 1);
attachments = (ArrayList<Attachment>) bundle.getSerializable(Helper.ARG_MEDIA_ARRAY);
mediaFromProfile = bundle.getBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, false);
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}
if (mediaFromProfile && FragmentMediaProfile.mediaAttachmentProfile != null) {
attachments = new ArrayList<>();
attachments.addAll(FragmentMediaProfile.mediaAttachmentProfile);
@ -146,7 +161,6 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
}
setTitle("");
ScreenSlidePagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
binding.mediaViewpager.setAdapter(mPagerAdapter);
binding.mediaViewpager.setSaveEnabled(false);
@ -239,6 +253,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
setFullscreen(true);
}
private Spannable linkify(Context context, String content) {
if (content == null) {
return new SpannableString("");
@ -300,7 +315,8 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
finish();
try {
ActivityCompat.finishAfterTransition(MediaActivity.this);
}catch (Exception ignored){}
} catch (Exception ignored) {
}
return true;
} else if (item.getItemId() == R.id.action_save) {
int position = binding.mediaViewpager.getCurrentItem();

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@ -23,7 +25,6 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.ViewModelProvider;
import java.util.ArrayList;
@ -34,6 +35,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityPartnershipBinding;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.CrossActionHelper;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -78,11 +80,15 @@ public class PartnerShipActivity extends BaseBarActivity {
binding.accountUn.setText(account.acct);
binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(PartnerShipActivity.this, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(PartnerShipActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent);
});
});
AccountsVM accountsVM = new ViewModelProvider(PartnerShipActivity.this).get(AccountsVM.class);
List<String> ids = new ArrayList<>();
ids.add(account.id);

View file

@ -51,11 +51,9 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -90,6 +88,7 @@ import app.fedilab.android.mastodon.client.entities.api.Field;
import app.fedilab.android.mastodon.client.entities.api.IdentityProof;
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Languages;
import app.fedilab.android.mastodon.client.entities.app.Pinned;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
@ -133,14 +132,17 @@ public class ProfileActivity extends BaseActivity {
private final BroadcastReceiver broadcast_data = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
Account accountReceived = (Account) b.getSerializable(Helper.ARG_ACCOUNT);
if (b.getBoolean(Helper.RECEIVE_REDRAW_PROFILE, false) && accountReceived != null) {
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(ProfileActivity.this).getBundle(bundleId, currentAccount, bundle -> {
Account accountReceived = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
if (bundle.getBoolean(Helper.RECEIVE_REDRAW_PROFILE, false) && accountReceived != null) {
if (account != null && accountReceived.id != null && account.id != null && accountReceived.id.equalsIgnoreCase(account.id)) {
initializeView(accountReceived);
}
}
});
}
}
};
@ -154,17 +156,11 @@ public class ProfileActivity extends BaseActivity {
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar();
Bundle b = getIntent().getExtras();
Bundle args = getIntent().getExtras();
binding.accountFollow.setEnabled(false);
checkRemotely = false;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
homeMuted = false;
if (b != null) {
account = (Account) b.getSerializable(Helper.ARG_ACCOUNT);
account_id = b.getString(Helper.ARG_USER_ID, null);
mention_str = b.getString(Helper.ARG_MENTION, null);
checkRemotely = b.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
if (!checkRemotely) {
checkRemotely = sharedpreferences.getBoolean(getString(R.string.SET_PROFILE_REMOTELY), false);
}
@ -181,6 +177,22 @@ public class ProfileActivity extends BaseActivity {
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
accountsVM = new ViewModelProvider(ProfileActivity.this).get(AccountsVM.class);
homeMuted = false;
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(ProfileActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
account_id = bundle.getString(Helper.ARG_USER_ID, null);
mention_str = bundle.getString(Helper.ARG_MENTION, null);
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
if (account != null) {
initializeView(account);
} else if (account_id != null) {
@ -443,13 +455,17 @@ public class ProfileActivity extends BaseActivity {
}
binding.openRemoteProfile.setOnClickListener(v -> {
Intent intent = new Intent(ProfileActivity.this, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
b.putSerializable(Helper.ARG_CHECK_REMOTELY, true);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
args.putSerializable(Helper.ARG_CHECK_REMOTELY, true);
new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent);
finish();
});
});
//Fields for profile
List<Field> fields = account.fields;
if (fields != null && fields.size() > 0) {
@ -484,7 +500,7 @@ public class ProfileActivity extends BaseActivity {
binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(ProfileActivity.this, MediaActivity.class);
Bundle b = new Bundle();
Bundle args = new Bundle();
Attachment attachment = new Attachment();
attachment.description = account.acct;
attachment.preview_url = account.avatar;
@ -493,14 +509,18 @@ public class ProfileActivity extends BaseActivity {
attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
args.putInt(Helper.ARG_MEDIA_POSITION, 1);
new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(ProfileActivity.this, binding.accountPp, attachment.url);
// start the new activity
startActivity(intent, options.toBundle());
});
});
binding.accountFollow.setOnClickListener(v -> {
@ -627,12 +647,16 @@ public class ProfileActivity extends BaseActivity {
notificationsRelatedAccountsBinding.acc.setText(account.username);
notificationsRelatedAccountsBinding.relatedAccountContainer.setOnClickListener(v -> {
Intent intent = new Intent(ProfileActivity.this, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent);
});
});
binding.relatedAccounts.addView(notificationsRelatedAccountsBinding.getRoot());
}
binding.familiarFollowers.setVisibility(View.VISIBLE);
@ -897,13 +921,17 @@ public class ProfileActivity extends BaseActivity {
new Pinned(ProfileActivity.this).insertPinned(finalPinned);
}
runOnUiThread(() -> {
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
});
} catch (DBException e) {
e.printStackTrace();
}
@ -1022,11 +1050,15 @@ public class ProfileActivity extends BaseActivity {
return true;
} else if (itemId == R.id.action_direct_message) {
Intent intent = new Intent(ProfileActivity.this, ComposeActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT_MENTION, account);
b.putString(Helper.ARG_VISIBILITY, "direct");
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT_MENTION, account);
args.putString(Helper.ARG_VISIBILITY, "direct");
new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent);
});
return true;
} else if (itemId == R.id.action_add_to_list) {
TimelinesVM timelinesVM = new ViewModelProvider(ProfileActivity.this).get(TimelinesVM.class);
@ -1109,12 +1141,15 @@ public class ProfileActivity extends BaseActivity {
return true;
} else if (itemId == R.id.action_mention) {
Intent intent;
Bundle b;
intent = new Intent(ProfileActivity.this, ComposeActivity.class);
b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT_MENTION, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT_MENTION, account);
new CachedBundle(ProfileActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent);
});
return true;
} else if (itemId == R.id.action_mute) {
AlertDialog.Builder builderInner;

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
@ -31,7 +33,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -49,6 +50,7 @@ import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityReorderTabsBinding;
import app.fedilab.android.databinding.PopupSearchInstanceBinding;
import app.fedilab.android.mastodon.client.entities.app.BottomMenu;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.InstanceSocial;
import app.fedilab.android.mastodon.client.entities.app.Pinned;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
@ -285,13 +287,17 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
}
}
reorderTabAdapter.notifyItemInserted(pinned.pinnedTimelines.size());
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(ReorderTimelinesActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
});
} else {
runOnUiThread(() -> Toasty.warning(ReorderTimelinesActivity.this, getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show());
}
@ -374,20 +380,29 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
super.onPause();
if (changes) {
//Update menu
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(ReorderTimelinesActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
}
if (bottomChanges) {
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_BOTTOM, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_REDRAW_BOTTOM, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(ReorderTimelinesActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
});
}
}

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.activities;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
@ -36,6 +38,7 @@ import app.fedilab.android.databinding.ActivityReportBinding;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.drawer.RulesAdapter;
@ -70,11 +73,21 @@ public class ReportActivity extends BaseBarActivity {
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Bundle args = getIntent().getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
if (bundleId != -1) {
new CachedBundle(ReportActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(args);
}
}
}
Bundle b = getIntent().getExtras();
if (b != null) {
status = (Status) b.getSerializable(Helper.ARG_STATUS);
account = (Account) b.getSerializable(Helper.ARG_ACCOUNT);
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}
if (account == null && status != null) {
account = status.account;
@ -139,7 +152,6 @@ public class ReportActivity extends BaseBarActivity {
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
@ -222,21 +234,25 @@ public class ReportActivity extends BaseBarActivity {
private void switchToSpam() {
fragment = new FragmentMastodonTimeline();
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
args.putSerializable(Helper.ARG_ACCOUNT, account);
//Set to display statuses with less options
bundle.putBoolean(Helper.ARG_MINIFIED, true);
args.putBoolean(Helper.ARG_MINIFIED, true);
if (status != null) {
status.isChecked = true;
bundle.putSerializable(Helper.ARG_STATUS_REPORT, status);
args.putSerializable(Helper.ARG_STATUS_REPORT, status);
}
new CachedBundle(ReportActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
fragment.setArguments(bundle);
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fram_spam_container, fragment);
fragmentTransaction.commit();
});
binding.actionButton.setText(R.string.next);
binding.actionButton.setOnClickListener(v -> {
@ -248,22 +264,25 @@ public class ReportActivity extends BaseBarActivity {
private void switchToSomethingElse() {
fragment = new FragmentMastodonTimeline();
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
args.putSerializable(Helper.ARG_ACCOUNT, account);
//Set to display statuses with less options
bundle.putBoolean(Helper.ARG_MINIFIED, true);
args.putBoolean(Helper.ARG_MINIFIED, true);
if (status != null) {
status.isChecked = true;
bundle.putSerializable(Helper.ARG_STATUS_REPORT, status);
args.putSerializable(Helper.ARG_STATUS_REPORT, status);
}
new CachedBundle(ReportActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
fragment.setArguments(bundle);
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fram_se_container, fragment);
fragmentTransaction.commit();
});
binding.actionButton.setText(R.string.next);
binding.actionButton.setOnClickListener(v -> {
if (category == null) {

View file

@ -114,14 +114,11 @@ public class SearchResultTabActivity extends BaseBarActivity {
Fragment fragment;
if (binding.searchViewpager.getAdapter() != null) {
fragment = (Fragment) binding.searchViewpager.getAdapter().instantiateItem(binding.searchViewpager, tab.getPosition());
if (fragment instanceof FragmentMastodonAccount) {
FragmentMastodonAccount fragmentMastodonAccount = ((FragmentMastodonAccount) fragment);
if (fragment instanceof FragmentMastodonAccount fragmentMastodonAccount) {
fragmentMastodonAccount.scrollToTop();
} else if (fragment instanceof FragmentMastodonTimeline) {
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
} else if (fragment instanceof FragmentMastodonTimeline fragmentMastodonTimeline) {
fragmentMastodonTimeline.scrollToTop();
} else if (fragment instanceof FragmentMastodonTag) {
FragmentMastodonTag fragmentMastodonTag = ((FragmentMastodonTag) fragment);
} else if (fragment instanceof FragmentMastodonTag fragmentMastodonTag) {
fragmentMastodonTag.scrollToTop();
}
}
@ -136,6 +133,9 @@ public class SearchResultTabActivity extends BaseBarActivity {
inflater.inflate(R.menu.menu_search, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
if(searchView == null) {
return true;
}
if (search != null) {
searchView.setQuery(search, false);
}
@ -302,29 +302,34 @@ public class SearchResultTabActivity extends BaseBarActivity {
@Override
public Fragment getItem(int position) {
Bundle bundle = new Bundle();
FragmentMastodonTimeline fragmentMastodonTimeline;
switch (position) {
case 0:
case 0 -> {
FragmentMastodonTag fragmentMastodonTag = new FragmentMastodonTag();
bundle.putString(Helper.ARG_SEARCH_KEYWORD, search);
fragmentMastodonTag.setArguments(bundle);
return fragmentMastodonTag;
case 1:
}
case 1 -> {
FragmentMastodonAccount fragmentMastodonAccount = new FragmentMastodonAccount();
bundle.putString(Helper.ARG_SEARCH_KEYWORD, search);
fragmentMastodonAccount.setArguments(bundle);
return fragmentMastodonAccount;
case 2:
FragmentMastodonTimeline fragmentMastodonTimeline = new FragmentMastodonTimeline();
}
case 2 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putString(Helper.ARG_SEARCH_KEYWORD, search);
fragmentMastodonTimeline.setArguments(bundle);
return fragmentMastodonTimeline;
default:
}
default -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putString(Helper.ARG_SEARCH_KEYWORD_CACHE, search);
fragmentMastodonTimeline.setArguments(bundle);
return fragmentMastodonTimeline;
}
}
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {

View file

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.activities;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentInstance;
import static app.fedilab.android.BaseMainActivity.currentToken;
@ -38,6 +39,7 @@ import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Accounts;
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.drawer.AccountAdapter;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
@ -70,12 +72,23 @@ public class StatusInfoActivity extends BaseActivity {
}
accountList = new ArrayList<>();
checkRemotely = false;
Bundle b = getIntent().getExtras();
if (b != null) {
type = (typeOfInfo) b.getSerializable(Helper.ARG_TYPE_OF_INFO);
status = (Status) b.getSerializable(Helper.ARG_STATUS);
checkRemotely = b.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
Bundle args = getIntent().getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(StatusInfoActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
type = (typeOfInfo) bundle.getSerializable(Helper.ARG_TYPE_OF_INFO);
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
if (type == null || status == null) {
finish();
return;
@ -138,6 +151,7 @@ public class StatusInfoActivity extends BaseActivity {
}
}
private void manageView(Accounts accounts) {
binding.loadingNextAccounts.setVisibility(View.GONE);
if (accountList != null && accounts != null && accounts.accounts != null) {

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.activities;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle;
import android.view.MenuItem;
@ -22,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityTimelineBinding;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper;
@ -42,32 +45,44 @@ public class TimelineActivity extends BaseBarActivity {
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Bundle b = getIntent().getExtras();
Bundle args = getIntent().getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(TimelineActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
Timeline.TimeLineEnum timelineType = null;
String lemmy_post_id = null;
PinnedTimeline pinnedTimeline = null;
Status status = null;
if (b != null) {
timelineType = (Timeline.TimeLineEnum) b.get(Helper.ARG_TIMELINE_TYPE);
lemmy_post_id = b.getString(Helper.ARG_LEMMY_POST_ID, null);
pinnedTimeline = (PinnedTimeline) b.getSerializable(Helper.ARG_REMOTE_INSTANCE);
status = (Status) b.getSerializable(Helper.ARG_STATUS);
if (bundle != null) {
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
lemmy_post_id = bundle.getString(Helper.ARG_LEMMY_POST_ID, null);
pinnedTimeline = (PinnedTimeline) bundle.getSerializable(Helper.ARG_REMOTE_INSTANCE);
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}
if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) {
setTitle(pinnedTimeline.remoteInstance.host);
}
FragmentMastodonTimeline fragmentMastodonTimeline = new FragmentMastodonTimeline();
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, timelineType);
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinnedTimeline);
bundle.putSerializable(Helper.ARG_LEMMY_POST_ID, lemmy_post_id);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_TIMELINE_TYPE, timelineType);
args.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinnedTimeline);
args.putSerializable(Helper.ARG_LEMMY_POST_ID, lemmy_post_id);
if (status != null) {
bundle.putSerializable(Helper.ARG_STATUS, status);
args.putSerializable(Helper.ARG_STATUS, status);
}
fragmentMastodonTimeline.setArguments(bundle);
new CachedBundle(TimelineActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle1 = new Bundle();
bundle1.putLong(Helper.ARG_INTENT_ID, bundleId);
fragmentMastodonTimeline.setArguments(bundle1);
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container_view, fragmentMastodonTimeline).commit();
});
}

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities.admin;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Intent;
@ -61,6 +63,7 @@ import app.fedilab.android.mastodon.activities.MediaActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminIp;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.helper.SpannableHelper;
@ -87,18 +90,32 @@ public class AdminAccountActivity extends BaseActivity {
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar();
Bundle b = getIntent().getExtras();
Bundle args = getIntent().getExtras();
adminAccount = null;
if (b != null) {
adminAccount = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT);
account_id = b.getString(Helper.ARG_ACCOUNT_ID, null);
}
postponeEnterTransition();
//Remove title
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
}
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(AdminAccountActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
adminAccount = (AdminAccount) bundle.getSerializable(Helper.ARG_ACCOUNT);
account_id = bundle.getString(Helper.ARG_ACCOUNT_ID, null);
}
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
@ -175,8 +192,6 @@ public class AdminAccountActivity extends BaseActivity {
initializeView(adminAccount);
}
});
}
private void initializeView(AdminAccount adminAccount) {
@ -329,7 +344,7 @@ public class AdminAccountActivity extends BaseActivity {
MastodonHelper.loadPPMastodon(binding.accountPp, adminAccount.account);
binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class);
Bundle b = new Bundle();
Bundle args = new Bundle();
Attachment attachment = new Attachment();
attachment.description = adminAccount.account.acct;
attachment.preview_url = adminAccount.account.avatar;
@ -338,14 +353,18 @@ public class AdminAccountActivity extends BaseActivity {
attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
args.putInt(Helper.ARG_MEDIA_POSITION, 1);
new CachedBundle(AdminAccountActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(AdminAccountActivity.this, binding.accountPp, attachment.url);
// start the new activity
startActivity(intent, options.toBundle());
});
});
binding.accountDate.setText(Helper.shortDateToString(adminAccount.created_at));

View file

@ -14,6 +14,7 @@ package app.fedilab.android.mastodon.activities.admin;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.ACCOUNT;
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.DOMAIN;
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.REPORT;
@ -43,6 +44,7 @@ import app.fedilab.android.databinding.PopupAdminFilterAccountsBinding;
import app.fedilab.android.databinding.PopupAdminFilterReportsBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminDomainBlock;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.ThemeHelper;
import app.fedilab.android.mastodon.ui.fragment.admin.FragmentAdminAccount;
@ -63,19 +65,22 @@ public class AdminActionActivity extends BaseBarActivity {
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
AdminDomainBlock adminDomainBlock = (AdminDomainBlock) b.getSerializable(Helper.ARG_ADMIN_DOMAINBLOCK);
AdminDomainBlock adminDomainBlockDelete = (AdminDomainBlock) b.getSerializable(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(AdminActionActivity.this).getBundle(bundleId, currentAccount, bundle -> {
AdminDomainBlock adminDomainBlock = (AdminDomainBlock) bundle.getSerializable(Helper.ARG_ADMIN_DOMAINBLOCK);
AdminDomainBlock adminDomainBlockDelete = (AdminDomainBlock) bundle.getSerializable(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE);
if (adminDomainBlock != null && adminDomainBlock.domain != null && fragmentAdminDomain != null) {
fragmentAdminDomain.update(adminDomainBlock);
}
if (adminDomainBlockDelete != null && fragmentAdminDomain != null) {
fragmentAdminDomain.delete(adminDomainBlockDelete);
}
}
});
}
}
};
@Override

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities.admin;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
@ -27,7 +29,6 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.Objects;
@ -38,6 +39,7 @@ import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityAdminDomainblockBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminDomainBlock;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.viewmodel.mastodon.AdminVM;
import es.dmoral.toasty.Toasty;
@ -110,10 +112,17 @@ public class AdminDomainBlockActivity extends BaseBarActivity {
} else {
Toasty.error(AdminDomainBlockActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
}
Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK, adminDomainBlockResult);
Intent intent = new Intent(Helper.BROADCAST_DATA);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ADMIN_DOMAINBLOCK, adminDomainBlockResult);
new CachedBundle(AdminDomainBlockActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intent);
finish();
});
}
);
});
@ -139,10 +148,18 @@ public class AdminDomainBlockActivity extends BaseBarActivity {
.setPositiveButton(R.string.unblock_domain, (dialog, which) -> {
adminVM.deleteDomain(MainActivity.currentInstance, MainActivity.currentToken, adminDomainBlock.id)
.observe(AdminDomainBlockActivity.this, adminDomainBlockResult -> {
Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE, adminDomainBlock);
Intent intent = new Intent(Helper.BROADCAST_DATA);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE, adminDomainBlock);
new CachedBundle(AdminDomainBlockActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intent);
finish();
});
}
);
dialog.dismiss();

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities.admin;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Intent;
@ -46,7 +48,6 @@ import com.bumptech.glide.request.transition.Transition;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@ -62,6 +63,7 @@ import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminIp;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.helper.SpannableHelper;
@ -87,19 +89,8 @@ public class AdminReportActivity extends BaseBarActivity {
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar();
Bundle b = getIntent().getExtras();
if (b != null) {
adminAccount = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT);
if (adminAccount != null) {
account = adminAccount.account;
}
}
Bundle args = getIntent().getExtras();
postponeEnterTransition();
//Remove title
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
}
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
@ -107,6 +98,28 @@ public class AdminReportActivity extends BaseBarActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
//Remove title
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
}
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(AdminReportActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
adminAccount = (AdminAccount) bundle.getSerializable(Helper.ARG_ACCOUNT);
if (adminAccount != null) {
account = adminAccount.account;
}
}
if (account != null) {
initializeView(account);
} else {
@ -344,7 +357,7 @@ public class AdminReportActivity extends BaseBarActivity {
MastodonHelper.loadPPMastodon(binding.accountPp, account);
binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AdminReportActivity.this, MediaActivity.class);
Bundle b = new Bundle();
Bundle args = new Bundle();
Attachment attachment = new Attachment();
attachment.description = account.acct;
attachment.preview_url = account.avatar;
@ -353,14 +366,17 @@ public class AdminReportActivity extends BaseBarActivity {
attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
args.putInt(Helper.ARG_MEDIA_POSITION, 1);
new CachedBundle(AdminReportActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(AdminReportActivity.this, binding.accountPp, attachment.url);
// start the new activity
startActivity(intent, options.toBundle());
});
});
binding.accountDate.setText(Helper.shortDateToString(account.created_at));

View file

@ -19,16 +19,13 @@ import static app.fedilab.android.BaseMainActivity.emojis;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteBlobTooBigException;
import android.database.sqlite.SQLiteDatabase;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelProvider;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
@ -41,7 +38,6 @@ import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.mastodon.client.endpoints.MastodonInstanceService;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.viewmodel.mastodon.InstancesVM;
import app.fedilab.android.sqlite.Sqlite;
import okhttp3.OkHttpClient;
import retrofit2.Call;
@ -230,17 +226,12 @@ public class EmojiInstance implements Serializable {
}
}
public interface EmojiFilteredCallBack{
void get(List<Emoji> emojiList);
}
/**
* Returns the emojis for an instance
*
* @param instance String
* @param filter String
* @param callBack EmojiFilteredCallBack - Get filtered emojis
*
* @return List<Emoji> - List of {@link Emoji}
*/
public void getEmojiListFiltered(@NonNull String instance, @NonNull String filter, EmojiFilteredCallBack callBack) throws DBException {
@ -311,4 +302,8 @@ public class EmojiInstance implements Serializable {
}
return filteredEmojis;
}
public interface EmojiFilteredCallBack {
void get(List<Emoji> emojiList);
}
}

View file

@ -32,7 +32,8 @@ public class Tag implements Serializable {
@SerializedName("following")
public boolean following = false;
public Tag() {}
public Tag() {
}
public Tag(String name) {
this.name = name;

View file

@ -0,0 +1,413 @@
package app.fedilab.android.mastodon.client.entities.app;
/* Copyright 2024 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcel;
import android.util.Base64;
import com.google.gson.annotations.SerializedName;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.sqlite.Sqlite;
/**
* Class that manages Bundle of Intent from database
*/
public class CachedBundle {
public String id;
public Bundle bundle;
public CacheType cacheType;
public String instance;
public String user_id;
public String target_id;
public Date created_at;
private SQLiteDatabase db;
private transient Context context;
public CachedBundle() {
}
public CachedBundle(Context context) {
//Creation of the DB with tables
this.context = context;
this.db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
}
public void insertAccountBundle(Account account, BaseAccount currentUser) throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
ContentValues valuesAccount = new ContentValues();
Bundle bundleAccount = new Bundle();
if (account != null) {
bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount));
valuesAccount.put(Sqlite.COL_CREATED_AT, Helper.dateToString(new Date()));
valuesAccount.put(Sqlite.COL_TARGET_ID, account.id);
valuesAccount.put(Sqlite.COL_USER_ID, currentUser.user_id);
valuesAccount.put(Sqlite.COL_INSTANCE, currentUser.instance);
valuesAccount.put(Sqlite.COL_TYPE, CacheType.ACCOUNT.getValue());
removeIntent(currentUser, account.id);
db.insertOrThrow(Sqlite.TABLE_INTENT, null, valuesAccount);
}
}
/**
* Insert a bundle in db
*
* @param bundle {@link Bundle}
* @return long - db id
* @throws DBException exception with database
*/
private long insertIntent(Bundle bundle, BaseAccount currentUser) throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
ContentValues values = new ContentValues();
values.put(Sqlite.COL_BUNDLE, serializeBundle(bundle));
values.put(Sqlite.COL_CREATED_AT, Helper.dateToString(new Date()));
values.put(Sqlite.COL_TYPE, CacheType.ARGS.getValue());
if (bundle.containsKey(Helper.ARG_ACCOUNT) && currentUser != null) {
ContentValues valuesAccount = new ContentValues();
Bundle bundleAccount = new Bundle();
Account account = null;
try {
account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}catch (ClassCastException ignored){}
if (account != null) {
bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount));
valuesAccount.put(Sqlite.COL_CREATED_AT, Helper.dateToString(new Date()));
valuesAccount.put(Sqlite.COL_TARGET_ID, account.id);
valuesAccount.put(Sqlite.COL_USER_ID, currentUser.user_id);
valuesAccount.put(Sqlite.COL_INSTANCE, currentUser.instance);
valuesAccount.put(Sqlite.COL_TYPE, CacheType.ACCOUNT.getValue());
removeIntent(currentUser, account.id);
db.insertOrThrow(Sqlite.TABLE_INTENT, null, valuesAccount);
}
}
if (bundle.containsKey(Helper.ARG_STATUS) && currentUser != null) {
ContentValues valuesAccount = new ContentValues();
Bundle bundleStatus = new Bundle();
Status status = null;
try {
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}catch (ClassCastException ignored){}
if (status != null) {
bundleStatus.putSerializable(Helper.ARG_STATUS, status);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleStatus));
valuesAccount.put(Sqlite.COL_CREATED_AT, Helper.dateToString(new Date()));
valuesAccount.put(Sqlite.COL_TARGET_ID, status.id);
valuesAccount.put(Sqlite.COL_USER_ID, currentUser.user_id);
valuesAccount.put(Sqlite.COL_INSTANCE, currentUser.instance);
valuesAccount.put(Sqlite.COL_TYPE, CacheType.STATUS.getValue());
removeIntent(currentUser, status.id);
db.insertOrThrow(Sqlite.TABLE_INTENT, null, valuesAccount);
}
}
try {
return db.insertOrThrow(Sqlite.TABLE_INTENT, null, values);
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public void getBundle(long id, BaseAccount Account, BundleCallback callback) {
new Thread(() -> {
Bundle bundle = null;
try {
CachedBundle cachedBundle = getCachedBundle(String.valueOf(id));
if (cachedBundle != null) {
bundle = cachedBundle.bundle;
if (bundle != null && bundle.containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
Account cachedAccount = getCachedAccount(Account, bundle.getString(Helper.ARG_CACHED_ACCOUNT_ID));
if (cachedAccount != null) {
bundle.putSerializable(Helper.ARG_ACCOUNT, cachedAccount);
}
}
if (bundle != null && bundle.containsKey(Helper.ARG_CACHED_STATUS_ID)) {
Status cachedStatus = getCachedStatus(Account, bundle.getString(Helper.ARG_CACHED_STATUS_ID));
if (cachedStatus != null) {
bundle.putSerializable(Helper.ARG_STATUS, cachedStatus);
}
}
}
} catch (DBException ignored) {
}
if( bundle == null) {
bundle = new Bundle();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Bundle finalBundle = bundle;
Runnable myRunnable = () -> callback.get(finalBundle);
mainHandler.post(myRunnable);
}).start();
}
public void insertBundle(Bundle bundle, BaseAccount Account, BundleInsertCallback callback) {
new Thread(() -> {
long dbBundleId = -1;
try {
dbBundleId = insertIntent(bundle, Account);
} catch (DBException ignored) {
}
Handler mainHandler = new Handler(Looper.getMainLooper());
long finalDbBundleId = dbBundleId;
Runnable myRunnable = () -> callback.inserted(finalDbBundleId);
mainHandler.post(myRunnable);
}).start();
}
/**
* Returns a bundle by targeted account id
*
* @param target_id String
* @return Account {@link Account}
*/
public Account getCachedAccount(BaseAccount account, String target_id) throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
if (account == null || target_id == null) {
return null;
}
try {
Cursor c = db.query(Sqlite.TABLE_INTENT, null, Sqlite.COL_USER_ID + " = '" + account.user_id + "' AND "
+ Sqlite.COL_INSTANCE + " = '" + account.instance + "' AND "
+ Sqlite.COL_TYPE + " = '" + CacheType.ACCOUNT.getValue() + "' AND "
+ Sqlite.COL_TARGET_ID + " = '" + target_id + "'", null, null, null, null, "1");
CachedBundle cachedBundle = cursorToCachedBundle(c);
if (cachedBundle != null && cachedBundle.bundle.containsKey(Helper.ARG_ACCOUNT)) {
return (Account) cachedBundle.bundle.getSerializable(Helper.ARG_ACCOUNT);
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return null;
}
/**
* Returns a bundle by targeted status id
*
* @param target_id String
* @return Status {@link Status}
*/
private Status getCachedStatus(BaseAccount account, String target_id) throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
if (account == null || target_id == null) {
return null;
}
try {
Cursor c = db.query(Sqlite.TABLE_INTENT, null, Sqlite.COL_USER_ID + " = '" + account.user_id + "' AND "
+ Sqlite.COL_INSTANCE + " = '" + account.instance + "' AND "
+ Sqlite.COL_TYPE + " = '" + CacheType.STATUS.getValue() + "' AND "
+ Sqlite.COL_TARGET_ID + " = '" + target_id + "'", null, null, null, null, "1");
CachedBundle cachedBundle = cursorToCachedBundle(c);
if (cachedBundle != null && cachedBundle.bundle.containsKey(Helper.ARG_STATUS)) {
return (Status) cachedBundle.bundle.getSerializable(Helper.ARG_STATUS);
}
} catch (Exception e) {
return null;
}
return null;
}
/**
* Returns a bundle by its ID
*
* @param id String
* @return CachedBundle {@link CachedBundle}
*/
private CachedBundle getCachedBundle(String id) throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
try {
Cursor c = db.query(Sqlite.TABLE_INTENT, null, Sqlite.COL_ID + " = \"" + id + "\"", null, null, null, null, "1");
return cursorToCachedBundle(c);
} catch (Exception e) {
return null;
}
}
/**
* Remove a bundle from db
*/
public void deleteOldIntent() throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, -1);
Date date = cal.getTime();
String dateStr = Helper.dateToString(date);
try {
db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_CREATED_AT + " < ?", new String[]{dateStr});
}catch (Exception e) {
e.printStackTrace();
}
}
/**
* Remove a bundle from db
*/
private void removeIntent(BaseAccount account, String target_id) throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
if (account == null || target_id == null) {
return;
}
db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_USER_ID + " = '" + account.user_id + "' AND "
+ Sqlite.COL_INSTANCE + " = '" + account.instance + "' AND "
+ Sqlite.COL_TARGET_ID + " = '" + target_id + "'", null);
}
/***
* Method to hydrate an CachedBundle from database
* @param c Cursor
* @return CachedBundle {@link CachedBundle}
*/
private CachedBundle cursorToCachedBundle(Cursor c) {
//No element found
if (c.getCount() == 0) {
c.close();
return null;
}
//Take the first element
c.moveToFirst();
//New user
CachedBundle account = convertCursorToCachedBundle(c);
//Close the cursor
c.close();
return account;
}
/**
* Read cursor and hydrate without closing it
*
* @param c - Cursor
* @return Account
*/
private CachedBundle convertCursorToCachedBundle(Cursor c) {
CachedBundle cachedBundle = new CachedBundle();
cachedBundle.id = c.getString(c.getColumnIndexOrThrow(Sqlite.COL_ID));
cachedBundle.bundle = deserializeBundle(c.getString(c.getColumnIndexOrThrow(Sqlite.COL_BUNDLE)));
cachedBundle.user_id = c.getString(c.getColumnIndexOrThrow(Sqlite.COL_USER_ID));
cachedBundle.instance = c.getString(c.getColumnIndexOrThrow(Sqlite.COL_INSTANCE));
cachedBundle.target_id = c.getString(c.getColumnIndexOrThrow(Sqlite.COL_TARGET_ID));
cachedBundle.cacheType = CacheType.valueOf(c.getString(c.getColumnIndexOrThrow(Sqlite.COL_TYPE)));
cachedBundle.created_at = Helper.stringToDate(context, c.getString(c.getColumnIndexOrThrow(Sqlite.COL_CREATED_AT)));
return cachedBundle;
}
private String serializeBundle(final Bundle bundle) {
String base64 = null;
final Parcel parcel = Parcel.obtain();
try {
parcel.writeBundle(bundle);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final GZIPOutputStream zos = new GZIPOutputStream(new BufferedOutputStream(bos));
zos.write(parcel.marshall());
zos.close();
base64 = Base64.encodeToString(bos.toByteArray(), 0);
} catch (IOException e) {
e.printStackTrace();
} finally {
parcel.recycle();
}
return base64;
}
private Bundle deserializeBundle(final String base64) {
Bundle bundle = null;
final Parcel parcel = Parcel.obtain();
try {
final ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
final byte[] buffer = new byte[1024];
final GZIPInputStream zis = new GZIPInputStream(new ByteArrayInputStream(Base64.decode(base64, 0)));
int len;
while ((len = zis.read(buffer)) != -1) {
byteBuffer.write(buffer, 0, len);
}
zis.close();
parcel.unmarshall(byteBuffer.toByteArray(), 0, byteBuffer.size());
parcel.setDataPosition(0);
bundle = parcel.readBundle(getClass().getClassLoader());
} catch (IOException e) {
e.printStackTrace();
} finally {
parcel.recycle();
}
return bundle;
}
public enum CacheType {
@SerializedName("ARGS")
ARGS("ARGS"),
@SerializedName("ACCOUNT")
ACCOUNT("ACCOUNT"),
@SerializedName("STATUS")
STATUS("STATUS");
private final String value;
CacheType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
public interface BundleCallback {
void get(Bundle bundle);
}
public interface BundleInsertCallback {
void inserted(long bundleId);
}
}

View file

@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.regex.Matcher;
public class ComposeHelper {

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.helper;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -44,6 +46,7 @@ import app.fedilab.android.mastodon.client.entities.api.Results;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.Account;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.ui.drawer.AccountsSearchAdapter;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
@ -183,77 +186,89 @@ public class CrossActionHelper {
statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get("crossactions", StatusesVM.class);
}
switch (actionType) {
case MUTE_ACTION:
case MUTE_ACTION -> {
assert accountsVM != null;
accountsVM.mute(ownerAccount.instance, ownerAccount.token, targetedAccount.id, true, 0)
.observe((LifecycleOwner) context, relationShip -> Toasty.info(context, context.getString(R.string.toast_mute), Toasty.LENGTH_SHORT).show());
break;
case UNMUTE_ACTION:
}
case UNMUTE_ACTION -> {
assert accountsVM != null;
accountsVM.unmute(ownerAccount.instance, ownerAccount.token, targetedAccount.id)
.observe((LifecycleOwner) context, relationShip -> Toasty.info(context, context.getString(R.string.toast_unmute), Toasty.LENGTH_SHORT).show());
break;
case BLOCK_ACTION:
}
case BLOCK_ACTION -> {
assert accountsVM != null;
accountsVM.block(ownerAccount.instance, ownerAccount.token, targetedAccount.id)
.observe((LifecycleOwner) context, relationShip -> Toasty.info(context, context.getString(R.string.toast_block), Toasty.LENGTH_SHORT).show());
break;
case UNBLOCK_ACTION:
}
case UNBLOCK_ACTION -> {
assert accountsVM != null;
accountsVM.unblock(ownerAccount.instance, ownerAccount.token, targetedAccount.id)
.observe((LifecycleOwner) context, relationShip -> Toasty.info(context, context.getString(R.string.toast_unblock), Toasty.LENGTH_SHORT).show());
break;
case FOLLOW_ACTION:
}
case FOLLOW_ACTION -> {
assert accountsVM != null;
accountsVM.follow(ownerAccount.instance, ownerAccount.token, targetedAccount.id, true, false, null)
.observe((LifecycleOwner) context, relationShip -> Toasty.info(context, context.getString(R.string.toast_follow), Toasty.LENGTH_SHORT).show());
break;
case UNFOLLOW_ACTION:
}
case UNFOLLOW_ACTION -> {
assert accountsVM != null;
accountsVM.unfollow(ownerAccount.instance, ownerAccount.token, targetedAccount.id)
.observe((LifecycleOwner) context, relationShip -> Toasty.info(context, context.getString(R.string.toast_unfollow), Toasty.LENGTH_SHORT).show());
break;
case FAVOURITE_ACTION:
}
case FAVOURITE_ACTION -> {
assert statusesVM != null;
statusesVM.favourite(ownerAccount.instance, ownerAccount.token, targetedStatus.id)
.observe((LifecycleOwner) context, status -> Toasty.info(context, context.getString(R.string.toast_favourite), Toasty.LENGTH_SHORT).show());
break;
case UNFAVOURITE_ACTION:
}
case UNFAVOURITE_ACTION -> {
assert statusesVM != null;
statusesVM.unFavourite(ownerAccount.instance, ownerAccount.token, targetedStatus.id)
.observe((LifecycleOwner) context, status -> Toasty.info(context, context.getString(R.string.toast_unfavourite), Toasty.LENGTH_SHORT).show());
break;
case BOOKMARK_ACTION:
}
case BOOKMARK_ACTION -> {
assert statusesVM != null;
statusesVM.bookmark(ownerAccount.instance, ownerAccount.token, targetedStatus.id)
.observe((LifecycleOwner) context, status -> Toasty.info(context, context.getString(R.string.toast_bookmark), Toasty.LENGTH_SHORT).show());
break;
case UNBOOKMARK_ACTION:
}
case UNBOOKMARK_ACTION -> {
assert statusesVM != null;
statusesVM.unBookmark(ownerAccount.instance, ownerAccount.token, targetedStatus.id)
.observe((LifecycleOwner) context, status -> Toasty.info(context, context.getString(R.string.toast_unbookmark), Toasty.LENGTH_SHORT).show());
break;
case REBLOG_ACTION:
}
case REBLOG_ACTION -> {
assert statusesVM != null;
statusesVM.reblog(ownerAccount.instance, ownerAccount.token, targetedStatus.id, null)
.observe((LifecycleOwner) context, status -> Toasty.info(context, context.getString(R.string.toast_reblog), Toasty.LENGTH_SHORT).show());
break;
case UNREBLOG_ACTION:
}
case UNREBLOG_ACTION -> {
assert statusesVM != null;
statusesVM.unReblog(ownerAccount.instance, ownerAccount.token, targetedStatus.id)
.observe((LifecycleOwner) context, status -> Toasty.info(context, context.getString(R.string.toast_unreblog), Toasty.LENGTH_SHORT).show());
break;
case REPLY_ACTION:
}
case REPLY_ACTION -> {
Intent intent = new Intent(context, ComposeActivity.class);
intent.putExtra(Helper.ARG_STATUS_REPLY, targetedStatus);
intent.putExtra(Helper.ARG_ACCOUNT, ownerAccount);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_REPLY, targetedStatus);
args.putSerializable(Helper.ARG_ACCOUNT, ownerAccount);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
break;
case COMPOSE:
});
}
case COMPOSE -> {
Intent intentCompose = new Intent(context, ComposeActivity.class);
intentCompose.putExtra(Helper.ARG_ACCOUNT, ownerAccount);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, ownerAccount);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentCompose.putExtras(bundle);
context.startActivity(intentCompose);
break;
});
}
}
}
@ -430,11 +445,16 @@ public class CrossActionHelper {
final BaseAccount account = accountArray[which];
Intent intentToot = new Intent(context, ComposeActivity.class);
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
intentToot.putExtras(bundle);
new CachedBundle(context).insertBundle(bundle, currentAccount, bundleId -> {
Bundle bundleCached = new Bundle();
bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId);
intentToot.putExtras(bundleCached);
context.startActivity(intentToot);
((BaseActivity) context).finish();
dialog.dismiss();
});
});
builderSingle.show();
}

View file

@ -78,7 +78,6 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.browser.customtabs.CustomTabColorSchemeParams;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
@ -89,7 +88,6 @@ import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -157,6 +155,7 @@ import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.Account;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.ReleaseNote;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException;
@ -210,6 +209,8 @@ public class Helper {
public static final String RECEIVE_REDRAW_PROFILE = "RECEIVE_REDRAW_PROFILE";
public static final String ARG_TIMELINE_TYPE = "ARG_TIMELINE_TYPE";
public static final String ARG_INTENT_ID = "ARG_INTENT_ID";
public static final String ARG_PEERTUBE_NAV_REMOTE = "ARG_PEERTUBE_NAV_REMOTE";
public static final String ARG_REMOTE_INSTANCE_STRING = "ARG_REMOTE_INSTANCE_STRING";
@ -241,6 +242,8 @@ public class Helper {
public static final String ARG_STATUS_REPLY_ID = "ARG_STATUS_REPLY_ID";
public static final String ARG_ACCOUNT = "ARG_ACCOUNT";
public static final String ARG_ACCOUNT_ID = "ARG_ACCOUNT_ID";
public static final String ARG_CACHED_ACCOUNT_ID = "ARG_CACHED_ACCOUNT_ID";
public static final String ARG_CACHED_STATUS_ID = "ARG_CACHED_STATUS_ID";
public static final String ARG_ADMIN_DOMAINBLOCK = "ARG_ADMIN_DOMAINBLOCK";
public static final String ARG_ADMIN_DOMAINBLOCK_DELETE = "ARG_ADMIN_DOMAINBLOCK_DELETE";
public static final String FEDILAB_MUTED_HASHTAGS = "Fedilab muted hashtags";
@ -843,7 +846,7 @@ public class Helper {
@SuppressLint("DefaultLocale")
public static String withSuffix(long count) {
if (count < 1000) return "" + count;
if (count < 1000) return String.valueOf(count);
int exp = (int) (Math.log(count) / Math.log(1000));
Locale locale = null;
try {
@ -869,13 +872,17 @@ public class Helper {
*/
public static void sendToastMessage(Context context, String type, String content) {
Intent intentBC = new Intent(context, ToastMessage.class);
Bundle b = new Bundle();
b.putString(RECEIVE_TOAST_TYPE, type);
b.putString(RECEIVE_TOAST_CONTENT, content);
Bundle args = new Bundle();
args.putString(RECEIVE_TOAST_TYPE, type);
args.putString(RECEIVE_TOAST_CONTENT, content);
intentBC.setAction(Helper.RECEIVE_TOAST_MESSAGE);
intentBC.putExtras(b);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBC.putExtras(bundle);
intentBC.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBC);
});
}
/**
@ -995,8 +1002,7 @@ public class Helper {
if (context == null) {
return false;
}
if (context instanceof Activity) {
final Activity activity = (Activity) context;
if (context instanceof Activity activity) {
return !activity.isDestroyed() && !activity.isFinishing();
}
return true;
@ -1512,12 +1518,16 @@ public class Helper {
* @param activity - Activity
*/
public static void recreateMainActivity(Activity activity) {
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
activity.sendBroadcast(intentBD);
});
}
public static void showKeyboard(Context context, View view) {
@ -1554,50 +1564,51 @@ public class Helper {
String channelTitle;
switch (notifType) {
case FAV:
case FAV -> {
channelId = "channel_favourite";
channelTitle = context.getString(R.string.channel_notif_fav);
break;
case FOLLLOW:
}
case FOLLLOW -> {
channelId = "channel_follow";
channelTitle = context.getString(R.string.channel_notif_follow);
break;
case MENTION:
}
case MENTION -> {
channelId = "channel_mention";
channelTitle = context.getString(R.string.channel_notif_mention);
break;
case POLL:
}
case POLL -> {
channelId = "channel_poll";
channelTitle = context.getString(R.string.channel_notif_poll);
break;
case BACKUP:
}
case BACKUP -> {
channelId = "channel_backup";
channelTitle = context.getString(R.string.channel_notif_backup);
break;
case STORE:
}
case STORE -> {
channelId = "channel_media";
channelTitle = context.getString(R.string.channel_notif_media);
break;
case TOOT:
}
case TOOT -> {
channelId = "channel_status";
channelTitle = context.getString(R.string.channel_notif_status);
break;
case UPDATE:
}
case UPDATE -> {
channelId = "channel_update";
channelTitle = context.getString(R.string.channel_notif_update);
break;
case SIGN_UP:
}
case SIGN_UP -> {
channelId = "channel_signup";
channelTitle = context.getString(R.string.channel_notif_signup);
break;
case REPORT:
}
case REPORT -> {
channelId = "channel_report";
channelTitle = context.getString(R.string.channel_notif_report);
break;
default:
}
default -> {
channelId = "channel_boost";
channelTitle = context.getString(R.string.channel_notif_boost);
}
}
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, channelId)
.setSmallIcon(getNotificationIcon(context)).setTicker(message);
/* if (notifType == NotifType.MENTION) {
@ -1605,31 +1616,25 @@ public class Helper {
message = message.substring(0, 499) + "";
}
}*/
notificationBuilder.setGroup(account.mastodon_account != null ? account.mastodon_account.username + "@" + account.instance : "" + "@" + account.instance)
notificationBuilder.setGroup(account.mastodon_account != null ? account.mastodon_account.username + "@" + account.instance : "@" + account.instance)
.setContentIntent(pIntent)
.setContentText(message);
int ledColour = Color.BLUE;
int prefColor;
prefColor = Integer.parseInt(sharedpreferences.getString(context.getString(R.string.SET_LED_COLOUR_VAL_N), String.valueOf(LED_COLOUR)));
switch (prefColor) {
case 1: // CYAN
case 1 -> // CYAN
ledColour = Color.CYAN;
break;
case 2: // MAGENTA
case 2 -> // MAGENTA
ledColour = Color.MAGENTA;
break;
case 3: // GREEN
case 3 -> // GREEN
ledColour = Color.GREEN;
break;
case 4: // RED
case 4 -> // RED
ledColour = Color.RED;
break;
case 5: // YELLOW
case 5 -> // YELLOW
ledColour = Color.YELLOW;
break;
case 6: // WHITE
case 6 -> // WHITE
ledColour = Color.WHITE;
break;
}
@ -1673,7 +1678,7 @@ public class Helper {
.setLargeIcon(icon)
.setSmallIcon(getNotificationIcon(context))
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setGroup(account.mastodon_account != null ? account.mastodon_account.username + "@" + account.instance : "" + "@" + account.instance)
.setGroup(account.mastodon_account != null ? account.mastodon_account.username + "@" + account.instance : "@" + account.instance)
.setGroupSummary(true)
.build();
@ -1922,11 +1927,15 @@ public class Helper {
binding.accountUn.setText(account.acct);
binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(activity, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
activity.startActivity(intent);
});
});
AccountsVM accountsVM = new ViewModelProvider((ViewModelStoreOwner) activity).get(AccountsVM.class);
List<String> ids = new ArrayList<>();

View file

@ -679,8 +679,7 @@ public class PinnedTimelineHelper {
popup.setOnDismissListener(menu1 -> {
if (activityMainBinding.viewPager.getAdapter() != null && activityMainBinding.tabLayout.getSelectedTabPosition() != -1) {
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
if (fragment instanceof FragmentMastodonTimeline fragmentMastodonTimeline && fragment.isVisible()) {
fragmentMastodonTimeline.refreshAllAdapters();
}
}

View file

@ -86,6 +86,7 @@ import app.fedilab.android.mastodon.client.entities.api.Emoji;
import app.fedilab.android.mastodon.client.entities.api.Filter;
import app.fedilab.android.mastodon.client.entities.api.Mention;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.MarkdownConverter;
import app.fedilab.android.mastodon.ui.drawer.StatusAdapter;
import app.fedilab.android.mastodon.viewmodel.mastodon.FiltersVM;
@ -154,7 +155,7 @@ public class SpannableHelper {
} else {
initialContent = new SpannableString(text);
}
boolean markdownSupport = sharedpreferences.getBoolean(context.getString(R.string.SET_MARKDOWN_SUPPORT), true);
boolean markdownSupport = sharedpreferences.getBoolean(context.getString(R.string.SET_MARKDOWN_SUPPORT), false);
//Get all links
SpannableStringBuilder content;
if (markdownSupport && convertMarkdown) {
@ -278,19 +279,23 @@ public class SpannableHelper {
public void onClick(@NonNull View textView) {
textView.setTag(CLICKABLE_SPAN);
Intent intent;
Bundle b;
Bundle args;
if (word.startsWith("#")) {
intent = new Intent(context, HashTagActivity.class);
b = new Bundle();
b.putString(Helper.ARG_SEARCH_KEYWORD, word.trim());
intent.putExtras(b);
args = new Bundle();
args.putString(Helper.ARG_SEARCH_KEYWORD, word.trim());
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
} else if (word.startsWith("@")) {
intent = new Intent(context, ProfileActivity.class);
b = new Bundle();
args = new Bundle();
Mention targetedMention = null;
for (Mention mention : mentions) {
if (word.compareToIgnoreCase("@" + mention.username) == 0) {
targetedMention = mention;
@ -298,13 +303,17 @@ public class SpannableHelper {
}
}
if (targetedMention != null) {
b.putString(Helper.ARG_USER_ID, targetedMention.id);
args.putString(Helper.ARG_USER_ID, targetedMention.id);
} else {
b.putString(Helper.ARG_MENTION, word);
args.putString(Helper.ARG_MENTION, word);
}
intent.putExtras(b);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
}
}
@ -626,9 +635,15 @@ public class SpannableHelper {
@Override
public void federatedStatus(Status status) {
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
}
@Override
@ -644,11 +659,15 @@ public class SpannableHelper {
@Override
public void federatedAccount(Account account) {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
}
});
}
@ -658,9 +677,15 @@ public class SpannableHelper {
@Override
public void federatedStatus(Status status) {
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
}
@Override
@ -676,11 +701,15 @@ public class SpannableHelper {
@Override
public void federatedAccount(Account account) {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
}
});
}
@ -690,9 +719,15 @@ public class SpannableHelper {
@Override
public void federatedStatus(Status status) {
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
}
@Override
@ -708,11 +743,15 @@ public class SpannableHelper {
@Override
public void federatedAccount(Account account) {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
}
});
}
@ -890,10 +929,14 @@ public class SpannableHelper {
@Override
public void onClick(@NonNull View textView) {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account.moved);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account.moved);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
@Override

View file

@ -176,13 +176,11 @@ public class ThemeHelper {
String[] list;
try {
list = context.getAssets().list("themes/contributors");
if (list.length > 0) {
for (String file : list) {
InputStream is = context.getAssets().open("themes/contributors/" + file);
LinkedHashMap<String, String> data = readCSVFile(is);
linkedHashMaps.add(data);
}
}
} catch (IOException e) {
e.printStackTrace();
}

View file

@ -102,9 +102,8 @@ public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
// We only want the active item to change
if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
if (viewHolder instanceof ItemTouchHelperViewHolder) {
if (viewHolder instanceof ItemTouchHelperViewHolder itemViewHolder) {
// Let the view holder know that this item is being moved or dragged
ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
itemViewHolder.onItemSelected();
}
}
@ -118,9 +117,8 @@ public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {
viewHolder.itemView.setAlpha(ALPHA_FULL);
if (viewHolder instanceof ItemTouchHelperViewHolder) {
if (viewHolder instanceof ItemTouchHelperViewHolder itemViewHolder) {
// Tell the view holder it's time to restore the idle state
ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
itemViewHolder.onItemClear();
}
}

View file

@ -73,8 +73,7 @@ public class TimePreferenceDialogFragment extends PreferenceDialogFragmentCompat
// Generate value to save
String time = hour + ":" + minute;
DialogPreference preference = getPreference();
if (preference instanceof TimePreference) {
TimePreference timePreference = ((TimePreference) preference);
if (preference instanceof TimePreference timePreference) {
if (timePreference.callChangeListener(time)) {
timePreference.setTime(time);
}

View file

@ -1,6 +1,8 @@
package app.fedilab.android.mastodon.imageeditor;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
@ -22,7 +24,6 @@ import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.transition.ChangeBounds;
import androidx.transition.TransitionManager;
@ -42,6 +43,7 @@ import java.io.InputStream;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityEditImageBinding;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.CirclesDrawingView;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.imageeditor.base.BaseActivity;
@ -284,7 +286,8 @@ public class EditImageActivity extends BaseActivity implements OnPhotoEditorList
binding.photoEditorView.getSource().setImageURI(Uri.fromFile(new File(imagePath)));
if (exit) {
Intent intentImage = new Intent(Helper.INTENT_SEND_MODIFIED_IMAGE);
intentImage.putExtra("imgpath", imagePath);
Bundle args = new Bundle();
args.putString("imgpath", imagePath);
CirclesDrawingView.CircleArea circleArea = binding.focusCircle.getTouchedCircle();
if (circleArea != null) {
//Dimension of the editor containing the image
@ -324,13 +327,16 @@ public class EditImageActivity extends BaseActivity implements OnPhotoEditorList
} else if (focusY < -1) {
focusY = -1;
}
intentImage.putExtra("focusX", focusX);
intentImage.putExtra("focusY", focusY);
args.putFloat("focusX", focusX);
args.putFloat("focusY", focusY);
}
new CachedBundle(EditImageActivity.this).insertBundle(args, currentAccount, bundleId -> {
intentImage.putExtras(args);
intentImage.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentImage);
finish();
});
}
}

View file

@ -47,10 +47,8 @@ public class BaseActivity extends AppCompatActivity {
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case READ_WRITE_STORAGE:
if (requestCode == READ_WRITE_STORAGE) {
isPermissionGranted(grantResults[0] == PackageManager.PERMISSION_GRANTED, permissions[0]);
break;
}
}

View file

@ -32,7 +32,6 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.preference.PreferenceManager;
import androidx.work.Data;
import androidx.work.ForegroundInfo;
@ -61,6 +60,7 @@ import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.Account;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.CamelTag;
import app.fedilab.android.mastodon.client.entities.app.PostState;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
@ -224,14 +224,24 @@ public class ComposeWorker extends Worker {
}
Call<Status> statusCall;
if (error) {
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE);
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, context.getString(R.string.media_cannot_be_uploaded));
b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
intentBD.putExtras(b);
args.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, context.getString(R.string.media_cannot_be_uploaded));
args.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
BaseAccount account = null;
try {
account = new Account(context).getAccountByToken(dataPost.token);
} catch (DBException e) {
e.printStackTrace();
}
new CachedBundle(context).insertBundle(args, account, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
});
return;
}
if (statuses.get(i).local_only) {
@ -305,30 +315,51 @@ public class ComposeWorker extends Worker {
}
}
} else if (statusResponse.errorBody() != null) {
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE);
b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
args.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
String err = statusResponse.errorBody().string();
if (err.contains("{\"error\":\"")) {
err = err.replaceAll("\\{\"error\":\"(.*)\"\\}", "$1");
}
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, err);
intentBD.putExtras(b);
args.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, err);
BaseAccount account = null;
try {
account = new Account(context).getAccountByToken(dataPost.token);
} catch (DBException e) {
e.printStackTrace();
}
new CachedBundle(context).insertBundle(args, account, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
});
return;
}
} catch (IOException e) {
e.printStackTrace();
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
args.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE);
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, e.getMessage());
intentBD.putExtras(b);
args.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, e.getMessage());
BaseAccount account = null;
try {
account = new Account(context).getAccountByToken(dataPost.token);
} catch (DBException e2) {
e2.printStackTrace();
}
new CachedBundle(context).insertBundle(args, account, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
});
return;
}
} else {
@ -376,14 +407,24 @@ public class ComposeWorker extends Worker {
}
if (dataPost.scheduledDate == null && dataPost.token != null && firstSendMessage != null) {
Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_NEW_MESSAGE, true);
b.putString(Helper.ARG_EDIT_STATUS_ID, dataPost.statusEditId);
Bundle args = new Bundle();
args.putBoolean(Helper.RECEIVE_NEW_MESSAGE, true);
args.putString(Helper.ARG_EDIT_STATUS_ID, dataPost.statusEditId);
Intent intentBD = new Intent(Helper.BROADCAST_DATA);
b.putSerializable(Helper.RECEIVE_STATUS_ACTION, firstSendMessage);
intentBD.putExtras(b);
args.putSerializable(Helper.RECEIVE_STATUS_ACTION, firstSendMessage);
BaseAccount account = null;
try {
account = new Account(context).getAccountByToken(dataPost.token);
} catch (DBException e2) {
e2.printStackTrace();
}
new CachedBundle(context).insertBundle(args, account, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
});
}
}

View file

@ -15,7 +15,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */
import android.app.Activity;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -29,7 +30,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
@ -48,6 +48,7 @@ import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.DrawerAccountBinding;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.helper.ThemeHelper;
@ -94,9 +95,9 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
accountViewHolder.binding.muteHome.setChecked(muted);
accountViewHolder.binding.muteHome.setOnClickListener(v -> {
if (muted) {
accountsVM.unmuteHome(MainActivity.currentAccount, account).observe((LifecycleOwner) context, account1 -> adapter.notifyItemChanged(accountViewHolder.getLayoutPosition()));
accountsVM.unmuteHome(currentAccount, account).observe((LifecycleOwner) context, account1 -> adapter.notifyItemChanged(accountViewHolder.getLayoutPosition()));
} else {
accountsVM.muteHome(MainActivity.currentAccount, account).observe((LifecycleOwner) context, account1 -> adapter.notifyItemChanged(accountViewHolder.getLayoutPosition()));
accountsVM.muteHome(currentAccount, account).observe((LifecycleOwner) context, account1 -> adapter.notifyItemChanged(accountViewHolder.getLayoutPosition()));
}
});
} else {
@ -111,11 +112,14 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
accountViewHolder.binding.avatar.setOnClickListener(v -> {
if (remoteInstance == null) {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else {
Toasty.info(context, context.getString(R.string.retrieve_remote_account), Toasty.LENGTH_SHORT).show();
SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class);
@ -124,11 +128,14 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
if (results != null && results.accounts != null && results.accounts.size() > 0) {
Account accountSearch = results.accounts.get(0);
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, accountSearch);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, accountSearch);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
}

View file

@ -14,7 +14,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.app.Activity;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -24,7 +25,6 @@ import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
@ -38,6 +38,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerFollowBinding;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
@ -103,12 +104,15 @@ public class AccountFollowRequestAdapter extends RecyclerView.Adapter<RecyclerVi
}));
holderFollow.binding.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
}

View file

@ -14,7 +14,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.app.Activity;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
@ -22,10 +23,8 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.cursoradapter.widget.SimpleCursorAdapter;
import java.util.List;
@ -33,6 +32,7 @@ import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
@ -61,16 +61,18 @@ public class AccountsSearchTopBarAdapter extends SimpleCursorAdapter {
LinearLayoutCompat container = view.findViewById(R.id.account_container);
container.setTag(cursor.getPosition());
ImageView account_pp = view.findViewById(R.id.account_pp);
container.setOnClickListener(v -> {
int position = (int) v.getTag();
if (accountList != null && accountList.size() > position) {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, accountList.get(position));
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, accountList.get(position));
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
});
}

View file

@ -51,7 +51,6 @@ import android.view.inputmethod.InputMethodManager;
import android.webkit.URLUtil;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -110,7 +109,6 @@ import app.fedilab.android.databinding.DrawerStatusComposeBinding;
import app.fedilab.android.databinding.DrawerStatusSimpleBinding;
import app.fedilab.android.mastodon.activities.ComposeActivity;
import app.fedilab.android.mastodon.activities.MediaActivity;
import app.fedilab.android.mastodon.activities.SearchResultTabActivity;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Emoji;
@ -120,6 +118,7 @@ import app.fedilab.android.mastodon.client.entities.api.Poll;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.api.Tag;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.CamelTag;
import app.fedilab.android.mastodon.client.entities.app.Languages;
import app.fedilab.android.mastodon.client.entities.app.Quotes;
@ -891,6 +890,13 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
Tag tag = new Tag();
tag.name = camelTag;
if (!results.hashtags.contains(tag)) {
for(Tag realTag: results.hashtags) {
if(realTag.name.equalsIgnoreCase(camelTag)) {
tag.history = realTag.history;
break;
}
}
results.hashtags.add(0, tag);
}
}
@ -1368,15 +1374,19 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
}
drawerMediaListBinding.getRoot().setOnClickListener(v -> {
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
Bundle args = new Bundle();
ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
mediaIntent.putExtras(b);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, drawerMediaListBinding.media, attachment.url);
context.startActivity(mediaIntent, options.toBundle());
});
});
holder.binding.simpleMedia.addView(drawerMediaListBinding.getRoot());
}

View file

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentNightMode;
import android.annotation.SuppressLint;
@ -22,6 +23,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
@ -54,6 +56,7 @@ import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Conversation;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -220,9 +223,15 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} else {
intent = new Intent(context, ContextActivity.class);
}
intent.putExtra(Helper.ARG_STATUS, conversation.last_status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, conversation.last_status);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holder.binding.attachmentsListContainer.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) {
@ -232,8 +241,14 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} else {
intent = new Intent(context, ContextActivity.class);
}
intent.putExtra(Helper.ARG_STATUS, conversation.last_status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, conversation.last_status);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
return false;
});

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@ -31,6 +33,7 @@ import app.fedilab.android.databinding.DrawerMediaBinding;
import app.fedilab.android.mastodon.activities.ContextActivity;
import app.fedilab.android.mastodon.activities.MediaActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.fragment.media.FragmentMediaProfile;
@ -72,30 +75,37 @@ public class ImageAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
holder.binding.media.setOnClickListener(v -> {
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
b.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true);
mediaIntent.putExtras(b);
ActivityOptionsCompat options = null;
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
args.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true);
if (attachment != null) {
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = null;
options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url);
} else {
return;
}
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
}
});
holder.binding.media.setOnLongClickListener(v -> {
Intent intentContext = new Intent(context, ContextActivity.class);
Bundle args = new Bundle();
if (attachment != null) {
intentContext.putExtra(Helper.ARG_STATUS, attachment.status);
args.putSerializable(Helper.ARG_STATUS, attachment.status);
} else {
return false;
}
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentContext.putExtras(bundle);
intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intentContext);
});
return false;
});
}

View file

@ -15,10 +15,10 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentNightMode;
import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.statusManagement;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -30,7 +30,6 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
@ -50,6 +49,7 @@ import app.fedilab.android.databinding.DrawerStatusNotificationBinding;
import app.fedilab.android.databinding.NotificationsRelatedAccountsBinding;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Notification;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -272,12 +272,15 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
}));
holderFollow.binding.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
if (notification.isFetchMore && fetchMoreCallBack != null) {
holderFollow.binding.layoutFetchMore.fetchMoreContainer.setVisibility(View.VISIBLE);
holderFollow.binding.layoutFetchMore.fetchMoreMin.setOnClickListener(v -> {
@ -382,12 +385,15 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
MastodonHelper.loadPPMastodon(holderStatus.bindingNotification.status.avatar, notification.account);
holderStatus.bindingNotification.status.statusUserInfo.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holderStatus.bindingNotification.status.mainContainer.setAlpha(.8f);
}
holderStatus.bindingNotification.status.displayName.setText(
@ -429,12 +435,15 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
notificationsRelatedAccountsBinding.acc.setText(relativeNotif.account.username);
notificationsRelatedAccountsBinding.relatedAccountContainer.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, relativeNotif.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, relativeNotif.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holderStatus.bindingNotification.relatedAccounts.addView(notificationsRelatedAccountsBinding.getRoot());
}
holderStatus.bindingNotification.otherAccounts.setVisibility(View.VISIBLE);
@ -443,21 +452,26 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
}
holderStatus.bindingNotification.status.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holderStatus.bindingNotification.status.statusUserInfo.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holderStatus.bindingNotification.status.displayName.setText(
notification.account.getSpanDisplayNameTitle(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName), title),

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@ -38,6 +40,7 @@ import app.fedilab.android.databinding.DrawerSliderBinding;
import app.fedilab.android.mastodon.activities.MediaActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import jp.wasabeef.glide.transformations.BlurTransformation;
@ -102,14 +105,17 @@ public class SliderAdapter extends SliderViewAdapter<SliderAdapter.SliderAdapter
}
} else {
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b);
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, viewHolder.binding.ivAutoImageSlider, status.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
}
});
}

View file

@ -88,7 +88,6 @@ import androidx.fragment.app.Fragment;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -153,6 +152,7 @@ import app.fedilab.android.mastodon.client.entities.api.Reaction;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.Account;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.RemoteInstance;
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
@ -481,7 +481,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
String loadMediaType = sharedpreferences.getString(context.getString(R.string.SET_LOAD_MEDIA_TYPE), "ALWAYS");
if (statusToDeal.quote != null) {
if (statusToDeal.quote != null && (statusToDeal.spoiler_text == null || statusToDeal.spoiler_text.trim().isEmpty() || statusToDeal.isExpended)) {
holder.binding.quotedMessage.cardviewContainer.setCardElevation((int) Helper.convertDpToPixel(5, context));
holder.binding.quotedMessage.dividerCard.setVisibility(View.GONE);
holder.binding.quotedMessage.cardviewContainer.setStrokeWidth((int) Helper.convertDpToPixel(1, context));
@ -503,9 +503,15 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return;
}
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, statusToDeal.quote);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal.quote);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holder.binding.quotedMessage.cardviewContainer.setStrokeColor(ThemeHelper.getAttColor(context, R.attr.colorPrimary));
holder.binding.quotedMessage.statusContent.setText(
statusToDeal.quote.getSpanContent(context,
@ -932,22 +938,28 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.reblog != null ? fetchedStatus.reblog.account : fetchedStatus.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.reblog != null ? fetchedStatus.reblog.account : fetchedStatus.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
}
});
} else {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, status.reblog != null ? status.reblog.account : status.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, status.reblog != null ? status.reblog.account : status.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
});
holder.binding.statusBoosterInfo.setOnClickListener(v -> {
@ -958,22 +970,28 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
}
});
} else {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, status.account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, status.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
});
//---> REBLOG/UNREBLOG
@ -1448,6 +1466,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
} else {
holder.binding.statusContent.setVisibility(View.GONE);
holder.binding.quotedMessage.cardviewContainer.setVisibility(View.GONE);
holder.binding.mediaContainer.setVisibility(View.GONE);
holder.binding.card.setVisibility(View.GONE);
}
@ -1656,15 +1675,18 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return;
}
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b);
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
});
layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
@ -1724,15 +1746,18 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return;
}
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b);
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
});
layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
@ -1761,20 +1786,32 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.reblogInfo.setOnClickListener(v -> {
if (statusToDeal.reblogs_count > 0) {
Intent intent = new Intent(context, StatusInfoActivity.class);
intent.putExtra(Helper.ARG_TYPE_OF_INFO, StatusInfoActivity.typeOfInfo.BOOSTED_BY);
intent.putExtra(Helper.ARG_STATUS, statusToDeal);
intent.putExtra(Helper.ARG_CHECK_REMOTELY, remote);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal);
args.putSerializable(Helper.ARG_TYPE_OF_INFO, StatusInfoActivity.typeOfInfo.BOOSTED_BY);
args.putBoolean(Helper.ARG_CHECK_REMOTELY, remote);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
});
holder.binding.favouriteInfo.setOnClickListener(v -> {
if (statusToDeal.favourites_count > 0) {
Intent intent = new Intent(context, StatusInfoActivity.class);
intent.putExtra(Helper.ARG_TYPE_OF_INFO, StatusInfoActivity.typeOfInfo.LIKED_BY);
intent.putExtra(Helper.ARG_STATUS, statusToDeal);
intent.putExtra(Helper.ARG_CHECK_REMOTELY, remote);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal);
args.putSerializable(Helper.ARG_TYPE_OF_INFO, StatusInfoActivity.typeOfInfo.LIKED_BY);
args.putBoolean(Helper.ARG_CHECK_REMOTELY, remote);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
});
@ -1990,22 +2027,31 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return;
}
if (context instanceof ContextActivity && !remote) {
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_STATUS, statusToDeal);
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
Fragment fragment = Helper.addFragment(((AppCompatActivity) context).getSupportFragmentManager(), R.id.nav_host_fragment_content_main, new FragmentMastodonContext(), bundle, null, FragmentMastodonContext.class.getName());
((ContextActivity) context).setCurrentFragment((FragmentMastodonContext) fragment);
});
} else {
if (remote) {
//Lemmy main post that should open Lemmy threads
if (adapter instanceof StatusAdapter && ((StatusAdapter) adapter).type == RemoteInstance.InstanceType.LEMMY && status.lemmy_post_id != null) {
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, ((StatusAdapter) adapter).pinnedTimeline);
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
bundle.putString(Helper.ARG_LEMMY_POST_ID, status.lemmy_post_id);
bundle.putSerializable(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_REMOTE_INSTANCE, ((StatusAdapter) adapter).pinnedTimeline);
args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
args.putString(Helper.ARG_LEMMY_POST_ID, status.lemmy_post_id);
args.putSerializable(Helper.ARG_STATUS, status);
Intent intent = new Intent(context, TimelineActivity.class);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} //Classic other cases for remote instances that will search the remote context
else if (!(context instanceof ContextActivity)) { //We are not already checking a remote conversation
Toasty.info(context, context.getString(R.string.retrieve_remote_status), Toasty.LENGTH_SHORT).show();
@ -2014,8 +2060,14 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, fetchedStatus);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, fetchedStatus);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
}
@ -2035,8 +2087,14 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
} else {
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, statusToDeal);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
}
});
@ -2120,9 +2178,15 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
statusDeleted.id = null;
statusDraft.statusDraftList.add(statusDeleted);
intent.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft);
intent.putExtra(Helper.ARG_STATUS_REPLY_ID, statusDeleted.in_reply_to_id);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
args.putSerializable(Helper.ARG_STATUS_REPLY_ID, statusDeleted.in_reply_to_id);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
sendAction(context, Helper.ARG_STATUS_DELETED, statusToDeal, null);
});
}
@ -2143,10 +2207,16 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
statusToDeal.spoilerChecked = true;
}
statusDraft.statusDraftList.add(statusToDeal);
intent.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft);
intent.putExtra(Helper.ARG_EDIT_STATUS_ID, statusToDeal.id);
intent.putExtra(Helper.ARG_STATUS_REPLY_ID, statusToDeal.in_reply_to_id);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
args.putString(Helper.ARG_EDIT_STATUS_ID, statusToDeal.id);
args.putString(Helper.ARG_STATUS_REPLY_ID, statusToDeal.in_reply_to_id);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else {
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
}
@ -2250,8 +2320,14 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return true;
} else if (itemId == R.id.action_report) {
Intent intent = new Intent(context, ReportActivity.class);
intent.putExtra(Helper.ARG_STATUS, statusToDeal);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else if (itemId == R.id.action_copy) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
String content;
@ -2305,14 +2381,24 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
} else if (itemId == R.id.action_custom_sharing) {
Intent intent = new Intent(context, CustomSharingActivity.class);
intent.putExtra(Helper.ARG_STATUS, statusToDeal);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else if (itemId == R.id.action_mention) {
Intent intent = new Intent(context, ComposeActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_STATUS_MENTION, statusToDeal);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_MENTION, statusToDeal);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else if (itemId == R.id.action_open_with) {
new Thread(() -> {
try {
@ -2412,19 +2498,31 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ComposeActivity.class);
intent.putExtra(Helper.ARG_STATUS_REPLY, fetchedStatus);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_REPLY, fetchedStatus);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
} else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
}
});
} else {
Intent intent = new Intent(context, ComposeActivity.class);
intent.putExtra(Helper.ARG_STATUS_REPLY, statusToDeal);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_REPLY, statusToDeal);
if (status.reblog != null) {
intent.putExtra(Helper.ARG_MENTION_BOOSTER, status.account);
args.putSerializable(Helper.ARG_MENTION_BOOSTER, status.account);
}
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
});
//For reports
@ -2691,15 +2789,18 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return;
}
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b);
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
});
layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
@ -2748,20 +2849,24 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
* @param id - Id of an account (can be null)
*/
public static void sendAction(@NonNull Context context, @NonNull String type, @Nullable Status status, @Nullable String id) {
Bundle b = new Bundle();
Bundle args = new Bundle();
if (status != null) {
b.putSerializable(type, status);
args.putSerializable(type, status);
}
if (id != null) {
b.putString(type, id);
args.putString(type, id);
}
if (type.equals(ARG_TIMELINE_REFRESH_ALL)) {
b.putBoolean(ARG_TIMELINE_REFRESH_ALL, true);
args.putBoolean(ARG_TIMELINE_REFRESH_ALL, true);
}
Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION);
intentBC.putExtras(b);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intentBC.putExtras(bundle);
intentBC.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBC);
});
}
@ -3144,32 +3249,46 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.bindingArt.artAcct.setText(String.format(Locale.getDefault(), "@%s", status.account.acct));
holder.bindingArt.artPp.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, status.account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, status.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holder.bindingArt.artMedia.setOnClickListener(v -> {
if (status.art_attachment != null) {
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, 1);
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, 1);
ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(status.art_attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
mediaIntent.putExtras(b);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url);
context.startActivity(mediaIntent, options.toBundle());
});
} else {
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
}
});
holder.bindingArt.bottomBanner.setOnClickListener(v -> {
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, status);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, status);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
} else if (viewHolder.getItemViewType() == STATUS_PIXELFED) {
Status statusToDeal = status.reblog != null ? status.reblog : status;
StatusViewHolder holder = (StatusViewHolder) viewHolder;
@ -3196,16 +3315,26 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.bindingPixelfed.artAcct.setText(String.format(Locale.getDefault(), "@%s", statusToDeal.account.acct));
holder.bindingPixelfed.artPp.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, statusToDeal.account);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, statusToDeal.account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holder.bindingPixelfed.bottomBanner.setOnClickListener(v -> {
Intent intent = new Intent(context, ContextActivity.class);
intent.putExtra(Helper.ARG_STATUS, statusToDeal);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS, statusToDeal);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
}
}
@ -3217,8 +3346,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder viewHolder) {
super.onViewRecycled(viewHolder);
if (viewHolder instanceof StatusViewHolder) {
StatusViewHolder holder = (StatusViewHolder) viewHolder;
if (viewHolder instanceof StatusViewHolder holder) {
if (holder.binding != null) {
PlayerView doubleTapPlayerView = holder.binding.media.getRoot().findViewById(R.id.media_video);
if (doubleTapPlayerView != null && doubleTapPlayerView.getPlayer() != null) {

View file

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.prepareRequestBuilder;
import android.app.Activity;
@ -77,6 +78,7 @@ import app.fedilab.android.mastodon.activities.MediaActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Poll;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.CacheDataSourceFactory;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod;
@ -191,15 +193,18 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
return;
}
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b);
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
});
layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition());
@ -667,15 +672,18 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
return;
}
Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b);
Bundle args = new Bundle();
args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle());
});
});
layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive;
notifyItemChanged(holder.getBindingAdapterPosition());

View file

@ -15,9 +15,12 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -39,6 +42,7 @@ import app.fedilab.android.databinding.DrawerStatusDraftBinding;
import app.fedilab.android.mastodon.activities.ComposeActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
@ -100,10 +104,15 @@ public class StatusDraftAdapter extends RecyclerView.Adapter<StatusDraftAdapter.
holder.binding.cardviewContainer.setOnClickListener(v -> {
Intent intent = new Intent(context, ComposeActivity.class);
intent.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holder.binding.delete.setOnClickListener(v -> {
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(context);

View file

@ -16,10 +16,12 @@ package app.fedilab.android.mastodon.ui.drawer;
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString;
import android.view.LayoutInflater;
@ -44,6 +46,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerStatusScheduledBinding;
import app.fedilab.android.mastodon.activities.ComposeActivity;
import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.ScheduledBoost;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException;
@ -126,10 +129,15 @@ public class StatusScheduledAdapter extends RecyclerView.Adapter<StatusScheduled
holder.binding.cardviewContainer.setOnClickListener(v -> {
if (statusDraft != null) {
Intent intent = new Intent(context, ComposeActivity.class);
intent.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
}
});
holder.binding.delete.setOnClickListener(v -> {
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(context);

View file

@ -15,7 +15,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */
import android.app.Activity;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -26,7 +27,6 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.preference.PreferenceManager;
@ -41,6 +41,7 @@ import app.fedilab.android.databinding.DrawerSuggestionBinding;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Suggestion;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
@ -87,12 +88,15 @@ public class SuggestionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
holder.binding.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b);
// start the new activity
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, account);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
holder.binding.followAction.setIconResource(R.drawable.ic_baseline_person_add_24);
if (account == null) {
return;

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -41,6 +43,7 @@ import app.fedilab.android.databinding.DrawerTagBinding;
import app.fedilab.android.mastodon.activities.HashTagActivity;
import app.fedilab.android.mastodon.client.entities.api.History;
import app.fedilab.android.mastodon.client.entities.api.Tag;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
public class TagAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@ -100,11 +103,15 @@ public class TagAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
tagViewHolder.binding.getRoot().setOnClickListener(v1 -> {
Intent intent = new Intent(context, HashTagActivity.class);
Bundle b = new Bundle();
b.putString(Helper.ARG_SEARCH_KEYWORD, tag.name.trim());
intent.putExtras(b);
Bundle args = new Bundle();
args.putString(Helper.ARG_SEARCH_KEYWORD, tag.name.trim());
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent);
});
});
}
public int getCount() {

View file

@ -11,10 +11,14 @@ import android.widget.Filterable;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.github.mikephil.charting.data.Entry;
import java.util.ArrayList;
import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerTagSearchBinding;
import app.fedilab.android.mastodon.client.entities.api.History;
import app.fedilab.android.mastodon.client.entities.api.Tag;
/* Copyright 2021 Thomas Schneider
@ -37,6 +41,7 @@ public class TagsSearchAdapter extends ArrayAdapter<Tag> implements Filterable {
private final List<Tag> tags;
private final List<Tag> tempTags;
private final List<Tag> suggestions;
private final Context context;
private final Filter searchFilter = new Filter() {
@Override
@ -75,6 +80,7 @@ public class TagsSearchAdapter extends ArrayAdapter<Tag> implements Filterable {
public TagsSearchAdapter(Context context, List<Tag> tags) {
super(context, android.R.layout.simple_list_item_1, tags);
this.context = context;
this.tags = tags;
this.tempTags = new ArrayList<>(tags);
this.suggestions = new ArrayList<>(tags);
@ -110,6 +116,21 @@ public class TagsSearchAdapter extends ArrayAdapter<Tag> implements Filterable {
holder = (TagSearchViewHolder) convertView.getTag();
}
holder.binding.tagName.setText(String.format("#%s", tag.name));
List<History> historyList = tag.history;
int stat = 0;
if (historyList != null) {
for (History history : historyList) {
stat += Integer.parseInt(history.accounts);
}
}
if(stat > 0 ) {
holder.binding.tagCount.setText("(" + context.getString(R.string.talking_about, stat) + ")");
holder.binding.tagCount.setVisibility(View.VISIBLE);
} else {
holder.binding.tagCount.setVisibility(View.GONE);
}
return holder.view;
}

View file

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.ui.drawer.admin;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -34,6 +36,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerAdminAccountBinding;
import app.fedilab.android.mastodon.activities.admin.AdminAccountActivity;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -77,12 +80,16 @@ public class AdminAccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
MastodonHelper.loadPPMastodon(holder.binding.pp, adminAccount.account);
holder.binding.cardviewContainer.setOnClickListener(v -> {
Intent intent = new Intent(context, AdminAccountActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, adminAccount);
intent.putExtras(b);
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_ACCOUNT, adminAccount);
new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
});
holder.binding.username.setText(adminAccount.account.display_name);
holder.binding.acct.setText(String.format(Locale.getDefault(), "@%s", adminAccount.account.acct));
holder.binding.postCount.setText(String.valueOf(adminAccount.account.statuses_count));

View file

@ -110,9 +110,17 @@ public class FragmentMedia extends Fragment {
enableSliding(true);
}
});
binding.mediaPicture.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen());
binding.mediaPicture.setOnClickListener(v -> {
if (isAdded()) {
((MediaActivity) requireActivity()).toogleFullScreen();
}
});
binding.mediaVideo.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen());
binding.mediaVideo.setOnClickListener(v -> {
if (isAdded()) {
((MediaActivity) requireActivity()).toogleFullScreen();
}
});
String type = attachment.type;
String preview_url = attachment.preview_url;
@ -363,7 +371,8 @@ public class FragmentMedia extends Fragment {
binding.videoLayout.setVisibility(View.GONE);
try {
ActivityCompat.finishAfterTransition(requireActivity());
}catch (Exception ignored){}
} catch (Exception ignored) {
}
}
}
@ -386,7 +395,9 @@ public class FragmentMedia extends Fragment {
@Override
public boolean onPreDraw() {
imageView.getViewTreeObserver().removeOnPreDrawListener(this);
if (isAdded()) {
ActivityCompat.startPostponedEnterTransition(requireActivity());
}
return true;
}
});

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.ui.fragment.media;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -38,6 +40,8 @@ import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.api.Statuses;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.CrossActionHelper;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -68,17 +72,37 @@ public class FragmentMediaProfile extends Fragment {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
Bundle bundle = this.getArguments();
if (bundle != null) {
accountTimeline = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT);
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false);
if (getArguments() != null) {
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
if (bundleId != -1) {
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
try {
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
} catch (DBException e) {
e.printStackTrace();
}
}
initializeAfterBundle(getArguments());
}
} else {
initializeAfterBundle(null);
}
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
if (bundle.containsKey(Helper.ARG_ACCOUNT)) {
accountTimeline = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
flagLoading = false;
accountsVM = new ViewModelProvider(requireActivity()).get(AccountsVM.class);
mediaStatuses = new ArrayList<>();
@ -114,7 +138,12 @@ public class FragmentMediaProfile extends Fragment {
accountsVM.getAccountStatuses(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountTimeline.id, null, null, null, null, null, true, false, MastodonHelper.statusesPerCall(requireActivity()))
.observe(getViewLifecycleOwner(), this::initializeStatusesCommonView);
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
/**

View file

@ -19,6 +19,7 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.MultiSelectListPreference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
@ -30,6 +31,7 @@ import java.util.Set;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.mastodon.client.entities.app.Languages;
import app.fedilab.android.mastodon.helper.Helper;
public class FragmentComposeSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -43,12 +45,21 @@ public class FragmentComposeSettings extends PreferenceFragmentCompat implements
private void createPref() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
//Theme for dialogs
ListPreference SET_THREAD_MESSAGE = findPreference(getString(R.string.SET_THREAD_MESSAGE));
if (SET_THREAD_MESSAGE != null) {
SET_THREAD_MESSAGE.getContext().setTheme(Helper.dialogStyle());
}
//---------
EditTextPreference SET_WATERMARK_TEXT = findPreference(getString(R.string.SET_WATERMARK_TEXT));
if (SET_WATERMARK_TEXT != null) {
String val = sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT), null));
SET_WATERMARK_TEXT.setText(val);
}
MultiSelectListPreference SET_SELECTED_LANGUAGE = findPreference(getString(R.string.SET_SELECTED_LANGUAGE));
if (SET_SELECTED_LANGUAGE != null) {

View file

@ -25,6 +25,7 @@ import androidx.preference.SwitchPreferenceCompat;
import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.mastodon.helper.Helper;
public class FragmentExtraFeaturesSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -41,6 +42,18 @@ public class FragmentExtraFeaturesSettings extends PreferenceFragmentCompat impl
addPreferencesFromResource(R.xml.pref_extra_features);
PreferenceScreen preferenceScreen = getPreferenceScreen();
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
//Theme for dialogs
ListPreference SET_POST_FORMAT = findPreference(getString(R.string.SET_POST_FORMAT));
if (SET_POST_FORMAT != null) {
SET_POST_FORMAT.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_COMPOSE_LOCAL_ONLY = findPreference(getString(R.string.SET_DEFAULT_LOCALE_NEW));
if (SET_COMPOSE_LOCAL_ONLY != null) {
SET_COMPOSE_LOCAL_ONLY.getContext().setTheme(Helper.dialogStyle());
}
//---------
SwitchPreferenceCompat SET_EXTAND_EXTRA_FEATURES = findPreference(getString(R.string.SET_EXTAND_EXTRA_FEATURES));
if (SET_EXTAND_EXTRA_FEATURES != null) {
boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_EXTAND_EXTRA_FEATURES) + MainActivity.currentUserID + MainActivity.currentInstance, false);
@ -69,13 +82,11 @@ public class FragmentExtraFeaturesSettings extends PreferenceFragmentCompat impl
SET_DISPLAY_REACTIONS.setChecked(checked);
}
ListPreference SET_POST_FORMAT = findPreference(getString(R.string.SET_POST_FORMAT));
if (SET_POST_FORMAT != null) {
String format = sharedpreferences.getString(getString(R.string.SET_POST_FORMAT) + MainActivity.currentUserID + MainActivity.currentInstance, "text/plain");
SET_POST_FORMAT.setValue(format);
}
ListPreference SET_COMPOSE_LOCAL_ONLY = findPreference(getString(R.string.SET_COMPOSE_LOCAL_ONLY));
if (SET_COMPOSE_LOCAL_ONLY != null) {
int localOnly = sharedpreferences.getInt(getString(R.string.SET_COMPOSE_LOCAL_ONLY) + MainActivity.currentUserID + MainActivity.currentInstance, 0);
SET_COMPOSE_LOCAL_ONLY.setValue(String.valueOf(localOnly));

View file

@ -63,13 +63,21 @@ public class FragmentHomeCacheSettings extends PreferenceFragmentCompat implemen
return;
}
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
//Theme for dialogs
ListPreference SET_FETCH_HOME_DELAY_VALUE = findPreference(getString(R.string.SET_FETCH_HOME_DELAY_VALUE));
if (SET_FETCH_HOME_DELAY_VALUE != null) {
SET_FETCH_HOME_DELAY_VALUE.getContext().setTheme(Helper.dialogStyle());
}
//---------
SwitchPreference SET_FETCH_HOME = findPreference(getString(R.string.SET_FETCH_HOME));
if (SET_FETCH_HOME != null) {
boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_FETCH_HOME) + MainActivity.currentUserID + MainActivity.currentInstance, false);
SET_FETCH_HOME.setChecked(checked);
}
ListPreference SET_FETCH_HOME_DELAY_VALUE = findPreference(getString(R.string.SET_FETCH_HOME_DELAY_VALUE));
if (SET_FETCH_HOME_DELAY_VALUE != null) {
String timeRefresh = sharedpreferences.getString(getString(R.string.SET_FETCH_HOME_DELAY_VALUE) + MainActivity.currentUserID + MainActivity.currentInstance, "60");
SET_FETCH_HOME_DELAY_VALUE.setValue(timeRefresh);

View file

@ -33,6 +33,7 @@ import app.fedilab.android.BuildConfig;
import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.ImageListPreference;
import app.fedilab.android.mastodon.helper.LogoHelper;
import es.dmoral.toasty.Toasty;
@ -54,6 +55,13 @@ public class FragmentInterfaceSettings extends PreferenceFragmentCompat implemen
Toasty.error(requireActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
return;
}
//Theme for dialogs
ImageListPreference SET_LOGO_LAUNCHER = findPreference(getString(R.string.SET_LOGO_LAUNCHER));
if (SET_LOGO_LAUNCHER != null) {
SET_LOGO_LAUNCHER.getContext().setTheme(Helper.dialogStyle());
}
//---------
SeekBarPreference SET_FONT_SCALE = findPreference(getString(R.string.SET_FONT_SCALE_INT));
if (SET_FONT_SCALE != null) {
SET_FONT_SCALE.setMax(180);
@ -64,7 +72,6 @@ public class FragmentInterfaceSettings extends PreferenceFragmentCompat implemen
SET_FONT_SCALE_ICON.setMax(180);
SET_FONT_SCALE_ICON.setMin(80);
}
ListPreference SET_LOGO_LAUNCHER = findPreference(getString(R.string.SET_LOGO_LAUNCHER));
if (SET_LOGO_LAUNCHER != null) {
SET_LOGO_LAUNCHER.setIcon(LogoHelper.getDrawable(SET_LOGO_LAUNCHER.getValue()));
}
@ -120,6 +127,9 @@ public class FragmentInterfaceSettings extends PreferenceFragmentCompat implemen
editor.putString(getString(R.string.SET_LOGO_LAUNCHER), newLauncher);
}
}
if (key.compareToIgnoreCase(getString(R.string.SET_DISABLE_TOPBAR_SCROLLING)) == 0) {
recreate = true;
}
editor.apply();
}
}

View file

@ -18,6 +18,7 @@ import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
@ -37,6 +38,14 @@ public class FragmentLanguageSettings extends PreferenceFragmentCompat implement
private void createPref() {
Preference SET_TRANSLATE_VALUES_RESET = findPreference(getString(R.string.SET_TRANSLATE_VALUES_RESET));
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
//Theme for dialogs
ListPreference SET_DEFAULT_LOCALE_NEW = findPreference(getString(R.string.SET_DEFAULT_LOCALE_NEW));
if (SET_DEFAULT_LOCALE_NEW != null) {
SET_DEFAULT_LOCALE_NEW.getContext().setTheme(Helper.dialogStyle());
}
//---------
if (SET_TRANSLATE_VALUES_RESET != null) {
SET_TRANSLATE_VALUES_RESET.setOnPreferenceClickListener(preference -> {
SharedPreferences.Editor editor = sharedPreferences.edit();

View file

@ -40,6 +40,7 @@ import java.util.ArrayList;
import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.PushHelper;
import app.fedilab.android.mastodon.helper.settings.TimePreference;
import app.fedilab.android.mastodon.helper.settings.TimePreferenceDialogFragment;
@ -76,13 +77,37 @@ public class FragmentNotificationsSettings extends PreferenceFragmentCompat impl
getPreferenceScreen().removeAll();
addPreferencesFromResource(R.xml.pref_notifications);
PreferenceScreen preferenceScreen = getPreferenceScreen();
//Theme for dialogs
ListPreference SET_NOTIFICATION_TYPE = findPreference(getString(R.string.SET_NOTIFICATION_TYPE));
if (SET_NOTIFICATION_TYPE != null) {
SET_NOTIFICATION_TYPE.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_NOTIFICATION_DELAY_VALUE = findPreference(getString(R.string.SET_NOTIFICATION_DELAY_VALUE));
if (SET_NOTIFICATION_DELAY_VALUE != null) {
SET_NOTIFICATION_DELAY_VALUE.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_PUSH_DISTRIBUTOR = findPreference(getString(R.string.SET_PUSH_DISTRIBUTOR));
if (SET_PUSH_DISTRIBUTOR != null) {
SET_PUSH_DISTRIBUTOR.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_LED_COLOUR_VAL_N = findPreference(getString(R.string.SET_LED_COLOUR_VAL_N));
if (SET_LED_COLOUR_VAL_N != null) {
SET_LED_COLOUR_VAL_N.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_NOTIFICATION_ACTION = findPreference(getString(R.string.SET_NOTIFICATION_ACTION));
if (SET_NOTIFICATION_ACTION != null) {
SET_NOTIFICATION_ACTION.getContext().setTheme(Helper.dialogStyle());
}
//---------
if (preferenceScreen == null) {
Toasty.error(requireActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
return;
}
ListPreference SET_NOTIFICATION_TYPE = findPreference(getString(R.string.SET_NOTIFICATION_TYPE));
String[] notificationValues = getResources().getStringArray(R.array.SET_NOTIFICATION_TYPE_VALUE);
if (SET_NOTIFICATION_TYPE != null && SET_NOTIFICATION_TYPE.getValue().equals(notificationValues[2])) {
PreferenceCategory notification_sounds = findPreference("notification_sounds");
@ -97,26 +122,21 @@ public class FragmentNotificationsSettings extends PreferenceFragmentCompat impl
if (notification_time_slot != null) {
preferenceScreen.removePreference(notification_time_slot);
}
ListPreference SET_NOTIFICATION_DELAY_VALUE = findPreference("SET_NOTIFICATION_DELAY_VALUE");
if (SET_NOTIFICATION_DELAY_VALUE != null) {
preferenceScreen.removePreferenceRecursively("SET_NOTIFICATION_DELAY_VALUE");
}
ListPreference SET_PUSH_DISTRIBUTOR = findPreference("SET_PUSH_DISTRIBUTOR");
if (SET_PUSH_DISTRIBUTOR != null) {
preferenceScreen.removePreferenceRecursively("SET_PUSH_DISTRIBUTOR");
}
return;
} else if (SET_NOTIFICATION_TYPE != null && SET_NOTIFICATION_TYPE.getValue().equals(notificationValues[1])) {
ListPreference SET_PUSH_DISTRIBUTOR = findPreference("SET_PUSH_DISTRIBUTOR");
if (SET_PUSH_DISTRIBUTOR != null) {
preferenceScreen.removePreferenceRecursively("SET_PUSH_DISTRIBUTOR");
}
} else {
ListPreference SET_NOTIFICATION_DELAY_VALUE = findPreference("SET_NOTIFICATION_DELAY_VALUE");
if (SET_NOTIFICATION_DELAY_VALUE != null) {
preferenceScreen.removePreferenceRecursively("SET_NOTIFICATION_DELAY_VALUE");
}
ListPreference SET_PUSH_DISTRIBUTOR = findPreference(getString(R.string.SET_PUSH_DISTRIBUTOR));
if (SET_PUSH_DISTRIBUTOR != null) {
List<String> distributors = UnifiedPush.getDistributors(requireActivity(), new ArrayList<>());
SET_PUSH_DISTRIBUTOR.setValue(UnifiedPush.getDistributor(requireActivity()));

View file

@ -114,6 +114,22 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements
Toasty.error(requireActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
}
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
//Theme for dialogs
ListPreference SET_THEME_BASE = findPreference(getString(R.string.SET_THEME_BASE));
if (SET_THEME_BASE != null) {
SET_THEME_BASE.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_THEME_DEFAULT_LIGHT = findPreference(getString(R.string.SET_THEME_DEFAULT_LIGHT));
if (SET_THEME_DEFAULT_LIGHT != null) {
SET_THEME_DEFAULT_LIGHT.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_THEME_DEFAULT_DARK = findPreference(getString(R.string.SET_THEME_DEFAULT_DARK));
if (SET_THEME_DEFAULT_DARK != null) {
SET_THEME_DEFAULT_DARK.getContext().setTheme(Helper.dialogStyle());
}
//---------
SwitchPreferenceCompat SET_DYNAMIC_COLOR = findPreference(getString(R.string.SET_DYNAMICCOLOR));
SwitchPreferenceCompat SET_CUSTOM_ACCENT = findPreference(getString(R.string.SET_CUSTOM_ACCENT));
ColorPreferenceCompat SET_CUSTOM_ACCENT_DARK_VALUE = findPreference(getString(R.string.SET_CUSTOM_ACCENT_DARK_VALUE));

View file

@ -31,6 +31,7 @@ import app.fedilab.android.mastodon.helper.Helper;
public class FragmentTimelinesSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
boolean recreate;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.pref_timelines);
@ -47,7 +48,18 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen
ListPreference SET_TRANSLATOR = findPreference(getString(R.string.SET_TRANSLATOR));
ListPreference SET_TRANSLATOR_VERSION = findPreference(getString(R.string.SET_TRANSLATOR_VERSION));
//Theme for dialogs
if (SET_TRANSLATOR_VERSION != null) {
SET_TRANSLATOR_VERSION.getContext().setTheme(Helper.dialogStyle());
}
if (SET_TRANSLATOR != null) {
SET_TRANSLATOR.getContext().setTheme(Helper.dialogStyle());
}
ListPreference SET_LOAD_MEDIA_TYPE = findPreference(getString(R.string.SET_LOAD_MEDIA_TYPE));
if (SET_LOAD_MEDIA_TYPE != null) {
SET_LOAD_MEDIA_TYPE.getContext().setTheme(Helper.dialogStyle());
}
//---------
EditTextPreference SET_TRANSLATOR_API_KEY = findPreference(getString(R.string.SET_TRANSLATOR_API_KEY));
EditTextPreference SET_TRANSLATOR_DOMAIN = findPreference(getString(R.string.SET_TRANSLATOR_DOMAIN));
if (SET_TRANSLATOR != null && !SET_TRANSLATOR.getValue().equals("DEEPL")) {

View file

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentInstance;
import static app.fedilab.android.BaseMainActivity.currentToken;
import static app.fedilab.android.mastodon.helper.MastodonHelper.ACCOUNTS_PER_CALL;
@ -38,14 +39,15 @@ import java.util.List;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.FragmentPaginationBinding;
import app.fedilab.android.mastodon.activities.SearchResultTabActivity;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Accounts;
import app.fedilab.android.mastodon.client.entities.api.Pagination;
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.ui.drawer.AccountAdapter;
@ -77,19 +79,49 @@ public class FragmentMastodonAccount extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
if (getArguments() != null) {
search = getArguments().getString(Helper.ARG_SEARCH_KEYWORD, null);
accountTimeline = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT);
followType = (FedilabProfileTLPageAdapter.follow_type) getArguments().getSerializable(Helper.ARG_FOLLOW_TYPE);
viewModelKey = getArguments().getString(Helper.ARG_VIEW_MODEL_KEY, "");
timelineType = (Timeline.TimeLineEnum) getArguments().get(Helper.ARG_TIMELINE_TYPE);
order = getArguments().getString(Helper.ARG_DIRECTORY_ORDER, "active");
local = getArguments().getBoolean(Helper.ARG_DIRECTORY_LOCAL, false);
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
instance = currentInstance;
token = currentToken;
flagLoading = false;
binding = FragmentPaginationBinding.inflate(inflater, container, false);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
if (getArguments() != null) {
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
if (bundleId != -1) {
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
try {
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
} catch (DBException e) {
e.printStackTrace();
}
}
initializeAfterBundle(getArguments());
}
} else {
initializeAfterBundle(null);
}
return binding.getRoot();
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
search = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null);
if (bundle.containsKey(Helper.ARG_ACCOUNT)) {
accountTimeline = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}
followType = (FedilabProfileTLPageAdapter.follow_type) bundle.getSerializable(Helper.ARG_FOLLOW_TYPE);
viewModelKey = bundle.getString(Helper.ARG_VIEW_MODEL_KEY, "");
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
order = bundle.getString(Helper.ARG_DIRECTORY_ORDER, "active");
local = bundle.getBoolean(Helper.ARG_DIRECTORY_LOCAL, false);
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
if (checkRemotely) {
String[] acctArray = accountTimeline.acct.split("@");
if (acctArray.length > 1) {
@ -102,20 +134,6 @@ public class FragmentMastodonAccount extends Fragment {
token = currentToken;
}
}
flagLoading = false;
binding = FragmentPaginationBinding.inflate(inflater, container, false);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.loader.setVisibility(View.VISIBLE);
binding.recyclerView.setVisibility(View.GONE);
accountsVM = new ViewModelProvider(FragmentMastodonAccount.this).get(viewModelKey, AccountsVM.class);
max_id = null;
offset = 0;
@ -126,6 +144,14 @@ public class FragmentMastodonAccount extends Fragment {
router(true);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.loader.setVisibility(View.VISIBLE);
binding.recyclerView.setVisibility(View.GONE);
}
/**
* Router for timelines
*/
@ -206,7 +232,7 @@ public class FragmentMastodonAccount extends Fragment {
}
} else if (timelineType == Timeline.TimeLineEnum.MUTED_TIMELINE_HOME) {
if (firstLoad) {
accountsVM.getMutedHome(MainActivity.currentAccount)
accountsVM.getMutedHome(currentAccount)
.observe(getViewLifecycleOwner(), this::initializeAccountCommonView);
}
} else if (timelineType == Timeline.TimeLineEnum.BLOCKED_TIMELINE) {

View file

@ -14,6 +14,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.mastodon.activities.ContextActivity.displayCW;
import static app.fedilab.android.mastodon.activities.ContextActivity.expand;
@ -21,7 +22,6 @@ import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -31,7 +31,6 @@ import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -44,6 +43,7 @@ import app.fedilab.android.databinding.FragmentPaginationBinding;
import app.fedilab.android.mastodon.activities.ContextActivity;
import app.fedilab.android.mastodon.client.entities.api.Context;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.DividerDecoration;
import app.fedilab.android.mastodon.helper.Helper;
@ -59,18 +59,19 @@ public class FragmentMastodonContext extends Fragment {
private StatusesVM statusesVM;
private List<Status> statuses;
private StatusAdapter statusAdapter;
private boolean refresh;
//Handle actions that can be done in other fragments
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override
public void onReceive(android.content.Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);
Status status_to_delete = (Status) b.getSerializable(Helper.ARG_STATUS_DELETED);
Status statusPosted = (Status) b.getSerializable(Helper.ARG_STATUS_POSTED);
Status status_to_update = (Status) b.getSerializable(Helper.ARG_STATUS_UPDATED);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
Status receivedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_statuses_for_user = bundle.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);
Status status_to_delete = (Status) bundle.getSerializable(Helper.ARG_STATUS_DELETED);
Status statusPosted = (Status) bundle.getSerializable(Helper.ARG_STATUS_POSTED);
Status status_to_update = (Status) bundle.getSerializable(Helper.ARG_STATUS_UPDATED);
if (receivedStatus != null && statusAdapter != null) {
int position = getPosition(receivedStatus);
if (position >= 0) {
@ -125,9 +126,12 @@ public class FragmentMastodonContext extends Fragment {
}
}
}
});
}
}
};
private boolean refresh;
private Status focusedStatus;
private String remote_instance, focusedStatusURI;
private Status firstStatus;
@ -160,10 +164,21 @@ public class FragmentMastodonContext extends Fragment {
pullToRefresh = false;
focusedStatusURI = null;
refresh = true;
binding = FragmentPaginationBinding.inflate(inflater, container, false);
if (getArguments() != null) {
focusedStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS);
remote_instance = getArguments().getString(Helper.ARG_REMOTE_INSTANCE, null);
focusedStatusURI = getArguments().getString(Helper.ARG_FOCUSED_STATUS_URI, null);
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
return binding.getRoot();
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
focusedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
remote_instance = bundle.getString(Helper.ARG_REMOTE_INSTANCE, null);
focusedStatusURI = bundle.getString(Helper.ARG_FOCUSED_STATUS_URI, null);
}
if (remote_instance != null) {
user_instance = remote_instance;
@ -176,7 +191,7 @@ public class FragmentMastodonContext extends Fragment {
getChildFragmentManager().beginTransaction().remove(this).commit();
}
binding = FragmentPaginationBinding.inflate(inflater, container, false);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
@ -204,9 +219,9 @@ public class FragmentMastodonContext extends Fragment {
}
ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED);
return binding.getRoot();
}
public void refresh() {
if (statuses != null) {
for (Status status : statuses) {

View file

@ -50,7 +50,6 @@ import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.work.Data;
@ -83,6 +82,7 @@ import app.fedilab.android.mastodon.client.entities.api.Context;
import app.fedilab.android.mastodon.client.entities.api.Mention;
import app.fedilab.android.mastodon.client.entities.api.Poll;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
@ -112,17 +112,19 @@ public class FragmentMastodonDirectMessage extends Fragment {
private final BroadcastReceiver broadcast_data = new BroadcastReceiver() {
@Override
public void onReceive(android.content.Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
if (b.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) {
Status statusReceived = (Status) b.getSerializable(Helper.RECEIVE_STATUS_ACTION);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
if (bundle.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) {
Status statusReceived = (Status) bundle.getSerializable(Helper.RECEIVE_STATUS_ACTION);
if (statusReceived != null) {
statuses.add(statusReceived);
statusDirectMessageAdapter.notifyItemInserted(statuses.size() - 1);
initiliazeStatus();
}
}
});
}
}
};
@ -132,8 +134,21 @@ public class FragmentMastodonDirectMessage extends Fragment {
focusedStatus = null;
pullToRefresh = false;
binding = FragmentDirectMessageBinding.inflate(inflater, container, false);
if (getArguments() != null) {
focusedStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS);
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
initializeAfterBundle(null);
}
return binding.getRoot();
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
focusedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}
user_instance = MainActivity.currentInstance;
user_token = MainActivity.currentToken;
@ -141,7 +156,7 @@ public class FragmentMastodonDirectMessage extends Fragment {
if (focusedStatus == null) {
getChildFragmentManager().beginTransaction().remove(this).commit();
}
binding = FragmentDirectMessageBinding.inflate(inflater, container, false);
statusesVM = new ViewModelProvider(FragmentMastodonDirectMessage.this).get(StatusesVM.class);
binding.recyclerView.setNestedScrollingEnabled(true);
this.statuses = new ArrayList<>();
@ -217,10 +232,8 @@ public class FragmentMastodonDirectMessage extends Fragment {
}
});
return binding.getRoot();
}
private void onSubmit(StatusDraft statusDraft) {
new Thread(() -> {
if (statusDraft.instance == null) {

View file

@ -14,12 +14,13 @@ package app.fedilab.android.mastodon.ui.fragment.timeline;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
@ -31,7 +32,6 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -49,6 +49,7 @@ import app.fedilab.android.databinding.FragmentPaginationBinding;
import app.fedilab.android.mastodon.client.entities.api.Notification;
import app.fedilab.android.mastodon.client.entities.api.Notifications;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException;
@ -73,11 +74,13 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_all_for_account_id = b.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID);
boolean refreshNotifications = b.getBoolean(Helper.ARG_REFRESH_NOTFICATION, false);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
Status receivedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_all_for_account_id = bundle.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID);
boolean refreshNotifications = bundle.getBoolean(Helper.ARG_REFRESH_NOTFICATION, false);
if (refreshNotifications) {
scrollToTop();
} else if (receivedStatus != null && notificationAdapter != null) {
@ -110,6 +113,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
}
}
}
});
}
}
};

View file

@ -170,7 +170,7 @@ public class FragmentMastodonTag extends Fragment {
Collections.sort(tags, (obj1, obj2) -> Integer.compare(obj2.getWeight(), obj1.getWeight()));
boolean isInCollection = false;
for (Tag tag : tags) {
if (tag.name.compareToIgnoreCase(search) == 0) {
if (tag.name.trim().compareToIgnoreCase(search.trim()) == 0) {
isInCollection = true;
break;
}

View file

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentInstance;
import static app.fedilab.android.BaseMainActivity.networkAvailable;
@ -35,7 +36,6 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -57,10 +57,12 @@ import app.fedilab.android.mastodon.client.entities.api.Pagination;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.api.Statuses;
import app.fedilab.android.mastodon.client.entities.app.BubbleTimeline;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.RemoteInstance;
import app.fedilab.android.mastodon.client.entities.app.TagTimeline;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.CrossActionHelper;
import app.fedilab.android.mastodon.helper.GlideApp;
import app.fedilab.android.mastodon.helper.Helper;
@ -92,15 +94,17 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
if (b != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);
String delete_all_for_account_id = b.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID);
Status status_to_delete = (Status) b.getSerializable(Helper.ARG_STATUS_DELETED);
Status status_to_update = (Status) b.getSerializable(Helper.ARG_STATUS_UPDATED);
Status statusPosted = (Status) b.getSerializable(Helper.ARG_STATUS_DELETED);
boolean refreshAll = b.getBoolean(Helper.ARG_TIMELINE_REFRESH_ALL, false);
Bundle args = intent.getExtras();
if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
Status receivedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_statuses_for_user = bundle.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);
String delete_all_for_account_id = bundle.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID);
Status status_to_delete = (Status) bundle.getSerializable(Helper.ARG_STATUS_DELETED);
Status status_to_update = (Status) bundle.getSerializable(Helper.ARG_STATUS_UPDATED);
Status statusPosted = (Status) bundle.getSerializable(Helper.ARG_STATUS_DELETED);
boolean refreshAll = bundle.getBoolean(Helper.ARG_TIMELINE_REFRESH_ALL, false);
if (receivedStatus != null && statusAdapter != null) {
int position = getPosition(receivedStatus);
if (position >= 0) {
@ -174,6 +178,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} else if (refreshAll) {
refreshAllAdapters();
}
});
}
}
};
@ -346,29 +351,12 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
timelinesVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, TimelinesVM.class);
accountsVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, AccountsVM.class);
initialStatuses = null;
lockForResumeCall = 0;
binding.loader.setVisibility(View.VISIBLE);
binding.recyclerView.setVisibility(View.GONE);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
max_id = statusReport != null ? statusReport.id : null;
offset = 0;
rememberPosition = sharedpreferences.getBoolean(getString(R.string.SET_REMEMBER_POSITION), true);
//Inner marker are only for pinned timelines and main timelines, they have isViewInitialized set to false
if (max_id == null && !isViewInitialized && rememberPosition) {
max_id = sharedpreferences.getString(getString(R.string.SET_INNER_MARKER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance + slug, null);
}
if (search != null) {
binding.swipeContainer.setRefreshing(false);
binding.swipeContainer.setEnabled(false);
}
//Only fragment in main view pager should not have the view initialized
//AND Only the first fragment will initialize its view
flagLoading = false;
}
@Override
@ -378,16 +366,36 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
timelineType = Timeline.TimeLineEnum.HOME;
canBeFederated = true;
retry_for_home_done = false;
binding = FragmentPaginationBinding.inflate(inflater, container, false);
if (getArguments() != null) {
timelineType = (Timeline.TimeLineEnum) getArguments().get(Helper.ARG_TIMELINE_TYPE);
lemmy_post_id = getArguments().getString(Helper.ARG_LEMMY_POST_ID, null);
list_id = getArguments().getString(Helper.ARG_LIST_ID, null);
search = getArguments().getString(Helper.ARG_SEARCH_KEYWORD, null);
searchCache = getArguments().getString(Helper.ARG_SEARCH_KEYWORD_CACHE, null);
pinnedTimeline = (PinnedTimeline) getArguments().getSerializable(Helper.ARG_REMOTE_INSTANCE);
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
if (bundleId != -1) {
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else {
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
try {
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
} catch (DBException e) {
e.printStackTrace();
}
}
initializeAfterBundle(getArguments());
}
}
return binding.getRoot();
}
private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) {
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
lemmy_post_id = bundle.getString(Helper.ARG_LEMMY_POST_ID, null);
list_id = bundle.getString(Helper.ARG_LIST_ID, null);
search = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null);
searchCache = bundle.getString(Helper.ARG_SEARCH_KEYWORD_CACHE, null);
pinnedTimeline = (PinnedTimeline) bundle.getSerializable(Helper.ARG_REMOTE_INSTANCE);
if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) {
if (pinnedTimeline.remoteInstance.type != RemoteInstance.InstanceType.NITTER) {
remoteInstance = pinnedTimeline.remoteInstance.host;
@ -400,24 +408,24 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
if (timelineType == Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC) {
canBeFederated = false;
}
publicTrendsDomain = getArguments().getString(Helper.ARG_REMOTE_INSTANCE_STRING, null);
isViewInitialized = getArguments().getBoolean(Helper.ARG_INITIALIZE_VIEW, true);
publicTrendsDomain = bundle.getString(Helper.ARG_REMOTE_INSTANCE_STRING, null);
isViewInitialized = bundle.getBoolean(Helper.ARG_INITIALIZE_VIEW, true);
isNotPinnedTimeline = isViewInitialized;
tagTimeline = (TagTimeline) getArguments().getSerializable(Helper.ARG_TAG_TIMELINE);
bubbleTimeline = (BubbleTimeline) getArguments().getSerializable(Helper.ARG_BUBBLE_TIMELINE);
accountTimeline = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT);
exclude_replies = !getArguments().getBoolean(Helper.ARG_SHOW_REPLIES, true);
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false);
show_pinned = getArguments().getBoolean(Helper.ARG_SHOW_PINNED, false);
exclude_reblogs = !getArguments().getBoolean(Helper.ARG_SHOW_REBLOGS, true);
media_only = getArguments().getBoolean(Helper.ARG_SHOW_MEDIA_ONY, false);
viewModelKey = getArguments().getString(Helper.ARG_VIEW_MODEL_KEY, "");
minified = getArguments().getBoolean(Helper.ARG_MINIFIED, false);
statusReport = (Status) getArguments().getSerializable(Helper.ARG_STATUS_REPORT);
initialStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS);
tagTimeline = (TagTimeline) bundle.getSerializable(Helper.ARG_TAG_TIMELINE);
bubbleTimeline = (BubbleTimeline) bundle.getSerializable(Helper.ARG_BUBBLE_TIMELINE);
if (bundle.containsKey(Helper.ARG_ACCOUNT)) {
accountTimeline = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}
exclude_replies = !bundle.getBoolean(Helper.ARG_SHOW_REPLIES, true);
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
show_pinned = bundle.getBoolean(Helper.ARG_SHOW_PINNED, false);
exclude_reblogs = !bundle.getBoolean(Helper.ARG_SHOW_REBLOGS, true);
media_only = bundle.getBoolean(Helper.ARG_SHOW_MEDIA_ONY, false);
viewModelKey = bundle.getString(Helper.ARG_VIEW_MODEL_KEY, "");
minified = bundle.getBoolean(Helper.ARG_MINIFIED, false);
statusReport = (Status) bundle.getSerializable(Helper.ARG_STATUS_REPORT);
initialStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}
//When visiting a profile without being authenticated
if (checkRemotely) {
String[] acctArray = accountTimeline.acct.split("@");
@ -454,13 +462,28 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
slug = timelineType != Timeline.TimeLineEnum.ART ? timelineType.getValue() + (ident != null ? "|" + ident : "") : Timeline.TimeLineEnum.TAG.getValue() + (ident != null ? "|" + ident : "");
}
timelinesVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, TimelinesVM.class);
accountsVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, AccountsVM.class);
initialStatuses = null;
lockForResumeCall = 0;
ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED);
binding = FragmentPaginationBinding.inflate(inflater, container, false);
canBeFederated = true;
retry_for_home_done = false;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
return binding.getRoot();
max_id = statusReport != null ? statusReport.id : null;
offset = 0;
rememberPosition = sharedpreferences.getBoolean(getString(R.string.SET_REMEMBER_POSITION), true);
//Inner marker are only for pinned timelines and main timelines, they have isViewInitialized set to false
if (max_id == null && !isViewInitialized && rememberPosition) {
max_id = sharedpreferences.getString(getString(R.string.SET_INNER_MARKER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance + slug, null);
}
//Only fragment in main view pager should not have the view initialized
//AND Only the first fragment will initialize its view
flagLoading = false;
ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED);
}
/**

View file

@ -114,42 +114,42 @@ public class FragmentNotificationContainer extends Fragment {
String[] categoriesArray = excludedCategories.split("\\|");
for (String category : categoriesArray) {
switch (category) {
case "mention":
case "mention" -> {
excludedCategoriesList.add("mention");
dialogView.displayMentions.setChecked(false);
break;
case "favourite":
}
case "favourite" -> {
excludedCategoriesList.add("favourite");
dialogView.displayFavourites.setChecked(false);
break;
case "reblog":
}
case "reblog" -> {
excludedCategoriesList.add("reblog");
dialogView.displayReblogs.setChecked(false);
break;
case "poll":
}
case "poll" -> {
excludedCategoriesList.add("poll");
dialogView.displayPollResults.setChecked(false);
break;
case "status":
}
case "status" -> {
excludedCategoriesList.add("status");
dialogView.displayUpdatesFromPeople.setChecked(false);
break;
case "follow":
}
case "follow" -> {
excludedCategoriesList.add("follow");
dialogView.displayFollows.setChecked(false);
break;
case "update":
}
case "update" -> {
excludedCategoriesList.add("update");
dialogView.displayUpdates.setChecked(false);
break;
case "admin.sign_up":
}
case "admin.sign_up" -> {
excludedCategoriesList.add("admin.sign_up");
dialogView.displaySignups.setChecked(false);
break;
case "admin.report":
}
case "admin.report" -> {
excludedCategoriesList.add("admin.report");
dialogView.displayReports.setChecked(false);
break;
}
}
}
}
@ -224,8 +224,7 @@ public class FragmentNotificationContainer extends Fragment {
Fragment fragment;
if (binding.viewpagerNotificationContainer.getAdapter() != null) {
fragment = (Fragment) binding.viewpagerNotificationContainer.getAdapter().instantiateItem(binding.viewpagerNotificationContainer, tab.getPosition());
if (fragment instanceof FragmentMastodonNotification) {
FragmentMastodonNotification fragmentMastodonNotification = ((FragmentMastodonNotification) fragment);
if (fragment instanceof FragmentMastodonNotification fragmentMastodonNotification) {
fragmentMastodonNotification.scrollToTop();
}
}

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.ui.fragment.timeline;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@ -33,7 +35,9 @@ import com.google.android.material.tabs.TabLayout;
import app.fedilab.android.R;
import app.fedilab.android.databinding.FragmentProfileTimelinesBinding;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.pageadapter.FedilabProfilePageAdapter;
@ -46,19 +50,22 @@ public class FragmentProfileTimeline extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
if (getArguments() != null) {
account = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT);
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false);
if (getArguments() != null) {
String cached_account_id = getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID);
try {
account = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, cached_account_id);
} catch (DBException e) {
e.printStackTrace();
}
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false);
initializeAfterBundle();
}
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
private void initializeAfterBundle() {
binding.tabLayout.addTab(binding.tabLayout.newTab().setText(getString(R.string.toots)));
binding.tabLayout.addTab(binding.tabLayout.newTab().setText(getString(R.string.replies)));
binding.tabLayout.addTab(binding.tabLayout.newTab().setText(getString(R.string.media)));
@ -80,10 +87,7 @@ public class FragmentProfileTimeline extends Fragment {
public void onTabReselected(TabLayout.Tab tab) {
if (binding.viewpager.getAdapter() != null && binding.viewpager
.getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline) {
FragmentMastodonTimeline fragmentMastodonTimeline = (FragmentMastodonTimeline) binding.viewpager
.getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem());
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline fragmentMastodonTimeline) {
fragmentMastodonTimeline.goTop();
}
}
@ -105,24 +109,25 @@ public class FragmentProfileTimeline extends Fragment {
popup.setOnDismissListener(menu1 -> {
if (binding.viewpager.getAdapter() != null && binding.viewpager
.getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline) {
FragmentMastodonTimeline fragmentMastodonTimeline = (FragmentMastodonTimeline) binding.viewpager
.getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem());
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline fragmentMastodonTimeline) {
FragmentTransaction fragTransaction = getChildFragmentManager().beginTransaction();
fragTransaction.detach(fragmentMastodonTimeline).commit();
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
args.putSerializable(Helper.ARG_ACCOUNT, account);
args.putBoolean(Helper.ARG_SHOW_PINNED, true);
args.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);
args.putBoolean(Helper.ARG_SHOW_REBLOGS, show_boosts);
args.putBoolean(Helper.ARG_SHOW_REPLIES, show_replies);
new CachedBundle(requireActivity()).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
bundle.putBoolean(Helper.ARG_SHOW_PINNED, true);
bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);
bundle.putBoolean(Helper.ARG_SHOW_REBLOGS, show_boosts);
bundle.putBoolean(Helper.ARG_SHOW_REPLIES, show_replies);
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
fragmentMastodonTimeline.setArguments(bundle);
FragmentTransaction fragTransaction2 = getChildFragmentManager().beginTransaction();
fragTransaction2.attach(fragmentMastodonTimeline);
fragTransaction2.commit();
fragmentMastodonTimeline.recreate();
});
}
});
@ -158,5 +163,10 @@ public class FragmentProfileTimeline extends Fragment {
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
}

View file

@ -53,45 +53,33 @@ public class FedilabNotificationPageAdapter extends FragmentStatePagerAdapter {
FragmentMastodonNotification fragmentMastodonNotification = new FragmentMastodonNotification();
if (!extended) {
switch (position) {
case 0:
case 0 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL);
break;
case 1:
case 1 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS);
break;
}
} else {
switch (position) {
case 0:
case 0 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL);
break;
case 1:
case 1 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS);
break;
case 2:
case 2 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FAVOURITES);
break;
case 3:
case 3 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.REBLOGS);
break;
case 4:
case 4 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.POLLS);
break;
case 5:
case 5 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.TOOTS);
break;
case 6:
case 6 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FOLLOWS);
break;
case 7:
case 7 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.UPDATES);
break;
case 8:
case 8 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_SIGNUP);
break;
case 9:
case 9 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_REPORT);
break;
}
}
fragmentMastodonNotification.setArguments(bundle);

View file

@ -56,37 +56,48 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
public Fragment getItem(int position) {
Bundle bundle = new Bundle();
bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position);
FragmentMastodonTimeline fragmentMastodonTimeline;
switch (position) {
case 0:
FragmentMastodonTimeline fragmentProfileTimeline = new FragmentMastodonTimeline();
case 0 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
if(account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
}
bundle.putBoolean(Helper.ARG_SHOW_PINNED, true);
bundle.putBoolean(Helper.ARG_SHOW_REPLIES, false);
bundle.putBoolean(Helper.ARG_SHOW_REBLOGS, true);
bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);
fragmentProfileTimeline.setArguments(bundle);
return fragmentProfileTimeline;
case 1:
fragmentProfileTimeline = new FragmentMastodonTimeline();
fragmentMastodonTimeline.setArguments(bundle);
return fragmentMastodonTimeline;
}
case 1 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
if(account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
}
bundle.putBoolean(Helper.ARG_SHOW_PINNED, false);
bundle.putBoolean(Helper.ARG_SHOW_REPLIES, true);
bundle.putBoolean(Helper.ARG_SHOW_REBLOGS, false);
bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);
fragmentProfileTimeline.setArguments(bundle);
return fragmentProfileTimeline;
case 2:
fragmentMastodonTimeline.setArguments(bundle);
return fragmentMastodonTimeline;
}
case 2 -> {
FragmentMediaProfile fragmentMediaProfile = new FragmentMediaProfile();
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
if(account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
}
bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);
fragmentMediaProfile.setArguments(bundle);
return fragmentMediaProfile;
default:
}
default -> {
return new FragmentMastodonTimeline();
}
}
}
@Override
public int getCount() {

View file

@ -54,28 +54,31 @@ public class FedilabProfileTLPageAdapter extends FragmentStatePagerAdapter {
@NonNull
@Override
public Fragment getItem(int position) {
Bundle bundle;
switch (position) {
case 0:
case 0 -> {
FragmentProfileTimeline fragmentProfileTimeline = new FragmentProfileTimeline();
Bundle bundle = new Bundle();
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
bundle = new Bundle();
bundle.putString(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
bundle.putSerializable(Helper.ARG_CHECK_REMOTELY, checkRemotely);
fragmentProfileTimeline.setArguments(bundle);
return fragmentProfileTimeline;
case 1:
case 2:
}
case 1, 2 -> {
FragmentMastodonAccount fragmentMastodonAccount = new FragmentMastodonAccount();
bundle = new Bundle();
bundle.putSerializable(Helper.ARG_ACCOUNT, account);
bundle.putString(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
bundle.putSerializable(Helper.ARG_CHECK_REMOTELY, checkRemotely);
bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position);
bundle.putSerializable(Helper.ARG_FOLLOW_TYPE, position == 1 ? follow_type.FOLLOWING : follow_type.FOLLOWERS);
fragmentMastodonAccount.setArguments(bundle);
return fragmentMastodonAccount;
default:
}
default -> {
return new FragmentMastodonTimeline();
}
}
}
@Override
public int getCount() {

View file

@ -52,13 +52,11 @@ public class FedilabScheduledPageAdapter extends FragmentStatePagerAdapter {
bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position);
FragmentScheduled fragmentScheduled = new FragmentScheduled();
switch (position) {
case 1:
case 1 ->
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_CLIENT);
break;
case 2:
case 2 ->
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_BOOST);
break;
default:
default ->
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_SERVER);
}
fragmentScheduled.setArguments(bundle);

View file

@ -14,6 +14,8 @@ package app.fedilab.android.mastodon.viewmodel.mastodon;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Application;
import android.net.Uri;
import android.os.Handler;
@ -30,6 +32,7 @@ import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.endpoints.MastodonAccountsService;
import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Accounts;
@ -52,6 +55,7 @@ import app.fedilab.android.mastodon.client.entities.api.Suggestions;
import app.fedilab.android.mastodon.client.entities.api.Tag;
import app.fedilab.android.mastodon.client.entities.api.Token;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.MutedAccounts;
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
import app.fedilab.android.mastodon.exception.DBException;
@ -342,6 +346,7 @@ public class AccountsVM extends AndroidViewModel {
Response<Account> accountResponse = accountCall.execute();
if (accountResponse.isSuccessful()) {
account = accountResponse.body();
new CachedBundle(getApplication().getApplicationContext()).insertAccountBundle(account, currentAccount);
}
} catch (Exception e) {
e.printStackTrace();
@ -1073,6 +1078,9 @@ public class AccountsVM extends AndroidViewModel {
Response<List<Account>> searchResponse = searchCall.execute();
if (searchResponse.isSuccessful()) {
accountList = searchResponse.body();
if(accountList != null && accountList.size() > 0 ) {
new CachedBundle(getApplication().getApplicationContext()).insertAccountBundle(accountList.get(0), currentAccount);
}
}
} catch (Exception e) {
e.printStackTrace();

View file

@ -61,7 +61,6 @@ import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;

View file

@ -43,10 +43,10 @@ import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.IDN;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
@ -178,11 +178,8 @@ public class RetrofitPeertubeAPI {
error.printStackTrace();
return;
}
try {
//At the state the instance can be encoded
instance = URLDecoder.decode(instance, "utf-8");
} catch (UnsupportedEncodingException ignored) {
}
instance = URLDecoder.decode(instance, StandardCharsets.UTF_8);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
account.token = token;
account.client_id = client_id;

View file

@ -17,7 +17,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.ListPreference;
import androidx.preference.MultiSelectListPreference;
import androidx.preference.Preference;

View file

@ -57,7 +57,6 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.preference.PreferenceManager;
import com.avatarfirst.avatargenlib.AvatarGenerator;
@ -276,7 +275,7 @@ public class Helper {
* @return String rounded value to be displayed
*/
public static String withSuffix(long count) {
if (count < 1000) return "" + count;
if (count < 1000) return String.valueOf(count);
int exp = (int) (Math.log(count) / Math.log(1000));
Locale locale = null;
try {

View file

@ -109,11 +109,10 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (view instanceof FrameLayout) {
if (view instanceof FrameLayout frameLayout) {
if (((AppCompatActivity) activity).getSupportActionBar() != null)
((AppCompatActivity) activity).getSupportActionBar().hide();
// A video wants to be shown
FrameLayout frameLayout = (FrameLayout) view;
View focusedChild = frameLayout.getFocusedChild();
// Save video related variables
@ -125,9 +124,8 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
activityNonVideoView.setVisibility(View.INVISIBLE);
activityVideoView.addView(videoViewContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
activityVideoView.setVisibility(View.VISIBLE);
if (focusedChild instanceof android.widget.VideoView) {
if (focusedChild instanceof android.widget.VideoView videoView) {
// android.widget.VideoView (typically API level <11)
android.widget.VideoView videoView = (android.widget.VideoView) focusedChild;
// Handle all the required events
videoView.setOnCompletionListener(this);
videoView.setOnErrorListener(this);

View file

@ -23,7 +23,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class Sqlite extends SQLiteOpenHelper {
public static final int DB_VERSION = 11;
public static final int DB_VERSION = 12;
public static final String DB_NAME = "fedilab_db";
//Table of owned accounts
@ -105,6 +105,10 @@ public class Sqlite extends SQLiteOpenHelper {
public static final String COL_TAG = "TAG";
public static final String TABLE_TIMELINE_CACHE_LOGS = "TIMELINE_CACHE_LOGS";
public static final String TABLE_INTENT = "INTENT";
public static final String COL_BUNDLE = "BUNDLE";
public static final String COL_TARGET_ID = "TARGET_ID";
private static final String CREATE_TABLE_USER_ACCOUNT = "CREATE TABLE " + TABLE_USER_ACCOUNT + " ("
@ -233,6 +237,16 @@ public class Sqlite extends SQLiteOpenHelper {
+ COL_TYPE + " TEXT NOT NULL, "
+ COL_CREATED_AT + " TEXT NOT NULL)";
private final String CREATE_TABLE_INTENT = "CREATE TABLE "
+ TABLE_INTENT + "("
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COL_INSTANCE + " TEXT, "
+ COL_USER_ID + " TEXT, "
+ COL_TYPE + " TEXT NOT NULL DEFAULT 'ARGS', "
+ COL_TARGET_ID + " TEXT, "
+ COL_BUNDLE + " TEXT, "
+ COL_CREATED_AT + " TEXT NOT NULL)";
public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
@ -263,6 +277,7 @@ public class Sqlite extends SQLiteOpenHelper {
db.execSQL(CREATE_TABLE_STORED_INSTANCES);
db.execSQL(CREATE_TABLE_CACHE_TAGS);
db.execSQL(CREATE_TABLE_TIMELINE_CACHE_LOGS);
db.execSQL(CREATE_TABLE_INTENT);
}
@Override
@ -295,6 +310,8 @@ public class Sqlite extends SQLiteOpenHelper {
db.execSQL(CREATE_TABLE_CACHE_TAGS);
case 10:
db.execSQL(CREATE_TABLE_TIMELINE_CACHE_LOGS);
case 11:
db.execSQL(CREATE_TABLE_INTENT);
default:
break;
}

View file

@ -15,6 +15,8 @@ package app.fedilab.android.ui.fragment;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -32,6 +34,7 @@ import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.databinding.FragmentLoginPickInstanceMastodonBinding;
import app.fedilab.android.mastodon.client.entities.api.JoinMastodonInstance;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.drawer.InstanceRegAdapter;
@ -145,10 +148,13 @@ public class FragmentLoginPickInstanceMastodon extends Fragment implements Insta
Bundle args = new Bundle();
args.putSerializable(Helper.ARG_REMOTE_INSTANCE_STRING, clickedInstance.domain);
args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC);
new CachedBundle(requireActivity()).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
Helper.addFragment(
getParentFragmentManager(), android.R.id.content, new FragmentMastodonTimeline(),
args, null, FragmentLoginRegisterMastodon.class.getName());
bundle, null, FragmentLoginRegisterMastodon.class.getName());
});
}
}
}

View file

@ -26,7 +26,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMode="scrollable" />
app:tabMode="auto" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/search_viewpager"

View file

@ -15,6 +15,7 @@
see <http://www.gnu.org/licenses>
-->
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tag_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -22,9 +23,19 @@
<TextView
android:id="@+id/tag_name"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
tools:text="@tools:sample/lorem"
android:padding="10dp" />
<TextView
android:id="@+id/tag_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:layout_marginStart="20dp"
android:padding="10dp" />
</androidx.appcompat.widget.LinearLayoutCompat>

View file

@ -43,8 +43,8 @@
<string name="favourite">المفضلة</string>
<string name="follow">متابِعون جدد</string>
<string name="mention">الإشارات</string>
<string name="reblog">الترقيات</string>
<string name="show_boosts">عرض الترقيات</string>
<string name="reblog">المعاد نشرها</string>
<string name="show_boosts">عرض المعاد نشرها</string>
<string name="show_replies">عرض الردود</string>
<string name="action_open_in_web">افتح في المتصفح</string>
<string name="translate">ترجمة</string>
@ -208,12 +208,12 @@
<string name="set_toots_page">عدد الرسائل التي يتم تحميلها كل مرة</string>
<string name="set_disable_gif">تعطيل الصور الرمزية المتحركة</string>
<string name="set_notif_follow">تنبيهي عندما يتبعني أحدهم</string>
<string name="set_notif_follow_share">تنبيهي عندما يقوم أحدهم بترقية منشوري</string>
<string name="set_notif_follow_share">إشعاري عندما يقوم أحدهم بإعادة نشر منشوري</string>
<string name="set_notif_follow_add">إخطاري عندما يُعجَب أحدهم بأحد منشوراتي</string>
<string name="set_notif_follow_mention">إخطاري عندما يُشار إليّ</string>
<string name="set_notif_follow_poll">أرسل إشعاراً عند انتهاء استطلاع الرأي</string>
<string name="set_notif_status">إشعار بالمشاركات الجديدة</string>
<string name="set_share_validation">عرض مربع حوار للتأكيد قبل ترقية أي تبويق</string>
<string name="set_share_validation">عرض مربع حوار للتأكيد قبل إعادة نشر أي منشور</string>
<string name="set_share_validation_fav">عرض مربع حوار للتأكيد قبل إضافة أي تبويق إلى المفضلة</string>
<string name="set_notify">هل تود الإشعار؟</string>
<string name="set_notif_silent">كتم الاشعارات</string>
@ -258,7 +258,7 @@
<string name="keywords_header_custom_sharing">الكلمات المفتاحية</string>
<string name="keywords_hint_custom_sharing">الكلمات المفتاحية…</string>
<!-- ACTIVITY CACHE -->
<string name="v_public">العمومية</string>
<string name="v_public">للعامة</string>
<string name="v_unlisted">غير المدرجة</string>
<string name="v_private">الخاصة</string>
<string name="v_direct">المباشرة</string>
@ -291,16 +291,16 @@
<string name="follow_instance">متابعة مثيل الخادم</string>
<string name="toast_instance_already_added">إنّك مُتابِع لمثيل الخادم هذا!</string>
<string name="action_partnership">الشراكات</string>
<string name="hide_boost">إخفاء ترقيات %s</string>
<string name="hide_boost">إخفاء المعاد نشرها مِن طرف %s</string>
<string name="endorse">أوصِ به على صفحتك</string>
<string name="show_boost">إظهار ترقيات %s</string>
<string name="show_boost">إظهار المعاد نشرها مِن %s</string>
<string name="unendorse">إلغاء التوصية مِن صفحتك</string>
<string name="direct_message">رسالة مباشِرة</string>
<string name="filters">عوامل التصفية</string>
<string name="action_filters_empty_content">ليس هناك أي عامل تصفية بعدُ. يمكنك إنشاء واحد بالنقر على زر \"+\".</string>
<string name="filter_keyword">كلمة مفتاحية أو عبارة</string>
<string name="context_home">الخط الزمني الرئيسي</string>
<string name="context_public">الخطوط الزمنية العمومية</string>
<string name="context_public">الخطوط الزمنية العامة</string>
<string name="context_notification">الإشعارات</string>
<string name="context_conversation">المحادثات</string>
<string name="filter_keyword_explanations">سوف يتم العثور عليه بغض النظر عن حالة الأحرف في النص أو حتى و إن كان في الرسالة تحذير عن المحتوى</string>
@ -316,7 +316,7 @@
<string name="action_list_add">لم تقم بعد بإنشاء قائمة. اضغط على زر \"+\" لإنشاء قائمة.</string>
<string name="expand_image">توسيع الوسائط المخفية تلقائيًا</string>
<string name="channel_notif_follow">مُتابِع جديد</string>
<string name="channel_notif_boost">ترقية جديدة</string>
<string name="channel_notif_boost">إعادة نشر جديدة</string>
<string name="channel_notif_fav">مفضلة جديدة</string>
<string name="channel_notif_mention">إشارة جديدة</string>
<string name="channel_notif_poll">انتهى استطلاع الرأي</string>
@ -340,9 +340,9 @@
<string name="display_toot_truncate">عرض المزيد</string>
<string name="hide_toot_truncate">اعرض أقل</string>
<string name="tags_already_stored">الوسم موجود مِن قَبل!</string>
<string name="schedule_boost">برمجة الترقية</string>
<string name="boost_scheduled">تمت برمجة الترقية!</string>
<string name="no_scheduled_boosts">ليس هناك أية برمجة للترقية للعرض!</string>
<string name="schedule_boost">برمجة إعادة نشر</string>
<string name="boost_scheduled">تمت برمجة إعادة النشر!</string>
<string name="no_scheduled_boosts">ليس هناك أية إعادة نشر للعرض!</string>
<string name="open_menu">فتح القائمة</string>
<string name="profile_picture">الصورة الشخصية</string>
<string name="profile_banner">رأسية الصفحة الشخصية</string>
@ -581,7 +581,7 @@
<string name="verified_by">تم التحقق منه عبر %1$s (%2$s)</string>
<string name="action_disabled">الإجراء مُعطّل</string>
<string name="action_unfollow">إلغاء المتابعة</string>
<string name="error_destination_path">حدث خطأ ما، الرجاء التحقق من مسار التحميلات في الإعدادات.</string>
<string name="error_destination_path">حدث خطأ ما، الرجاء التحقق من مسار التنزيلات في الإعدادات.</string>
<string name="action_announcements">الإعلانات</string>
<string name="no_announcements">ليس هناك إعلانات!</string>
<string name="add_reaction">إضافة ردة فعل</string>
@ -699,7 +699,7 @@
<string name="add_field">إضافة حقل</string>
<string name="unlocked">غير مقفَل</string>
<string name="locked">مُقفَل</string>
<string name="scheduled">مُبَرمَج</string>
<string name="scheduled">المُبَرمَجة</string>
<string name="bottom_menu">القائمة الدنيا</string>
<string name="action_lists_edit">تعديل القائمة</string>
<string name="select_a_theme">اختر حُلة</string>
@ -865,4 +865,20 @@
<string name="push_distributors">موزع الإشعارات</string>
<string name="report_indication_title_status">أخبرنا ما الخَطب مع هذا المنشور</string>
<string name="set_alt_text_mandatory">وصف إلزامي للوسائط</string>
<string name="Suggestions">الاقتراحات</string>
<string name="no_blocked_domains">لم تقم بحجب أي نطاق بعد</string>
<string name="following">المُتابَعون</string>
<string name="thread_long_message">قِسمة الرسائل الطويلة في الردود</string>
<string name="put_all_accounts_in_home_muted">يقوم بكتم كافة الحسابات على الخيط الرئيس.</string>
<string name="thread_long_message_yes">قَسِّم الرسالة</string>
<string name="unmute_home">إلغاء كتمه على الخيط الرئيس</string>
<string name="followed_tags">الوسوم المتابَعة</string>
<string name="pref_customize">تخصيص الألوان</string>
<string name="thread_long_message_no">لا تقم بتقسيمها</string>
<string name="manage_tags">إدارة الوسوم</string>
<string name="set_extand_extra_features_title">ميزات إضافية</string>
<string name="blocked_domains">النطاقات المحظورة</string>
<string name="thread_long_this_message">أتريد تقسيم هذه الرسائل في الردود؟</string>
<string name="Directory">دليل الحسابات</string>
<string name="mute_home">كتمه على الخيط الرئيس</string>
</resources>

View file

@ -0,0 +1,411 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="close">Затваряне</string>
<string name="action_open_in_web">Отваряне в браузъра</string>
<string name="action_cache">Кеш памет</string>
<string name="action_about">Относно</string>
<string name="password">Парола</string>
<string name="action_logout">Излизане</string>
<string name="accounts">Акаунти</string>
<string name="translate">Превеждане</string>
<string name="no">Не</string>
<string name="action_privacy">Поверителност</string>
<string name="tags">Хаштагове</string>
<string name="yes">Да</string>
<string name="download_file">Сваляне на %1$s</string>
<string name="instance_example">Инстанция: mastodon.social</string>
<string name="mention">Споменавания</string>
<string name="instance">Инстанция</string>
<string name="toots">Съобщения</string>
<string name="download">Сваляне</string>
<string name="action_about_instance">Относно инстанцията</string>
<string name="cancel">Отмяна</string>
<string name="media">Мултимедия</string>
<string name="replies">Отговори</string>
<string name="camera">Камера</string>
<string name="home_menu">Начало</string>
<string name="share_with">Споделяне с</string>
<string name="add_account">Добавяне на акаунт</string>
<string name="follow">Нови последователи</string>
<string name="delete_all">Изтриване на всички</string>
<string name="text_size">Размер на текста</string>
<string name="next">Следващо</string>
<string name="previous">Предишно</string>
<string name="open_with">Отваряне чрез</string>
<string name="validate">Потвърждаване</string>
<string name="shared_via">Споделяне чрез Федилаб</string>
<string name="username">Потребителско име</string>
<string name="drafts">Чернови</string>
<string name="favourite">Любими</string>
<string name="show_replies">Показване на отговори</string>
<string name="muted_menu">Заглушени потребители</string>
<string name="blocked_menu">Блокирани потребители</string>
<string name="notifications">Известия</string>
<string name="follow_request">Заявки за последване</string>
<string name="no_status">Няма съобщения за показване</string>
<string name="more_action_1">Заглушаване</string>
<string name="more_action_2">Блокиране</string>
<string name="more_action_3">Докладване</string>
<string name="more_action_4">Изтриване</string>
<string name="more_action_5">Копиране</string>
<string name="bookmarks">Отметки</string>
<string name="date_seconds">%d сек</string>
<string name="date_minutes">%d мин</string>
<string name="date_hours">%d ч</string>
<string name="date_day">%d д</string>
<plurals name="date_seconds_polls">
<item quantity="one">%d секунда</item>
<item quantity="other">%d секунди</item>
</plurals>
<plurals name="date_minutes_polls">
<item quantity="one">%d минута</item>
<item quantity="other">%d минути</item>
</plurals>
<plurals name="date_hours_polls">
<item quantity="one">%d час</item>
<item quantity="other">%d часа</item>
</plurals>
<plurals name="date_day_polls">
<item quantity="one">%d ден</item>
<item quantity="other">%d дни</item>
</plurals>
<string name="no_draft">Няма чернови!</string>
<string name="choose_accounts">Избиране на акаунт</string>
<string name="remove_draft">Изтриване на черновата?</string>
<string name="about_developer">Разработчик:</string>
<string name="about_license">Лиценз:</string>
<string name="about_license_action">GNU GPL V3</string>
<string name="about_code">Програмен код:</string>
<string name="about_thekinrar">Търсене на инстанции:</string>
<string name="no_follow_request">Няма заявка за последване</string>
<string name="status_cnt">Съобщения
\n %1$s</string>
<string name="reject">Отхвърляне</string>
<string name="settings_time_to">и</string>
<string name="action_mute">Заглушаване</string>
<string name="save_over">Мултимедията е запазена</string>
<string name="download_from" formatted="false">Файл: %1$s</string>
<string name="email">Е-поща</string>
<string name="save">Запазване</string>
<string name="clipboard">Съдържанието на съобщението е копирано в клипборда</string>
<string name="clipboard_version">Информацията е копирана в клипборда</string>
<string name="settings_time_from">Между</string>
<string name="action_follow">Последване</string>
s
<string name="icon_size">Размер на иконките</string>
<string name="settings">Настройки</string>
<string name="insert_emoji">Вмъкване на емоджи</string>
<string name="more_action_6">Споделяне</string>
<string name="more_action_7">Споменаване</string>
<string name="tag_already_followed">Вече следваш този хаштаг!</string>
<string name="reblog">Споделяния</string>
<string name="show_boosts">Показване на споделяния</string>
<string name="show_my_messages">Показване на съобщенията ми</string>
<string name="local_menu">Местна емисия</string>
<string name="logout_account_confirmation">Сигурен ли си, че искаш да излезеш @%1$s@%2$s?</string>
<string name="favourite_add">Добавяне на това съобщение към любими?</string>
<string name="reblog_add">Споделяне на това съобщение?</string>
<string name="warn_boost_no_media_description">Предупреждаване при липса на описание на мултимедията в съобщение преди споделяне</string>
<string name="bookmark_add">Добавяне на отметка</string>
<string name="bookmark_remove">Премахване на отметката</string>
<string name="toot_delete_media">Премахване на тази мултимедия?</string>
<string name="toot_error_no_content">Съобщението ти е празно!</string>
<string name="instance_no_description">Няма налично описание!</string>
<string name="followers_cnt">Последователи
\n %1$s</string>
<string name="following_cnt">Последвани
\n %1$s</string>
<string name="no_notifications">Няма известие за показване</string>
<string name="followers">Последователи</string>
<string name="delete_notification_ask_all">Изтриване на всички известия?</string>
<string name="toast_reblog">Съобщението беше споделено!</string>
<string name="search">Търсене</string>
<string name="action_lists">Списъци</string>
<string name="poxy_password">Парола</string>
<string name="follow_instance">Последване на инстанцията</string>
<string name="context_public">Публични емисии</string>
<string name="context_home">Начална емисия</string>
<string name="show_boost">Показване на споделяния от %s</string>
<string name="filters">Филтри</string>
<string name="context_notification">Известия</string>
<string name="context_conversation">Разговори</string>
<string name="block_domain">Блокиране на домейна</string>
<string name="information">Информация</string>
<string name="set_change_locale">Промяна на езика</string>
<string name="profile_picture">Профилна снимка</string>
<string name="bot">Бот</string>
<string name="show_media_only">Само мултимедия</string>
<string name="languages">Езици</string>
<string name="no_tags">Няма хаштагове</string>
<string name="submit">Изпращане</string>
<string name="done">Готово</string>
<string name="vote">Гласуване</string>
<string name="move_timeline">Преместване на емисия</string>
<string name="hide_timeline">Скриване на емисия</string>
<string name="reorder_timelines">Управляване на емисиите</string>
<string name="settings_category_notif_categories">Категории</string>
<string name="label_text">Текст</string>
<string name="label_filter">Филтър</string>
<string name="account">Акаунт</string>
<string name="boosted_by">Споделено от</string>
<string name="followers_only">Само последователи</string>
<string name="report_1_unfollow_title">Отпоследване на %1$s</string>
<string name="write_the_tag_to_follow">Напиши хаштага за да се последва</string>
<string name="unfollow">Отпоследване</string>
<string name="mute_tag_action">Заглушаване на хаштага</string>
<string name="pin_tag">Закачане на хаштага</string>
<string name="manage_tags">Управляване на хаштаговете</string>
<string name="toast_account_changed" formatted="false">Сега работи с акаунта %1$s</string>
<string name="follow_tag">Последване на хаштага</string>
<string name="show_privates">Показване на директните съобщения</string>
<string name="send_email">Изпращане на имейл</string>
<string name="favourite_remove">Премахване на това съобщение от любими?</string>
<string name="also_boosted_by">Споделено също от:</string>
<string name="settings_category_label_timelines">Емисии</string>
<string name="hide_boost">Скриване на споделяния от %s</string>
<string name="action_tag_follow">Последване на хаштаг</string>
<string name="followed_tags">Последвани хаштагове</string>
<string name="manage_accounts">Управляване на акаунтите</string>
<string name="add_tags">Управляване на хаштаговете</string>
<string name="toast_instance_unavailable">Не бяха намерени емисии на тази инстанция!</string>
<string name="remember_position">Запомняне на позицията в емисиите</string>
<string name="unpin_timeline">Премахване на закачената емисия?</string>
<string name="delete_timeline">Изтриване на емисията</string>
<string name="display_timelines">Показване на емисии</string>
<string name="set_timelines_in_a_list_title">Емисии в списък</string>
<string name="action_pinned_delete">Изтриване на закачените емисии?</string>
<string name="following">Последвани</string>
<string name="action_unfollow_tag">Отпоследване на хаштага</string>
<string name="unfollow_tag">Отпоследване на хаштага</string>
<string name="action_unfollow">Отпоследване</string>
<string name="delete">Изтриване</string>
<string name="action_lists_delete">Изтриване на списъка</string>
<string name="lemmy_instance">Леми инстанция</string>
<string name="title_header_custom_sharing">Заглавие</string>
<string name="title">Заглавие</string>
<string name="schedule">Запланиране</string>
<string name="notif_mention">те спомена</string>
<string name="notif_status">написа ново съобщение</string>
<string name="notif_follow">те последва</string>
<string name="delete_notification_all">Всички известия са изтрити!</string>
<string name="toast_block">Акаунтът беше блокиран!</string>
<string name="toast_follow">Акаунтът беше последван!</string>
<string name="toast_error">Опа! Възникна грешка!</string>
<string name="set_save_changes">Запазване на промените</string>
<string name="custom_tabs">Вграден в приложението браузър</string>
<string name="followed_by">Следва те</string>
<string name="v_direct">Директно</string>
<string name="action_lists_add_to">Добавяне в списък</string>
<string name="proxy_set">Прокси</string>
<string name="poxy_login">Потребителско име</string>
<string name="action_partnership">Партньорства</string>
<string name="direct_message">Директно съобщение</string>
<string name="schedule_boost">Запланиране на споделяне</string>
<string name="trending">Набиращи популярност</string>
<string name="toots_client">Съобщения (Устройство)</string>
<string name="toots_server">Съобщения (Сървър)</string>
<string name="category">Категория</string>
<string name="description">Описание</string>
<string name="settings_category_label_interface">Интерфейс</string>
<string name="contact">Контакти</string>
<string name="permissions">Разрешения</string>
<string name="voice_message">Гласово съобщение</string>
<string name="select">Избиране</string>
<string name="compose">Писане</string>
<string name="reset">Нулиране</string>
<string name="edit_profile">Редактиране на профила</string>
<string name="theming">Теми</string>
<string name="action_announcements">Оповестявания</string>
<string name="no_announcements">Няма оповестявания!</string>
<string name="interactions">Взаимодействия</string>
<string name="scheduled">Планирани</string>
<string name="moderator">Модератор</string>
<string name="blocked_domains">Блокирани домейни</string>
<string name="set_post_format">Формат на публикацията</string>
<string name="bubble">Балон</string>
<string name="Directory">Директория</string>
<string name="my_account">Моят акаунт</string>
<string name="release_notes">Бележки към изданието</string>
<string name="my_app">Моето приложение</string>
<string name="my_instance">Моята инстанция</string>
<string name="Suggestions">Предложени</string>
<string name="no_accounts">Няма акаунти за показване</string>
<string name="toast_mute">Акаунтът беше заглушен!</string>
<string name="administrator">Администратор</string>
<string name="user">Потребител</string>
<string name="scheduled_toots">Запланирани съобщения</string>
<string name="more_action_9">Изтриване &amp; пре-написване</string>
<string name="toot_sent">Съобщението е изпратено!</string>
<string name="toot_sensitive">Деликатно съдържание?</string>
<string name="about_vesrion">Издание %1$s</string>
<string name="no_scheduled_toots">Няма запланирани съобщения за показване!</string>
<string name="remove_scheduled">Изтриване на запланираното съобщение?</string>
<string name="toast_unblock">Акаунтът вече не е блокиран!</string>
<string name="toast_unmute">Акаунтът вече не е заглушен!</string>
<string name="toast_unfollow">Акаунтът вече не е следван!</string>
<string name="toast_unreblog">Съобщението вече не е споделено!</string>
<string name="toast_bookmark">Съобщението беше добавено към твоите отметки!</string>
<string name="toast_unbookmark">Съобщението беше премахнато от твоите отметки!</string>
<string name="set_notif_status">Известяване за нови публикации</string>
<string name="set_notify">Известяване?</string>
<string name="set_lock_account">Заключване на акаунта</string>
<string name="expand_cw">Автоматично разгъване на cw</string>
<string name="action_unblock">Отблокиране</string>
<string name="cache_units">Мб</string>
<string name="v_public">Публично</string>
<string name="keywords_hint_custom_sharing">Ключови думи…</string>
<string name="keywords_header_custom_sharing">Ключови думи</string>
<string name="description_header_custom_sharing">Описание</string>
<string name="title_hint_custom_sharing">Заглавие…</string>
<string name="v_unlisted">Нелистнато</string>
<string name="v_private">Поверително</string>
<string name="filter_regex">Филтриране по регулярни изрази</string>
<string name="action_lists_title_placeholder">Заглавие на новия списък</string>
<string name="action_lists_empty">Все още нямаш списъци!</string>
<string name="filter_keyword">Ключова дума или израз</string>
<string name="action_update_filter">Обновяване на филтър</string>
<string name="filter_expire">Изтича след</string>
<string name="action_filter_delete">Изтриване на филтъра?</string>
<string name="filter_context">Контекст на филтъра</string>
<string name="context_whole_word">Цяла дума</string>
<string name="expand_image">Автоматично разгъване на скрита мултимедия</string>
<string name="toast_block_domain">Домейнът е блокиран</string>
<string name="display_toot_truncate">Показване на повече</string>
<string name="tags_already_stored">Хаштагът вече съществува!</string>
<string name="any_tags">Някое от тези</string>
<string name="all_tags">Всяко от тези</string>
<string name="none_tags">Никое от тези</string>
<string name="local">Локални</string>
<string name="share">Споделяне</string>
<string name="action_logout_account">Излизане от акаунта</string>
<string name="copy_link">Копиране на връзката</string>
<string name="filter_timeline_with_a_tag">Филтриране на емисия с хаштагове</string>
<string name="copy_version">Копиране на информацията</string>
<string name="list_of_blocked_domains">Списък на блокираните обаждания</string>
<string name="create_poll">Създаване на анкета</string>
<string name="poll_choice_s">Вариант %d</string>
<string name="label_emoji">Емоджи</string>
<string name="display_name">Показвано име</string>
<string name="add_poll_item">Добавяне на вариант</string>
<string name="category_regional">Регионални</string>
<string name="category_general">Общи</string>
<string name="category_music">Музика</string>
<string name="category_activism">Активизъм</string>
<string name="category_tech">Технологии</string>
<string name="category_games">Гейминг</string>
<string name="users">%1$s потребители</string>
<string name="password_error">Паролите не съвпадат!</string>
<string name="account_created">Акаунтът е създаден!</string>
<string name="save_draft">Запазване на съобщението в чернови?</string>
<string name="reports">Доклади</string>
<string name="active">Активни</string>
<string name="_new">Нови</string>
<string name="audio">Аудио</string>
<string name="add_instances">Добавяне на инстанция</string>
<string name="crash_title">Федилаб спря :(</string>
<string name="visibility">Видимост</string>
<string name="set_clear_cache_exit">Изчистване на кеша при напускане</string>
<plurals name="number_of_voters">
<item quantity="one">%d гласувал</item>
<item quantity="other">%d гласували</item>
</plurals>
<string name="set_clear_cache_exit_indication">Кешът (мултимедия, кеширани съобщения, данни от вградения браузър) ще се изчисти автоматично при напускане на приложението.</string>
<string name="replace_youtube">YouTube</string>
<string name="replace_twitter">Twitter</string>
<string name="replace_instagram">Instagram</string>
<string name="replace_reddit">Reddit</string>
<string name="replace_medium">Medium</string>
<string name="action_add_notes">Добавяне на бележки</string>
<string name="note_for_account">Бележки за акаунта</string>
<string name="link_color_title">Връзки</string>
<string name="reset_color">Нулиране на цветовете</string>
<string name="data_export_theme">Темата беше изнесена</string>
<string name="data_export_settings">Настройките бяха изнесени</string>
<string name="data_export_settings_success">Настройките са изнесени успешно</string>
<string name="import_theme">Внасяне на тема</string>
<string name="import_theme_title">Докосни тук, за да внесеш тема от предишно изнасяне</string>
<string name="export_theme">Изнасяне на темата</string>
<string name="export_theme_title">Докосни тук, за да изнесеш текущата тема</string>
<string name="set_video_cache">Видео кеш в МБ, нула означава липса на кеш.</string>
<string name="keepon">Продължаване</string>
<string name="report_val1">Не ми харесва</string>
<string name="report_val2">Това е спам</string>
<string name="report_1_block_title">Блокиране на %1$s</string>
<string name="dont_have_an_account">Нямаш акаунт?</string>
<string name="add_filter">Добавяне на филтър</string>
<string name="add_field">Добавяне на поле</string>
<string name="set_bot_content">Бот-акаунт</string>
<string name="set_discoverable_content">Откриваем акаунт</string>
<string name="locked">Заключен</string>
<string name="unlocked">Отключен</string>
<string name="set_display_bookmark_indication">Винаги да се показва бутона за отмятане</string>
<string name="approve">Одобряване</string>
<string name="domain">Домейн</string>
<string name="approved">Одобрено</string>
<string name="delete_keyword">Изтриване на ключова дума</string>
<string name="show_anyway">Показване въпреки това</string>
<string name="add_keyword">Добавяне на ключова дума</string>
<string name="unblock_domain">Отблокиране на домейна</string>
<string name="domains">Домейни</string>
<string name="also_followed_by">Следван от:</string>
<string name="translator_domain">Домейн на преводача</string>
<string name="new_messages">Нови съобщения</string>
<string name="follows_you">Следва те</string>
<string name="cached_messages">Кеширано съобщение</string>
<string name="public_comment">Публичен коментар</string>
<string name="inserted_count">%d нови съобщения</string>
<string name="action_followed_tag_empty">Не следваш никакви хаштагове!</string>
<string name="hide_completely">Скриване напълно</string>
<string name="import_data">Внасяне на данни</string>
<string name="data_import_settings_success">Настройките са внесени успешно</string>
<string name="profiled_updated">Профилът е обновен!</string>
<string name="set_sensitive_content">Винаги да се маркира мултимедията като деликатна</string>
<string name="type_default_theme_dark">Тъмна тема по подразбиране</string>
<string name="share_link">Споделяне на връзката</string>
<string name="report_1_mute_title">Заглушаване на %1$s</string>
<string name="category_art">Изкуство</string>
<string name="category_food">Храна</string>
<string name="notif_display_mentions">Споменавания</string>
<string name="updated_count">%d обновени съобщения</string>
<string name="report_more_additional">Допълнителни коментари</string>
<string name="last_active">Последно активни</string>
<string name="filter">Филтър</string>
<string name="set_display_translate_indication">Винаги да се показва бутона за превеждане</string>
<string name="poll_type_single">Едно избрано</string>
<string name="poll_type_multiple">Множество избрани</string>
<string name="files_cache_size">Размер на файл кеша</string>
<string name="clear_cache">Изчистване на кеш паметта</string>
<string name="delete_cache">Изтриване на кеш паметта</string>
<string name="messages_stored_in_drafts">Съобщения съхранявани в чернови</string>
<string name="open_draft">Отваряне на чернова</string>
<string name="delete_cache_message">Сигурен ли си, че искаш да изтриеш кеш паметта? Ако имаш чернови с мултимедия, прикачената мултимедия ще бъде загубена.</string>
<string name="import_settings">Внасяне на настройки</string>
<string name="export_settings">Изнасяне на настройки</string>
<string name="load_settings">Зареждане на изнесени настройки</string>
<string name="action_announcement_from_to">Оповестяване · %1$s - %2$s</string>
<string name="set_use_cache_indication">Емисиите ще бъдат кеширани, за да бъде приложението по-бързо.</string>
<string name="reply">Отговор</string>
<string name="context_home_list">Начало и списъци</string>
<string name="profiles">Профили</string>
<string name="keyword_or_phrase">Ключова дума или израз</string>
<string name="hide_with_warning">Скриване с предупреждение</string>
<string name="filter_action">Действие на филтъра</string>
<string name="account_approved">Акаунтът е одобрен</string>
<string name="allow">Разрешаване</string>
<string name="action_privacy_policy">Политика за поверителност</string>
<string name="private_comment">Поверителен коментар</string>
<string name="type_default_theme_light">Светла тема по подразбиране</string>
<string name="no_blocked_domains">Нямаш блокирани домейни</string>
<string name="local_only">Само локални</string>
<string name="set_extand_extra_features_title">Допълнителни функции</string>
<string name="translator">Преводач</string>
<string name="set_translator">Преводач</string>
<string name="set_translator_version">Версия на преводача</string>
<string name="version">Версия</string>
<string name="v_list">Списък</string>
<string name="filter_languages">Филтриране на езици</string>
<string name="home_cache">Кеш на началната емисия</string>
<string name="tags_deleted">Хаштагът е премахнат!</string>
<string name="tags_renamed">Хаштагът е сменен!</string>
<string name="send_anyway">Изпращане въпреки това</string>
</resources>

View file

@ -1042,8 +1042,8 @@
<string name="requested_by">Folgeanfrage gestellt</string>
<string name="warn_boost_no_media_description">Vor dem Teilen warnen, falls der Beitrag keine Medienbeschreibung hat</string>
<string name="reblog_missing_description">Diesem Beitrag fehlt die Medienbeschreibung. Dennoch teilen\?</string>
<string name="fetch_remote_media">Automatisches Abrufen entfernter Medien, wenn diese nicht verfügbar sind</string>
<string name="fetching_messages">Rufe Beiträge ab</string>
<string name="fetch_remote_media">Automatisch entfernte Medien abrufen, wenn diese nicht verfügbar sind</string>
<string name="fetching_messages">Beiträge abrufen</string>
<string name="add_description">Beschreibung hinzufügen</string>
<string name="retrieve_remote_account">Entferntes Konto abrufen!</string>
<string name="exit">Beenden</string>
@ -1065,7 +1065,7 @@
<string name="thread_long_message">Teile lange Beiträge in Antworten auf</string>
<string name="thread_long_message_yes">Den Beitrag aufteilen</string>
<string name="thread_long_message_no">Nicht aufteilen</string>
<string name="thumbnail">Vorschau</string>
<string name="thumbnail">Vorschaubild</string>
<string name="thread_long_message_message">Der Beitrag wird in mehrere Antworten aufgeteilt, um die maximale Zeichenanzahl Ihrer Instanz einzuhalten.</string>
<string name="thread_long_this_message">Diese Beiträge in Antworten aufteilen?</string>
<string name="clipboard_version">Informationen wurden in die Zwischenablage kopiert</string>

View file

@ -257,7 +257,7 @@
<!-- About lists -->
<string name="action_lists">Listoj</string>
<string name="action_lists_confirm_delete">Ĉu vi certas, ke vi volas porĉiame forigi ĉi tiun liston?</string>
<string name="action_lists_add_to">Aldoni al la listo</string>
<string name="action_lists_add_to">Aldoni al listo</string>
<string name="action_lists_delete">Forigi la liston</string>
<string name="action_lists_title_placeholder">Nova listo titolo</string>
<string name="action_lists_add_user">La konto estis aldonita al la listo!</string>
@ -354,14 +354,14 @@
<string name="languages">Lingvoj</string>
<string name="show_media_only">Nur aŭdvidaĵo</string>
<string name="show_media_nsfw">Montru NSFW</string>
<string name="bot">Boto</string>
<string name="pixelfed_instance">Pixelfed instenco</string>
<string name="mastodon_instance">Mastodono Instenco</string>
<string name="bot">Roboto</string>
<string name="pixelfed_instance">Pixelfed servilo</string>
<string name="mastodon_instance">Mastodono-servilo</string>
<string name="any_tags">Iu ajn de ĉi tiuj</string>
<string name="all_tags">Ĉiuj de ĉi tiuj</string>
<string name="none_tags">None of these</string>
<string name="some_words_any">Any of these words (space-separated)</string>
<string name="some_words_all">All these words (space-separated)</string>
<string name="none_tags">Neniom</string>
<string name="some_words_any">Iuj ajn vortoj (apartigitaj per spacetoj)</string>
<string name="some_words_all">Ĉiuj ajn vortoj (apartigitaj per spacetoj)</string>
<string name="some_tags">Add some words to filter (space-separated)</string>
<string name="change_tag_column">Change column name</string>
<string name="misskey_instance">Misskey instance</string>
@ -386,11 +386,11 @@
<string name="no_tags">No tags</string>
<string name="set_retrieve_metadata_share_from_extras">Attach an image when sharing a URL</string>
<!-- end languages -->
<string name="create_poll">Krei Baloto</string>
<string name="poll_choice_s">Elekta %d</string>
<string name="poll_invalid_choices">Vi bezonas du elektoj malpleje por la baloto!</string>
<string name="create_poll">Krei enketon</string>
<string name="poll_choice_s">Opcio %d</string>
<string name="poll_invalid_choices">Havendas almenaŭ du opciojn por la enketo!</string>
<string name="done">Farite</string>
<string name="poll_finish_at">end at %s</string>
<string name="poll_finish_at">finiĝis je %s</string>
<string name="vote">Voĉdoni</string>
<string name="notif_poll">Partoprenita balotenketo finiĝis</string>
<string name="notif_poll_self">A poll you tooted has ended</string>
@ -417,7 +417,7 @@
<string name="saving">Saving…</string>
<string name="image_saved">Image Saved Successfully!</string>
<string name="save_image_failed">Failed to save Image</string>
<string name="add_poll_item">Add a poll item</string>
<string name="add_poll_item">Aldoni enketeron</string>
<string name="mute_conversation">Mute conversation</string>
<string name="unmute_conversation">Unmute conversation</string>
<string name="toast_unmute_conversation">The conversation is no longer muted!</string>
@ -477,9 +477,9 @@
<string name="settings_title_custom_sharing_indication">Allow content creators to share statuses to their RSS feeds</string>
<string name="compose">Verki</string>
<string name="select">Elekti</string>
<string name="add_instances">Aldoni instencon</string>
<string name="set_enable_crash_report">Enable crash reports</string>
<string name="set_enable_crash_report_indication">If enabled, a crash report will be created locally and then you will be able to share it.</string>
<string name="add_instances">Aldoni servilon</string>
<string name="set_enable_crash_report">Ŝalti kolaps-raportojn</string>
<string name="set_enable_crash_report_indication">Se ŝaltita, kolaps-raporto estos kreita loke, kaj poste vi eblos disvastigi ĝin.</string>
<string name="crash_title">Fedilab haltis :(</string>
<string name="crash_message">You can send me by email the crash report. It will help to fix it :)\n\nYou can add additional content. Thank you!</string>
<string name="visibility">Visibility</string>
@ -608,4 +608,11 @@
<string name="notif_display_mentions">Mencioj</string>
<string name="notif_display_favourites">Stelumoj</string>
<string name="save_changes">Konservi ŝanĝojn</string>
<string name="saved_changes">Ŝanĝoj estis konservitaj!</string>
<string name="updated_count">%d ĝisdatigitaj mesaĝoj</string>
<string name="silenced">Silentigita</string>
<string name="follow_tag">Sekvi etikedon</string>
<string name="action_lists_edit">Redakti liston</string>
<string name="private_comment">Privata komento</string>
<string name="copy_version">Kopii informon</string>
</resources>

View file

@ -948,7 +948,7 @@
<string name="bubble">Bulle</string>
<string name="reply_visibility">Visibilité des réponses</string>
<string name="v_list">Liste</string>
<string name="following">Suivant</string>
<string name="following">Abonnements</string>
<string name="icons_visibility">Visibilité des icônes</string>
<string name="translator">Traducteur</string>
<string name="set_translator">Traducteur</string>
@ -1062,4 +1062,7 @@
<string name="set_remote_conversation">L\'application affichera publiquement les conversations pour obtenir tous les messages. Les interactions auront besoin d\'une étape supplémentaire pour fédérer les messages.</string>
<string name="show_my_messages">Afficher mes messages</string>
<string name="frequency_count_minutes">%d fréquence (minutes)</string>
<string name="thumbnail">Miniature</string>
<string name="timeline_scrollbar">Afficher une barre de défilement pour les fils</string>
<string name="underline_links">Souligner les éléments cliquables</string>
</resources>

View file

@ -451,7 +451,7 @@
\n
\n Xa podes acceder coa túa conta escribindo <b>%1$s</b> no primeiro campo e premendo <b>Acceder</b>.
\n
\n <b>Importante</b>: se a túa instancia require validación, recibirás un correo unha vez sexa validada! </string>
\n <b>Importante</b>: se a túa instancia require validación, recibirás un correo unha vez sexa validada! \u0020</string>
<string name="save_draft">¿Gardar mensaxe en borradores?</string>
<string name="administration">Administración</string>
<string name="reports">Informes</string>
@ -1067,4 +1067,5 @@
<string name="copy_version">Copiar información</string>
<string name="underline_links">Subliñar os elementos clicables</string>
<string name="tag_already_followed">Xa segues ese cancelo!</string>
<string name="timeline_scrollbar">Mostrar barra de desprazamento nas cronoloxías</string>
</resources>

View file

@ -40,4 +40,35 @@
<string name="favourite">Favoritos</string>
<string name="share_with">Compartir con</string>
<string name="add_account">Adder un conto</string>
<string name="clipboard_version">Le information ha essite copiate al area de transferentia</string>
<string name="shared_via">Compartite per Fedilab</string>
<string name="camera">Camera</string>
<string name="follow">Nove sequitores</string>
<string name="reblog">Boosts</string>
<string name="mention">Mentiones</string>
<string name="show_boosts">Monstrar le boosts</string>
<string name="local_menu">Chronologia local</string>
<string name="muted_menu">Usatores silentiate</string>
<string name="insert_emoji">Inserer emoji</string>
<string name="no_status">Necun message a monstrar</string>
<string name="reblog_add">Facer boost a iste message?</string>
<string name="more_action_2">Blocar</string>
<string name="more_action_1">Silentiar</string>
<string name="more_action_4">Deler</string>
<string name="more_action_5">Copiar</string>
<string name="more_action_6">Compartir</string>
<string name="toot_error_no_content">Tu message es vacue!</string>
<string name="toots_visibility_title">Visibilitate per predefinition del messages:</string>
<string name="toot_sent">Le message esseva inviate!</string>
<string name="choose_accounts">Selige un conto</string>
<string name="about_vesrion">Version %1$s</string>
<string name="about_developer">Disveloppator:</string>
<string name="about_license">Licentia:</string>
<string name="about_license_action">GNU GPL V3</string>
<string name="about_code">Codice fonte:</string>
<string name="no_accounts">Nulle conto a monstrar</string>
<string name="status_cnt">Messages
\n %1$s</string>
<string name="followers_cnt">Sequitores
\n %1$s</string>
</resources>

View file

@ -1066,4 +1066,5 @@
<string name="thumbnail">缩略图</string>
<string name="thread_long_message_message">消息将分为几个回复,以满足您所在实例的最大字数。</string>
<string name="thread_long_this_message">是否将长消息分为回复?</string>
<string name="clipboard_version">信息已复制到剪贴板</string>
</resources>

View file

@ -1065,6 +1065,7 @@
<string name="SET_LONG_PRESS_STORE_MEDIA" translatable="false">SET_LONG_PRESS_STORE_MEDIA</string>
<string name="SET_UNFOLLOW_VALIDATION" translatable="false">SET_UNFOLLOW_VALIDATION</string>
<string name="SET_USE_SINGLE_TOPBAR" translatable="false">SET_USE_SINGLE_TOPBAR</string>
<string name="SET_DISABLE_TOPBAR_SCROLLING" translatable="false">SET_DISABLE_TOPBAR_SCROLLING</string>
<string name="SET_DISPLAY_COUNTERS" translatable="false">SET_DISPLAY_COUNTERS</string>
<string name="SET_DISPLAY_COMPACT_ACTION_BUTTON" translatable="false">SET_DISPLAY_COMPACT_ACTION_BUTTON</string>
@ -1731,6 +1732,7 @@
<string name="load_settings">Load exported settings</string>
<string name="push_distributors">Push distributor</string>
<string name="set_single_topbar_title">Single action bar</string>
<string name="set_disable_topbar_scrolling_title">Disable top bar scrolling</string>
<string name="set_single_topbar">When enabled, the app will only have a single bar for timelines</string>
<string name="set_timelines_in_a_list_title">Timelines in a list</string>
<string name="set_timelines_in_a_list">When enabled, all pinned timelines will be displayed in a drop-down menu</string>

Some files were not shown because too many files have changed in this diff Show more