Some cleaning
This commit is contained in:
parent
8fb7e4dc71
commit
c590ab48f5
|
@ -165,6 +165,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
public abstract class BaseMainActivity extends BaseActivity implements NetworkStateReceiver.NetworkStateReceiverListener, FragmentMastodonTimeline.UpdateCounters, FragmentNotificationContainer.UpdateCounters, FragmentMastodonConversation.UpdateCounters {
|
public abstract class BaseMainActivity extends BaseActivity implements NetworkStateReceiver.NetworkStateReceiverListener, FragmentMastodonTimeline.UpdateCounters, FragmentNotificationContainer.UpdateCounters, FragmentMastodonConversation.UpdateCounters {
|
||||||
|
|
||||||
|
private static final int REQUEST_CODE = 5415;
|
||||||
public static String currentInstance, currentToken, currentUserID, client_id, client_secret, software;
|
public static String currentInstance, currentToken, currentUserID, client_id, client_secret, software;
|
||||||
public static HashMap<String, List<Emoji>> emojis = new HashMap<>();
|
public static HashMap<String, List<Emoji>> emojis = new HashMap<>();
|
||||||
public static Account.API api;
|
public static Account.API api;
|
||||||
|
@ -297,7 +298,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
};
|
};
|
||||||
private NetworkStateReceiver networkStateReceiver;
|
private NetworkStateReceiver networkStateReceiver;
|
||||||
private boolean headerMenuOpen;
|
private boolean headerMenuOpen;
|
||||||
private static final int REQUEST_CODE = 5415;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -786,7 +786,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
binding.toolbarSearch.setOnSearchClickListener(v -> binding.tabLayout.setVisibility(View.VISIBLE));
|
binding.toolbarSearch.setOnSearchClickListener(v -> binding.tabLayout.setVisibility(View.VISIBLE));
|
||||||
//For receiving data from other activities
|
//For receiving data from other activities
|
||||||
LocalBroadcastManager.getInstance(BaseMainActivity.this).registerReceiver(broadcast_data, new IntentFilter(Helper.BROADCAST_DATA));
|
LocalBroadcastManager.getInstance(BaseMainActivity.this).registerReceiver(broadcast_data, new IntentFilter(Helper.BROADCAST_DATA));
|
||||||
|
@ -1042,7 +1041,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
String title = "";
|
String title = "";
|
||||||
String description = "";
|
String description = "";
|
||||||
|
|
||||||
if(titleEl != null) {
|
if (titleEl != null) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
title = Html.fromHtml(titleEl.attr("content"), Html.FROM_HTML_MODE_LEGACY).toString();
|
title = Html.fromHtml(titleEl.attr("content"), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1050,7 +1049,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(descriptionEl != null) {
|
if (descriptionEl != null) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
description = Html.fromHtml(descriptionEl.attr("content"), Html.FROM_HTML_MODE_LEGACY).toString();
|
description = Html.fromHtml(descriptionEl.attr("content"), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1059,13 +1058,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
}
|
}
|
||||||
|
|
||||||
String imageUrl = "";
|
String imageUrl = "";
|
||||||
if(imageUrlEl != null) {
|
if (imageUrlEl != null) {
|
||||||
imageUrl = imageUrlEl.attr("content");
|
imageUrl = imageUrlEl.attr("content");
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder titleBuilder = new StringBuilder();
|
StringBuilder titleBuilder = new StringBuilder();
|
||||||
|
|
||||||
if(!originalUrl.trim().equalsIgnoreCase(sharedText.trim())) {
|
if (!originalUrl.trim().equalsIgnoreCase(sharedText.trim())) {
|
||||||
// If the shared text is not just the URL, add it to the top
|
// If the shared text is not just the URL, add it to the top
|
||||||
String toAppend = sharedText.replaceAll("\\s*" + Pattern.quote(originalUrl) + "\\s*", "");
|
String toAppend = sharedText.replaceAll("\\s*" + Pattern.quote(originalUrl) + "\\s*", "");
|
||||||
titleBuilder.append(toAppend);
|
titleBuilder.append(toAppend);
|
||||||
|
@ -1073,7 +1072,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
|
|
||||||
if (title.length() > 0) {
|
if (title.length() > 0) {
|
||||||
// OG title fetched from source
|
// OG title fetched from source
|
||||||
if(titleBuilder.length() > 0) titleBuilder.append("\n\n");
|
if (titleBuilder.length() > 0)
|
||||||
|
titleBuilder.append("\n\n");
|
||||||
titleBuilder.append(title);
|
titleBuilder.append(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,6 +320,7 @@ public class AccountReportActivity 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) {
|
||||||
|
|
|
@ -107,11 +107,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
private Status statusReply, statusMention, statusQuoted;
|
private Status statusReply, statusMention, statusQuoted;
|
||||||
private StatusDraft statusDraft;
|
private StatusDraft statusDraft;
|
||||||
private ComposeAdapter composeAdapter;
|
private ComposeAdapter composeAdapter;
|
||||||
private boolean promptSaveDraft;
|
|
||||||
private boolean restoredDraft;
|
|
||||||
private List<Attachment> sharedAttachments;
|
|
||||||
|
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -138,7 +133,9 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private boolean promptSaveDraft;
|
||||||
|
private boolean restoredDraft;
|
||||||
|
private List<Attachment> sharedAttachments;
|
||||||
private ActivityPaginationBinding binding;
|
private ActivityPaginationBinding binding;
|
||||||
private BaseAccount account;
|
private BaseAccount account;
|
||||||
private String instance, token;
|
private String instance, token;
|
||||||
|
|
|
@ -117,8 +117,6 @@ public class ProfileActivity extends BaseActivity {
|
||||||
private String mention_str;
|
private String mention_str;
|
||||||
private WellKnownNodeinfo.NodeInfo nodeInfo;
|
private WellKnownNodeinfo.NodeInfo nodeInfo;
|
||||||
private boolean checkRemotely;
|
private boolean checkRemotely;
|
||||||
private boolean homeMuted;
|
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -133,6 +131,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private boolean homeMuted;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
|
@ -87,28 +87,6 @@ public class Account implements Serializable {
|
||||||
public Account moved;
|
public Account moved;
|
||||||
@SerializedName("role")
|
@SerializedName("role")
|
||||||
public Role role;
|
public Role role;
|
||||||
|
|
||||||
|
|
||||||
public static class Role implements Serializable {
|
|
||||||
@SerializedName("id")
|
|
||||||
public String id;
|
|
||||||
@SerializedName("name")
|
|
||||||
public String name;
|
|
||||||
@SerializedName("color")
|
|
||||||
public String color;
|
|
||||||
@SerializedName("position")
|
|
||||||
public int position;
|
|
||||||
@SerializedName("permissions")
|
|
||||||
public int permissions;
|
|
||||||
@SerializedName("highlighted")
|
|
||||||
public boolean highlighted;
|
|
||||||
@SerializedName("created_at")
|
|
||||||
public Date created_at;
|
|
||||||
@SerializedName("updated_at")
|
|
||||||
public Date updated_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public transient RelationShip relationShip;
|
public transient RelationShip relationShip;
|
||||||
|
|
||||||
public synchronized Spannable getSpanDisplayName(Context context, WeakReference<View> viewWeakReference) {
|
public synchronized Spannable getSpanDisplayName(Context context, WeakReference<View> viewWeakReference) {
|
||||||
|
@ -133,6 +111,34 @@ public class Account implements Serializable {
|
||||||
return SpannableHelper.convert(context, note, null, this, null, viewWeakReference);
|
return SpannableHelper.convert(context, note, null, this, null, viewWeakReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
boolean same = false;
|
||||||
|
if (obj instanceof Account) {
|
||||||
|
same = this.id.equals(((Account) obj).id);
|
||||||
|
}
|
||||||
|
return same;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Role implements Serializable {
|
||||||
|
@SerializedName("id")
|
||||||
|
public String id;
|
||||||
|
@SerializedName("name")
|
||||||
|
public String name;
|
||||||
|
@SerializedName("color")
|
||||||
|
public String color;
|
||||||
|
@SerializedName("position")
|
||||||
|
public int position;
|
||||||
|
@SerializedName("permissions")
|
||||||
|
public int permissions;
|
||||||
|
@SerializedName("highlighted")
|
||||||
|
public boolean highlighted;
|
||||||
|
@SerializedName("created_at")
|
||||||
|
public Date created_at;
|
||||||
|
@SerializedName("updated_at")
|
||||||
|
public Date updated_at;
|
||||||
|
}
|
||||||
|
|
||||||
public static class AccountParams implements Serializable {
|
public static class AccountParams implements Serializable {
|
||||||
@SerializedName("discoverable")
|
@SerializedName("discoverable")
|
||||||
public boolean discoverable;
|
public boolean discoverable;
|
||||||
|
@ -150,14 +156,4 @@ public class Account implements Serializable {
|
||||||
public LinkedHashMap<Integer, Field.FieldParams> fields;
|
public LinkedHashMap<Integer, Field.FieldParams> fields;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(@Nullable Object obj) {
|
|
||||||
boolean same = false;
|
|
||||||
if (obj instanceof Account) {
|
|
||||||
same = this.id.equals(((Account) obj).id);
|
|
||||||
}
|
|
||||||
return same;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,10 +153,6 @@ public class Status implements Serializable, Cloneable {
|
||||||
return contentTranslateSpan;
|
return contentTranslateSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Callback {
|
|
||||||
void emojiFetched();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public Object clone() throws CloneNotSupportedException {
|
public Object clone() throws CloneNotSupportedException {
|
||||||
return super.clone();
|
return super.clone();
|
||||||
|
@ -167,4 +163,8 @@ public class Status implements Serializable, Cloneable {
|
||||||
BOTTOM
|
BOTTOM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface Callback {
|
||||||
|
void emojiFetched();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,16 +25,6 @@ import app.fedilab.android.client.entities.api.Account;
|
||||||
|
|
||||||
public class AdminAccount implements Serializable {
|
public class AdminAccount implements Serializable {
|
||||||
|
|
||||||
@SerializedName("id")
|
|
||||||
public String id;
|
|
||||||
@SerializedName("username")
|
|
||||||
public String username;
|
|
||||||
@SerializedName("domain")
|
|
||||||
public String domain;
|
|
||||||
@SerializedName("created_at")
|
|
||||||
public Date created_at;
|
|
||||||
@SerializedName("email")
|
|
||||||
public String email;
|
|
||||||
public static LinkedHashMap<Integer, String> permissions;
|
public static LinkedHashMap<Integer, String> permissions;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -61,6 +51,16 @@ public class AdminAccount implements Serializable {
|
||||||
permissions.put(80000, "Delete User Data");
|
permissions.put(80000, "Delete User Data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
public String id;
|
||||||
|
@SerializedName("username")
|
||||||
|
public String username;
|
||||||
|
@SerializedName("domain")
|
||||||
|
public String domain;
|
||||||
|
@SerializedName("created_at")
|
||||||
|
public Date created_at;
|
||||||
|
@SerializedName("email")
|
||||||
|
public String email;
|
||||||
@SerializedName("ip")
|
@SerializedName("ip")
|
||||||
public String ip;
|
public String ip;
|
||||||
@SerializedName("role")
|
@SerializedName("role")
|
||||||
|
|
|
@ -509,7 +509,7 @@ public class StatusCache {
|
||||||
try {
|
try {
|
||||||
db.delete(Sqlite.TABLE_STATUS_CACHE,
|
db.delete(Sqlite.TABLE_STATUS_CACHE,
|
||||||
Sqlite.COL_USER_ID + " = ? AND " + Sqlite.COL_INSTANCE + " =? AND " + Sqlite.COL_STATUS + " LIKE ?",
|
Sqlite.COL_USER_ID + " = ? AND " + Sqlite.COL_INSTANCE + " =? AND " + Sqlite.COL_STATUS + " LIKE ?",
|
||||||
new String[]{userid, instance, "%\"id\":\"" + targetedUser + "\"%" });
|
new String[]{userid, instance, "%\"id\":\"" + targetedUser + "\"%"});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1965,6 +1965,20 @@ public class Helper {
|
||||||
return R.style.AppTheme;
|
return R.style.AppTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addMutedAccount(app.fedilab.android.client.entities.api.Account target) {
|
||||||
|
if (MainActivity.filteredAccounts == null) {
|
||||||
|
MainActivity.filteredAccounts = new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (!MainActivity.filteredAccounts.contains(target)) {
|
||||||
|
MainActivity.filteredAccounts.add(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeMutedAccount(app.fedilab.android.client.entities.api.Account target) {
|
||||||
|
if (MainActivity.filteredAccounts != null) {
|
||||||
|
MainActivity.filteredAccounts.remove(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Enum that described actions to replace inside a toot content
|
//Enum that described actions to replace inside a toot content
|
||||||
public enum PatternType {
|
public enum PatternType {
|
||||||
|
@ -1996,19 +2010,4 @@ public class Helper {
|
||||||
public interface OnFileCopied {
|
public interface OnFileCopied {
|
||||||
void onFileCopied(File file);
|
void onFileCopied(File file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addMutedAccount(app.fedilab.android.client.entities.api.Account target) {
|
|
||||||
if (MainActivity.filteredAccounts == null) {
|
|
||||||
MainActivity.filteredAccounts = new ArrayList<>();
|
|
||||||
}
|
|
||||||
if (!MainActivity.filteredAccounts.contains(target)) {
|
|
||||||
MainActivity.filteredAccounts.add(target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeMutedAccount(app.fedilab.android.client.entities.api.Account target) {
|
|
||||||
if (MainActivity.filteredAccounts != null) {
|
|
||||||
MainActivity.filteredAccounts.remove(target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,15 +409,6 @@ public class MediaHelper {
|
||||||
return maxHeight;
|
return maxHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Listener for recording media
|
|
||||||
public interface ActionRecord {
|
|
||||||
void onRecorded(String file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface OnSchedule {
|
|
||||||
void scheduledAt(String scheduledDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ResizedImageRequestBody(Context context, Uri uri, File targetedFile) {
|
public static void ResizedImageRequestBody(Context context, Uri uri, File targetedFile) {
|
||||||
InputStream decodeBitmapInputStream = null;
|
InputStream decodeBitmapInputStream = null;
|
||||||
try {
|
try {
|
||||||
|
@ -529,7 +520,6 @@ public class MediaHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static long getMaxSize(long maxSize) {
|
private static long getMaxSize(long maxSize) {
|
||||||
if (MainActivity.instanceInfo != null && MainActivity.instanceInfo.configuration != null && MainActivity.instanceInfo.configuration.media_attachments != null) {
|
if (MainActivity.instanceInfo != null && MainActivity.instanceInfo.configuration != null && MainActivity.instanceInfo.configuration.media_attachments != null) {
|
||||||
maxSize = MainActivity.instanceInfo.configuration.media_attachments.image_size_limit;
|
maxSize = MainActivity.instanceInfo.configuration.media_attachments.image_size_limit;
|
||||||
|
@ -584,4 +574,14 @@ public class MediaHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Listener for recording media
|
||||||
|
public interface ActionRecord {
|
||||||
|
void onRecorded(String file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnSchedule {
|
||||||
|
void scheduledAt(String scheduledDate);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,6 @@ public class PinnedTimelineHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public synchronized static void redrawTopBarPinned(BaseMainActivity activity, ActivityMainBinding activityMainBinding, Pinned pinned, BottomMenu bottomMenu, List<MastodonList> mastodonLists) {
|
public synchronized static void redrawTopBarPinned(BaseMainActivity activity, ActivityMainBinding activityMainBinding, Pinned pinned, BottomMenu bottomMenu, List<MastodonList> mastodonLists) {
|
||||||
//Values must be initialized if there is no records in db
|
//Values must be initialized if there is no records in db
|
||||||
if (pinned == null) {
|
if (pinned == null) {
|
||||||
|
|
|
@ -88,16 +88,13 @@ import es.dmoral.toasty.Toasty;
|
||||||
public class SpannableHelper {
|
public class SpannableHelper {
|
||||||
|
|
||||||
public static final String CLICKABLE_SPAN = "CLICKABLE_SPAN";
|
public static final String CLICKABLE_SPAN = "CLICKABLE_SPAN";
|
||||||
|
private static int linkColor;
|
||||||
|
|
||||||
public static Spannable convert(Context context, String text,
|
public static Spannable convert(Context context, String text,
|
||||||
Status status, Account account, Announcement announcement, WeakReference<View> viewWeakReference) {
|
Status status, Account account, Announcement announcement, WeakReference<View> viewWeakReference) {
|
||||||
return convert(context, text, status, account, announcement, viewWeakReference, null);
|
return convert(context, text, status, account, announcement, viewWeakReference, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static int linkColor;
|
|
||||||
|
|
||||||
|
|
||||||
public static Spannable convert(Context context, String text,
|
public static Spannable convert(Context context, String text,
|
||||||
Status status, Account account, Announcement announcement,
|
Status status, Account account, Announcement announcement,
|
||||||
WeakReference<View> viewWeakReference, Status.Callback callback) {
|
WeakReference<View> viewWeakReference, Status.Callback callback) {
|
||||||
|
@ -613,7 +610,6 @@ public class SpannableHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove extra carriage returns at the bottom due to <p> tags in toots
|
* Remove extra carriage returns at the bottom due to <p> tags in toots
|
||||||
*
|
*
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class ThemeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animate two views, the current view will be hidden to left
|
* Animate two views, the current view will be hidden to left
|
||||||
*
|
*
|
||||||
|
@ -230,7 +229,6 @@ public class ThemeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow to set colors for having description on media
|
* Allow to set colors for having description on media
|
||||||
*
|
*
|
||||||
|
|
|
@ -71,6 +71,8 @@ public class EditImageActivity extends BaseActivity implements OnPhotoEditorList
|
||||||
private final ConstraintSet mConstraintSet = new ConstraintSet();
|
private final ConstraintSet mConstraintSet = new ConstraintSet();
|
||||||
PhotoEditor mPhotoEditor;
|
PhotoEditor mPhotoEditor;
|
||||||
String path;
|
String path;
|
||||||
|
CropImageContractOptions cropImageContractOptions;
|
||||||
|
ActivityResultLauncher<CropImageContractOptions> cropImageContractOptionsActivityResultLauncher;
|
||||||
private PropertiesBSFragment mPropertiesBSFragment;
|
private PropertiesBSFragment mPropertiesBSFragment;
|
||||||
private ShapeBSFragment mShapeBSFragment;
|
private ShapeBSFragment mShapeBSFragment;
|
||||||
private ShapeBuilder mShapeBuilder;
|
private ShapeBuilder mShapeBuilder;
|
||||||
|
@ -79,8 +81,6 @@ public class EditImageActivity extends BaseActivity implements OnPhotoEditorList
|
||||||
private Uri uri;
|
private Uri uri;
|
||||||
private boolean exit;
|
private boolean exit;
|
||||||
private ActivityEditImageBinding binding;
|
private ActivityEditImageBinding binding;
|
||||||
CropImageContractOptions cropImageContractOptions;
|
|
||||||
ActivityResultLauncher<CropImageContractOptions> cropImageContractOptionsActivityResultLauncher;
|
|
||||||
|
|
||||||
private static int exifToDegrees(int exifOrientation) {
|
private static int exifToDegrees(int exifOrientation) {
|
||||||
if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
|
if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
|
||||||
|
|
|
@ -56,8 +56,8 @@ import es.dmoral.toasty.Toasty;
|
||||||
public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
private final List<Account> accountList;
|
private final List<Account> accountList;
|
||||||
private Context context;
|
|
||||||
private final boolean home_mute;
|
private final boolean home_mute;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
public AccountAdapter(List<Account> accountList, boolean home_mute) {
|
public AccountAdapter(List<Account> accountList, boolean home_mute) {
|
||||||
this.accountList = accountList;
|
this.accountList = accountList;
|
||||||
|
|
|
@ -150,6 +150,30 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
"..--..", ".-.-.-", ".----.", "-.-.--", "-..-.", "-.--.", "-.--.-", ".-...", "---...", "-.-.-.", "-...-", ".-.-.", "-....-", "..--.-",
|
"..--..", ".-.-.-", ".----.", "-.-.--", "-..-.", "-.--.", "-.--.-", ".-...", "---...", "-.-.-.", "-...-", ".-.-.", "-....-", "..--.-",
|
||||||
".-..-.", "...-..-", ".--.-.", "..-.-", "--...-"
|
".-..-.", "...-..-", ".--.-.", "..-.-", "--...-"
|
||||||
};
|
};
|
||||||
|
public static int currentCursorPosition;
|
||||||
|
private final List<Status> statusList;
|
||||||
|
private final int TYPE_NORMAL = 0;
|
||||||
|
private final BaseAccount account;
|
||||||
|
private final String visibility;
|
||||||
|
private final app.fedilab.android.client.entities.api.Account mentionedAccount;
|
||||||
|
private final String editMessageId;
|
||||||
|
public ManageDrafts manageDrafts;
|
||||||
|
public promptDraftListener promptDraftListener;
|
||||||
|
private int statusCount;
|
||||||
|
private Context context;
|
||||||
|
private AlertDialog alertDialogEmoji;
|
||||||
|
private List<Emoji> emojisList = new ArrayList<>();
|
||||||
|
private boolean unlisted_changed = false;
|
||||||
|
|
||||||
|
public ComposeAdapter(List<Status> statusList, int statusCount, BaseAccount account, app.fedilab.android.client.entities.api.Account mentionedAccount, String visibility, String editMessageId) {
|
||||||
|
this.statusList = statusList;
|
||||||
|
this.statusCount = statusCount;
|
||||||
|
this.account = account;
|
||||||
|
this.mentionedAccount = mentionedAccount;
|
||||||
|
this.visibility = visibility;
|
||||||
|
this.editMessageId = editMessageId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static int countMorseChar(String content) {
|
public static int countMorseChar(String content) {
|
||||||
int count_char = 0;
|
int count_char = 0;
|
||||||
|
@ -180,81 +204,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
return morseContent;
|
return morseContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<Status> statusList;
|
|
||||||
private final int TYPE_NORMAL = 0;
|
|
||||||
private final BaseAccount account;
|
|
||||||
private final String visibility;
|
|
||||||
private final app.fedilab.android.client.entities.api.Account mentionedAccount;
|
|
||||||
private final String editMessageId;
|
|
||||||
public ManageDrafts manageDrafts;
|
|
||||||
private int statusCount;
|
|
||||||
private Context context;
|
|
||||||
private AlertDialog alertDialogEmoji;
|
|
||||||
private List<Emoji> emojisList = new ArrayList<>();
|
|
||||||
public promptDraftListener promptDraftListener;
|
|
||||||
private boolean unlisted_changed = false;
|
|
||||||
public static int currentCursorPosition;
|
|
||||||
|
|
||||||
public ComposeAdapter(List<Status> statusList, int statusCount, BaseAccount account, app.fedilab.android.client.entities.api.Account mentionedAccount, String visibility, String editMessageId) {
|
|
||||||
this.statusList = statusList;
|
|
||||||
this.statusCount = statusCount;
|
|
||||||
this.account = account;
|
|
||||||
this.mentionedAccount = mentionedAccount;
|
|
||||||
this.visibility = visibility;
|
|
||||||
this.editMessageId = editMessageId;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an attachment from ComposeActivity
|
|
||||||
*
|
|
||||||
* @param position int - position of the drawer that added a media
|
|
||||||
* @param uris List<Uri> - uris of the media
|
|
||||||
*/
|
|
||||||
public void addAttachment(int position, List<Uri> uris) {
|
|
||||||
if (position == -1) {
|
|
||||||
position = statusList.size() - 1;
|
|
||||||
}
|
|
||||||
// position = statusCount-1+position;
|
|
||||||
if (statusList.get(position).media_attachments == null) {
|
|
||||||
statusList.get(position).media_attachments = new ArrayList<>();
|
|
||||||
}
|
|
||||||
if (promptDraftListener != null) {
|
|
||||||
promptDraftListener.promptDraft();
|
|
||||||
}
|
|
||||||
int finalPosition = position;
|
|
||||||
Helper.createAttachmentFromUri(context, uris, attachments -> {
|
|
||||||
for (Attachment attachment : attachments) {
|
|
||||||
statusList.get(finalPosition).media_attachments.add(attachment);
|
|
||||||
}
|
|
||||||
notifyItemChanged(finalPosition);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an attachment from ComposeActivity
|
|
||||||
*
|
|
||||||
* @param position int - position of the drawer that added a media
|
|
||||||
* @param attachment Attachment - media attachment
|
|
||||||
*/
|
|
||||||
public void addAttachment(int position, Attachment attachment) {
|
|
||||||
if (position == -1) {
|
|
||||||
position = statusList.size() - 1;
|
|
||||||
}
|
|
||||||
// position = statusCount-1+position;
|
|
||||||
if (statusList.get(position).media_attachments == null) {
|
|
||||||
statusList.get(position).media_attachments = new ArrayList<>();
|
|
||||||
}
|
|
||||||
if (promptDraftListener != null) {
|
|
||||||
promptDraftListener.promptDraft();
|
|
||||||
}
|
|
||||||
int finalPosition = position;
|
|
||||||
statusList.get(finalPosition).media_attachments.add(attachment);
|
|
||||||
notifyItemChanged(finalPosition);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void updateCharacterCount(ComposeViewHolder composeViewHolder) {
|
private static void updateCharacterCount(ComposeViewHolder composeViewHolder) {
|
||||||
int charCount = MastodonHelper.countLength(composeViewHolder);
|
int charCount = MastodonHelper.countLength(composeViewHolder);
|
||||||
composeViewHolder.binding.characterCount.setText(String.valueOf(charCount));
|
composeViewHolder.binding.characterCount.setText(String.valueOf(charCount));
|
||||||
|
@ -285,6 +234,55 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
return statusDraftDB;
|
return statusDraftDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an attachment from ComposeActivity
|
||||||
|
*
|
||||||
|
* @param position int - position of the drawer that added a media
|
||||||
|
* @param uris List<Uri> - uris of the media
|
||||||
|
*/
|
||||||
|
public void addAttachment(int position, List<Uri> uris) {
|
||||||
|
if (position == -1) {
|
||||||
|
position = statusList.size() - 1;
|
||||||
|
}
|
||||||
|
// position = statusCount-1+position;
|
||||||
|
if (statusList.get(position).media_attachments == null) {
|
||||||
|
statusList.get(position).media_attachments = new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (promptDraftListener != null) {
|
||||||
|
promptDraftListener.promptDraft();
|
||||||
|
}
|
||||||
|
int finalPosition = position;
|
||||||
|
Helper.createAttachmentFromUri(context, uris, attachments -> {
|
||||||
|
for (Attachment attachment : attachments) {
|
||||||
|
statusList.get(finalPosition).media_attachments.add(attachment);
|
||||||
|
}
|
||||||
|
notifyItemChanged(finalPosition);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an attachment from ComposeActivity
|
||||||
|
*
|
||||||
|
* @param position int - position of the drawer that added a media
|
||||||
|
* @param attachment Attachment - media attachment
|
||||||
|
*/
|
||||||
|
public void addAttachment(int position, Attachment attachment) {
|
||||||
|
if (position == -1) {
|
||||||
|
position = statusList.size() - 1;
|
||||||
|
}
|
||||||
|
// position = statusCount-1+position;
|
||||||
|
if (statusList.get(position).media_attachments == null) {
|
||||||
|
statusList.get(position).media_attachments = new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (promptDraftListener != null) {
|
||||||
|
promptDraftListener.promptDraft();
|
||||||
|
}
|
||||||
|
int finalPosition = position;
|
||||||
|
statusList.get(finalPosition).media_attachments.add(attachment);
|
||||||
|
notifyItemChanged(finalPosition);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//Create text when mentioning a toot
|
//Create text when mentioning a toot
|
||||||
public void loadMentions(Status status) {
|
public void loadMentions(Status status) {
|
||||||
//Get the first draft
|
//Get the first draft
|
||||||
|
|
|
@ -69,22 +69,6 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
this.conversationList = conversations;
|
this.conversationList = conversations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return conversationList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Conversation getItem(int position) {
|
|
||||||
return conversationList.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
context = parent.getContext();
|
|
||||||
DrawerConversationBinding itemBinding = DrawerConversationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
||||||
return new ConversationHolder(itemBinding);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyColorConversation(Context context, ConversationHolder holder) {
|
public static void applyColorConversation(Context context, ConversationHolder holder) {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||||
|
@ -123,6 +107,22 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return conversationList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Conversation getItem(int position) {
|
||||||
|
return conversationList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
context = parent.getContext();
|
||||||
|
DrawerConversationBinding itemBinding = DrawerConversationBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new ConversationHolder(itemBinding);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
|
|
|
@ -37,8 +37,8 @@ import app.fedilab.android.databinding.DrawerFieldBinding;
|
||||||
public class FieldAdapter extends RecyclerView.Adapter<FieldAdapter.FieldViewHolder> {
|
public class FieldAdapter extends RecyclerView.Adapter<FieldAdapter.FieldViewHolder> {
|
||||||
|
|
||||||
private final List<Field> fields;
|
private final List<Field> fields;
|
||||||
private Context context;
|
|
||||||
private final Account account;
|
private final Account account;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
public FieldAdapter(List<Field> fields, Account account) {
|
public FieldAdapter(List<Field> fields, Account account) {
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
|
|
|
@ -40,8 +40,12 @@ import app.fedilab.android.helper.Helper;
|
||||||
|
|
||||||
public class InstanceRegAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class InstanceRegAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
private final List<JoinMastodonInstance> joinMastodonInstanceList;
|
private final List<JoinMastodonInstance> joinMastodonInstanceList;
|
||||||
private Context context;
|
|
||||||
public ActionClick actionClick;
|
public ActionClick actionClick;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public InstanceRegAdapter(List<JoinMastodonInstance> joinMastodonInstanceList) {
|
||||||
|
this.joinMastodonInstanceList = joinMastodonInstanceList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
|
@ -67,11 +71,6 @@ public class InstanceRegAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
holder.binding.watchTrendig.setOnClickListener(v -> actionClick.trends(position));
|
holder.binding.watchTrendig.setOnClickListener(v -> actionClick.trends(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public InstanceRegAdapter(List<JoinMastodonInstance> joinMastodonInstanceList) {
|
|
||||||
this.joinMastodonInstanceList = joinMastodonInstanceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return joinMastodonInstanceList.size();
|
return joinMastodonInstanceList.size();
|
||||||
}
|
}
|
||||||
|
@ -88,12 +87,6 @@ public class InstanceRegAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
return new ViewHolder(itemBinding);
|
return new ViewHolder(itemBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ActionClick {
|
|
||||||
void instance(int position);
|
|
||||||
|
|
||||||
void trends(int position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +96,12 @@ public class InstanceRegAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
return joinMastodonInstanceList.size();
|
return joinMastodonInstanceList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface ActionClick {
|
||||||
|
void instance(int position);
|
||||||
|
|
||||||
|
void trends(int position);
|
||||||
|
}
|
||||||
|
|
||||||
public interface RecyclerViewClickListener {
|
public interface RecyclerViewClickListener {
|
||||||
void recyclerViewListClicked(View v, int position);
|
void recyclerViewListClicked(View v, int position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,50 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
this.notificationList = notificationList;
|
this.notificationList = notificationList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void applyColorAccount(Context context, ViewHolderFollow holder) {
|
||||||
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||||
|
boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false);
|
||||||
|
boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false);
|
||||||
|
int theme_icons_color = -1;
|
||||||
|
int theme_statuses_color = -1;
|
||||||
|
int theme_text_color = -1;
|
||||||
|
int theme_text_header_1_line = -1;
|
||||||
|
int theme_text_header_2_line = -1;
|
||||||
|
if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME
|
||||||
|
if (customLight) {
|
||||||
|
theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1);
|
||||||
|
theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_BACKGROUND), -1);
|
||||||
|
theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_TEXT), -1);
|
||||||
|
theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_DISPLAY_NAME), -1);
|
||||||
|
theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_USERNAME), -1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (customDark) {
|
||||||
|
theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1);
|
||||||
|
theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_BACKGROUND), -1);
|
||||||
|
theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_TEXT), -1);
|
||||||
|
theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_DISPLAY_NAME), -1);
|
||||||
|
theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_USERNAME), -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (theme_text_color != -1) {
|
||||||
|
holder.binding.title.setTextColor(theme_text_color);
|
||||||
|
}
|
||||||
|
if (theme_icons_color != -1) {
|
||||||
|
Helper.changeDrawableColor(context, holder.binding.icon, theme_icons_color);
|
||||||
|
}
|
||||||
|
if (theme_statuses_color != -1) {
|
||||||
|
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
|
||||||
|
}
|
||||||
|
if (theme_text_header_1_line != -1) {
|
||||||
|
holder.binding.displayName.setTextColor(theme_text_header_1_line);
|
||||||
|
}
|
||||||
|
if (theme_text_header_2_line != -1) {
|
||||||
|
holder.binding.username.setTextColor(theme_text_header_2_line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return notificationList.size();
|
return notificationList.size();
|
||||||
}
|
}
|
||||||
|
@ -145,50 +189,6 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void applyColorAccount(Context context, ViewHolderFollow holder) {
|
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
||||||
boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false);
|
|
||||||
boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false);
|
|
||||||
int theme_icons_color = -1;
|
|
||||||
int theme_statuses_color = -1;
|
|
||||||
int theme_text_color = -1;
|
|
||||||
int theme_text_header_1_line = -1;
|
|
||||||
int theme_text_header_2_line = -1;
|
|
||||||
if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) { //LIGHT THEME
|
|
||||||
if (customLight) {
|
|
||||||
theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_ICON), -1);
|
|
||||||
theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_BACKGROUND), -1);
|
|
||||||
theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_TEXT), -1);
|
|
||||||
theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_DISPLAY_NAME), -1);
|
|
||||||
theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_USERNAME), -1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (customDark) {
|
|
||||||
theme_icons_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_ICON), -1);
|
|
||||||
theme_statuses_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_BACKGROUND), -1);
|
|
||||||
theme_text_color = sharedpreferences.getInt(context.getString(R.string.SET_DARK_TEXT), -1);
|
|
||||||
theme_text_header_1_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_DISPLAY_NAME), -1);
|
|
||||||
theme_text_header_2_line = sharedpreferences.getInt(context.getString(R.string.SET_DARK_USERNAME), -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (theme_text_color != -1) {
|
|
||||||
holder.binding.title.setTextColor(theme_text_color);
|
|
||||||
}
|
|
||||||
if (theme_icons_color != -1) {
|
|
||||||
Helper.changeDrawableColor(context, holder.binding.icon, theme_icons_color);
|
|
||||||
}
|
|
||||||
if (theme_statuses_color != -1) {
|
|
||||||
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
|
|
||||||
}
|
|
||||||
if (theme_text_header_1_line != -1) {
|
|
||||||
holder.binding.displayName.setTextColor(theme_text_header_1_line);
|
|
||||||
}
|
|
||||||
if (theme_text_header_2_line != -1) {
|
|
||||||
holder.binding.username.setTextColor(theme_text_header_2_line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
Notification notification = notificationList.get(position);
|
Notification notification = notificationList.get(position);
|
||||||
|
|
|
@ -2215,28 +2215,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
|
||||||
super.onAttachedToRecyclerView(recyclerView);
|
|
||||||
|
|
||||||
mRecyclerView = recyclerView;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* private static boolean mediaObfuscated(Status status) {
|
|
||||||
//Media is not sensitive and doesn't have a spoiler text
|
|
||||||
if (!status.isMediaObfuscated) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!status.sensitive && (status.spoiler_text == null || status.spoiler_text.trim().isEmpty())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (status.isMediaObfuscated && status.spoiler_text != null && !status.spoiler_text.trim().isEmpty()) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return status.sensitive;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a broadcast to other open fragments that content a timeline
|
* Send a broadcast to other open fragments that content a timeline
|
||||||
*
|
*
|
||||||
|
@ -2261,68 +2239,20 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
|
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* private static boolean mediaObfuscated(Status status) {
|
||||||
@Override
|
//Media is not sensitive and doesn't have a spoiler text
|
||||||
public int getItemViewType(int position) {
|
if (!status.isMediaObfuscated) {
|
||||||
if (timelineType == Timeline.TimeLineEnum.ART) {
|
return false;
|
||||||
return STATUS_ART;
|
}
|
||||||
|
if (!status.sensitive && (status.spoiler_text == null || status.spoiler_text.trim().isEmpty())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (status.isMediaObfuscated && status.spoiler_text != null && !status.spoiler_text.trim().isEmpty()) {
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (statusList.get(position).filteredByApp != null) {
|
return status.sensitive;
|
||||||
if (statusList.get(position).filteredByApp.filter_action.equals("warn")) {
|
|
||||||
return STATUS_FILTERED;
|
|
||||||
} else { //These messages should not be displayed unless they contain a fetch more button
|
|
||||||
if (!statusList.get(position).isFetchMore) {
|
|
||||||
return STATUS_HIDDEN;
|
|
||||||
} else {
|
|
||||||
return STATUS_FILTERED_HIDE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return isVisible(timelineType, statusList.get(position)) ? STATUS_VISIBLE : STATUS_HIDDEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
context = parent.getContext();
|
|
||||||
if (viewType == STATUS_HIDDEN) { //Hidden statuses - ie: filtered
|
|
||||||
DrawerStatusHiddenBinding itemBinding = DrawerStatusHiddenBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
||||||
return new StatusViewHolder(itemBinding);
|
|
||||||
} else if (viewType == STATUS_ART) { //Art statuses
|
|
||||||
DrawerStatusArtBinding itemBinding = DrawerStatusArtBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
||||||
return new StatusViewHolder(itemBinding);
|
|
||||||
} else if (viewType == STATUS_FILTERED) { //Filtered warn
|
|
||||||
DrawerStatusFilteredBinding itemBinding = DrawerStatusFilteredBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
||||||
return new StatusViewHolder(itemBinding);
|
|
||||||
} else if (viewType == STATUS_FILTERED_HIDE) { //Filtered hide
|
|
||||||
DrawerStatusFilteredHideBinding itemBinding = DrawerStatusFilteredHideBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
||||||
return new StatusViewHolder(itemBinding);
|
|
||||||
} else { //Classic statuses
|
|
||||||
if (!minified) {
|
|
||||||
DrawerStatusBinding itemBinding = DrawerStatusBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
||||||
return new StatusViewHolder(itemBinding);
|
|
||||||
} else {
|
|
||||||
DrawerStatusReportBinding itemBinding = DrawerStatusReportBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
|
||||||
return new StatusViewHolder(itemBinding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return statusList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Status getItem(int position) {
|
|
||||||
return statusList.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void applyColor(Context context, StatusViewHolder holder) {
|
public static void applyColor(Context context, StatusViewHolder holder) {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
@ -2410,6 +2340,74 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
||||||
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
|
|
||||||
|
mRecyclerView = recyclerView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
if (timelineType == Timeline.TimeLineEnum.ART) {
|
||||||
|
return STATUS_ART;
|
||||||
|
} else {
|
||||||
|
if (statusList.get(position).filteredByApp != null) {
|
||||||
|
if (statusList.get(position).filteredByApp.filter_action.equals("warn")) {
|
||||||
|
return STATUS_FILTERED;
|
||||||
|
} else { //These messages should not be displayed unless they contain a fetch more button
|
||||||
|
if (!statusList.get(position).isFetchMore) {
|
||||||
|
return STATUS_HIDDEN;
|
||||||
|
} else {
|
||||||
|
return STATUS_FILTERED_HIDE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return isVisible(timelineType, statusList.get(position)) ? STATUS_VISIBLE : STATUS_HIDDEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
context = parent.getContext();
|
||||||
|
if (viewType == STATUS_HIDDEN) { //Hidden statuses - ie: filtered
|
||||||
|
DrawerStatusHiddenBinding itemBinding = DrawerStatusHiddenBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new StatusViewHolder(itemBinding);
|
||||||
|
} else if (viewType == STATUS_ART) { //Art statuses
|
||||||
|
DrawerStatusArtBinding itemBinding = DrawerStatusArtBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new StatusViewHolder(itemBinding);
|
||||||
|
} else if (viewType == STATUS_FILTERED) { //Filtered warn
|
||||||
|
DrawerStatusFilteredBinding itemBinding = DrawerStatusFilteredBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new StatusViewHolder(itemBinding);
|
||||||
|
} else if (viewType == STATUS_FILTERED_HIDE) { //Filtered hide
|
||||||
|
DrawerStatusFilteredHideBinding itemBinding = DrawerStatusFilteredHideBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new StatusViewHolder(itemBinding);
|
||||||
|
} else { //Classic statuses
|
||||||
|
if (!minified) {
|
||||||
|
DrawerStatusBinding itemBinding = DrawerStatusBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new StatusViewHolder(itemBinding);
|
||||||
|
} else {
|
||||||
|
DrawerStatusReportBinding itemBinding = DrawerStatusReportBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new StatusViewHolder(itemBinding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return statusList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status getItem(int position) {
|
||||||
|
return statusList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
//Nothing to do with hidden statuses
|
//Nothing to do with hidden statuses
|
||||||
|
@ -2604,6 +2602,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
DrawerStatusArtBinding bindingArt;
|
DrawerStatusArtBinding bindingArt;
|
||||||
DrawerStatusFilteredBinding bindingFiltered;
|
DrawerStatusFilteredBinding bindingFiltered;
|
||||||
DrawerStatusFilteredHideBinding bindingFilteredHide;
|
DrawerStatusFilteredHideBinding bindingFilteredHide;
|
||||||
|
|
||||||
StatusViewHolder(DrawerStatusBinding itemView) {
|
StatusViewHolder(DrawerStatusBinding itemView) {
|
||||||
super(itemView.getRoot());
|
super(itemView.getRoot());
|
||||||
binding = itemView;
|
binding = itemView;
|
||||||
|
|
|
@ -200,5 +200,4 @@ public class FragmentAdminReport extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -68,11 +68,11 @@ import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class FragmentLoginMain extends Fragment {
|
public class FragmentLoginMain extends Fragment {
|
||||||
|
|
||||||
|
private static final int REQUEST_CODE = 5412;
|
||||||
|
private final int PICK_IMPORT = 5557;
|
||||||
private FragmentLoginMainBinding binding;
|
private FragmentLoginMainBinding binding;
|
||||||
private boolean searchInstanceRunning = false;
|
private boolean searchInstanceRunning = false;
|
||||||
private String oldSearch;
|
private String oldSearch;
|
||||||
private static final int REQUEST_CODE = 5412;
|
|
||||||
private final int PICK_IMPORT = 5557;
|
|
||||||
private ActivityResultLauncher<String> permissionLauncher;
|
private ActivityResultLauncher<String> permissionLauncher;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
|
|
|
@ -46,6 +46,8 @@ import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
public class FragmentMediaProfile extends Fragment {
|
public class FragmentMediaProfile extends Fragment {
|
||||||
|
|
||||||
|
String tempToken;
|
||||||
|
String tempInstance;
|
||||||
private FragmentPaginationBinding binding;
|
private FragmentPaginationBinding binding;
|
||||||
private AccountsVM accountsVM;
|
private AccountsVM accountsVM;
|
||||||
private Account accountTimeline;
|
private Account accountTimeline;
|
||||||
|
@ -53,8 +55,6 @@ public class FragmentMediaProfile extends Fragment {
|
||||||
private List<Status> mediaStatuses;
|
private List<Status> mediaStatuses;
|
||||||
private String max_id;
|
private String max_id;
|
||||||
private ImageAdapter imageAdapter;
|
private ImageAdapter imageAdapter;
|
||||||
String tempToken;
|
|
||||||
String tempInstance;
|
|
||||||
private boolean checkRemotely;
|
private boolean checkRemotely;
|
||||||
private String accountId;
|
private String accountId;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import es.dmoral.toasty.Toasty;
|
||||||
public class FragmentThemingSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class FragmentThemingSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle bundle, String s) {
|
public void onCreatePreferences(Bundle bundle, String s) {
|
||||||
createPref();
|
createPref();
|
||||||
|
|
|
@ -50,12 +50,11 @@ import app.fedilab.android.viewmodel.mastodon.StatusesVM;
|
||||||
public class FragmentMastodonContext extends Fragment {
|
public class FragmentMastodonContext extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
|
public FirstMessage firstMessage;
|
||||||
private FragmentPaginationBinding binding;
|
private FragmentPaginationBinding binding;
|
||||||
private StatusesVM statusesVM;
|
private StatusesVM statusesVM;
|
||||||
private List<Status> statuses;
|
private List<Status> statuses;
|
||||||
private StatusAdapter statusAdapter;
|
private StatusAdapter statusAdapter;
|
||||||
public FirstMessage firstMessage;
|
|
||||||
|
|
||||||
//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
|
||||||
|
|
|
@ -84,9 +84,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
private StatusAdapter statusAdapter;
|
private StatusAdapter statusAdapter;
|
||||||
private Timeline.TimeLineEnum timelineType;
|
private Timeline.TimeLineEnum timelineType;
|
||||||
private List<Status> timelineStatuses;
|
private List<Status> timelineStatuses;
|
||||||
private boolean checkRemotely;
|
|
||||||
private String accountIDInRemoteInstance;
|
|
||||||
|
|
||||||
//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
|
||||||
|
@ -162,6 +159,8 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private boolean checkRemotely;
|
||||||
|
private String accountIDInRemoteInstance;
|
||||||
private boolean isViewInitialized;
|
private boolean isViewInitialized;
|
||||||
private Statuses initialStatuses;
|
private Statuses initialStatuses;
|
||||||
private String list_id;
|
private String list_id;
|
||||||
|
@ -180,6 +179,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
||||||
private int lockForResumeCall;
|
private int lockForResumeCall;
|
||||||
private boolean isNotPinnedTimeline;
|
private boolean isNotPinnedTimeline;
|
||||||
private int extraCalls;
|
private int extraCalls;
|
||||||
|
|
||||||
//Allow to recreate data when detaching/attaching fragment
|
//Allow to recreate data when detaching/attaching fragment
|
||||||
public void recreate() {
|
public void recreate() {
|
||||||
initialStatuses = null;
|
initialStatuses = null;
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class FragmentProfileTimeline extends Fragment {
|
||||||
private Account account;
|
private Account account;
|
||||||
private FragmentProfileTimelinesBinding binding;
|
private FragmentProfileTimelinesBinding binding;
|
||||||
private boolean checkRemotely;
|
private boolean checkRemotely;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||||
|
|
||||||
public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
|
public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
|
||||||
private final Account account;
|
private final Account account;
|
||||||
private Fragment mCurrentFragment;
|
|
||||||
private final boolean checkRemotely;
|
private final boolean checkRemotely;
|
||||||
|
private Fragment mCurrentFragment;
|
||||||
|
|
||||||
public FedilabProfilePageAdapter(FragmentManager fm, Account account, boolean remotely) {
|
public FedilabProfilePageAdapter(FragmentManager fm, Account account, boolean remotely) {
|
||||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
|
|
|
@ -30,8 +30,8 @@ import app.fedilab.android.ui.fragment.timeline.FragmentProfileTimeline;
|
||||||
|
|
||||||
public class FedilabProfileTLPageAdapter extends FragmentStatePagerAdapter {
|
public class FedilabProfileTLPageAdapter extends FragmentStatePagerAdapter {
|
||||||
private final Account account;
|
private final Account account;
|
||||||
private Fragment mCurrentFragment;
|
|
||||||
private final boolean checkRemotely;
|
private final boolean checkRemotely;
|
||||||
|
private Fragment mCurrentFragment;
|
||||||
|
|
||||||
public FedilabProfileTLPageAdapter(FragmentManager fm, Account account, boolean remotely) {
|
public FedilabProfileTLPageAdapter(FragmentManager fm, Account account, boolean remotely) {
|
||||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
|
|
Loading…
Reference in New Issue