|
|
@ -44,6 +44,7 @@ import android.view.WindowManager;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.Toast;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.activity.OnBackPressedCallback;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.appcompat.app.ActionBar;
|
|
|
|
import androidx.appcompat.app.ActionBar;
|
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
@ -158,31 +159,21 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
|
|
|
private String editMessageId;
|
|
|
|
private String editMessageId;
|
|
|
|
|
|
|
|
|
|
|
|
private static int visibilityToNumber(String visibility) {
|
|
|
|
private static int visibilityToNumber(String visibility) {
|
|
|
|
switch (visibility) {
|
|
|
|
return switch (visibility) {
|
|
|
|
case "public":
|
|
|
|
case "unlisted" -> 2;
|
|
|
|
return 3;
|
|
|
|
case "private" -> 1;
|
|
|
|
case "unlisted":
|
|
|
|
case "direct" -> 0;
|
|
|
|
return 2;
|
|
|
|
default -> 3;
|
|
|
|
case "private":
|
|
|
|
};
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case "direct":
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 3;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static String visibilityToString(int visibility) {
|
|
|
|
private static String visibilityToString(int visibility) {
|
|
|
|
switch (visibility) {
|
|
|
|
return switch (visibility) {
|
|
|
|
case 3:
|
|
|
|
case 2 -> "unlisted";
|
|
|
|
return "public";
|
|
|
|
case 1 -> "private";
|
|
|
|
case 2:
|
|
|
|
case 0 -> "direct";
|
|
|
|
return "unlisted";
|
|
|
|
default -> "public";
|
|
|
|
case 1:
|
|
|
|
};
|
|
|
|
return "private";
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
return "direct";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return "public";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String getVisibility(BaseAccount account, String defaultVisibility) {
|
|
|
|
public static String getVisibility(BaseAccount account, String defaultVisibility) {
|
|
|
@ -208,13 +199,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onBackPressed() {
|
|
|
|
|
|
|
|
if (binding.recyclerView.getVisibility() == View.VISIBLE) {
|
|
|
|
|
|
|
|
storeDraftWarning();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
super.onBackPressed();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void storeDraftWarning() {
|
|
|
|
private void storeDraftWarning() {
|
|
|
|
if (statusDraft == null) {
|
|
|
|
if (statusDraft == null) {
|
|
|
@ -778,6 +762,15 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
|
|
|
composeAdapter.addSharing(null, null, sharedDescription, null, sharedContent, null);
|
|
|
|
composeAdapter.addSharing(null, null, sharedDescription, null, sharedContent, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void handleOnBackPressed() {
|
|
|
|
|
|
|
|
if (binding.recyclerView.getVisibility() == View.VISIBLE) {
|
|
|
|
|
|
|
|
storeDraftWarning();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -1032,7 +1025,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
|
|
|
.into(binding.mediaPreview);
|
|
|
|
.into(binding.mediaPreview);
|
|
|
|
if (attachment.description != null) {
|
|
|
|
if (attachment.description != null) {
|
|
|
|
binding.mediaDescription.setText(attachment.description);
|
|
|
|
binding.mediaDescription.setText(attachment.description);
|
|
|
|
binding.mediaDescription.setSelection(binding.mediaDescription.getText().length());
|
|
|
|
binding.mediaDescription.setSelection(Objects.requireNonNull(binding.mediaDescription.getText()).length());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
binding.mediaDescription.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1500)});
|
|
|
|
binding.mediaDescription.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1500)});
|
|
|
|
binding.mediaDescription.requestFocus();
|
|
|
|
binding.mediaDescription.requestFocus();
|
|
|
@ -1043,13 +1036,13 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
|
|
|
binding.description.setVisibility(View.GONE);
|
|
|
|
binding.description.setVisibility(View.GONE);
|
|
|
|
actionBar.show();
|
|
|
|
actionBar.show();
|
|
|
|
binding.recyclerView.setVisibility(View.VISIBLE);
|
|
|
|
binding.recyclerView.setVisibility(View.VISIBLE);
|
|
|
|
composeAdapter.openDescriptionActivity(true, binding.mediaDescription.getText().toString().trim(), holder, attachment, messagePosition, mediaPosition);
|
|
|
|
composeAdapter.openDescriptionActivity(true, Objects.requireNonNull(binding.mediaDescription.getText()).toString().trim(), holder, attachment, messagePosition, mediaPosition);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
binding.mediaCancel.setOnClickListener(v -> {
|
|
|
|
binding.mediaCancel.setOnClickListener(v -> {
|
|
|
|
binding.description.setVisibility(View.GONE);
|
|
|
|
binding.description.setVisibility(View.GONE);
|
|
|
|
actionBar.show();
|
|
|
|
actionBar.show();
|
|
|
|
binding.recyclerView.setVisibility(View.VISIBLE);
|
|
|
|
binding.recyclerView.setVisibility(View.VISIBLE);
|
|
|
|
composeAdapter.openDescriptionActivity(false, binding.mediaDescription.getText().toString().trim(), holder, attachment, messagePosition, mediaPosition);
|
|
|
|
composeAdapter.openDescriptionActivity(false, Objects.requireNonNull(binding.mediaDescription.getText()).toString().trim(), holder, attachment, messagePosition, mediaPosition);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|