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 --> <!-- If you read our contributing advice -->
[ ] - I read - [ ] I read the [contributing page](https://codeberg.org/tom79/Fedilab/src/branch/main/CONTRIBUTING.md)
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 --> <!-- If you read our contributing advice -->
[ ] - I read - [ ] I read the [contributing page](https://codeberg.org/tom79/Fedilab/src/branch/main/CONTRIBUTING.md)
the [contributing page](https://codeberg.org/tom79/Fedilab/src/branch/main/CONTRIBUTING.md)

View File

@ -13,8 +13,8 @@ android {
defaultConfig { defaultConfig {
minSdk 21 minSdk 21
targetSdk 34 targetSdk 34
versionCode 505 versionCode 510
versionName "3.26.0" versionName "3.27.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
flavorDimensions "default" 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", "version": "3.26.0",
"code": "505", "code": "505",

View File

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

View File

@ -15,6 +15,8 @@ package app.fedilab.android.activities;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
@ -26,7 +28,6 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import java.util.ArrayList; 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.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.CrossActionHelper; import app.fedilab.android.mastodon.helper.CrossActionHelper;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -84,10 +86,10 @@ public class AboutActivity extends BaseBarActivity {
String finalVersion = version; String finalVersion = version;
binding.aboutVersionCopy.setOnClickListener(v->{ binding.aboutVersionCopy.setOnClickListener(v -> {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
String content = "Fedilab v" + finalVersion + " for " + (BuildConfig.DONATIONS?"FDroid":"Google"); String content = "Fedilab v" + finalVersion + " for " + (BuildConfig.DONATIONS ? "FDroid" : "Google");
ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content); ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content);
if (clipboard != null) { if (clipboard != null) {
@ -119,11 +121,15 @@ public class AboutActivity extends BaseBarActivity {
binding.accountUn.setText(account.acct); binding.accountUn.setText(account.acct);
binding.accountPp.setOnClickListener(v -> { binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AboutActivity.this, ProfileActivity.class); Intent intent = new Intent(AboutActivity.this, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b); new CachedBundle(AboutActivity.this).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
startActivity(intent); startActivity(intent);
}); });
});
AccountsVM accountsVM = new ViewModelProvider(AboutActivity.this).get(AccountsVM.class); AccountsVM accountsVM = new ViewModelProvider(AboutActivity.this).get(AccountsVM.class);
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
ids.add(account.id); ids.add(account.id);

View File

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

View File

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

View File

@ -39,7 +39,6 @@ import org.conscrypt.Conscrypt;
import java.security.Security; import java.security.Security;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.ThemeHelper; 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.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.work.Data; 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.ScheduledStatus;
import app.fedilab.android.mastodon.client.entities.api.Status; 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.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft; import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.DividerDecorationSimple; 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() { private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(android.content.Context context, Intent intent) { public void onReceive(android.content.Context context, Intent intent) {
String imgpath = intent.getStringExtra("imgpath"); Bundle args = intent.getExtras();
float focusX = intent.getFloatExtra("focusX", -2); if (args != null) {
float focusY = intent.getFloatExtra("focusY", -2); 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) { if (imgpath != null) {
int position = 0; int position = 0;
for (Status status : statusList) { for (Status status : statusList) {
@ -132,7 +136,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
if (focusX != -2) { if (focusX != -2) {
attachment.focus = focusX + "," + focusY; attachment.focus = focusX + "," + focusY;
} }
composeAdapter.notifyItemChanged(position); composeAdapter.notifyItemChanged(position);
break; break;
} }
@ -141,6 +144,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
position++; position++;
} }
} }
});
}
} }
}; };
private boolean promptSaveDraft; 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); binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
statusList = new ArrayList<>(); statusList = new ArrayList<>();
Bundle b = getIntent().getExtras(); 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) { if (b != null) {
statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY); statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY);
statusQuoted = (Status) b.getSerializable(Helper.ARG_QUOTED_MESSAGE); 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); sharedDescription = b.getString(Helper.ARG_SHARE_DESCRIPTION, null);
shareURL = b.getString(Helper.ARG_SHARE_URL, 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) { if (sharedContent != null && shareURL != null && sharedContent.compareTo(shareURL) == 0) {
sharedContent = ""; sharedContent = "";
} }
@ -774,8 +795,12 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
} }
} }
}); });
};
mainHandler.post(myRunnable);
}).start();
} }
@Override @Override
public void onItemDraftAdded(int position, String initialContent) { public void onItemDraftAdded(int position, String initialContent) {
Status status = new Status(); Status status = new Status();
@ -783,7 +808,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
status.id = Helper.generateIdString(); status.id = Helper.generateIdString();
status.mentions = statusList.get(position - 1).mentions; status.mentions = statusList.get(position - 1).mentions;
status.visibility = statusList.get(position - 1).visibility; status.visibility = statusList.get(position - 1).visibility;
if(initialContent != null) { if (initialContent != null) {
status.text = initialContent; status.text = initialContent;
} }
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this); final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this);

View File

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

View File

@ -39,6 +39,7 @@ import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityDirectMessageBinding; import app.fedilab.android.databinding.ActivityDirectMessageBinding;
import app.fedilab.android.mastodon.client.entities.api.Status; 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.StatusCache;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
@ -71,31 +72,48 @@ public class DirectMessageActivity extends BaseActivity implements FragmentMasto
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
if (getSupportActionBar() != null) { if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);
} }
Bundle b = getIntent().getExtras(); Bundle args = getIntent().getExtras();
displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false); displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false);
Status focusedStatus = null; // or other values
if (b != null) { if (args != null) {
focusedStatus = (Status) b.getSerializable(Helper.ARG_STATUS); long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
remote_instance = b.getString(Helper.ARG_REMOTE_INSTANCE, null); 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) { if (focusedStatus == null || currentAccount == null || currentAccount.mastodon_account == null) {
finish(); finish();
return; return;
} }
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
Bundle bundle = new Bundle(); Bundle args = new Bundle();
bundle.putSerializable(Helper.ARG_STATUS, focusedStatus); args.putSerializable(Helper.ARG_STATUS, focusedStatus);
bundle.putString(Helper.ARG_REMOTE_INSTANCE, remote_instance); 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 FragmentMastodonDirectMessage = new FragmentMastodonDirectMessage();
FragmentMastodonDirectMessage.firstMessage = this; 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); 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) { if (status != null) {
StatusCache statusCache = new StatusCache(); StatusCache statusCache = new StatusCache();
statusCache.instance = BaseMainActivity.currentInstance; statusCache.instance = BaseMainActivity.currentInstance;
@ -116,8 +134,9 @@ public class DirectMessageActivity extends BaseActivity implements FragmentMasto
}).start(); }).start();
} }
}); });
} });
}
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { 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.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textfield.TextInputEditText; 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.databinding.ActivityEditProfileBinding;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.api.Field;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -259,13 +259,18 @@ public class EditProfileActivity extends BaseBarActivity {
} }
private void sendBroadCast(Account account) { private void sendBroadCast(Account account) {
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_PROFILE, true); args.putBoolean(Helper.RECEIVE_REDRAW_PROFILE, true);
b.putSerializable(Helper.ARG_ACCOUNT, account); 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); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(bundle);
intentBD.setPackage(BuildConfig.APPLICATION_ID); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD); sendBroadcast(intentBD);
});
} }
private Intent prepareIntent() { private Intent prepareIntent() {

View File

@ -40,7 +40,6 @@ import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityFollowedTagsBinding; import app.fedilab.android.databinding.ActivityFollowedTagsBinding;
import app.fedilab.android.databinding.PopupAddFollowedTagtBinding; 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.api.Tag;
import app.fedilab.android.mastodon.client.entities.app.Timeline; import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
@ -151,7 +150,7 @@ public class FollowedTagActivity extends BaseBarActivity implements FollowedTagA
popupAddFollowedTagtBinding.addTag.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)}); popupAddFollowedTagtBinding.addTag.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)});
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> { dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> {
String name = Objects.requireNonNull(popupAddFollowedTagtBinding.addTag.getText()).toString().trim(); String name = Objects.requireNonNull(popupAddFollowedTagtBinding.addTag.getText()).toString().trim();
if(tagList.contains(new Tag(name))) { if (tagList.contains(new Tag(name))) {
Toasty.error(FollowedTagActivity.this, getString(R.string.tag_already_followed), Toasty.LENGTH_LONG).show(); Toasty.error(FollowedTagActivity.this, getString(R.string.tag_already_followed), Toasty.LENGTH_LONG).show();
return; return;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
@ -31,7 +33,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; 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.ActivityReorderTabsBinding;
import app.fedilab.android.databinding.PopupSearchInstanceBinding; import app.fedilab.android.databinding.PopupSearchInstanceBinding;
import app.fedilab.android.mastodon.client.entities.app.BottomMenu; 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.InstanceSocial;
import app.fedilab.android.mastodon.client.entities.app.Pinned; 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.PinnedTimeline;
@ -285,13 +287,17 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
} }
} }
reorderTabAdapter.notifyItemInserted(pinned.pinnedTimelines.size()); reorderTabAdapter.notifyItemInserted(pinned.pinnedTimelines.size());
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); 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); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD); sendBroadcast(intentBD);
}); });
});
} else { } else {
runOnUiThread(() -> Toasty.warning(ReorderTimelinesActivity.this, getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show()); 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(); super.onPause();
if (changes) { if (changes) {
//Update menu //Update menu
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); 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); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD); sendBroadcast(intentBD);
});
} }
if (bottomChanges) { if (bottomChanges) {
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_BOTTOM, true); args.putBoolean(Helper.RECEIVE_REDRAW_BOTTOM, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); 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); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD); 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; 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.Account;
import app.fedilab.android.mastodon.client.entities.api.RelationShip; 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.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.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.drawer.RulesAdapter; import app.fedilab.android.mastodon.ui.drawer.RulesAdapter;
@ -70,11 +73,21 @@ public class ReportActivity extends BaseBarActivity {
if (getSupportActionBar() != null) { if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 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(); private void initializeAfterBundle(Bundle bundle) {
if (b != null) { if (bundle != null) {
status = (Status) b.getSerializable(Helper.ARG_STATUS); status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
account = (Account) b.getSerializable(Helper.ARG_ACCOUNT); account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
} }
if (account == null && status != null) { if (account == null && status != null) {
account = status.account; account = status.account;
@ -139,7 +152,6 @@ public class ReportActivity extends BaseBarActivity {
}); });
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) { if (item.getItemId() == android.R.id.home) {
@ -222,21 +234,25 @@ public class ReportActivity extends BaseBarActivity {
private void switchToSpam() { private void switchToSpam() {
fragment = new FragmentMastodonTimeline(); fragment = new FragmentMastodonTimeline();
Bundle bundle = new Bundle(); Bundle args = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE); args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
bundle.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
//Set to display statuses with less options //Set to display statuses with less options
bundle.putBoolean(Helper.ARG_MINIFIED, true); args.putBoolean(Helper.ARG_MINIFIED, true);
if (status != null) { if (status != null) {
status.isChecked = true; 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); fragment.setArguments(bundle);
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction(); fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fram_spam_container, fragment); fragmentTransaction.replace(R.id.fram_spam_container, fragment);
fragmentTransaction.commit(); fragmentTransaction.commit();
});
binding.actionButton.setText(R.string.next); binding.actionButton.setText(R.string.next);
binding.actionButton.setOnClickListener(v -> { binding.actionButton.setOnClickListener(v -> {
@ -248,22 +264,25 @@ public class ReportActivity extends BaseBarActivity {
private void switchToSomethingElse() { private void switchToSomethingElse() {
fragment = new FragmentMastodonTimeline(); fragment = new FragmentMastodonTimeline();
Bundle bundle = new Bundle(); Bundle args = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE); args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
bundle.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
//Set to display statuses with less options //Set to display statuses with less options
bundle.putBoolean(Helper.ARG_MINIFIED, true); args.putBoolean(Helper.ARG_MINIFIED, true);
if (status != null) { if (status != null) {
status.isChecked = true; 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); fragment.setArguments(bundle);
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction(); fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fram_se_container, fragment); fragmentTransaction.replace(R.id.fram_se_container, fragment);
fragmentTransaction.commit(); fragmentTransaction.commit();
});
binding.actionButton.setText(R.string.next); binding.actionButton.setText(R.string.next);
binding.actionButton.setOnClickListener(v -> { binding.actionButton.setOnClickListener(v -> {
if (category == null) { if (category == null) {

View File

@ -114,14 +114,11 @@ public class SearchResultTabActivity extends BaseBarActivity {
Fragment fragment; Fragment fragment;
if (binding.searchViewpager.getAdapter() != null) { if (binding.searchViewpager.getAdapter() != null) {
fragment = (Fragment) binding.searchViewpager.getAdapter().instantiateItem(binding.searchViewpager, tab.getPosition()); fragment = (Fragment) binding.searchViewpager.getAdapter().instantiateItem(binding.searchViewpager, tab.getPosition());
if (fragment instanceof FragmentMastodonAccount) { if (fragment instanceof FragmentMastodonAccount fragmentMastodonAccount) {
FragmentMastodonAccount fragmentMastodonAccount = ((FragmentMastodonAccount) fragment);
fragmentMastodonAccount.scrollToTop(); fragmentMastodonAccount.scrollToTop();
} else if (fragment instanceof FragmentMastodonTimeline) { } else if (fragment instanceof FragmentMastodonTimeline fragmentMastodonTimeline) {
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
fragmentMastodonTimeline.scrollToTop(); fragmentMastodonTimeline.scrollToTop();
} else if (fragment instanceof FragmentMastodonTag) { } else if (fragment instanceof FragmentMastodonTag fragmentMastodonTag) {
FragmentMastodonTag fragmentMastodonTag = ((FragmentMastodonTag) fragment);
fragmentMastodonTag.scrollToTop(); fragmentMastodonTag.scrollToTop();
} }
} }
@ -136,6 +133,9 @@ public class SearchResultTabActivity extends BaseBarActivity {
inflater.inflate(R.menu.menu_search, menu); inflater.inflate(R.menu.menu_search, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
if(searchView == null) {
return true;
}
if (search != null) { if (search != null) {
searchView.setQuery(search, false); searchView.setQuery(search, false);
} }
@ -302,29 +302,34 @@ public class SearchResultTabActivity extends BaseBarActivity {
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
FragmentMastodonTimeline fragmentMastodonTimeline;
switch (position) { switch (position) {
case 0: case 0 -> {
FragmentMastodonTag fragmentMastodonTag = new FragmentMastodonTag(); FragmentMastodonTag fragmentMastodonTag = new FragmentMastodonTag();
bundle.putString(Helper.ARG_SEARCH_KEYWORD, search); bundle.putString(Helper.ARG_SEARCH_KEYWORD, search);
fragmentMastodonTag.setArguments(bundle); fragmentMastodonTag.setArguments(bundle);
return fragmentMastodonTag; return fragmentMastodonTag;
case 1: }
case 1 -> {
FragmentMastodonAccount fragmentMastodonAccount = new FragmentMastodonAccount(); FragmentMastodonAccount fragmentMastodonAccount = new FragmentMastodonAccount();
bundle.putString(Helper.ARG_SEARCH_KEYWORD, search); bundle.putString(Helper.ARG_SEARCH_KEYWORD, search);
fragmentMastodonAccount.setArguments(bundle); fragmentMastodonAccount.setArguments(bundle);
return fragmentMastodonAccount; return fragmentMastodonAccount;
case 2: }
FragmentMastodonTimeline fragmentMastodonTimeline = new FragmentMastodonTimeline(); case 2 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putString(Helper.ARG_SEARCH_KEYWORD, search); bundle.putString(Helper.ARG_SEARCH_KEYWORD, search);
fragmentMastodonTimeline.setArguments(bundle); fragmentMastodonTimeline.setArguments(bundle);
return fragmentMastodonTimeline; return fragmentMastodonTimeline;
default: }
default -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline(); fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putString(Helper.ARG_SEARCH_KEYWORD_CACHE, search); bundle.putString(Helper.ARG_SEARCH_KEYWORD_CACHE, search);
fragmentMastodonTimeline.setArguments(bundle); fragmentMastodonTimeline.setArguments(bundle);
return fragmentMastodonTimeline; return fragmentMastodonTimeline;
} }
} }
}
@Override @Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { 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>. */ * 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.currentInstance;
import static app.fedilab.android.BaseMainActivity.currentToken; 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.Accounts;
import app.fedilab.android.mastodon.client.entities.api.RelationShip; 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.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.drawer.AccountAdapter; import app.fedilab.android.mastodon.ui.drawer.AccountAdapter;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM; import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
@ -70,12 +72,23 @@ public class StatusInfoActivity extends BaseActivity {
} }
accountList = new ArrayList<>(); accountList = new ArrayList<>();
checkRemotely = false; checkRemotely = false;
Bundle b = getIntent().getExtras(); Bundle args = getIntent().getExtras();
if (b != null) { if (args != null) {
type = (typeOfInfo) b.getSerializable(Helper.ARG_TYPE_OF_INFO); long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
status = (Status) b.getSerializable(Helper.ARG_STATUS); new CachedBundle(StatusInfoActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
checkRemotely = b.getBoolean(Helper.ARG_CHECK_REMOTELY, false); } 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) { if (type == null || status == null) {
finish(); finish();
return; return;
@ -138,6 +151,7 @@ public class StatusInfoActivity extends BaseActivity {
} }
} }
private void manageView(Accounts accounts) { private void manageView(Accounts accounts) {
binding.loadingNextAccounts.setVisibility(View.GONE); binding.loadingNextAccounts.setVisibility(View.GONE);
if (accountList != null && accounts != null && accounts.accounts != null) { 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
@ -22,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityTimelineBinding; import app.fedilab.android.databinding.ActivityTimelineBinding;
import app.fedilab.android.mastodon.client.entities.api.Status; 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.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.Timeline; import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
@ -42,32 +45,44 @@ public class TimelineActivity extends BaseBarActivity {
if (getSupportActionBar() != null) { if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 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; Timeline.TimeLineEnum timelineType = null;
String lemmy_post_id = null; String lemmy_post_id = null;
PinnedTimeline pinnedTimeline = null; PinnedTimeline pinnedTimeline = null;
Status status = null; Status status = null;
if (b != null) { if (bundle != null) {
timelineType = (Timeline.TimeLineEnum) b.get(Helper.ARG_TIMELINE_TYPE); timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
lemmy_post_id = b.getString(Helper.ARG_LEMMY_POST_ID, null); lemmy_post_id = bundle.getString(Helper.ARG_LEMMY_POST_ID, null);
pinnedTimeline = (PinnedTimeline) b.getSerializable(Helper.ARG_REMOTE_INSTANCE); pinnedTimeline = (PinnedTimeline) bundle.getSerializable(Helper.ARG_REMOTE_INSTANCE);
status = (Status) b.getSerializable(Helper.ARG_STATUS); status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
} }
if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) { if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) {
setTitle(pinnedTimeline.remoteInstance.host); setTitle(pinnedTimeline.remoteInstance.host);
} }
FragmentMastodonTimeline fragmentMastodonTimeline = new FragmentMastodonTimeline(); FragmentMastodonTimeline fragmentMastodonTimeline = new FragmentMastodonTimeline();
Bundle bundle = new Bundle(); Bundle args = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, timelineType); args.putSerializable(Helper.ARG_TIMELINE_TYPE, timelineType);
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinnedTimeline); args.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinnedTimeline);
bundle.putSerializable(Helper.ARG_LEMMY_POST_ID, lemmy_post_id); args.putSerializable(Helper.ARG_LEMMY_POST_ID, lemmy_post_id);
if (status != null) { 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() getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container_view, fragmentMastodonTimeline).commit(); .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>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Intent; 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.Attachment;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount; 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.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.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.helper.SpannableHelper; import app.fedilab.android.mastodon.helper.SpannableHelper;
@ -87,18 +90,32 @@ public class AdminAccountActivity extends BaseActivity {
setContentView(binding.getRoot()); setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar); setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
Bundle b = getIntent().getExtras(); Bundle args = getIntent().getExtras();
adminAccount = null; adminAccount = null;
if (b != null) {
adminAccount = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT);
account_id = b.getString(Helper.ARG_ACCOUNT_ID, null);
}
postponeEnterTransition(); postponeEnterTransition();
//Remove title //Remove title
if (actionBar != null) { if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false); 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); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
@ -175,8 +192,6 @@ public class AdminAccountActivity extends BaseActivity {
initializeView(adminAccount); initializeView(adminAccount);
} }
}); });
} }
private void initializeView(AdminAccount adminAccount) { private void initializeView(AdminAccount adminAccount) {
@ -329,7 +344,7 @@ public class AdminAccountActivity extends BaseActivity {
MastodonHelper.loadPPMastodon(binding.accountPp, adminAccount.account); MastodonHelper.loadPPMastodon(binding.accountPp, adminAccount.account);
binding.accountPp.setOnClickListener(v -> { binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class); Intent intent = new Intent(AdminAccountActivity.this, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
Attachment attachment = new Attachment(); Attachment attachment = new Attachment();
attachment.description = adminAccount.account.acct; attachment.description = adminAccount.account.acct;
attachment.preview_url = adminAccount.account.avatar; attachment.preview_url = adminAccount.account.avatar;
@ -338,14 +353,18 @@ public class AdminAccountActivity extends BaseActivity {
attachment.type = "image"; attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment); attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1); args.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b); 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 ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(AdminAccountActivity.this, binding.accountPp, attachment.url); .makeSceneTransitionAnimation(AdminAccountActivity.this, binding.accountPp, attachment.url);
// start the new activity // start the new activity
startActivity(intent, options.toBundle()); startActivity(intent, options.toBundle());
}); });
});
binding.accountDate.setText(Helper.shortDateToString(adminAccount.created_at)); 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * 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.ACCOUNT;
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.DOMAIN; import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.DOMAIN;
import static app.fedilab.android.mastodon.activities.admin.AdminActionActivity.AdminEnum.REPORT; 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.databinding.PopupAdminFilterReportsBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity; import app.fedilab.android.mastodon.activities.BaseBarActivity;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminDomainBlock; 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.Helper;
import app.fedilab.android.mastodon.helper.ThemeHelper; import app.fedilab.android.mastodon.helper.ThemeHelper;
import app.fedilab.android.mastodon.ui.fragment.admin.FragmentAdminAccount; import app.fedilab.android.mastodon.ui.fragment.admin.FragmentAdminAccount;
@ -63,19 +65,22 @@ public class AdminActionActivity extends BaseBarActivity {
private final BroadcastReceiver mReceiver = new BroadcastReceiver() { private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras(); Bundle args = intent.getExtras();
if (b != null) { if (args != null) {
AdminDomainBlock adminDomainBlock = (AdminDomainBlock) b.getSerializable(Helper.ARG_ADMIN_DOMAINBLOCK); long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
AdminDomainBlock adminDomainBlockDelete = (AdminDomainBlock) b.getSerializable(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE); 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) { if (adminDomainBlock != null && adminDomainBlock.domain != null && fragmentAdminDomain != null) {
fragmentAdminDomain.update(adminDomainBlock); fragmentAdminDomain.update(adminDomainBlock);
} }
if (adminDomainBlockDelete != null && fragmentAdminDomain != null) { if (adminDomainBlockDelete != null && fragmentAdminDomain != null) {
fragmentAdminDomain.delete(adminDomainBlockDelete); fragmentAdminDomain.delete(adminDomainBlockDelete);
} }
} });
} }
}
}; };
@Override @Override

View File

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

View File

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities.admin;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Intent; import android.content.Intent;
@ -46,7 +48,6 @@ import com.bumptech.glide.request.transition.Transition;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; 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.Attachment;
import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount; 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.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.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.helper.SpannableHelper; import app.fedilab.android.mastodon.helper.SpannableHelper;
@ -87,19 +89,8 @@ public class AdminReportActivity extends BaseBarActivity {
setContentView(binding.getRoot()); setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar); setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
Bundle b = getIntent().getExtras(); Bundle args = getIntent().getExtras();
if (b != null) {
adminAccount = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT);
if (adminAccount != null) {
account = adminAccount.account;
}
}
postponeEnterTransition(); postponeEnterTransition();
//Remove title
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
}
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f);
binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
@ -107,6 +98,28 @@ public class AdminReportActivity extends BaseBarActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(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) { if (account != null) {
initializeView(account); initializeView(account);
} else { } else {
@ -344,7 +357,7 @@ public class AdminReportActivity extends BaseBarActivity {
MastodonHelper.loadPPMastodon(binding.accountPp, account); MastodonHelper.loadPPMastodon(binding.accountPp, account);
binding.accountPp.setOnClickListener(v -> { binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(AdminReportActivity.this, MediaActivity.class); Intent intent = new Intent(AdminReportActivity.this, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
Attachment attachment = new Attachment(); Attachment attachment = new Attachment();
attachment.description = account.acct; attachment.description = account.acct;
attachment.preview_url = account.avatar; attachment.preview_url = account.avatar;
@ -353,14 +366,17 @@ public class AdminReportActivity extends BaseBarActivity {
attachment.type = "image"; attachment.type = "image";
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment); attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
b.putInt(Helper.ARG_MEDIA_POSITION, 1); args.putInt(Helper.ARG_MEDIA_POSITION, 1);
intent.putExtras(b); 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 ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(AdminReportActivity.this, binding.accountPp, attachment.url); .makeSceneTransitionAnimation(AdminReportActivity.this, binding.accountPp, attachment.url);
// start the new activity
startActivity(intent, options.toBundle()); startActivity(intent, options.toBundle());
}); });
});
binding.accountDate.setText(Helper.shortDateToString(account.created_at)); 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.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteBlobTooBigException;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelProvider;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken; 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.client.endpoints.MastodonInstanceService;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.viewmodel.mastodon.InstancesVM;
import app.fedilab.android.sqlite.Sqlite; import app.fedilab.android.sqlite.Sqlite;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import retrofit2.Call; 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 * Returns the emojis for an instance
* *
* @param instance String * @param instance String
* @param filter String * @param filter String
* @param callBack EmojiFilteredCallBack - Get filtered emojis * @param callBack EmojiFilteredCallBack - Get filtered emojis
*
* @return List<Emoji> - List of {@link Emoji} * @return List<Emoji> - List of {@link Emoji}
*/ */
public void getEmojiListFiltered(@NonNull String instance, @NonNull String filter, EmojiFilteredCallBack callBack) throws DBException { public void getEmojiListFiltered(@NonNull String instance, @NonNull String filter, EmojiFilteredCallBack callBack) throws DBException {
@ -248,8 +239,8 @@ public class EmojiInstance implements Serializable {
throw new DBException("db is null. Wrong initialization."); throw new DBException("db is null. Wrong initialization.");
} }
new Thread(() -> { new Thread(() -> {
List<Emoji> emojiArrayList= new ArrayList<>(); List<Emoji> emojiArrayList = new ArrayList<>();
List<Emoji> emojiFiltered= new ArrayList<>(); List<Emoji> emojiFiltered = new ArrayList<>();
if (emojis == null || !emojis.containsKey(BaseMainActivity.currentInstance) || emojis.get(BaseMainActivity.currentInstance) == null) { if (emojis == null || !emojis.containsKey(BaseMainActivity.currentInstance) || emojis.get(BaseMainActivity.currentInstance) == null) {
try { try {
Cursor c = db.query(Sqlite.TABLE_EMOJI_INSTANCE, null, Sqlite.COL_INSTANCE + " = '" + instance + "'", null, null, null, null, "1"); Cursor c = db.query(Sqlite.TABLE_EMOJI_INSTANCE, null, Sqlite.COL_INSTANCE + " = '" + instance + "'", null, null, null, null, "1");
@ -271,9 +262,9 @@ public class EmojiInstance implements Serializable {
} else { } else {
emojiArrayList = emojis.get(instance); emojiArrayList = emojis.get(instance);
} }
if(emojiArrayList != null && emojiArrayList.size() > 0 ) { if (emojiArrayList != null && emojiArrayList.size() > 0) {
for(Emoji emoji: emojiArrayList) { for (Emoji emoji : emojiArrayList) {
if(emoji.shortcode.contains(filter)) { if (emoji.shortcode.contains(filter)) {
emojiFiltered.add(emoji); emojiFiltered.add(emoji);
} }
} }
@ -311,4 +302,8 @@ public class EmojiInstance implements Serializable {
} }
return filteredEmojis; return filteredEmojis;
} }
public interface EmojiFilteredCallBack {
void get(List<Emoji> emojiList);
}
} }

View File

@ -32,7 +32,8 @@ public class Tag implements Serializable {
@SerializedName("following") @SerializedName("following")
public boolean following = false; public boolean following = false;
public Tag() {} public Tag() {
}
public Tag(String name) { public Tag(String name) {
this.name = 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; import java.util.regex.Matcher;
public class ComposeHelper { public class ComposeHelper {
@ -44,13 +43,13 @@ public class ComposeHelper {
Matcher matcher = mentionPatternALL.matcher(content); Matcher matcher = mentionPatternALL.matcher(content);
while (matcher.find()) { while (matcher.find()) {
String mentionLong = matcher.group(1); String mentionLong = matcher.group(1);
if(mentionLong != null) { if (mentionLong != null) {
if (!mentions.contains(mentionLong)) { if (!mentions.contains(mentionLong)) {
mentions.add(mentionLong); mentions.add(mentionLong);
} }
} }
String mentionShort = matcher.group(2); String mentionShort = matcher.group(2);
if(mentionShort != null) { if (mentionShort != null) {
if (!mentions.contains(mentionShort)) { if (!mentions.contains(mentionShort)) {
mentions.add(mentionShort); mentions.add(mentionShort);
} }

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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; 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.api.Status;
import app.fedilab.android.mastodon.client.entities.app.Account; 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.BaseAccount;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.ui.drawer.AccountsSearchAdapter; import app.fedilab.android.mastodon.ui.drawer.AccountsSearchAdapter;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM; import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
@ -183,77 +186,89 @@ public class CrossActionHelper {
statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get("crossactions", StatusesVM.class); statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get("crossactions", StatusesVM.class);
} }
switch (actionType) { switch (actionType) {
case MUTE_ACTION: case MUTE_ACTION -> {
assert accountsVM != null; assert accountsVM != null;
accountsVM.mute(ownerAccount.instance, ownerAccount.token, targetedAccount.id, true, 0) 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()); .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; assert accountsVM != null;
accountsVM.unmute(ownerAccount.instance, ownerAccount.token, targetedAccount.id) 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()); .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; assert accountsVM != null;
accountsVM.block(ownerAccount.instance, ownerAccount.token, targetedAccount.id) 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()); .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; assert accountsVM != null;
accountsVM.unblock(ownerAccount.instance, ownerAccount.token, targetedAccount.id) 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()); .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; assert accountsVM != null;
accountsVM.follow(ownerAccount.instance, ownerAccount.token, targetedAccount.id, true, false, 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()); .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; assert accountsVM != null;
accountsVM.unfollow(ownerAccount.instance, ownerAccount.token, targetedAccount.id) 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()); .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; assert statusesVM != null;
statusesVM.favourite(ownerAccount.instance, ownerAccount.token, targetedStatus.id) 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()); .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; assert statusesVM != null;
statusesVM.unFavourite(ownerAccount.instance, ownerAccount.token, targetedStatus.id) 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()); .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; assert statusesVM != null;
statusesVM.bookmark(ownerAccount.instance, ownerAccount.token, targetedStatus.id) 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()); .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; assert statusesVM != null;
statusesVM.unBookmark(ownerAccount.instance, ownerAccount.token, targetedStatus.id) 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()); .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; assert statusesVM != null;
statusesVM.reblog(ownerAccount.instance, ownerAccount.token, targetedStatus.id, 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()); .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; assert statusesVM != null;
statusesVM.unReblog(ownerAccount.instance, ownerAccount.token, targetedStatus.id) 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()); .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 intent = new Intent(context, ComposeActivity.class);
intent.putExtra(Helper.ARG_STATUS_REPLY, targetedStatus); Bundle args = new Bundle();
intent.putExtra(Helper.ARG_ACCOUNT, ownerAccount); 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); context.startActivity(intent);
break; });
case COMPOSE: }
case COMPOSE -> {
Intent intentCompose = new Intent(context, ComposeActivity.class); 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); context.startActivity(intentCompose);
break; });
}
} }
} }
@ -430,11 +445,16 @@ public class CrossActionHelper {
final BaseAccount account = accountArray[which]; final BaseAccount account = accountArray[which];
Intent intentToot = new Intent(context, ComposeActivity.class); Intent intentToot = new Intent(context, ComposeActivity.class);
bundle.putSerializable(Helper.ARG_ACCOUNT, account); 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); context.startActivity(intentToot);
((BaseActivity) context).finish(); ((BaseActivity) context).finish();
dialog.dismiss(); dialog.dismiss();
}); });
});
builderSingle.show(); builderSingle.show();
} }

View File

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

View File

@ -679,8 +679,7 @@ public class PinnedTimelineHelper {
popup.setOnDismissListener(menu1 -> { popup.setOnDismissListener(menu1 -> {
if (activityMainBinding.viewPager.getAdapter() != null && activityMainBinding.tabLayout.getSelectedTabPosition() != -1) { if (activityMainBinding.viewPager.getAdapter() != null && activityMainBinding.tabLayout.getSelectedTabPosition() != -1) {
Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition()); Fragment fragment = (Fragment) activityMainBinding.viewPager.getAdapter().instantiateItem(activityMainBinding.viewPager, activityMainBinding.tabLayout.getSelectedTabPosition());
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) { if (fragment instanceof FragmentMastodonTimeline fragmentMastodonTimeline && fragment.isVisible()) {
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
fragmentMastodonTimeline.refreshAllAdapters(); 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.Filter;
import app.fedilab.android.mastodon.client.entities.api.Mention; 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.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.client.entities.app.MarkdownConverter;
import app.fedilab.android.mastodon.ui.drawer.StatusAdapter; import app.fedilab.android.mastodon.ui.drawer.StatusAdapter;
import app.fedilab.android.mastodon.viewmodel.mastodon.FiltersVM; import app.fedilab.android.mastodon.viewmodel.mastodon.FiltersVM;
@ -154,7 +155,7 @@ public class SpannableHelper {
} else { } else {
initialContent = new SpannableString(text); 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 //Get all links
SpannableStringBuilder content; SpannableStringBuilder content;
if (markdownSupport && convertMarkdown) { if (markdownSupport && convertMarkdown) {
@ -278,19 +279,23 @@ public class SpannableHelper {
public void onClick(@NonNull View textView) { public void onClick(@NonNull View textView) {
textView.setTag(CLICKABLE_SPAN); textView.setTag(CLICKABLE_SPAN);
Intent intent; Intent intent;
Bundle b; Bundle args;
if (word.startsWith("#")) { if (word.startsWith("#")) {
intent = new Intent(context, HashTagActivity.class); intent = new Intent(context, HashTagActivity.class);
b = new Bundle(); args = new Bundle();
b.putString(Helper.ARG_SEARCH_KEYWORD, word.trim()); args.putString(Helper.ARG_SEARCH_KEYWORD, word.trim());
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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} else if (word.startsWith("@")) { } else if (word.startsWith("@")) {
intent = new Intent(context, ProfileActivity.class); intent = new Intent(context, ProfileActivity.class);
b = new Bundle(); args = new Bundle();
Mention targetedMention = null; Mention targetedMention = null;
for (Mention mention : mentions) { for (Mention mention : mentions) {
if (word.compareToIgnoreCase("@" + mention.username) == 0) { if (word.compareToIgnoreCase("@" + mention.username) == 0) {
targetedMention = mention; targetedMention = mention;
@ -298,20 +303,24 @@ public class SpannableHelper {
} }
} }
if (targetedMention != null) { if (targetedMention != null) {
b.putString(Helper.ARG_USER_ID, targetedMention.id); args.putString(Helper.ARG_USER_ID, targetedMention.id);
} else { } 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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} }
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
if(!underlineLinks) { if (!underlineLinks) {
ds.setUnderlineText(status != null && status.underlined); ds.setUnderlineText(status != null && status.underlined);
} }
if (linkColor != -1) { if (linkColor != -1) {
@ -603,7 +612,7 @@ public class SpannableHelper {
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
if(!underlineLinks) { if (!underlineLinks) {
ds.setUnderlineText(status != null && status.underlined); ds.setUnderlineText(status != null && status.underlined);
} }
if (linkColor != -1) { if (linkColor != -1) {
@ -626,9 +635,15 @@ public class SpannableHelper {
@Override @Override
public void federatedStatus(Status status) { public void federatedStatus(Status status) {
Intent intent = new Intent(context, ContextActivity.class); 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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} }
@Override @Override
@ -644,11 +659,15 @@ public class SpannableHelper {
@Override @Override
public void federatedAccount(Account account) { public void federatedAccount(Account account) {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} }
}); });
} }
@ -658,9 +677,15 @@ public class SpannableHelper {
@Override @Override
public void federatedStatus(Status status) { public void federatedStatus(Status status) {
Intent intent = new Intent(context, ContextActivity.class); 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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} }
@Override @Override
@ -676,11 +701,15 @@ public class SpannableHelper {
@Override @Override
public void federatedAccount(Account account) { public void federatedAccount(Account account) {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} }
}); });
} }
@ -690,9 +719,15 @@ public class SpannableHelper {
@Override @Override
public void federatedStatus(Status status) { public void federatedStatus(Status status) {
Intent intent = new Intent(context, ContextActivity.class); 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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} }
@Override @Override
@ -708,11 +743,15 @@ public class SpannableHelper {
@Override @Override
public void federatedAccount(Account account) { public void federatedAccount(Account account) {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
});
} }
}); });
} }
@ -750,7 +789,7 @@ public class SpannableHelper {
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
if(!underlineLinks) { if (!underlineLinks) {
ds.setUnderlineText(status != null && status.underlined); ds.setUnderlineText(status != null && status.underlined);
} }
if (linkColor != -1) { if (linkColor != -1) {
@ -890,16 +929,20 @@ public class SpannableHelper {
@Override @Override
public void onClick(@NonNull View textView) { public void onClick(@NonNull View textView) {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account.moved); args.putSerializable(Helper.ARG_ACCOUNT, account.moved);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} }
@Override @Override
public void updateDrawState(@NonNull TextPaint ds) { public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds); super.updateDrawState(ds);
if(!underlineLinks) { if (!underlineLinks) {
ds.setUnderlineText(false); ds.setUnderlineText(false);
} }
if (linkColor != -1) { if (linkColor != -1) {

View File

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

View File

@ -81,7 +81,7 @@ public class TranslateHelper {
String translate; String translate;
if (translates == null || translates.size() <= 1) { if (translates == null || translates.size() <= 1) {
translate = MyTransL.getLocale(); translate = MyTransL.getLocale();
if(translates != null && translates.size() == 1 ) { if (translates != null && translates.size() == 1) {
for (String val : translates) { for (String val : translates) {
translate = val; translate = val;
} }

View File

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

View File

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

View File

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

View File

@ -47,10 +47,8 @@ public class BaseActivity extends AppCompatActivity {
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults); super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) { if (requestCode == READ_WRITE_STORAGE) {
case READ_WRITE_STORAGE:
isPermissionGranted(grantResults[0] == PackageManager.PERMISSION_GRANTED, permissions[0]); 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.NonNull;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.work.Data; import androidx.work.Data;
import androidx.work.ForegroundInfo; 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.api.Status;
import app.fedilab.android.mastodon.client.entities.app.Account; 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.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.CamelTag;
import app.fedilab.android.mastodon.client.entities.app.PostState; import app.fedilab.android.mastodon.client.entities.app.PostState;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft; import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
@ -224,14 +224,24 @@ public class ComposeWorker extends Worker {
} }
Call<Status> statusCall; Call<Status> statusCall;
if (error) { if (error) {
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true); args.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE); Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE);
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, context.getString(R.string.media_cannot_be_uploaded)); args.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, context.getString(R.string.media_cannot_be_uploaded));
b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft); args.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
intentBD.putExtras(b); 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); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD); context.sendBroadcast(intentBD);
});
return; return;
} }
if (statuses.get(i).local_only) { if (statuses.get(i).local_only) {
@ -305,30 +315,51 @@ public class ComposeWorker extends Worker {
} }
} }
} else if (statusResponse.errorBody() != null) { } else if (statusResponse.errorBody() != null) {
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true); args.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE); 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(); String err = statusResponse.errorBody().string();
if (err.contains("{\"error\":\"")) { if (err.contains("{\"error\":\"")) {
err = err.replaceAll("\\{\"error\":\"(.*)\"\\}", "$1"); err = err.replaceAll("\\{\"error\":\"(.*)\"\\}", "$1");
} }
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, err); args.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, err);
intentBD.putExtras(b);
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); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD); context.sendBroadcast(intentBD);
});
return; return;
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true); args.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true);
b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft); args.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE); Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE);
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, e.getMessage()); args.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, e.getMessage());
intentBD.putExtras(b); 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); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD); context.sendBroadcast(intentBD);
});
return; return;
} }
} else { } else {
@ -376,14 +407,24 @@ public class ComposeWorker extends Worker {
} }
if (dataPost.scheduledDate == null && dataPost.token != null && firstSendMessage != null) { if (dataPost.scheduledDate == null && dataPost.token != null && firstSendMessage != null) {
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putBoolean(Helper.RECEIVE_NEW_MESSAGE, true); args.putBoolean(Helper.RECEIVE_NEW_MESSAGE, true);
b.putString(Helper.ARG_EDIT_STATUS_ID, dataPost.statusEditId); args.putString(Helper.ARG_EDIT_STATUS_ID, dataPost.statusEditId);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
b.putSerializable(Helper.RECEIVE_STATUS_ACTION, firstSendMessage); args.putSerializable(Helper.RECEIVE_STATUS_ACTION, firstSendMessage);
intentBD.putExtras(b); 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); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD); context.sendBroadcast(intentBD);
});
} }
} }

View File

@ -66,14 +66,14 @@ public class CustomReceiver extends MessagingReceiver {
@Override @Override
public void onNewEndpoint(@Nullable Context context, @NotNull String endpoint, @NotNull String slug) { public void onNewEndpoint(@Nullable Context context, @NotNull String endpoint, @NotNull String slug) {
if (context != null) { if (context != null) {
synchronized(this) { synchronized (this) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
String storedEnpoint = sharedpreferences.getString(context.getString(R.string.SET_STORED_ENDPOINT)+slug, null); String storedEnpoint = sharedpreferences.getString(context.getString(R.string.SET_STORED_ENDPOINT) + slug, null);
if(storedEnpoint == null || !storedEnpoint.equals(endpoint)) { if (storedEnpoint == null || !storedEnpoint.equals(endpoint)) {
PushNotifications PushNotifications
.registerPushNotifications(context, endpoint, slug); .registerPushNotifications(context, endpoint, slug);
SharedPreferences.Editor editor = sharedpreferences.edit(); SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(context.getString(R.string.SET_STORED_ENDPOINT)+slug, endpoint); editor.putString(context.getString(R.string.SET_STORED_ENDPOINT) + slug, endpoint);
editor.commit(); editor.commit();
} }
} }

View File

@ -15,7 +15,8 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.app.Activity; import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -29,7 +30,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
@ -48,6 +48,7 @@ import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.DrawerAccountBinding; import app.fedilab.android.databinding.DrawerAccountBinding;
import app.fedilab.android.mastodon.activities.ProfileActivity; import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.helper.ThemeHelper; 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.setChecked(muted);
accountViewHolder.binding.muteHome.setOnClickListener(v -> { accountViewHolder.binding.muteHome.setOnClickListener(v -> {
if (muted) { 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 { } 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 { } else {
@ -111,11 +112,14 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
accountViewHolder.binding.avatar.setOnClickListener(v -> { accountViewHolder.binding.avatar.setOnClickListener(v -> {
if (remoteInstance == null) { if (remoteInstance == null) {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} else { } else {
Toasty.info(context, context.getString(R.string.retrieve_remote_account), Toasty.LENGTH_SHORT).show(); Toasty.info(context, context.getString(R.string.retrieve_remote_account), Toasty.LENGTH_SHORT).show();
SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class); 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) { if (results != null && results.accounts != null && results.accounts.size() > 0) {
Account accountSearch = results.accounts.get(0); Account accountSearch = results.accounts.get(0);
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, accountSearch); args.putSerializable(Helper.ARG_ACCOUNT, accountSearch);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} else { } else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show(); 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.app.Activity; import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -24,7 +25,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
@ -38,6 +38,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerFollowBinding; import app.fedilab.android.databinding.DrawerFollowBinding;
import app.fedilab.android.mastodon.activities.ProfileActivity; import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM; import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM;
@ -103,12 +104,15 @@ public class AccountFollowRequestAdapter extends RecyclerView.Adapter<RecyclerVi
})); }));
holderFollow.binding.avatar.setOnClickListener(v -> { holderFollow.binding.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.app.Activity; import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
@ -22,10 +23,8 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.appcompat.widget.LinearLayoutCompat; import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.cursoradapter.widget.SimpleCursorAdapter; import androidx.cursoradapter.widget.SimpleCursorAdapter;
import java.util.List; import java.util.List;
@ -33,6 +32,7 @@ import java.util.List;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.mastodon.activities.ProfileActivity; import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.Helper;
@ -61,16 +61,18 @@ public class AccountsSearchTopBarAdapter extends SimpleCursorAdapter {
LinearLayoutCompat container = view.findViewById(R.id.account_container); LinearLayoutCompat container = view.findViewById(R.id.account_container);
container.setTag(cursor.getPosition()); container.setTag(cursor.getPosition());
ImageView account_pp = view.findViewById(R.id.account_pp);
container.setOnClickListener(v -> { container.setOnClickListener(v -> {
int position = (int) v.getTag(); int position = (int) v.getTag();
if (accountList != null && accountList.size() > position) { if (accountList != null && accountList.size() > position) {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, accountList.get(position)); args.putSerializable(Helper.ARG_ACCOUNT, accountList.get(position));
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} }
}); });
} }

View File

@ -51,7 +51,6 @@ import android.view.inputmethod.InputMethodManager;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.GridView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
@ -110,7 +109,6 @@ import app.fedilab.android.databinding.DrawerStatusComposeBinding;
import app.fedilab.android.databinding.DrawerStatusSimpleBinding; import app.fedilab.android.databinding.DrawerStatusSimpleBinding;
import app.fedilab.android.mastodon.activities.ComposeActivity; import app.fedilab.android.mastodon.activities.ComposeActivity;
import app.fedilab.android.mastodon.activities.MediaActivity; 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.Account;
import app.fedilab.android.mastodon.client.entities.api.Attachment; 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.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.Status;
import app.fedilab.android.mastodon.client.entities.api.Tag; 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.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.CamelTag;
import app.fedilab.android.mastodon.client.entities.app.Languages; import app.fedilab.android.mastodon.client.entities.app.Languages;
import app.fedilab.android.mastodon.client.entities.app.Quotes; import app.fedilab.android.mastodon.client.entities.app.Quotes;
@ -549,7 +548,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
String defaultFormat = sharedpreferences.getString(context.getString(R.string.SET_THREAD_MESSAGE), context.getString(R.string.DEFAULT_THREAD_VALUE)); String defaultFormat = sharedpreferences.getString(context.getString(R.string.SET_THREAD_MESSAGE), context.getString(R.string.DEFAULT_THREAD_VALUE));
//User asked to be prompted for threading long messages //User asked to be prompted for threading long messages
if(defaultFormat.compareToIgnoreCase("ASK") == 0 && !splitChoiceDone) { if (defaultFormat.compareToIgnoreCase("ASK") == 0 && !splitChoiceDone) {
splitChoiceDone = true; splitChoiceDone = true;
AlertDialog.Builder threadConfirm = new MaterialAlertDialogBuilder(context); AlertDialog.Builder threadConfirm = new MaterialAlertDialogBuilder(context);
threadConfirm.setTitle(context.getString(R.string.thread_long_this_message)); threadConfirm.setTitle(context.getString(R.string.thread_long_this_message));
@ -561,29 +560,29 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
holder.binding.content.setText(splitText.get(0)); holder.binding.content.setText(splitText.get(0));
int statusListSize = statusList.size(); int statusListSize = statusList.size();
int i = 0; int i = 0;
for(String message: splitText) { for (String message : splitText) {
if(i==0) { if (i == 0) {
i++; i++;
continue; continue;
} }
manageDrafts.onItemDraftAdded(statusListSize+(i-1), message); manageDrafts.onItemDraftAdded(statusListSize + (i - 1), message);
buttonVisibility(holder); buttonVisibility(holder);
i++; i++;
} }
dialog.dismiss(); dialog.dismiss();
}); });
threadConfirm.show(); threadConfirm.show();
} else if(defaultFormat.compareToIgnoreCase("ENABLE") == 0) { //User wants to automatically thread long messages } else if (defaultFormat.compareToIgnoreCase("ENABLE") == 0) { //User wants to automatically thread long messages
proceedToSplit = true; proceedToSplit = true;
ArrayList<String> splitText = ComposeHelper.splitToots(s.toString(), max_car); ArrayList<String> splitText = ComposeHelper.splitToots(s.toString(), max_car);
int statusListSize = statusList.size(); int statusListSize = statusList.size();
int i = 0; int i = 0;
for(String message: splitText) { for (String message : splitText) {
if(i==0) { if (i == 0) {
i++; i++;
continue; continue;
} }
manageDrafts.onItemDraftAdded(statusListSize+(i-1), message); manageDrafts.onItemDraftAdded(statusListSize + (i - 1), message);
buttonVisibility(holder); buttonVisibility(holder);
i++; i++;
} }
@ -594,7 +593,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
String contentString = s.toString(); String contentString = s.toString();
if(proceedToSplit) { if (proceedToSplit) {
int max_car = MastodonHelper.getInstanceMaxChars(context); int max_car = MastodonHelper.getInstanceMaxChars(context);
ArrayList<String> splitText = ComposeHelper.splitToots(contentString, max_car); ArrayList<String> splitText = ComposeHelper.splitToots(contentString, max_car);
contentString = splitText.get(0); contentString = splitText.get(0);
@ -891,6 +890,13 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
Tag tag = new Tag(); Tag tag = new Tag();
tag.name = camelTag; tag.name = camelTag;
if (!results.hashtags.contains(tag)) { 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); results.hashtags.add(0, tag);
} }
} }
@ -1352,31 +1358,35 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
if (getItemViewType(position) == TYPE_NORMAL) { if (getItemViewType(position) == TYPE_NORMAL) {
Status status = statusList.get(position); Status status = statusList.get(position);
StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder; StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder;
if(status.media_attachments != null && status.media_attachments.size() > 0 ) { if (status.media_attachments != null && status.media_attachments.size() > 0) {
holder.binding.simpleMedia.removeAllViews(); holder.binding.simpleMedia.removeAllViews();
List<Attachment> attachmentList = statusList.get(position).media_attachments; List<Attachment> attachmentList = statusList.get(position).media_attachments;
for(Attachment attachment: attachmentList) { for (Attachment attachment : attachmentList) {
DrawerMediaListBinding drawerMediaListBinding = DrawerMediaListBinding.inflate(LayoutInflater.from(context), holder.binding.simpleMedia, false); DrawerMediaListBinding drawerMediaListBinding = DrawerMediaListBinding.inflate(LayoutInflater.from(context), holder.binding.simpleMedia, false);
Glide.with(drawerMediaListBinding.media.getContext()) Glide.with(drawerMediaListBinding.media.getContext())
.load(attachment.preview_url) .load(attachment.preview_url)
.into(drawerMediaListBinding.media); .into(drawerMediaListBinding.media);
if(attachment.filename != null) { if (attachment.filename != null) {
drawerMediaListBinding.mediaName.setText(attachment.filename); drawerMediaListBinding.mediaName.setText(attachment.filename);
} else if (attachment.preview_url != null){ } else if (attachment.preview_url != null) {
drawerMediaListBinding.mediaName.setText(URLUtil.guessFileName(attachment.preview_url, null, null)); drawerMediaListBinding.mediaName.setText(URLUtil.guessFileName(attachment.preview_url, null, null));
} }
drawerMediaListBinding.getRoot().setOnClickListener(v->{ drawerMediaListBinding.getRoot().setOnClickListener(v -> {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(attachment); attachments.add(attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, drawerMediaListBinding.media, attachment.url); .makeSceneTransitionAnimation((Activity) context, drawerMediaListBinding.media, attachment.url);
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
});
holder.binding.simpleMedia.addView(drawerMediaListBinding.getRoot()); 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>. */ * 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.BaseMainActivity.currentNightMode;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
@ -22,6 +23,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.view.LayoutInflater; 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.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Conversation; 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.api.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -220,9 +223,15 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} else { } else {
intent = new Intent(context, ContextActivity.class); 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); context.startActivity(intent);
}); });
});
holder.binding.attachmentsListContainer.setOnTouchListener((v, event) -> { holder.binding.attachmentsListContainer.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) { if (event.getAction() == MotionEvent.ACTION_UP) {
@ -232,8 +241,14 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} else { } else {
intent = new Intent(context, ContextActivity.class); 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); context.startActivity(intent);
});
} }
return false; 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; 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.ContextActivity;
import app.fedilab.android.mastodon.activities.MediaActivity; import app.fedilab.android.mastodon.activities.MediaActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment; 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.helper.Helper;
import app.fedilab.android.mastodon.ui.fragment.media.FragmentMediaProfile; 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 -> { holder.binding.media.setOnClickListener(v -> {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, position + 1); args.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
b.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true); args.putBoolean(Helper.ARG_MEDIA_ARRAY_PROFILE, true);
mediaIntent.putExtras(b);
ActivityOptionsCompat options = null;
if (attachment != null) { 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 options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url); .makeSceneTransitionAnimation((Activity) context, holder.binding.media, attachment.url);
} else {
return;
}
// start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
}
});
holder.binding.media.setOnLongClickListener(v -> { holder.binding.media.setOnLongClickListener(v -> {
Intent intentContext = new Intent(context, ContextActivity.class); Intent intentContext = new Intent(context, ContextActivity.class);
Bundle args = new Bundle();
if (attachment != null) { if (attachment != null) {
intentContext.putExtra(Helper.ARG_STATUS, attachment.status); args.putSerializable(Helper.ARG_STATUS, attachment.status);
} else { } else {
return false; 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); intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intentContext); context.startActivity(intentContext);
});
return false; return false;
}); });
} }

View File

@ -15,10 +15,10 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */ * 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.BaseMainActivity.currentNightMode;
import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.statusManagement; import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.statusManagement;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -30,7 +30,6 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
@ -50,6 +49,7 @@ import app.fedilab.android.databinding.DrawerStatusNotificationBinding;
import app.fedilab.android.databinding.NotificationsRelatedAccountsBinding; import app.fedilab.android.databinding.NotificationsRelatedAccountsBinding;
import app.fedilab.android.mastodon.activities.ProfileActivity; import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Notification; 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.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -272,12 +272,15 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
})); }));
holderFollow.binding.avatar.setOnClickListener(v -> { holderFollow.binding.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account); args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
if (notification.isFetchMore && fetchMoreCallBack != null) { if (notification.isFetchMore && fetchMoreCallBack != null) {
holderFollow.binding.layoutFetchMore.fetchMoreContainer.setVisibility(View.VISIBLE); holderFollow.binding.layoutFetchMore.fetchMoreContainer.setVisibility(View.VISIBLE);
holderFollow.binding.layoutFetchMore.fetchMoreMin.setOnClickListener(v -> { 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); MastodonHelper.loadPPMastodon(holderStatus.bindingNotification.status.avatar, notification.account);
holderStatus.bindingNotification.status.statusUserInfo.setOnClickListener(v -> { holderStatus.bindingNotification.status.statusUserInfo.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account); args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holderStatus.bindingNotification.status.mainContainer.setAlpha(.8f); holderStatus.bindingNotification.status.mainContainer.setAlpha(.8f);
} }
holderStatus.bindingNotification.status.displayName.setText( holderStatus.bindingNotification.status.displayName.setText(
@ -429,12 +435,15 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
notificationsRelatedAccountsBinding.acc.setText(relativeNotif.account.username); notificationsRelatedAccountsBinding.acc.setText(relativeNotif.account.username);
notificationsRelatedAccountsBinding.relatedAccountContainer.setOnClickListener(v -> { notificationsRelatedAccountsBinding.relatedAccountContainer.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, relativeNotif.account); args.putSerializable(Helper.ARG_ACCOUNT, relativeNotif.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holderStatus.bindingNotification.relatedAccounts.addView(notificationsRelatedAccountsBinding.getRoot()); holderStatus.bindingNotification.relatedAccounts.addView(notificationsRelatedAccountsBinding.getRoot());
} }
holderStatus.bindingNotification.otherAccounts.setVisibility(View.VISIBLE); holderStatus.bindingNotification.otherAccounts.setVisibility(View.VISIBLE);
@ -443,21 +452,26 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} }
holderStatus.bindingNotification.status.avatar.setOnClickListener(v -> { holderStatus.bindingNotification.status.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account); args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holderStatus.bindingNotification.status.statusUserInfo.setOnClickListener(v -> { holderStatus.bindingNotification.status.statusUserInfo.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, notification.account); args.putSerializable(Helper.ARG_ACCOUNT, notification.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holderStatus.bindingNotification.status.displayName.setText( holderStatus.bindingNotification.status.displayName.setText(
notification.account.getSpanDisplayNameTitle(context, notification.account.getSpanDisplayNameTitle(context,
new WeakReference<>(holderStatus.bindingNotification.status.displayName), title), 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; 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.activities.MediaActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment; 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.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.BlurTransformation;
@ -102,14 +105,17 @@ public class SliderAdapter extends SliderViewAdapter<SliderAdapter.SliderAdapter
} }
} else { } else {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, position + 1); args.putInt(Helper.ARG_MEDIA_POSITION, position + 1);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, viewHolder.binding.ivAutoImageSlider, status.media_attachments.get(0).url); .makeSceneTransitionAnimation((Activity) context, viewHolder.binding.ivAutoImageSlider, status.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
});
} }
}); });
} }

View File

@ -88,7 +88,6 @@ import androidx.fragment.app.Fragment;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; 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.api.Status;
import app.fedilab.android.mastodon.client.entities.app.Account; 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.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.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.RemoteInstance; import app.fedilab.android.mastodon.client.entities.app.RemoteInstance;
import app.fedilab.android.mastodon.client.entities.app.StatusCache; 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"); 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.cardviewContainer.setCardElevation((int) Helper.convertDpToPixel(5, context));
holder.binding.quotedMessage.dividerCard.setVisibility(View.GONE); holder.binding.quotedMessage.dividerCard.setVisibility(View.GONE);
holder.binding.quotedMessage.cardviewContainer.setStrokeWidth((int) Helper.convertDpToPixel(1, context)); holder.binding.quotedMessage.cardviewContainer.setStrokeWidth((int) Helper.convertDpToPixel(1, context));
@ -503,9 +503,15 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
Intent intent = new Intent(context, ContextActivity.class); 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); context.startActivity(intent);
}); });
});
holder.binding.quotedMessage.cardviewContainer.setStrokeColor(ThemeHelper.getAttColor(context, R.attr.colorPrimary)); holder.binding.quotedMessage.cardviewContainer.setStrokeColor(ThemeHelper.getAttColor(context, R.attr.colorPrimary));
holder.binding.quotedMessage.statusContent.setText( holder.binding.quotedMessage.statusContent.setText(
statusToDeal.quote.getSpanContent(context, 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) { if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0); Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.reblog != null ? fetchedStatus.reblog.account : fetchedStatus.account); args.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.reblog != null ? fetchedStatus.reblog.account : fetchedStatus.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} else { } else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show(); Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
} }
}); });
} else { } else {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, status.reblog != null ? status.reblog.account : status.account); args.putSerializable(Helper.ARG_ACCOUNT, status.reblog != null ? status.reblog.account : status.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} }
}); });
holder.binding.statusBoosterInfo.setOnClickListener(v -> { 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) { if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0); Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.account); args.putSerializable(Helper.ARG_ACCOUNT, fetchedStatus.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} else { } else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show(); Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
} }
}); });
} else { } else {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, status.account); args.putSerializable(Helper.ARG_ACCOUNT, status.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} }
}); });
//---> REBLOG/UNREBLOG //---> REBLOG/UNREBLOG
@ -1286,13 +1304,13 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} else { } else {
holder.binding.replyCount.setVisibility(View.GONE); holder.binding.replyCount.setVisibility(View.GONE);
} }
if(statusToDeal.reblogs_count > 0) { if (statusToDeal.reblogs_count > 0) {
holder.binding.boostCount.setText(String.valueOf(statusToDeal.reblogs_count)); holder.binding.boostCount.setText(String.valueOf(statusToDeal.reblogs_count));
holder.binding.boostCount.setVisibility(View.VISIBLE); holder.binding.boostCount.setVisibility(View.VISIBLE);
} else { } else {
holder.binding.boostCount.setVisibility(View.GONE); holder.binding.boostCount.setVisibility(View.GONE);
} }
if(statusToDeal.favourites_count > 0) { if (statusToDeal.favourites_count > 0) {
holder.binding.favoriteCount.setText(String.valueOf(statusToDeal.favourites_count)); holder.binding.favoriteCount.setText(String.valueOf(statusToDeal.favourites_count));
holder.binding.favoriteCount.setVisibility(View.VISIBLE); holder.binding.favoriteCount.setVisibility(View.VISIBLE);
} else { } else {
@ -1317,7 +1335,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} else { } else {
holder.binding.dateShort.setCompoundDrawables(null, null, null, null); holder.binding.dateShort.setCompoundDrawables(null, null, null, null);
} }
if(relativeDate) { if (relativeDate) {
if (originalDateForBoost || status.reblog == null) { if (originalDateForBoost || status.reblog == null) {
holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at)); holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at));
} else { } else {
@ -1448,6 +1466,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
} else { } else {
holder.binding.statusContent.setVisibility(View.GONE); holder.binding.statusContent.setVisibility(View.GONE);
holder.binding.quotedMessage.cardviewContainer.setVisibility(View.GONE);
holder.binding.mediaContainer.setVisibility(View.GONE); holder.binding.mediaContainer.setVisibility(View.GONE);
holder.binding.card.setVisibility(View.GONE); holder.binding.card.setVisibility(View.GONE);
} }
@ -1656,15 +1675,18 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
});
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive; statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition()); adapter.notifyItemChanged(holder.getBindingAdapterPosition());
@ -1724,15 +1746,18 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
});
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive; statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition()); adapter.notifyItemChanged(holder.getBindingAdapterPosition());
@ -1761,20 +1786,32 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.reblogInfo.setOnClickListener(v -> { holder.binding.reblogInfo.setOnClickListener(v -> {
if (statusToDeal.reblogs_count > 0) { if (statusToDeal.reblogs_count > 0) {
Intent intent = new Intent(context, StatusInfoActivity.class); Intent intent = new Intent(context, StatusInfoActivity.class);
intent.putExtra(Helper.ARG_TYPE_OF_INFO, StatusInfoActivity.typeOfInfo.BOOSTED_BY); Bundle args = new Bundle();
intent.putExtra(Helper.ARG_STATUS, statusToDeal); args.putSerializable(Helper.ARG_STATUS, statusToDeal);
intent.putExtra(Helper.ARG_CHECK_REMOTELY, remote); 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); context.startActivity(intent);
});
} }
}); });
holder.binding.favouriteInfo.setOnClickListener(v -> { holder.binding.favouriteInfo.setOnClickListener(v -> {
if (statusToDeal.favourites_count > 0) { if (statusToDeal.favourites_count > 0) {
Intent intent = new Intent(context, StatusInfoActivity.class); Intent intent = new Intent(context, StatusInfoActivity.class);
intent.putExtra(Helper.ARG_TYPE_OF_INFO, StatusInfoActivity.typeOfInfo.LIKED_BY); Bundle args = new Bundle();
intent.putExtra(Helper.ARG_STATUS, statusToDeal); args.putSerializable(Helper.ARG_STATUS, statusToDeal);
intent.putExtra(Helper.ARG_CHECK_REMOTELY, remote); 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); context.startActivity(intent);
});
} }
}); });
@ -1782,7 +1819,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (statusToDeal.poll != null && statusToDeal.poll.options != null) { if (statusToDeal.poll != null && statusToDeal.poll.options != null) {
int normalize; int normalize;
if(statusToDeal.poll.multiple && statusToDeal.poll.voters_count > 1) { if (statusToDeal.poll.multiple && statusToDeal.poll.voters_count > 1) {
normalize = statusToDeal.poll.voters_count; normalize = statusToDeal.poll.voters_count;
} else { } else {
normalize = statusToDeal.poll.votes_count; normalize = statusToDeal.poll.votes_count;
@ -1990,22 +2027,31 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
if (context instanceof ContextActivity && !remote) { 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 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()); 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); ((ContextActivity) context).setCurrentFragment((FragmentMastodonContext) fragment);
});
} else { } else {
if (remote) { if (remote) {
//Lemmy main post that should open Lemmy threads //Lemmy main post that should open Lemmy threads
if (adapter instanceof StatusAdapter && ((StatusAdapter) adapter).type == RemoteInstance.InstanceType.LEMMY && status.lemmy_post_id != null) { if (adapter instanceof StatusAdapter && ((StatusAdapter) adapter).type == RemoteInstance.InstanceType.LEMMY && status.lemmy_post_id != null) {
Bundle bundle = new Bundle(); Bundle args = new Bundle();
bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, ((StatusAdapter) adapter).pinnedTimeline); args.putSerializable(Helper.ARG_REMOTE_INSTANCE, ((StatusAdapter) adapter).pinnedTimeline);
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE); args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.REMOTE);
bundle.putString(Helper.ARG_LEMMY_POST_ID, status.lemmy_post_id); args.putString(Helper.ARG_LEMMY_POST_ID, status.lemmy_post_id);
bundle.putSerializable(Helper.ARG_STATUS, status); args.putSerializable(Helper.ARG_STATUS, status);
Intent intent = new Intent(context, TimelineActivity.class); 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); intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} //Classic other cases for remote instances that will search the remote context } //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 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(); 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) { if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0); Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ContextActivity.class); 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); context.startActivity(intent);
});
} else { } else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show(); 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 { } else {
Intent intent = new Intent(context, ContextActivity.class); 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); context.startActivity(intent);
});
} }
} }
}); });
@ -2120,9 +2178,15 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
statusDeleted.id = null; statusDeleted.id = null;
statusDraft.statusDraftList.add(statusDeleted); statusDraft.statusDraftList.add(statusDeleted);
intent.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft); Bundle args = new Bundle();
intent.putExtra(Helper.ARG_STATUS_REPLY_ID, statusDeleted.in_reply_to_id); 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); context.startActivity(intent);
});
sendAction(context, Helper.ARG_STATUS_DELETED, statusToDeal, null); sendAction(context, Helper.ARG_STATUS_DELETED, statusToDeal, null);
}); });
} }
@ -2143,10 +2207,16 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
statusToDeal.spoilerChecked = true; statusToDeal.spoilerChecked = true;
} }
statusDraft.statusDraftList.add(statusToDeal); statusDraft.statusDraftList.add(statusToDeal);
intent.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft); Bundle args = new Bundle();
intent.putExtra(Helper.ARG_EDIT_STATUS_ID, statusToDeal.id); args.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft);
intent.putExtra(Helper.ARG_STATUS_REPLY_ID, statusToDeal.in_reply_to_id); 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); context.startActivity(intent);
});
} else { } else {
Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); 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; return true;
} else if (itemId == R.id.action_report) { } else if (itemId == R.id.action_report) {
Intent intent = new Intent(context, ReportActivity.class); 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); context.startActivity(intent);
});
} else if (itemId == R.id.action_copy) { } else if (itemId == R.id.action_copy) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
String content; 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))); context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
} else if (itemId == R.id.action_custom_sharing) { } else if (itemId == R.id.action_custom_sharing) {
Intent intent = new Intent(context, CustomSharingActivity.class); 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); context.startActivity(intent);
});
} else if (itemId == R.id.action_mention) { } else if (itemId == R.id.action_mention) {
Intent intent = new Intent(context, ComposeActivity.class); Intent intent = new Intent(context, ComposeActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_STATUS_MENTION, statusToDeal); args.putSerializable(Helper.ARG_STATUS_MENTION, statusToDeal);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
});
} else if (itemId == R.id.action_open_with) { } else if (itemId == R.id.action_open_with) {
new Thread(() -> { new Thread(() -> {
try { try {
@ -2412,19 +2498,31 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (results != null && results.statuses != null && results.statuses.size() > 0) { if (results != null && results.statuses != null && results.statuses.size() > 0) {
Status fetchedStatus = results.statuses.get(0); Status fetchedStatus = results.statuses.get(0);
Intent intent = new Intent(context, ComposeActivity.class); 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); context.startActivity(intent);
});
} else { } else {
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show(); Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
} }
}); });
} else { } else {
Intent intent = new Intent(context, ComposeActivity.class); 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) { 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); context.startActivity(intent);
});
} }
}); });
//For reports //For reports
@ -2691,15 +2789,18 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(statusToDeal.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url); .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, statusToDeal.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
});
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
statusToDeal.sensitive = !statusToDeal.sensitive; statusToDeal.sensitive = !statusToDeal.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition()); 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) * @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) { 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) { if (status != null) {
b.putSerializable(type, status); args.putSerializable(type, status);
} }
if (id != null) { if (id != null) {
b.putString(type, id); args.putString(type, id);
} }
if (type.equals(ARG_TIMELINE_REFRESH_ALL)) { 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); 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); intentBC.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBC); 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.artAcct.setText(String.format(Locale.getDefault(), "@%s", status.account.acct));
holder.bindingArt.artPp.setOnClickListener(v -> { holder.bindingArt.artPp.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, status.account); args.putSerializable(Helper.ARG_ACCOUNT, status.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holder.bindingArt.artMedia.setOnClickListener(v -> { holder.bindingArt.artMedia.setOnClickListener(v -> {
if (status.art_attachment != null) { if (status.art_attachment != null) {
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, 1); args.putInt(Helper.ARG_MEDIA_POSITION, 1);
ArrayList<Attachment> attachments = new ArrayList<>(); ArrayList<Attachment> attachments = new ArrayList<>();
attachments.add(status.art_attachment); attachments.add(status.art_attachment);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments); args.putSerializable(Helper.ARG_MEDIA_ARRAY, attachments);
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url); .makeSceneTransitionAnimation((Activity) context, holder.bindingArt.artMedia, status.art_attachment.url);
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
});
} else { } else {
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
} }
}); });
holder.bindingArt.bottomBanner.setOnClickListener(v -> { holder.bindingArt.bottomBanner.setOnClickListener(v -> {
Intent intent = new Intent(context, ContextActivity.class); 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); context.startActivity(intent);
}); });
});
} else if (viewHolder.getItemViewType() == STATUS_PIXELFED) { } else if (viewHolder.getItemViewType() == STATUS_PIXELFED) {
Status statusToDeal = status.reblog != null ? status.reblog : status; Status statusToDeal = status.reblog != null ? status.reblog : status;
StatusViewHolder holder = (StatusViewHolder) viewHolder; 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.artAcct.setText(String.format(Locale.getDefault(), "@%s", statusToDeal.account.acct));
holder.bindingPixelfed.artPp.setOnClickListener(v -> { holder.bindingPixelfed.artPp.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, statusToDeal.account); args.putSerializable(Helper.ARG_ACCOUNT, statusToDeal.account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holder.bindingPixelfed.bottomBanner.setOnClickListener(v -> { holder.bindingPixelfed.bottomBanner.setOnClickListener(v -> {
Intent intent = new Intent(context, ContextActivity.class); 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); context.startActivity(intent);
}); });
});
} }
} }
@ -3217,8 +3346,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
@Override @Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder viewHolder) { public void onViewRecycled(@NonNull RecyclerView.ViewHolder viewHolder) {
super.onViewRecycled(viewHolder); super.onViewRecycled(viewHolder);
if (viewHolder instanceof StatusViewHolder) { if (viewHolder instanceof StatusViewHolder holder) {
StatusViewHolder holder = (StatusViewHolder) viewHolder;
if (holder.binding != null) { if (holder.binding != null) {
PlayerView doubleTapPlayerView = holder.binding.media.getRoot().findViewById(R.id.media_video); PlayerView doubleTapPlayerView = holder.binding.media.getRoot().findViewById(R.id.media_video);
if (doubleTapPlayerView != null && doubleTapPlayerView.getPlayer() != null) { 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>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.prepareRequestBuilder; import static app.fedilab.android.mastodon.ui.drawer.StatusAdapter.prepareRequestBuilder;
import android.app.Activity; 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.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Poll; 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.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.CacheDataSourceFactory; import app.fedilab.android.mastodon.helper.CacheDataSourceFactory;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod; import app.fedilab.android.mastodon.helper.LongClickLinkMovementMethod;
@ -191,15 +193,18 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, mediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
});
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive; status.sensitive = !status.sensitive;
adapter.notifyItemChanged(holder.getBindingAdapterPosition()); adapter.notifyItemChanged(holder.getBindingAdapterPosition());
@ -667,15 +672,18 @@ public class StatusDirectMessageAdapter extends RecyclerView.Adapter<RecyclerVie
return; return;
} }
Intent mediaIntent = new Intent(context, MediaActivity.class); Intent mediaIntent = new Intent(context, MediaActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition); args.putInt(Helper.ARG_MEDIA_POSITION, finalMediaPosition);
b.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments)); args.putSerializable(Helper.ARG_MEDIA_ARRAY, new ArrayList<>(status.media_attachments));
mediaIntent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
mediaIntent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url); .makeSceneTransitionAnimation((Activity) context, layoutMediaBinding.media, status.media_attachments.get(0).url);
// start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
});
layoutMediaBinding.viewHide.setOnClickListener(v -> { layoutMediaBinding.viewHide.setOnClickListener(v -> {
status.sensitive = !status.sensitive; status.sensitive = !status.sensitive;
notifyItemChanged(holder.getBindingAdapterPosition()); notifyItemChanged(holder.getBindingAdapterPosition());

View File

@ -15,9 +15,12 @@ package app.fedilab.android.mastodon.ui.drawer;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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.activities.ComposeActivity;
import app.fedilab.android.mastodon.client.entities.api.Attachment; 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.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft; import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
@ -100,10 +104,15 @@ public class StatusDraftAdapter extends RecyclerView.Adapter<StatusDraftAdapter.
holder.binding.cardviewContainer.setOnClickListener(v -> { holder.binding.cardviewContainer.setOnClickListener(v -> {
Intent intent = new Intent(context, ComposeActivity.class); 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); context.startActivity(intent);
}); });
});
holder.binding.delete.setOnClickListener(v -> { holder.binding.delete.setOnClickListener(v -> {
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(context); 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 androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -44,6 +46,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerStatusScheduledBinding; import app.fedilab.android.databinding.DrawerStatusScheduledBinding;
import app.fedilab.android.mastodon.activities.ComposeActivity; import app.fedilab.android.mastodon.activities.ComposeActivity;
import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus; 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.ScheduledBoost;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft; import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
@ -126,10 +129,15 @@ public class StatusScheduledAdapter extends RecyclerView.Adapter<StatusScheduled
holder.binding.cardviewContainer.setOnClickListener(v -> { holder.binding.cardviewContainer.setOnClickListener(v -> {
if (statusDraft != null) { if (statusDraft != null) {
Intent intent = new Intent(context, ComposeActivity.class); 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); context.startActivity(intent);
});
} }
}); });
holder.binding.delete.setOnClickListener(v -> { holder.binding.delete.setOnClickListener(v -> {
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(context); 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>. */ * see <http://www.gnu.org/licenses>. */
import android.app.Activity; import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -26,7 +27,6 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.ActivityOptionsCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
import androidx.preference.PreferenceManager; 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.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.api.Suggestion;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.viewmodel.mastodon.AccountsVM; 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 -> { holder.binding.avatar.setOnClickListener(v -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account); args.putSerializable(Helper.ARG_ACCOUNT, account);
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
// start the new activity Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holder.binding.followAction.setIconResource(R.drawable.ic_baseline_person_add_24); holder.binding.followAction.setIconResource(R.drawable.ic_baseline_person_add_24);
if (account == null) { if (account == null) {
return; 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; 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.activities.HashTagActivity;
import app.fedilab.android.mastodon.client.entities.api.History; 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.api.Tag;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
public class TagAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { 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 -> { tagViewHolder.binding.getRoot().setOnClickListener(v1 -> {
Intent intent = new Intent(context, HashTagActivity.class); Intent intent = new Intent(context, HashTagActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putString(Helper.ARG_SEARCH_KEYWORD, tag.name.trim()); args.putString(Helper.ARG_SEARCH_KEYWORD, tag.name.trim());
intent.putExtras(b); new CachedBundle(context).insertBundle(args, currentAccount, bundleId -> {
Bundle bundle = new Bundle();
bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
intent.putExtras(bundle);
context.startActivity(intent); context.startActivity(intent);
}); });
});
} }
public int getCount() { public int getCount() {

View File

@ -11,10 +11,14 @@ import android.widget.Filterable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.github.mikephil.charting.data.Entry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerTagSearchBinding; import app.fedilab.android.databinding.DrawerTagSearchBinding;
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.api.Tag;
/* Copyright 2021 Thomas Schneider /* 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> tags;
private final List<Tag> tempTags; private final List<Tag> tempTags;
private final List<Tag> suggestions; private final List<Tag> suggestions;
private final Context context;
private final Filter searchFilter = new Filter() { private final Filter searchFilter = new Filter() {
@Override @Override
@ -75,6 +80,7 @@ public class TagsSearchAdapter extends ArrayAdapter<Tag> implements Filterable {
public TagsSearchAdapter(Context context, List<Tag> tags) { public TagsSearchAdapter(Context context, List<Tag> tags) {
super(context, android.R.layout.simple_list_item_1, tags); super(context, android.R.layout.simple_list_item_1, tags);
this.context = context;
this.tags = tags; this.tags = tags;
this.tempTags = new ArrayList<>(tags); this.tempTags = new ArrayList<>(tags);
this.suggestions = 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 = (TagSearchViewHolder) convertView.getTag();
} }
holder.binding.tagName.setText(String.format("#%s", tag.name)); 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; return holder.view;
} }

View File

@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.ui.drawer.admin;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -34,6 +36,7 @@ import app.fedilab.android.R;
import app.fedilab.android.databinding.DrawerAdminAccountBinding; import app.fedilab.android.databinding.DrawerAdminAccountBinding;
import app.fedilab.android.mastodon.activities.admin.AdminAccountActivity; 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.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.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; 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); MastodonHelper.loadPPMastodon(holder.binding.pp, adminAccount.account);
holder.binding.cardviewContainer.setOnClickListener(v -> { holder.binding.cardviewContainer.setOnClickListener(v -> {
Intent intent = new Intent(context, AdminAccountActivity.class); Intent intent = new Intent(context, AdminAccountActivity.class);
Bundle b = new Bundle(); Bundle args = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, adminAccount); args.putSerializable(Helper.ARG_ACCOUNT, adminAccount);
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); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
}); });
});
holder.binding.username.setText(adminAccount.account.display_name); holder.binding.username.setText(adminAccount.account.display_name);
holder.binding.acct.setText(String.format(Locale.getDefault(), "@%s", adminAccount.account.acct)); holder.binding.acct.setText(String.format(Locale.getDefault(), "@%s", adminAccount.account.acct));
holder.binding.postCount.setText(String.valueOf(adminAccount.account.statuses_count)); holder.binding.postCount.setText(String.valueOf(adminAccount.account.statuses_count));

View File

@ -110,9 +110,17 @@ public class FragmentMedia extends Fragment {
enableSliding(true); 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 type = attachment.type;
String preview_url = attachment.preview_url; String preview_url = attachment.preview_url;
@ -363,7 +371,8 @@ public class FragmentMedia extends Fragment {
binding.videoLayout.setVisibility(View.GONE); binding.videoLayout.setVisibility(View.GONE);
try { try {
ActivityCompat.finishAfterTransition(requireActivity()); ActivityCompat.finishAfterTransition(requireActivity());
}catch (Exception ignored){} } catch (Exception ignored) {
}
} }
} }
@ -386,7 +395,9 @@ public class FragmentMedia extends Fragment {
@Override @Override
public boolean onPreDraw() { public boolean onPreDraw() {
imageView.getViewTreeObserver().removeOnPreDrawListener(this); imageView.getViewTreeObserver().removeOnPreDrawListener(this);
if (isAdded()) {
ActivityCompat.startPostponedEnterTransition(requireActivity()); ActivityCompat.startPostponedEnterTransition(requireActivity());
}
return true; 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; 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.Attachment;
import app.fedilab.android.mastodon.client.entities.api.Status; 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.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.CrossActionHelper;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
@ -68,17 +72,37 @@ public class FragmentMediaProfile extends Fragment {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
Bundle bundle = this.getArguments();
if (bundle != null) { if (getArguments() != null) {
accountTimeline = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT); long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false); 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(); return binding.getRoot();
} }
@Override private void initializeAfterBundle(Bundle bundle) {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); 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; flagLoading = false;
accountsVM = new ViewModelProvider(requireActivity()).get(AccountsVM.class); accountsVM = new ViewModelProvider(requireActivity()).get(AccountsVM.class);
mediaStatuses = new ArrayList<>(); 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())) accountsVM.getAccountStatuses(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountTimeline.id, null, null, null, null, null, true, false, MastodonHelper.statusesPerCall(requireActivity()))
.observe(getViewLifecycleOwner(), this::initializeStatusesCommonView); .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 android.os.Bundle;
import androidx.preference.EditTextPreference; import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.MultiSelectListPreference; import androidx.preference.MultiSelectListPreference;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
@ -30,6 +31,7 @@ import java.util.Set;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.mastodon.client.entities.app.Languages; import app.fedilab.android.mastodon.client.entities.app.Languages;
import app.fedilab.android.mastodon.helper.Helper;
public class FragmentComposeSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { public class FragmentComposeSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -43,12 +45,21 @@ public class FragmentComposeSettings extends PreferenceFragmentCompat implements
private void createPref() { private void createPref() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); 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)); EditTextPreference SET_WATERMARK_TEXT = findPreference(getString(R.string.SET_WATERMARK_TEXT));
if (SET_WATERMARK_TEXT != null) { 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)); 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); SET_WATERMARK_TEXT.setText(val);
} }
MultiSelectListPreference SET_SELECTED_LANGUAGE = findPreference(getString(R.string.SET_SELECTED_LANGUAGE)); MultiSelectListPreference SET_SELECTED_LANGUAGE = findPreference(getString(R.string.SET_SELECTED_LANGUAGE));
if (SET_SELECTED_LANGUAGE != null) { if (SET_SELECTED_LANGUAGE != null) {

View File

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

View File

@ -63,13 +63,21 @@ public class FragmentHomeCacheSettings extends PreferenceFragmentCompat implemen
return; return;
} }
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); 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)); SwitchPreference SET_FETCH_HOME = findPreference(getString(R.string.SET_FETCH_HOME));
if (SET_FETCH_HOME != null) { if (SET_FETCH_HOME != null) {
boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_FETCH_HOME) + MainActivity.currentUserID + MainActivity.currentInstance, false); boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_FETCH_HOME) + MainActivity.currentUserID + MainActivity.currentInstance, false);
SET_FETCH_HOME.setChecked(checked); 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) { if (SET_FETCH_HOME_DELAY_VALUE != null) {
String timeRefresh = sharedpreferences.getString(getString(R.string.SET_FETCH_HOME_DELAY_VALUE) + MainActivity.currentUserID + MainActivity.currentInstance, "60"); String timeRefresh = sharedpreferences.getString(getString(R.string.SET_FETCH_HOME_DELAY_VALUE) + MainActivity.currentUserID + MainActivity.currentInstance, "60");
SET_FETCH_HOME_DELAY_VALUE.setValue(timeRefresh); 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.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.ImageListPreference;
import app.fedilab.android.mastodon.helper.LogoHelper; import app.fedilab.android.mastodon.helper.LogoHelper;
import es.dmoral.toasty.Toasty; 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(); Toasty.error(requireActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
return; 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)); SeekBarPreference SET_FONT_SCALE = findPreference(getString(R.string.SET_FONT_SCALE_INT));
if (SET_FONT_SCALE != null) { if (SET_FONT_SCALE != null) {
SET_FONT_SCALE.setMax(180); 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.setMax(180);
SET_FONT_SCALE_ICON.setMin(80); SET_FONT_SCALE_ICON.setMin(80);
} }
ListPreference SET_LOGO_LAUNCHER = findPreference(getString(R.string.SET_LOGO_LAUNCHER));
if (SET_LOGO_LAUNCHER != null) { if (SET_LOGO_LAUNCHER != null) {
SET_LOGO_LAUNCHER.setIcon(LogoHelper.getDrawable(SET_LOGO_LAUNCHER.getValue())); 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); editor.putString(getString(R.string.SET_LOGO_LAUNCHER), newLauncher);
} }
} }
if (key.compareToIgnoreCase(getString(R.string.SET_DISABLE_TOPBAR_SCROLLING)) == 0) {
recreate = true;
}
editor.apply(); editor.apply();
} }
} }

View File

@ -18,6 +18,7 @@ import android.annotation.SuppressLint;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import androidx.preference.ListPreference;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
@ -37,6 +38,14 @@ public class FragmentLanguageSettings extends PreferenceFragmentCompat implement
private void createPref() { private void createPref() {
Preference SET_TRANSLATE_VALUES_RESET = findPreference(getString(R.string.SET_TRANSLATE_VALUES_RESET)); Preference SET_TRANSLATE_VALUES_RESET = findPreference(getString(R.string.SET_TRANSLATE_VALUES_RESET));
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); 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) { if (SET_TRANSLATE_VALUES_RESET != null) {
SET_TRANSLATE_VALUES_RESET.setOnPreferenceClickListener(preference -> { SET_TRANSLATE_VALUES_RESET.setOnPreferenceClickListener(preference -> {
SharedPreferences.Editor editor = sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit();

View File

@ -40,6 +40,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import app.fedilab.android.R; 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.PushHelper;
import app.fedilab.android.mastodon.helper.settings.TimePreference; import app.fedilab.android.mastodon.helper.settings.TimePreference;
import app.fedilab.android.mastodon.helper.settings.TimePreferenceDialogFragment; import app.fedilab.android.mastodon.helper.settings.TimePreferenceDialogFragment;
@ -76,13 +77,37 @@ public class FragmentNotificationsSettings extends PreferenceFragmentCompat impl
getPreferenceScreen().removeAll(); getPreferenceScreen().removeAll();
addPreferencesFromResource(R.xml.pref_notifications); addPreferencesFromResource(R.xml.pref_notifications);
PreferenceScreen preferenceScreen = getPreferenceScreen(); 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) { if (preferenceScreen == null) {
Toasty.error(requireActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); Toasty.error(requireActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
return; return;
} }
ListPreference SET_NOTIFICATION_TYPE = findPreference(getString(R.string.SET_NOTIFICATION_TYPE));
String[] notificationValues = getResources().getStringArray(R.array.SET_NOTIFICATION_TYPE_VALUE); String[] notificationValues = getResources().getStringArray(R.array.SET_NOTIFICATION_TYPE_VALUE);
if (SET_NOTIFICATION_TYPE != null && SET_NOTIFICATION_TYPE.getValue().equals(notificationValues[2])) { if (SET_NOTIFICATION_TYPE != null && SET_NOTIFICATION_TYPE.getValue().equals(notificationValues[2])) {
PreferenceCategory notification_sounds = findPreference("notification_sounds"); PreferenceCategory notification_sounds = findPreference("notification_sounds");
@ -97,26 +122,21 @@ public class FragmentNotificationsSettings extends PreferenceFragmentCompat impl
if (notification_time_slot != null) { if (notification_time_slot != null) {
preferenceScreen.removePreference(notification_time_slot); preferenceScreen.removePreference(notification_time_slot);
} }
ListPreference SET_NOTIFICATION_DELAY_VALUE = findPreference("SET_NOTIFICATION_DELAY_VALUE");
if (SET_NOTIFICATION_DELAY_VALUE != null) { if (SET_NOTIFICATION_DELAY_VALUE != null) {
preferenceScreen.removePreferenceRecursively("SET_NOTIFICATION_DELAY_VALUE"); preferenceScreen.removePreferenceRecursively("SET_NOTIFICATION_DELAY_VALUE");
} }
ListPreference SET_PUSH_DISTRIBUTOR = findPreference("SET_PUSH_DISTRIBUTOR");
if (SET_PUSH_DISTRIBUTOR != null) { if (SET_PUSH_DISTRIBUTOR != null) {
preferenceScreen.removePreferenceRecursively("SET_PUSH_DISTRIBUTOR"); preferenceScreen.removePreferenceRecursively("SET_PUSH_DISTRIBUTOR");
} }
return; return;
} else if (SET_NOTIFICATION_TYPE != null && SET_NOTIFICATION_TYPE.getValue().equals(notificationValues[1])) { } 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) { if (SET_PUSH_DISTRIBUTOR != null) {
preferenceScreen.removePreferenceRecursively("SET_PUSH_DISTRIBUTOR"); preferenceScreen.removePreferenceRecursively("SET_PUSH_DISTRIBUTOR");
} }
} else { } else {
ListPreference SET_NOTIFICATION_DELAY_VALUE = findPreference("SET_NOTIFICATION_DELAY_VALUE");
if (SET_NOTIFICATION_DELAY_VALUE != null) { if (SET_NOTIFICATION_DELAY_VALUE != null) {
preferenceScreen.removePreferenceRecursively("SET_NOTIFICATION_DELAY_VALUE"); preferenceScreen.removePreferenceRecursively("SET_NOTIFICATION_DELAY_VALUE");
} }
ListPreference SET_PUSH_DISTRIBUTOR = findPreference(getString(R.string.SET_PUSH_DISTRIBUTOR));
if (SET_PUSH_DISTRIBUTOR != null) { if (SET_PUSH_DISTRIBUTOR != null) {
List<String> distributors = UnifiedPush.getDistributors(requireActivity(), new ArrayList<>()); List<String> distributors = UnifiedPush.getDistributors(requireActivity(), new ArrayList<>());
SET_PUSH_DISTRIBUTOR.setValue(UnifiedPush.getDistributor(requireActivity())); 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(); Toasty.error(requireActivity(), getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
} }
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); 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_DYNAMIC_COLOR = findPreference(getString(R.string.SET_DYNAMICCOLOR));
SwitchPreferenceCompat SET_CUSTOM_ACCENT = findPreference(getString(R.string.SET_CUSTOM_ACCENT)); 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)); 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 { public class FragmentTimelinesSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
boolean recreate; boolean recreate;
@Override @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.pref_timelines); 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 = findPreference(getString(R.string.SET_TRANSLATOR));
ListPreference SET_TRANSLATOR_VERSION = findPreference(getString(R.string.SET_TRANSLATOR_VERSION)); 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_API_KEY = findPreference(getString(R.string.SET_TRANSLATOR_API_KEY));
EditTextPreference SET_TRANSLATOR_DOMAIN = findPreference(getString(R.string.SET_TRANSLATOR_DOMAIN)); EditTextPreference SET_TRANSLATOR_DOMAIN = findPreference(getString(R.string.SET_TRANSLATOR_DOMAIN));
if (SET_TRANSLATOR != null && !SET_TRANSLATOR.getValue().equals("DEEPL")) { 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>. */ * 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.currentInstance;
import static app.fedilab.android.BaseMainActivity.currentToken; import static app.fedilab.android.BaseMainActivity.currentToken;
import static app.fedilab.android.mastodon.helper.MastodonHelper.ACCOUNTS_PER_CALL; 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.BaseMainActivity;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.databinding.FragmentPaginationBinding;
import app.fedilab.android.mastodon.activities.SearchResultTabActivity; import app.fedilab.android.mastodon.activities.SearchResultTabActivity;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.Accounts;
import app.fedilab.android.mastodon.client.entities.api.Pagination; 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.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.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.MastodonHelper; import app.fedilab.android.mastodon.helper.MastodonHelper;
import app.fedilab.android.mastodon.ui.drawer.AccountAdapter; import app.fedilab.android.mastodon.ui.drawer.AccountAdapter;
@ -77,19 +79,49 @@ public class FragmentMastodonAccount extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { 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; instance = currentInstance;
token = currentToken; 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) { if (checkRemotely) {
String[] acctArray = accountTimeline.acct.split("@"); String[] acctArray = accountTimeline.acct.split("@");
if (acctArray.length > 1) { if (acctArray.length > 1) {
@ -102,20 +134,6 @@ public class FragmentMastodonAccount extends Fragment {
token = currentToken; 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); accountsVM = new ViewModelProvider(FragmentMastodonAccount.this).get(viewModelKey, AccountsVM.class);
max_id = null; max_id = null;
offset = 0; offset = 0;
@ -126,6 +144,14 @@ public class FragmentMastodonAccount extends Fragment {
router(true); 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 * Router for timelines
*/ */
@ -206,7 +232,7 @@ public class FragmentMastodonAccount extends Fragment {
} }
} else if (timelineType == Timeline.TimeLineEnum.MUTED_TIMELINE_HOME) { } else if (timelineType == Timeline.TimeLineEnum.MUTED_TIMELINE_HOME) {
if (firstLoad) { if (firstLoad) {
accountsVM.getMutedHome(MainActivity.currentAccount) accountsVM.getMutedHome(currentAccount)
.observe(getViewLifecycleOwner(), this::initializeAccountCommonView); .observe(getViewLifecycleOwner(), this::initializeAccountCommonView);
} }
} else if (timelineType == Timeline.TimeLineEnum.BLOCKED_TIMELINE) { } 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * 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.displayCW;
import static app.fedilab.android.mastodon.activities.ContextActivity.expand; import static app.fedilab.android.mastodon.activities.ContextActivity.expand;
@ -21,7 +22,6 @@ import android.content.BroadcastReceiver;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -31,7 +31,6 @@ import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; 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.activities.ContextActivity;
import app.fedilab.android.mastodon.client.entities.api.Context; 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.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.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.DividerDecoration; import app.fedilab.android.mastodon.helper.DividerDecoration;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
@ -59,18 +59,19 @@ public class FragmentMastodonContext extends Fragment {
private StatusesVM statusesVM; private StatusesVM statusesVM;
private List<Status> statuses; private List<Status> statuses;
private StatusAdapter statusAdapter; private StatusAdapter statusAdapter;
private boolean refresh;
//Handle actions that can be done in other fragments //Handle actions that can be done in other fragments
private final BroadcastReceiver receive_action = new BroadcastReceiver() { private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override @Override
public void onReceive(android.content.Context context, Intent intent) { public void onReceive(android.content.Context context, Intent intent) {
Bundle b = intent.getExtras(); Bundle args = intent.getExtras();
if (b != null) { if (args != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION); long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
Status status_to_delete = (Status) b.getSerializable(Helper.ARG_STATUS_DELETED); Status receivedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS_ACTION);
Status statusPosted = (Status) b.getSerializable(Helper.ARG_STATUS_POSTED); String delete_statuses_for_user = bundle.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);
Status status_to_update = (Status) b.getSerializable(Helper.ARG_STATUS_UPDATED); 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) { if (receivedStatus != null && statusAdapter != null) {
int position = getPosition(receivedStatus); int position = getPosition(receivedStatus);
if (position >= 0) { if (position >= 0) {
@ -125,9 +126,12 @@ public class FragmentMastodonContext extends Fragment {
} }
} }
} }
});
} }
} }
}; };
private boolean refresh;
private Status focusedStatus; private Status focusedStatus;
private String remote_instance, focusedStatusURI; private String remote_instance, focusedStatusURI;
private Status firstStatus; private Status firstStatus;
@ -160,10 +164,21 @@ public class FragmentMastodonContext extends Fragment {
pullToRefresh = false; pullToRefresh = false;
focusedStatusURI = null; focusedStatusURI = null;
refresh = true; refresh = true;
binding = FragmentPaginationBinding.inflate(inflater, container, false);
if (getArguments() != null) { if (getArguments() != null) {
focusedStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS); long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
remote_instance = getArguments().getString(Helper.ARG_REMOTE_INSTANCE, null); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
focusedStatusURI = getArguments().getString(Helper.ARG_FOCUSED_STATUS_URI, null); } 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) { if (remote_instance != null) {
user_instance = remote_instance; user_instance = remote_instance;
@ -176,7 +191,7 @@ public class FragmentMastodonContext extends Fragment {
getChildFragmentManager().beginTransaction().remove(this).commit(); getChildFragmentManager().beginTransaction().remove(this).commit();
} }
binding = FragmentPaginationBinding.inflate(inflater, container, false);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); 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); ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED);
return binding.getRoot();
} }
public void refresh() { public void refresh() {
if (statuses != null) { if (statuses != null) {
for (Status status : statuses) { for (Status status : statuses) {

View File

@ -50,7 +50,6 @@ import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.work.Data; 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.Mention;
import app.fedilab.android.mastodon.client.entities.api.Poll; 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.Status;
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
import app.fedilab.android.mastodon.client.entities.app.StatusDraft; import app.fedilab.android.mastodon.client.entities.app.StatusDraft;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
@ -112,17 +112,19 @@ public class FragmentMastodonDirectMessage extends Fragment {
private final BroadcastReceiver broadcast_data = new BroadcastReceiver() { private final BroadcastReceiver broadcast_data = new BroadcastReceiver() {
@Override @Override
public void onReceive(android.content.Context context, Intent intent) { public void onReceive(android.content.Context context, Intent intent) {
Bundle b = intent.getExtras(); Bundle args = intent.getExtras();
if (b != null) { if (args != null) {
long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
if (b.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) { new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
Status statusReceived = (Status) b.getSerializable(Helper.RECEIVE_STATUS_ACTION); if (bundle.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) {
Status statusReceived = (Status) bundle.getSerializable(Helper.RECEIVE_STATUS_ACTION);
if (statusReceived != null) { if (statusReceived != null) {
statuses.add(statusReceived); statuses.add(statusReceived);
statusDirectMessageAdapter.notifyItemInserted(statuses.size() - 1); statusDirectMessageAdapter.notifyItemInserted(statuses.size() - 1);
initiliazeStatus(); initiliazeStatus();
} }
} }
});
} }
} }
}; };
@ -132,8 +134,21 @@ public class FragmentMastodonDirectMessage extends Fragment {
focusedStatus = null; focusedStatus = null;
pullToRefresh = false; pullToRefresh = false;
binding = FragmentDirectMessageBinding.inflate(inflater, container, false);
if (getArguments() != null) { 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_instance = MainActivity.currentInstance;
user_token = MainActivity.currentToken; user_token = MainActivity.currentToken;
@ -141,7 +156,7 @@ public class FragmentMastodonDirectMessage extends Fragment {
if (focusedStatus == null) { if (focusedStatus == null) {
getChildFragmentManager().beginTransaction().remove(this).commit(); getChildFragmentManager().beginTransaction().remove(this).commit();
} }
binding = FragmentDirectMessageBinding.inflate(inflater, container, false);
statusesVM = new ViewModelProvider(FragmentMastodonDirectMessage.this).get(StatusesVM.class); statusesVM = new ViewModelProvider(FragmentMastodonDirectMessage.this).get(StatusesVM.class);
binding.recyclerView.setNestedScrollingEnabled(true); binding.recyclerView.setNestedScrollingEnabled(true);
this.statuses = new ArrayList<>(); this.statuses = new ArrayList<>();
@ -217,10 +232,8 @@ public class FragmentMastodonDirectMessage extends Fragment {
} }
}); });
return binding.getRoot();
} }
private void onSubmit(StatusDraft statusDraft) { private void onSubmit(StatusDraft statusDraft) {
new Thread(() -> { new Thread(() -> {
if (statusDraft.instance == null) { 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -31,7 +32,6 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; 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.Notification;
import app.fedilab.android.mastodon.client.entities.api.Notifications; 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.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.StatusCache;
import app.fedilab.android.mastodon.client.entities.app.Timeline; import app.fedilab.android.mastodon.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException; 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() { private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras(); Bundle args = intent.getExtras();
if (b != null) { if (args != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION); long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
String delete_all_for_account_id = b.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
boolean refreshNotifications = b.getBoolean(Helper.ARG_REFRESH_NOTFICATION, false); 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) { if (refreshNotifications) {
scrollToTop(); scrollToTop();
} else if (receivedStatus != null && notificationAdapter != null) { } 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())); Collections.sort(tags, (obj1, obj2) -> Integer.compare(obj2.getWeight(), obj1.getWeight()));
boolean isInCollection = false; boolean isInCollection = false;
for (Tag tag : tags) { for (Tag tag : tags) {
if (tag.name.compareToIgnoreCase(search) == 0) { if (tag.name.trim().compareToIgnoreCase(search.trim()) == 0) {
isInCollection = true; isInCollection = true;
break; break;
} }

View File

@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.fragment.timeline;
* see <http://www.gnu.org/licenses>. */ * 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.currentInstance;
import static app.fedilab.android.BaseMainActivity.networkAvailable; import static app.fedilab.android.BaseMainActivity.networkAvailable;
@ -35,7 +36,6 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; 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.Status;
import app.fedilab.android.mastodon.client.entities.api.Statuses; 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.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.PinnedTimeline;
import app.fedilab.android.mastodon.client.entities.app.RemoteInstance; 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.TagTimeline;
import app.fedilab.android.mastodon.client.entities.app.Timeline; 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.CrossActionHelper;
import app.fedilab.android.mastodon.helper.GlideApp; import app.fedilab.android.mastodon.helper.GlideApp;
import app.fedilab.android.mastodon.helper.Helper; 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() { private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras(); Bundle args = intent.getExtras();
if (b != null) { if (args != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION); long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, bundle -> {
String delete_all_for_account_id = b.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID); Status receivedStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS_ACTION);
Status status_to_delete = (Status) b.getSerializable(Helper.ARG_STATUS_DELETED); String delete_statuses_for_user = bundle.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);
Status status_to_update = (Status) b.getSerializable(Helper.ARG_STATUS_UPDATED); String delete_all_for_account_id = bundle.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID);
Status statusPosted = (Status) b.getSerializable(Helper.ARG_STATUS_DELETED); Status status_to_delete = (Status) bundle.getSerializable(Helper.ARG_STATUS_DELETED);
boolean refreshAll = b.getBoolean(Helper.ARG_TIMELINE_REFRESH_ALL, false); 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) { if (receivedStatus != null && statusAdapter != null) {
int position = getPosition(receivedStatus); int position = getPosition(receivedStatus);
if (position >= 0) { if (position >= 0) {
@ -174,6 +178,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} else if (refreshAll) { } else if (refreshAll) {
refreshAllAdapters(); refreshAllAdapters();
} }
});
} }
} }
}; };
@ -346,29 +351,12 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, 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.loader.setVisibility(View.VISIBLE);
binding.recyclerView.setVisibility(View.GONE); 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) { if (search != null) {
binding.swipeContainer.setRefreshing(false); binding.swipeContainer.setRefreshing(false);
binding.swipeContainer.setEnabled(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 @Override
@ -378,16 +366,36 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
timelineType = Timeline.TimeLineEnum.HOME; timelineType = Timeline.TimeLineEnum.HOME;
canBeFederated = true; binding = FragmentPaginationBinding.inflate(inflater, container, false);
retry_for_home_done = false;
if (getArguments() != null) { if (getArguments() != null) {
timelineType = (Timeline.TimeLineEnum) getArguments().get(Helper.ARG_TIMELINE_TYPE); long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
lemmy_post_id = getArguments().getString(Helper.ARG_LEMMY_POST_ID, null); if (bundleId != -1) {
list_id = getArguments().getString(Helper.ARG_LIST_ID, null); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
search = getArguments().getString(Helper.ARG_SEARCH_KEYWORD, null); } else {
searchCache = getArguments().getString(Helper.ARG_SEARCH_KEYWORD_CACHE, null); if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
pinnedTimeline = (PinnedTimeline) getArguments().getSerializable(Helper.ARG_REMOTE_INSTANCE); 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 != null && pinnedTimeline.remoteInstance != null) {
if (pinnedTimeline.remoteInstance.type != RemoteInstance.InstanceType.NITTER) { if (pinnedTimeline.remoteInstance.type != RemoteInstance.InstanceType.NITTER) {
remoteInstance = pinnedTimeline.remoteInstance.host; remoteInstance = pinnedTimeline.remoteInstance.host;
@ -400,24 +408,24 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
if (timelineType == Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC) { if (timelineType == Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC) {
canBeFederated = false; canBeFederated = false;
} }
publicTrendsDomain = getArguments().getString(Helper.ARG_REMOTE_INSTANCE_STRING, null); publicTrendsDomain = bundle.getString(Helper.ARG_REMOTE_INSTANCE_STRING, null);
isViewInitialized = getArguments().getBoolean(Helper.ARG_INITIALIZE_VIEW, true); isViewInitialized = bundle.getBoolean(Helper.ARG_INITIALIZE_VIEW, true);
isNotPinnedTimeline = isViewInitialized; isNotPinnedTimeline = isViewInitialized;
tagTimeline = (TagTimeline) getArguments().getSerializable(Helper.ARG_TAG_TIMELINE); tagTimeline = (TagTimeline) bundle.getSerializable(Helper.ARG_TAG_TIMELINE);
bubbleTimeline = (BubbleTimeline) getArguments().getSerializable(Helper.ARG_BUBBLE_TIMELINE); bubbleTimeline = (BubbleTimeline) bundle.getSerializable(Helper.ARG_BUBBLE_TIMELINE);
accountTimeline = (Account) getArguments().getSerializable(Helper.ARG_ACCOUNT); if (bundle.containsKey(Helper.ARG_ACCOUNT)) {
exclude_replies = !getArguments().getBoolean(Helper.ARG_SHOW_REPLIES, true); accountTimeline = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false); }
show_pinned = getArguments().getBoolean(Helper.ARG_SHOW_PINNED, false); exclude_replies = !bundle.getBoolean(Helper.ARG_SHOW_REPLIES, true);
exclude_reblogs = !getArguments().getBoolean(Helper.ARG_SHOW_REBLOGS, true); checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
media_only = getArguments().getBoolean(Helper.ARG_SHOW_MEDIA_ONY, false); show_pinned = bundle.getBoolean(Helper.ARG_SHOW_PINNED, false);
viewModelKey = getArguments().getString(Helper.ARG_VIEW_MODEL_KEY, ""); exclude_reblogs = !bundle.getBoolean(Helper.ARG_SHOW_REBLOGS, true);
minified = getArguments().getBoolean(Helper.ARG_MINIFIED, false); media_only = bundle.getBoolean(Helper.ARG_SHOW_MEDIA_ONY, false);
statusReport = (Status) getArguments().getSerializable(Helper.ARG_STATUS_REPORT); viewModelKey = bundle.getString(Helper.ARG_VIEW_MODEL_KEY, "");
initialStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS); 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 //When visiting a profile without being authenticated
if (checkRemotely) { if (checkRemotely) {
String[] acctArray = accountTimeline.acct.split("@"); 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 : ""); 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); canBeFederated = true;
binding = FragmentPaginationBinding.inflate(inflater, container, false); retry_for_home_done = false;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); 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("\\|"); String[] categoriesArray = excludedCategories.split("\\|");
for (String category : categoriesArray) { for (String category : categoriesArray) {
switch (category) { switch (category) {
case "mention": case "mention" -> {
excludedCategoriesList.add("mention"); excludedCategoriesList.add("mention");
dialogView.displayMentions.setChecked(false); dialogView.displayMentions.setChecked(false);
break; }
case "favourite": case "favourite" -> {
excludedCategoriesList.add("favourite"); excludedCategoriesList.add("favourite");
dialogView.displayFavourites.setChecked(false); dialogView.displayFavourites.setChecked(false);
break; }
case "reblog": case "reblog" -> {
excludedCategoriesList.add("reblog"); excludedCategoriesList.add("reblog");
dialogView.displayReblogs.setChecked(false); dialogView.displayReblogs.setChecked(false);
break; }
case "poll": case "poll" -> {
excludedCategoriesList.add("poll"); excludedCategoriesList.add("poll");
dialogView.displayPollResults.setChecked(false); dialogView.displayPollResults.setChecked(false);
break; }
case "status": case "status" -> {
excludedCategoriesList.add("status"); excludedCategoriesList.add("status");
dialogView.displayUpdatesFromPeople.setChecked(false); dialogView.displayUpdatesFromPeople.setChecked(false);
break; }
case "follow": case "follow" -> {
excludedCategoriesList.add("follow"); excludedCategoriesList.add("follow");
dialogView.displayFollows.setChecked(false); dialogView.displayFollows.setChecked(false);
break; }
case "update": case "update" -> {
excludedCategoriesList.add("update"); excludedCategoriesList.add("update");
dialogView.displayUpdates.setChecked(false); dialogView.displayUpdates.setChecked(false);
break; }
case "admin.sign_up": case "admin.sign_up" -> {
excludedCategoriesList.add("admin.sign_up"); excludedCategoriesList.add("admin.sign_up");
dialogView.displaySignups.setChecked(false); dialogView.displaySignups.setChecked(false);
break; }
case "admin.report": case "admin.report" -> {
excludedCategoriesList.add("admin.report"); excludedCategoriesList.add("admin.report");
dialogView.displayReports.setChecked(false); dialogView.displayReports.setChecked(false);
break; }
} }
} }
} }
@ -224,8 +224,7 @@ public class FragmentNotificationContainer extends Fragment {
Fragment fragment; Fragment fragment;
if (binding.viewpagerNotificationContainer.getAdapter() != null) { if (binding.viewpagerNotificationContainer.getAdapter() != null) {
fragment = (Fragment) binding.viewpagerNotificationContainer.getAdapter().instantiateItem(binding.viewpagerNotificationContainer, tab.getPosition()); fragment = (Fragment) binding.viewpagerNotificationContainer.getAdapter().instantiateItem(binding.viewpagerNotificationContainer, tab.getPosition());
if (fragment instanceof FragmentMastodonNotification) { if (fragment instanceof FragmentMastodonNotification fragmentMastodonNotification) {
FragmentMastodonNotification fragmentMastodonNotification = ((FragmentMastodonNotification) fragment);
fragmentMastodonNotification.scrollToTop(); 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -33,7 +35,9 @@ import com.google.android.material.tabs.TabLayout;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.FragmentProfileTimelinesBinding; import app.fedilab.android.databinding.FragmentProfileTimelinesBinding;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.client.entities.app.Timeline;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.pageadapter.FedilabProfilePageAdapter; import app.fedilab.android.mastodon.ui.pageadapter.FedilabProfilePageAdapter;
@ -46,19 +50,22 @@ public class FragmentProfileTimeline extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { 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); 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(); return binding.getRoot();
} }
@Override private void initializeAfterBundle() {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.tabLayout.addTab(binding.tabLayout.newTab().setText(getString(R.string.toots))); 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.replies)));
binding.tabLayout.addTab(binding.tabLayout.newTab().setText(getString(R.string.media))); 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) { public void onTabReselected(TabLayout.Tab tab) {
if (binding.viewpager.getAdapter() != null && binding.viewpager if (binding.viewpager.getAdapter() != null && binding.viewpager
.getAdapter() .getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline) { .instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline fragmentMastodonTimeline) {
FragmentMastodonTimeline fragmentMastodonTimeline = (FragmentMastodonTimeline) binding.viewpager
.getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem());
fragmentMastodonTimeline.goTop(); fragmentMastodonTimeline.goTop();
} }
} }
@ -105,24 +109,25 @@ public class FragmentProfileTimeline extends Fragment {
popup.setOnDismissListener(menu1 -> { popup.setOnDismissListener(menu1 -> {
if (binding.viewpager.getAdapter() != null && binding.viewpager if (binding.viewpager.getAdapter() != null && binding.viewpager
.getAdapter() .getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline) { .instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem()) instanceof FragmentMastodonTimeline fragmentMastodonTimeline) {
FragmentMastodonTimeline fragmentMastodonTimeline = (FragmentMastodonTimeline) binding.viewpager
.getAdapter()
.instantiateItem(binding.viewpager, binding.viewpager.getCurrentItem());
FragmentTransaction fragTransaction = getChildFragmentManager().beginTransaction(); FragmentTransaction fragTransaction = getChildFragmentManager().beginTransaction();
fragTransaction.detach(fragmentMastodonTimeline).commit(); 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 bundle = new Bundle();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE); bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
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);
fragmentMastodonTimeline.setArguments(bundle); fragmentMastodonTimeline.setArguments(bundle);
FragmentTransaction fragTransaction2 = getChildFragmentManager().beginTransaction(); FragmentTransaction fragTransaction2 = getChildFragmentManager().beginTransaction();
fragTransaction2.attach(fragmentMastodonTimeline); fragTransaction2.attach(fragmentMastodonTimeline);
fragTransaction2.commit(); fragTransaction2.commit();
fragmentMastodonTimeline.recreate(); 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(); FragmentMastodonNotification fragmentMastodonNotification = new FragmentMastodonNotification();
if (!extended) { if (!extended) {
switch (position) { switch (position) {
case 0: case 0 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL);
break; case 1 ->
case 1:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS);
break;
} }
} else { } else {
switch (position) { switch (position) {
case 0: case 0 ->
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ALL);
break; case 1 ->
case 1:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.MENTIONS);
break; case 2 ->
case 2:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FAVOURITES); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FAVOURITES);
break; case 3 ->
case 3:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.REBLOGS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.REBLOGS);
break; case 4 ->
case 4:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.POLLS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.POLLS);
break; case 5 ->
case 5:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.TOOTS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.TOOTS);
break; case 6 ->
case 6:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FOLLOWS); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.FOLLOWS);
break; case 7 ->
case 7:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.UPDATES); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.UPDATES);
break; case 8 ->
case 8:
bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_SIGNUP); 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); bundle.putSerializable(Helper.ARG_NOTIFICATION_TYPE, FragmentMastodonNotification.NotificationTypeEnum.ADMIN_REPORT);
break;
} }
} }
fragmentMastodonNotification.setArguments(bundle); fragmentMastodonNotification.setArguments(bundle);

View File

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

View File

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

View File

@ -52,13 +52,11 @@ public class FedilabScheduledPageAdapter extends FragmentStatePagerAdapter {
bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position); bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position);
FragmentScheduled fragmentScheduled = new FragmentScheduled(); FragmentScheduled fragmentScheduled = new FragmentScheduled();
switch (position) { switch (position) {
case 1: case 1 ->
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_CLIENT); 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); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_BOOST);
break; default ->
default:
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_SERVER); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.SCHEDULED_TOOT_SERVER);
} }
fragmentScheduled.setArguments(bundle); 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, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.app.Application; import android.app.Application;
import android.net.Uri; import android.net.Uri;
import android.os.Handler; import android.os.Handler;
@ -30,6 +32,7 @@ import java.util.List;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; 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.endpoints.MastodonAccountsService;
import app.fedilab.android.mastodon.client.entities.api.Account; 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.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.Tag;
import app.fedilab.android.mastodon.client.entities.api.Token; 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.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.MutedAccounts;
import app.fedilab.android.mastodon.client.entities.app.StatusCache; import app.fedilab.android.mastodon.client.entities.app.StatusCache;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
@ -342,6 +346,7 @@ public class AccountsVM extends AndroidViewModel {
Response<Account> accountResponse = accountCall.execute(); Response<Account> accountResponse = accountCall.execute();
if (accountResponse.isSuccessful()) { if (accountResponse.isSuccessful()) {
account = accountResponse.body(); account = accountResponse.body();
new CachedBundle(getApplication().getApplicationContext()).insertAccountBundle(account, currentAccount);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -1073,6 +1078,9 @@ public class AccountsVM extends AndroidViewModel {
Response<List<Account>> searchResponse = searchCall.execute(); Response<List<Account>> searchResponse = searchCall.execute();
if (searchResponse.isSuccessful()) { if (searchResponse.isSuccessful()) {
accountList = searchResponse.body(); accountList = searchResponse.body();
if(accountList != null && accountList.size() > 0 ) {
new CachedBundle(getApplication().getApplicationContext()).insertAccountBundle(accountList.get(0), currentAccount);
}
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class Sqlite extends 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"; public static final String DB_NAME = "fedilab_db";
//Table of owned accounts //Table of owned accounts
@ -105,6 +105,10 @@ public class Sqlite extends SQLiteOpenHelper {
public static final String COL_TAG = "TAG"; public static final String COL_TAG = "TAG";
public static final String TABLE_TIMELINE_CACHE_LOGS = "TIMELINE_CACHE_LOGS"; 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 + " (" 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_TYPE + " TEXT NOT NULL, "
+ COL_CREATED_AT + " 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) { public Sqlite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, 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_STORED_INSTANCES);
db.execSQL(CREATE_TABLE_CACHE_TAGS); db.execSQL(CREATE_TABLE_CACHE_TAGS);
db.execSQL(CREATE_TABLE_TIMELINE_CACHE_LOGS); db.execSQL(CREATE_TABLE_TIMELINE_CACHE_LOGS);
db.execSQL(CREATE_TABLE_INTENT);
} }
@Override @Override
@ -295,6 +310,8 @@ public class Sqlite extends SQLiteOpenHelper {
db.execSQL(CREATE_TABLE_CACHE_TAGS); db.execSQL(CREATE_TABLE_CACHE_TAGS);
case 10: case 10:
db.execSQL(CREATE_TABLE_TIMELINE_CACHE_LOGS); db.execSQL(CREATE_TABLE_TIMELINE_CACHE_LOGS);
case 11:
db.execSQL(CREATE_TABLE_INTENT);
default: default:
break; break;
} }

View File

@ -15,6 +15,8 @@ package app.fedilab.android.ui.fragment;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -32,6 +34,7 @@ import java.util.List;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.FragmentLoginPickInstanceMastodonBinding; import app.fedilab.android.databinding.FragmentLoginPickInstanceMastodonBinding;
import app.fedilab.android.mastodon.client.entities.api.JoinMastodonInstance; 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.client.entities.app.Timeline;
import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.ui.drawer.InstanceRegAdapter; import app.fedilab.android.mastodon.ui.drawer.InstanceRegAdapter;
@ -145,10 +148,13 @@ public class FragmentLoginPickInstanceMastodon extends Fragment implements Insta
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putSerializable(Helper.ARG_REMOTE_INSTANCE_STRING, clickedInstance.domain); args.putSerializable(Helper.ARG_REMOTE_INSTANCE_STRING, clickedInstance.domain);
args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC); 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( Helper.addFragment(
getParentFragmentManager(), android.R.id.content, new FragmentMastodonTimeline(), 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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabGravity="fill" app:tabGravity="fill"
app:tabMode="scrollable" /> app:tabMode="auto" />
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/search_viewpager" android:id="@+id/search_viewpager"

View File

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

View File

@ -43,8 +43,8 @@
<string name="favourite">المفضلة</string> <string name="favourite">المفضلة</string>
<string name="follow">متابِعون جدد</string> <string name="follow">متابِعون جدد</string>
<string name="mention">الإشارات</string> <string name="mention">الإشارات</string>
<string name="reblog">الترقيات</string> <string name="reblog">المعاد نشرها</string>
<string name="show_boosts">عرض الترقيات</string> <string name="show_boosts">عرض المعاد نشرها</string>
<string name="show_replies">عرض الردود</string> <string name="show_replies">عرض الردود</string>
<string name="action_open_in_web">افتح في المتصفح</string> <string name="action_open_in_web">افتح في المتصفح</string>
<string name="translate">ترجمة</string> <string name="translate">ترجمة</string>
@ -208,12 +208,12 @@
<string name="set_toots_page">عدد الرسائل التي يتم تحميلها كل مرة</string> <string name="set_toots_page">عدد الرسائل التي يتم تحميلها كل مرة</string>
<string name="set_disable_gif">تعطيل الصور الرمزية المتحركة</string> <string name="set_disable_gif">تعطيل الصور الرمزية المتحركة</string>
<string name="set_notif_follow">تنبيهي عندما يتبعني أحدهم</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_add">إخطاري عندما يُعجَب أحدهم بأحد منشوراتي</string>
<string name="set_notif_follow_mention">إخطاري عندما يُشار إليّ</string> <string name="set_notif_follow_mention">إخطاري عندما يُشار إليّ</string>
<string name="set_notif_follow_poll">أرسل إشعاراً عند انتهاء استطلاع الرأي</string> <string name="set_notif_follow_poll">أرسل إشعاراً عند انتهاء استطلاع الرأي</string>
<string name="set_notif_status">إشعار بالمشاركات الجديدة</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_share_validation_fav">عرض مربع حوار للتأكيد قبل إضافة أي تبويق إلى المفضلة</string>
<string name="set_notify">هل تود الإشعار؟</string> <string name="set_notify">هل تود الإشعار؟</string>
<string name="set_notif_silent">كتم الاشعارات</string> <string name="set_notif_silent">كتم الاشعارات</string>
@ -258,7 +258,7 @@
<string name="keywords_header_custom_sharing">الكلمات المفتاحية</string> <string name="keywords_header_custom_sharing">الكلمات المفتاحية</string>
<string name="keywords_hint_custom_sharing">الكلمات المفتاحية…</string> <string name="keywords_hint_custom_sharing">الكلمات المفتاحية…</string>
<!-- ACTIVITY CACHE --> <!-- ACTIVITY CACHE -->
<string name="v_public">العمومية</string> <string name="v_public">للعامة</string>
<string name="v_unlisted">غير المدرجة</string> <string name="v_unlisted">غير المدرجة</string>
<string name="v_private">الخاصة</string> <string name="v_private">الخاصة</string>
<string name="v_direct">المباشرة</string> <string name="v_direct">المباشرة</string>
@ -291,16 +291,16 @@
<string name="follow_instance">متابعة مثيل الخادم</string> <string name="follow_instance">متابعة مثيل الخادم</string>
<string name="toast_instance_already_added">إنّك مُتابِع لمثيل الخادم هذا!</string> <string name="toast_instance_already_added">إنّك مُتابِع لمثيل الخادم هذا!</string>
<string name="action_partnership">الشراكات</string> <string name="action_partnership">الشراكات</string>
<string name="hide_boost">إخفاء ترقيات %s</string> <string name="hide_boost">إخفاء المعاد نشرها مِن طرف %s</string>
<string name="endorse">أوصِ به على صفحتك</string> <string name="endorse">أوصِ به على صفحتك</string>
<string name="show_boost">إظهار ترقيات %s</string> <string name="show_boost">إظهار المعاد نشرها مِن %s</string>
<string name="unendorse">إلغاء التوصية مِن صفحتك</string> <string name="unendorse">إلغاء التوصية مِن صفحتك</string>
<string name="direct_message">رسالة مباشِرة</string> <string name="direct_message">رسالة مباشِرة</string>
<string name="filters">عوامل التصفية</string> <string name="filters">عوامل التصفية</string>
<string name="action_filters_empty_content">ليس هناك أي عامل تصفية بعدُ. يمكنك إنشاء واحد بالنقر على زر \"+\".</string> <string name="action_filters_empty_content">ليس هناك أي عامل تصفية بعدُ. يمكنك إنشاء واحد بالنقر على زر \"+\".</string>
<string name="filter_keyword">كلمة مفتاحية أو عبارة</string> <string name="filter_keyword">كلمة مفتاحية أو عبارة</string>
<string name="context_home">الخط الزمني الرئيسي</string> <string name="context_home">الخط الزمني الرئيسي</string>
<string name="context_public">الخطوط الزمنية العمومية</string> <string name="context_public">الخطوط الزمنية العامة</string>
<string name="context_notification">الإشعارات</string> <string name="context_notification">الإشعارات</string>
<string name="context_conversation">المحادثات</string> <string name="context_conversation">المحادثات</string>
<string name="filter_keyword_explanations">سوف يتم العثور عليه بغض النظر عن حالة الأحرف في النص أو حتى و إن كان في الرسالة تحذير عن المحتوى</string> <string name="filter_keyword_explanations">سوف يتم العثور عليه بغض النظر عن حالة الأحرف في النص أو حتى و إن كان في الرسالة تحذير عن المحتوى</string>
@ -316,7 +316,7 @@
<string name="action_list_add">لم تقم بعد بإنشاء قائمة. اضغط على زر \"+\" لإنشاء قائمة.</string> <string name="action_list_add">لم تقم بعد بإنشاء قائمة. اضغط على زر \"+\" لإنشاء قائمة.</string>
<string name="expand_image">توسيع الوسائط المخفية تلقائيًا</string> <string name="expand_image">توسيع الوسائط المخفية تلقائيًا</string>
<string name="channel_notif_follow">مُتابِع جديد</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_fav">مفضلة جديدة</string>
<string name="channel_notif_mention">إشارة جديدة</string> <string name="channel_notif_mention">إشارة جديدة</string>
<string name="channel_notif_poll">انتهى استطلاع الرأي</string> <string name="channel_notif_poll">انتهى استطلاع الرأي</string>
@ -340,9 +340,9 @@
<string name="display_toot_truncate">عرض المزيد</string> <string name="display_toot_truncate">عرض المزيد</string>
<string name="hide_toot_truncate">اعرض أقل</string> <string name="hide_toot_truncate">اعرض أقل</string>
<string name="tags_already_stored">الوسم موجود مِن قَبل!</string> <string name="tags_already_stored">الوسم موجود مِن قَبل!</string>
<string name="schedule_boost">برمجة الترقية</string> <string name="schedule_boost">برمجة إعادة نشر</string>
<string name="boost_scheduled">تمت برمجة الترقية!</string> <string name="boost_scheduled">تمت برمجة إعادة النشر!</string>
<string name="no_scheduled_boosts">ليس هناك أية برمجة للترقية للعرض!</string> <string name="no_scheduled_boosts">ليس هناك أية إعادة نشر للعرض!</string>
<string name="open_menu">فتح القائمة</string> <string name="open_menu">فتح القائمة</string>
<string name="profile_picture">الصورة الشخصية</string> <string name="profile_picture">الصورة الشخصية</string>
<string name="profile_banner">رأسية الصفحة الشخصية</string> <string name="profile_banner">رأسية الصفحة الشخصية</string>
@ -581,7 +581,7 @@
<string name="verified_by">تم التحقق منه عبر %1$s (%2$s)</string> <string name="verified_by">تم التحقق منه عبر %1$s (%2$s)</string>
<string name="action_disabled">الإجراء مُعطّل</string> <string name="action_disabled">الإجراء مُعطّل</string>
<string name="action_unfollow">إلغاء المتابعة</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="action_announcements">الإعلانات</string>
<string name="no_announcements">ليس هناك إعلانات!</string> <string name="no_announcements">ليس هناك إعلانات!</string>
<string name="add_reaction">إضافة ردة فعل</string> <string name="add_reaction">إضافة ردة فعل</string>
@ -699,7 +699,7 @@
<string name="add_field">إضافة حقل</string> <string name="add_field">إضافة حقل</string>
<string name="unlocked">غير مقفَل</string> <string name="unlocked">غير مقفَل</string>
<string name="locked">مُقفَل</string> <string name="locked">مُقفَل</string>
<string name="scheduled">مُبَرمَج</string> <string name="scheduled">المُبَرمَجة</string>
<string name="bottom_menu">القائمة الدنيا</string> <string name="bottom_menu">القائمة الدنيا</string>
<string name="action_lists_edit">تعديل القائمة</string> <string name="action_lists_edit">تعديل القائمة</string>
<string name="select_a_theme">اختر حُلة</string> <string name="select_a_theme">اختر حُلة</string>
@ -865,4 +865,20 @@
<string name="push_distributors">موزع الإشعارات</string> <string name="push_distributors">موزع الإشعارات</string>
<string name="report_indication_title_status">أخبرنا ما الخَطب مع هذا المنشور</string> <string name="report_indication_title_status">أخبرنا ما الخَطب مع هذا المنشور</string>
<string name="set_alt_text_mandatory">وصف إلزامي للوسائط</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> </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="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="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="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="fetch_remote_media">Automatisch entfernte Medien abrufen, wenn diese nicht verfügbar sind</string>
<string name="fetching_messages">Rufe Beiträge ab</string> <string name="fetching_messages">Beiträge abrufen</string>
<string name="add_description">Beschreibung hinzufügen</string> <string name="add_description">Beschreibung hinzufügen</string>
<string name="retrieve_remote_account">Entferntes Konto abrufen!</string> <string name="retrieve_remote_account">Entferntes Konto abrufen!</string>
<string name="exit">Beenden</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">Teile lange Beiträge in Antworten auf</string>
<string name="thread_long_message_yes">Den Beitrag aufteilen</string> <string name="thread_long_message_yes">Den Beitrag aufteilen</string>
<string name="thread_long_message_no">Nicht 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_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="thread_long_this_message">Diese Beiträge in Antworten aufteilen?</string>
<string name="clipboard_version">Informationen wurden in die Zwischenablage kopiert</string> <string name="clipboard_version">Informationen wurden in die Zwischenablage kopiert</string>

View File

@ -257,7 +257,7 @@
<!-- About lists --> <!-- About lists -->
<string name="action_lists">Listoj</string> <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_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_delete">Forigi la liston</string>
<string name="action_lists_title_placeholder">Nova listo titolo</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> <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="languages">Lingvoj</string>
<string name="show_media_only">Nur aŭdvidaĵo</string> <string name="show_media_only">Nur aŭdvidaĵo</string>
<string name="show_media_nsfw">Montru NSFW</string> <string name="show_media_nsfw">Montru NSFW</string>
<string name="bot">Boto</string> <string name="bot">Roboto</string>
<string name="pixelfed_instance">Pixelfed instenco</string> <string name="pixelfed_instance">Pixelfed servilo</string>
<string name="mastodon_instance">Mastodono Instenco</string> <string name="mastodon_instance">Mastodono-servilo</string>
<string name="any_tags">Iu ajn de ĉi tiuj</string> <string name="any_tags">Iu ajn de ĉi tiuj</string>
<string name="all_tags">Ĉiuj de ĉi tiuj</string> <string name="all_tags">Ĉiuj de ĉi tiuj</string>
<string name="none_tags">None of these</string> <string name="none_tags">Neniom</string>
<string name="some_words_any">Any of these words (space-separated)</string> <string name="some_words_any">Iuj ajn vortoj (apartigitaj per spacetoj)</string>
<string name="some_words_all">All these words (space-separated)</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="some_tags">Add some words to filter (space-separated)</string>
<string name="change_tag_column">Change column name</string> <string name="change_tag_column">Change column name</string>
<string name="misskey_instance">Misskey instance</string> <string name="misskey_instance">Misskey instance</string>
@ -386,11 +386,11 @@
<string name="no_tags">No tags</string> <string name="no_tags">No tags</string>
<string name="set_retrieve_metadata_share_from_extras">Attach an image when sharing a URL</string> <string name="set_retrieve_metadata_share_from_extras">Attach an image when sharing a URL</string>
<!-- end languages --> <!-- end languages -->
<string name="create_poll">Krei Baloto</string> <string name="create_poll">Krei enketon</string>
<string name="poll_choice_s">Elekta %d</string> <string name="poll_choice_s">Opcio %d</string>
<string name="poll_invalid_choices">Vi bezonas du elektoj malpleje por la baloto!</string> <string name="poll_invalid_choices">Havendas almenaŭ du opciojn por la enketo!</string>
<string name="done">Farite</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="vote">Voĉdoni</string>
<string name="notif_poll">Partoprenita balotenketo finiĝis</string> <string name="notif_poll">Partoprenita balotenketo finiĝis</string>
<string name="notif_poll_self">A poll you tooted has ended</string> <string name="notif_poll_self">A poll you tooted has ended</string>
@ -417,7 +417,7 @@
<string name="saving">Saving…</string> <string name="saving">Saving…</string>
<string name="image_saved">Image Saved Successfully!</string> <string name="image_saved">Image Saved Successfully!</string>
<string name="save_image_failed">Failed to save Image</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="mute_conversation">Mute conversation</string>
<string name="unmute_conversation">Unmute conversation</string> <string name="unmute_conversation">Unmute conversation</string>
<string name="toast_unmute_conversation">The conversation is no longer muted!</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="settings_title_custom_sharing_indication">Allow content creators to share statuses to their RSS feeds</string>
<string name="compose">Verki</string> <string name="compose">Verki</string>
<string name="select">Elekti</string> <string name="select">Elekti</string>
<string name="add_instances">Aldoni instencon</string> <string name="add_instances">Aldoni servilon</string>
<string name="set_enable_crash_report">Enable crash reports</string> <string name="set_enable_crash_report">Ŝalti kolaps-raportojn</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="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_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="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> <string name="visibility">Visibility</string>
@ -608,4 +608,11 @@
<string name="notif_display_mentions">Mencioj</string> <string name="notif_display_mentions">Mencioj</string>
<string name="notif_display_favourites">Stelumoj</string> <string name="notif_display_favourites">Stelumoj</string>
<string name="save_changes">Konservi ŝanĝojn</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> </resources>

View File

@ -948,7 +948,7 @@
<string name="bubble">Bulle</string> <string name="bubble">Bulle</string>
<string name="reply_visibility">Visibilité des réponses</string> <string name="reply_visibility">Visibilité des réponses</string>
<string name="v_list">Liste</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="icons_visibility">Visibilité des icônes</string>
<string name="translator">Traducteur</string> <string name="translator">Traducteur</string>
<string name="set_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="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="show_my_messages">Afficher mes messages</string>
<string name="frequency_count_minutes">%d fréquence (minutes)</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> </resources>

View File

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

View File

@ -40,4 +40,35 @@
<string name="favourite">Favoritos</string> <string name="favourite">Favoritos</string>
<string name="share_with">Compartir con</string> <string name="share_with">Compartir con</string>
<string name="add_account">Adder un conto</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> </resources>

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