mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Some cleaning
This commit is contained in:
parent
2edfd8c945
commit
1ff15b0f93
58 changed files with 215 additions and 282 deletions
|
@ -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;
|
||||||
|
@ -73,7 +72,6 @@ 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.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 +79,6 @@ 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.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
|
@ -1625,8 +1622,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1921,14 +1917,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,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;
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class AccountReportActivity extends BaseBarActivity {
|
||||||
private ActivityAdminReportBinding binding;
|
private ActivityAdminReportBinding binding;
|
||||||
private AdminVM adminVM;
|
private AdminVM adminVM;
|
||||||
private AdminAccount targeted_account;
|
private AdminAccount targeted_account;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -73,6 +74,7 @@ public class AccountReportActivity extends BaseBarActivity {
|
||||||
initializeAfterBundle(null);
|
initializeAfterBundle(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeAfterBundle(Bundle bundle) {
|
private void initializeAfterBundle(Bundle bundle) {
|
||||||
|
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -32,7 +32,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;
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,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();
|
||||||
|
|
|
@ -25,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;
|
||||||
|
|
|
@ -54,7 +54,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
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;
|
||||||
|
|
|
@ -31,7 +31,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;
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,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;
|
||||||
|
|
|
@ -48,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;
|
||||||
|
|
|
@ -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 {
|
||||||
|
@ -311,4 +302,8 @@ public class EmojiInstance implements Serializable {
|
||||||
}
|
}
|
||||||
return filteredEmojis;
|
return filteredEmojis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface EmojiFilteredCallBack {
|
||||||
|
void get(List<Emoji> emojiList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -56,7 +56,9 @@ public class CachedBundle {
|
||||||
|
|
||||||
private transient Context context;
|
private transient Context context;
|
||||||
|
|
||||||
public CachedBundle() {}
|
public CachedBundle() {
|
||||||
|
}
|
||||||
|
|
||||||
public CachedBundle(Context context) {
|
public CachedBundle(Context context) {
|
||||||
//Creation of the DB with tables
|
//Creation of the DB with tables
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
@ -119,14 +121,6 @@ public class CachedBundle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface BundleCallback{
|
|
||||||
void get(Bundle bundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface BundleInsertCallback{
|
|
||||||
void inserted(long bundleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getBundle(long id, BaseAccount Account, BundleCallback callback) {
|
public void getBundle(long id, BaseAccount Account, BundleCallback callback) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
Bundle bundle = null;
|
Bundle bundle = null;
|
||||||
|
@ -148,7 +142,8 @@ public class CachedBundle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeIntent(String.valueOf(id));
|
removeIntent(String.valueOf(id));
|
||||||
} catch (DBException ignored) {}
|
} catch (DBException ignored) {
|
||||||
|
}
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
Bundle finalBundle = bundle;
|
Bundle finalBundle = bundle;
|
||||||
Runnable myRunnable = () -> callback.get(finalBundle);
|
Runnable myRunnable = () -> callback.get(finalBundle);
|
||||||
|
@ -161,7 +156,8 @@ public class CachedBundle {
|
||||||
long dbBundleId = -1;
|
long dbBundleId = -1;
|
||||||
try {
|
try {
|
||||||
dbBundleId = insertIntent(bundle, Account);
|
dbBundleId = insertIntent(bundle, Account);
|
||||||
} catch (DBException ignored) {}
|
} catch (DBException ignored) {
|
||||||
|
}
|
||||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
long finalDbBundleId = dbBundleId;
|
long finalDbBundleId = dbBundleId;
|
||||||
Runnable myRunnable = () -> callback.inserted(finalDbBundleId);
|
Runnable myRunnable = () -> callback.inserted(finalDbBundleId);
|
||||||
|
@ -169,8 +165,6 @@ public class CachedBundle {
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a bundle by targeted account id
|
* Returns a bundle by targeted account id
|
||||||
*
|
*
|
||||||
|
@ -199,7 +193,6 @@ public class CachedBundle {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a bundle by targeted status id
|
* Returns a bundle by targeted status id
|
||||||
*
|
*
|
||||||
|
@ -228,7 +221,6 @@ public class CachedBundle {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a bundle by its ID
|
* Returns a bundle by its ID
|
||||||
*
|
*
|
||||||
|
@ -259,10 +251,8 @@ public class CachedBundle {
|
||||||
db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_ID + " = '" + id + "'", null);
|
db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_ID + " = '" + id + "'", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a bundle from db
|
* Remove a bundle from db
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private void removeIntent(BaseAccount account, String target_id) throws DBException {
|
private void removeIntent(BaseAccount account, String target_id) throws DBException {
|
||||||
if (db == null) {
|
if (db == null) {
|
||||||
|
@ -276,7 +266,6 @@ public class CachedBundle {
|
||||||
+ Sqlite.COL_TARGET_ID + " = '" + target_id + "'", null);
|
+ Sqlite.COL_TARGET_ID + " = '" + target_id + "'", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Method to hydrate an CachedBundle from database
|
* Method to hydrate an CachedBundle from database
|
||||||
* @param c Cursor
|
* @param c Cursor
|
||||||
|
@ -356,7 +345,6 @@ public class CachedBundle {
|
||||||
return bundle;
|
return bundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum CacheType {
|
public enum CacheType {
|
||||||
@SerializedName("ARGS")
|
@SerializedName("ARGS")
|
||||||
ARGS("ARGS"),
|
ARGS("ARGS"),
|
||||||
|
@ -370,9 +358,19 @@ public class CachedBundle {
|
||||||
CacheType(String value) {
|
CacheType(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface BundleCallback {
|
||||||
|
void get(Bundle bundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface BundleInsertCallback {
|
||||||
|
void inserted(long bundleId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.ArrayList;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ComposeHelper {
|
public class ComposeHelper {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -848,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 {
|
||||||
|
@ -1000,8 +998,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;
|
||||||
|
@ -1611,7 +1608,7 @@ 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;
|
||||||
|
@ -1673,7 +1670,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();
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,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;
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -17,7 +17,6 @@ package app.fedilab.android.mastodon.ui.drawer;
|
||||||
|
|
||||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -31,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;
|
||||||
|
|
|
@ -16,7 +16,6 @@ package app.fedilab.android.mastodon.ui.drawer;
|
||||||
|
|
||||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -26,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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -19,7 +19,6 @@ 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;
|
||||||
|
@ -31,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;
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -3238,8 +3237,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) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ package app.fedilab.android.mastodon.ui.drawer;
|
||||||
|
|
||||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -28,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;
|
||||||
|
|
|
@ -111,11 +111,15 @@ public class FragmentMedia extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
binding.mediaPicture.setOnClickListener(v -> {
|
binding.mediaPicture.setOnClickListener(v -> {
|
||||||
if(isAdded()){((MediaActivity) requireActivity()).toogleFullScreen();}
|
if (isAdded()) {
|
||||||
|
((MediaActivity) requireActivity()).toogleFullScreen();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.mediaVideo.setOnClickListener(v -> {
|
binding.mediaVideo.setOnClickListener(v -> {
|
||||||
if(isAdded()) {((MediaActivity) requireActivity()).toogleFullScreen();}
|
if (isAdded()) {
|
||||||
|
((MediaActivity) requireActivity()).toogleFullScreen();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
String type = attachment.type;
|
String type = attachment.type;
|
||||||
|
@ -367,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) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -39,7 +39,6 @@ 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;
|
||||||
|
|
|
@ -21,7 +21,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 +30,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;
|
||||||
|
|
||||||
|
@ -59,7 +57,6 @@ 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
|
||||||
|
@ -128,6 +125,7 @@ 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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -19,7 +19,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.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 +30,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;
|
||||||
|
|
|
@ -36,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;
|
||||||
|
@ -63,7 +62,6 @@ 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;
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,10 +91,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,10 +113,7 @@ 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();
|
Bundle args = new Bundle();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -47,6 +47,7 @@ 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 +179,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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue