Improve compose activity
This commit is contained in:
parent
63b154fce1
commit
f34237ce7a
|
@ -42,6 +42,6 @@ dependencies {
|
||||||
compile 'com.github.chrisbanes:PhotoView:1.3.1'
|
compile 'com.github.chrisbanes:PhotoView:1.3.1'
|
||||||
compile 'com.mikepenz:google-material-typeface:3.0.1.0.original@aar'
|
compile 'com.mikepenz:google-material-typeface:3.0.1.0.original@aar'
|
||||||
compile 'com.github.arimorty:floatingsearchview:2.0.3'
|
compile 'com.github.arimorty:floatingsearchview:2.0.3'
|
||||||
compile 'org.parceler:parceler-api:1.1.6'
|
compile 'com.jakewharton:butterknife:8.4.0'
|
||||||
annotationProcessor 'org.parceler:parceler:1.1.6'
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ import android.provider.OpenableColumns;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v13.view.inputmethod.EditorInfoCompat;
|
import android.support.v13.view.inputmethod.EditorInfoCompat;
|
||||||
import android.support.v13.view.inputmethod.InputConnectionCompat;
|
import android.support.v13.view.inputmethod.InputConnectionCompat;
|
||||||
|
@ -57,14 +56,15 @@ import android.text.Spanned;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
@ -72,6 +72,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import com.keylesspalace.tusky.entity.Media;
|
import com.keylesspalace.tusky.entity.Media;
|
||||||
import com.keylesspalace.tusky.entity.Status;
|
import com.keylesspalace.tusky.entity.Status;
|
||||||
|
import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
@ -100,8 +101,6 @@ public class ComposeActivity extends BaseActivity {
|
||||||
private static final int MEDIA_SIZE_UNKNOWN = -1;
|
private static final int MEDIA_SIZE_UNKNOWN = -1;
|
||||||
|
|
||||||
private String inReplyToId;
|
private String inReplyToId;
|
||||||
private String domain;
|
|
||||||
private String accessToken;
|
|
||||||
private EditText textEditor;
|
private EditText textEditor;
|
||||||
private LinearLayout mediaPreviewBar;
|
private LinearLayout mediaPreviewBar;
|
||||||
private ArrayList<QueuedMedia> mediaQueued;
|
private ArrayList<QueuedMedia> mediaQueued;
|
||||||
|
@ -117,6 +116,10 @@ public class ComposeActivity extends BaseActivity {
|
||||||
private ProgressDialog finishingUploadDialog;
|
private ProgressDialog finishingUploadDialog;
|
||||||
private EditText contentWarningEditor;
|
private EditText contentWarningEditor;
|
||||||
private boolean mediaPickEnabled;
|
private boolean mediaPickEnabled;
|
||||||
|
private ImageButton pickBtn;
|
||||||
|
private Button nsfwBtn;
|
||||||
|
private ImageButton visibilityBtn;
|
||||||
|
private Button floatingBtn;
|
||||||
|
|
||||||
private static class QueuedMedia {
|
private static class QueuedMedia {
|
||||||
enum Type {
|
enum Type {
|
||||||
|
@ -325,6 +328,7 @@ public class ComposeActivity extends BaseActivity {
|
||||||
actionBar.setTitle(null);
|
actionBar.setTitle(null);
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
actionBar.setDisplayShowHomeEnabled(true);
|
actionBar.setDisplayShowHomeEnabled(true);
|
||||||
|
actionBar.setHomeAsUpIndicator(R.drawable.ic_close_24dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
SharedPreferences preferences = getSharedPreferences(
|
||||||
|
@ -332,13 +336,35 @@ public class ComposeActivity extends BaseActivity {
|
||||||
|
|
||||||
mediaPickEnabled = true;
|
mediaPickEnabled = true;
|
||||||
|
|
||||||
FloatingActionButton floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn);
|
floatingBtn = (Button) findViewById(R.id.floating_btn);
|
||||||
|
pickBtn = (ImageButton) findViewById(R.id.compose_photo_pick);
|
||||||
|
nsfwBtn = (Button) findViewById(R.id.action_toggle_nsfw);
|
||||||
|
visibilityBtn = (ImageButton) findViewById(R.id.action_toggle_visibility);
|
||||||
|
|
||||||
floatingBtn.setOnClickListener(new View.OnClickListener() {
|
floatingBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
sendStatus();
|
sendStatus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
pickBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
onMediaPick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
nsfwBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
toggleNsfw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
visibilityBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showComposeOptions();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ArrayList<SavedQueuedMedia> savedMediaQueued = null;
|
ArrayList<SavedQueuedMedia> savedMediaQueued = null;
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
|
@ -362,6 +388,12 @@ public class ComposeActivity extends BaseActivity {
|
||||||
statusHideText = false;
|
statusHideText = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (statusMarkSensitive) {
|
||||||
|
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.color_accent_dark));
|
||||||
|
} else {
|
||||||
|
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.image_button_dark));
|
||||||
|
}
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String[] mentionedUsernames = null;
|
String[] mentionedUsernames = null;
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
|
@ -375,9 +407,6 @@ public class ComposeActivity extends BaseActivity {
|
||||||
mentionedUsernames = intent.getStringArrayExtra("mentioned_usernames");
|
mentionedUsernames = intent.getStringArrayExtra("mentioned_usernames");
|
||||||
}
|
}
|
||||||
|
|
||||||
domain = preferences.getString("domain", null);
|
|
||||||
accessToken = preferences.getString("accessToken", null);
|
|
||||||
|
|
||||||
textEditor = createEditText(null); // new String[] { "image/gif", "image/webp" }
|
textEditor = createEditText(null); // new String[] { "image/gif", "image/webp" }
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
textEditor.onRestoreInstanceState(savedInstanceState.getParcelable("textEditorState"));
|
textEditor.onRestoreInstanceState(savedInstanceState.getParcelable("textEditorState"));
|
||||||
|
@ -435,10 +464,19 @@ public class ComposeActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toggleNsfw() {
|
||||||
|
statusMarkSensitive = !statusMarkSensitive;
|
||||||
|
|
||||||
|
if (statusMarkSensitive) {
|
||||||
|
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.color_accent_dark));
|
||||||
|
} else {
|
||||||
|
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.image_button_dark));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void showComposeOptions() {
|
private void showComposeOptions() {
|
||||||
ComposeOptionsFragment fragment = ComposeOptionsFragment.newInstance(
|
ComposeOptionsFragment fragment = ComposeOptionsFragment.newInstance(
|
||||||
statusVisibility, statusMarkSensitive, statusHideText,
|
statusVisibility, statusHideText, inReplyToId != null,
|
||||||
showMarkSensitive, inReplyToId != null,
|
|
||||||
new ComposeOptionsFragment.Listener() {
|
new ComposeOptionsFragment.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
|
@ -453,11 +491,6 @@ public class ComposeActivity extends BaseActivity {
|
||||||
statusVisibility = visibility;
|
statusVisibility = visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMarkSensitiveChanged(boolean markSensitive) {
|
|
||||||
statusMarkSensitive = markSensitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContentWarningChanged(boolean hideText) {
|
public void onContentWarningChanged(boolean hideText) {
|
||||||
showContentWarning(hideText);
|
showContentWarning(hideText);
|
||||||
|
@ -551,6 +584,7 @@ public class ComposeActivity extends BaseActivity {
|
||||||
editText.setLayoutParams(layoutParams);
|
editText.setLayoutParams(layoutParams);
|
||||||
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
|
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
|
||||||
editText.setEms(10);
|
editText.setEms(10);
|
||||||
|
editText.setBackgroundColor(0);
|
||||||
editText.setGravity(Gravity.START | Gravity.TOP);
|
editText.setGravity(Gravity.START | Gravity.TOP);
|
||||||
editText.setHint(R.string.hint_compose);
|
editText.setHint(R.string.hint_compose);
|
||||||
return editText;
|
return editText;
|
||||||
|
@ -758,23 +792,12 @@ public class ComposeActivity extends BaseActivity {
|
||||||
|
|
||||||
private void enableMediaPicking() {
|
private void enableMediaPicking() {
|
||||||
mediaPickEnabled = true;
|
mediaPickEnabled = true;
|
||||||
invalidateOptionsMenu();
|
pickBtn.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableMediaPicking() {
|
private void disableMediaPicking() {
|
||||||
mediaPickEnabled = false;
|
mediaPickEnabled = false;
|
||||||
invalidateOptionsMenu();
|
pickBtn.setEnabled(false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
||||||
if (mediaPickEnabled) {
|
|
||||||
menu.findItem(R.id.compose_photo_pick).setEnabled(true);
|
|
||||||
} else {
|
|
||||||
menu.findItem(R.id.compose_photo_pick).setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onPrepareOptionsMenu(menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMediaToQueue(QueuedMedia.Type type, Bitmap preview, Uri uri, long mediaSize) {
|
private void addMediaToQueue(QueuedMedia.Type type, Bitmap preview, Uri uri, long mediaSize) {
|
||||||
|
@ -786,10 +809,15 @@ public class ComposeActivity extends BaseActivity {
|
||||||
int marginBottom = resources.getDimensionPixelSize(
|
int marginBottom = resources.getDimensionPixelSize(
|
||||||
R.dimen.compose_media_preview_margin_bottom);
|
R.dimen.compose_media_preview_margin_bottom);
|
||||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(side, side);
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(side, side);
|
||||||
layoutParams.setMargins(margin, margin, margin, marginBottom);
|
layoutParams.setMargins(margin, 0, margin, marginBottom);
|
||||||
view.setLayoutParams(layoutParams);
|
view.setLayoutParams(layoutParams);
|
||||||
view.setImageBitmap(preview);
|
|
||||||
view.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
Picasso.with(this)
|
||||||
|
.load(uri)
|
||||||
|
.resize(side, side)
|
||||||
|
.centerCrop()
|
||||||
|
.into(view);
|
||||||
|
|
||||||
view.setOnClickListener(new View.OnClickListener() {
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -1055,8 +1083,16 @@ public class ComposeActivity extends BaseActivity {
|
||||||
|
|
||||||
void showMarkSensitive(boolean show) {
|
void showMarkSensitive(boolean show) {
|
||||||
showMarkSensitive = show;
|
showMarkSensitive = show;
|
||||||
|
|
||||||
if(!showMarkSensitive) {
|
if(!showMarkSensitive) {
|
||||||
statusMarkSensitive = false;
|
statusMarkSensitive = false;
|
||||||
|
nsfwBtn.setTextColor(ContextCompat.getColor(this, R.color.image_button_dark));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(show) {
|
||||||
|
nsfwBtn.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
nsfwBtn.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,12 +1105,6 @@ public class ComposeActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.compose_toolbar, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
@ -1082,16 +1112,6 @@ public class ComposeActivity extends BaseActivity {
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case R.id.compose_photo_pick: {
|
|
||||||
onMediaPick();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case R.id.compose_options: {
|
|
||||||
showComposeOptions();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
|
@ -15,21 +15,18 @@ import android.widget.RadioGroup;
|
||||||
public class ComposeOptionsFragment extends BottomSheetDialogFragment {
|
public class ComposeOptionsFragment extends BottomSheetDialogFragment {
|
||||||
public interface Listener extends Parcelable {
|
public interface Listener extends Parcelable {
|
||||||
void onVisibilityChanged(String visibility);
|
void onVisibilityChanged(String visibility);
|
||||||
void onMarkSensitiveChanged(boolean markSensitive);
|
|
||||||
void onContentWarningChanged(boolean hideText);
|
void onContentWarningChanged(boolean hideText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Listener listener;
|
private Listener listener;
|
||||||
|
|
||||||
public static ComposeOptionsFragment newInstance(String visibility, boolean markSensitive,
|
public static ComposeOptionsFragment newInstance(String visibility,
|
||||||
boolean hideText, boolean showMarkSensitive, boolean isReply, Listener listener) {
|
boolean hideText, boolean isReply, Listener listener) {
|
||||||
Bundle arguments = new Bundle();
|
Bundle arguments = new Bundle();
|
||||||
ComposeOptionsFragment fragment = new ComposeOptionsFragment();
|
ComposeOptionsFragment fragment = new ComposeOptionsFragment();
|
||||||
arguments.putParcelable("listener", listener);
|
arguments.putParcelable("listener", listener);
|
||||||
arguments.putString("visibility", visibility);
|
arguments.putString("visibility", visibility);
|
||||||
arguments.putBoolean("markSensitive", markSensitive);
|
|
||||||
arguments.putBoolean("hideText", hideText);
|
arguments.putBoolean("hideText", hideText);
|
||||||
arguments.putBoolean("showMarkSensitive", showMarkSensitive);
|
|
||||||
arguments.putBoolean("isReply", isReply);
|
arguments.putBoolean("isReply", isReply);
|
||||||
fragment.setArguments(arguments);
|
fragment.setArguments(arguments);
|
||||||
return fragment;
|
return fragment;
|
||||||
|
@ -44,9 +41,7 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
|
||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
listener = arguments.getParcelable("listener");
|
listener = arguments.getParcelable("listener");
|
||||||
String statusVisibility = arguments.getString("visibility");
|
String statusVisibility = arguments.getString("visibility");
|
||||||
boolean statusMarkSensitive = arguments.getBoolean("markSensitive");
|
|
||||||
boolean statusHideText = arguments.getBoolean("hideText");
|
boolean statusHideText = arguments.getBoolean("hideText");
|
||||||
boolean showMarkSensitive = arguments.getBoolean("showMarkSensitive");
|
|
||||||
boolean isReply = arguments.getBoolean("isReply");
|
boolean isReply = arguments.getBoolean("isReply");
|
||||||
|
|
||||||
RadioGroup radio = (RadioGroup) rootView.findViewById(R.id.radio_visibility);
|
RadioGroup radio = (RadioGroup) rootView.findViewById(R.id.radio_visibility);
|
||||||
|
@ -91,20 +86,6 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
|
||||||
publicButton.setEnabled(false);
|
publicButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox markSensitive = (CheckBox) rootView.findViewById(R.id.compose_mark_sensitive);
|
|
||||||
if (showMarkSensitive) {
|
|
||||||
markSensitive.setChecked(statusMarkSensitive);
|
|
||||||
markSensitive.setEnabled(true);
|
|
||||||
markSensitive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
listener.onMarkSensitiveChanged(isChecked);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
markSensitive.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckBox hideText = (CheckBox) rootView.findViewById(R.id.compose_hide_text);
|
CheckBox hideText = (CheckBox) rootView.findViewById(R.id.compose_hide_text);
|
||||||
hideText.setChecked(statusHideText);
|
hideText.setChecked(statusHideText);
|
||||||
hideText.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
hideText.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
|
|
@ -239,6 +239,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
final String url = attachments[i].url;
|
final String url = attachments[i].url;
|
||||||
final Status.MediaAttachment.Type type = attachments[i].type;
|
final Status.MediaAttachment.Type type = attachments[i].type;
|
||||||
|
|
||||||
previews[i].setOnClickListener(new View.OnClickListener() {
|
previews[i].setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -28,6 +28,9 @@ import uk.co.senab.photoview.PhotoView;
|
||||||
import uk.co.senab.photoview.PhotoViewAttacher;
|
import uk.co.senab.photoview.PhotoViewAttacher;
|
||||||
|
|
||||||
public class ViewMediaFragment extends Fragment {
|
public class ViewMediaFragment extends Fragment {
|
||||||
|
|
||||||
|
private PhotoViewAttacher attacher;
|
||||||
|
|
||||||
public static ViewMediaFragment newInstance(String url) {
|
public static ViewMediaFragment newInstance(String url) {
|
||||||
Bundle arguments = new Bundle();
|
Bundle arguments = new Bundle();
|
||||||
ViewMediaFragment fragment = new ViewMediaFragment();
|
ViewMediaFragment fragment = new ViewMediaFragment();
|
||||||
|
@ -45,7 +48,7 @@ public class ViewMediaFragment extends Fragment {
|
||||||
String url = arguments.getString("url");
|
String url = arguments.getString("url");
|
||||||
PhotoView photoView = (PhotoView) rootView.findViewById(R.id.view_media_image);
|
PhotoView photoView = (PhotoView) rootView.findViewById(R.id.view_media_image);
|
||||||
|
|
||||||
final PhotoViewAttacher attacher = new PhotoViewAttacher(photoView);
|
attacher = new PhotoViewAttacher(photoView);
|
||||||
|
|
||||||
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
|
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,6 +79,12 @@ public class ViewMediaFragment extends Fragment {
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
attacher.cleanup();
|
||||||
|
super.onDestroyView();
|
||||||
|
}
|
||||||
|
|
||||||
private void dismiss() {
|
private void dismiss() {
|
||||||
getFragmentManager().popBackStack();
|
getFragmentManager().popBackStack();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,10 @@
|
||||||
|
|
||||||
package com.keylesspalace.tusky.entity;
|
package com.keylesspalace.tusky.entity;
|
||||||
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
|
||||||
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion;
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
import org.parceler.Parcels;
|
|
||||||
|
|
||||||
public class Account {
|
public class Account {
|
||||||
public String id;
|
public String id;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/toolbar_icon_dark"
|
||||||
|
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||||
|
</vector>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM11,19.93c-3.95,-0.49 -7,-3.85 -7,-7.93 0,-0.62 0.08,-1.21 0.21,-1.79L9,15v1c0,1.1 0.9,2 2,2v1.93zM17.9,17.39c-0.26,-0.81 -1,-1.39 -1.9,-1.39h-1v-3c0,-0.55 -0.45,-1 -1,-1L8,12v-2h2c0.55,0 1,-0.45 1,-1L11,7h2c1.1,0 2,-0.9 2,-2v-0.41c2.93,1.19 5,4.06 5,7.41 0,2.08 -0.8,3.97 -2.1,5.39z"/>
|
||||||
|
</vector>
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/activity_compose"
|
android:id="@+id/activity_compose"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
@ -9,85 +10,129 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:theme="@style/AppTheme.Account.AppBarLayout"
|
android:theme="@style/AppTheme.Account.AppBarLayout"
|
||||||
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
|
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark" />
|
||||||
android:background="?attr/toolbar_background_color" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/compose_content_warning_bar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/compose_content_warning_bar"
|
android:orientation="vertical"
|
||||||
android:paddingTop="0dp"
|
android:layout_marginBottom="8dp">
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:layout_marginBottom="4dp">
|
|
||||||
<android.support.design.widget.TextInputLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/field_content_warning"
|
android:id="@+id/field_content_warning"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
android:hint="@string/hint_content_warning"
|
android:hint="@string/hint_content_warning"
|
||||||
android:inputType="text" />
|
android:inputType="text|textCapSentences" />
|
||||||
</android.support.design.widget.TextInputLayout>
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?android:attr/listDivider"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/compose_edit_area"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp">
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:id="@+id/compose_edit_area">
|
|
||||||
|
|
||||||
<!--An special EditText is created at runtime here, because it has to be a modified
|
<!--An special EditText is created at runtime here, because it has to be a modified
|
||||||
* anonymous class to support image/GIF picking from the soft keyboard.-->
|
* anonymous class to support image/GIF picking from the soft keyboard.-->
|
||||||
|
|
||||||
<LinearLayout
|
<HorizontalScrollView
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:orientation="horizontal"
|
<LinearLayout
|
||||||
android:id="@+id/compose_media_preview_bar"
|
android:id="@+id/compose_media_preview_bar"
|
||||||
android:layout_alignParentBottom="true">
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<!--This is filled at runtime with ImageView's for each preview in the upload queue.-->
|
<!--This is filled at runtime with ImageView's for each preview in the upload queue.-->
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:paddingTop="4dp"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingBottom="16dp"
|
android:paddingRight="16dp"
|
||||||
android:layout_height="wrap_content">
|
android:paddingTop="4dp">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/compose_photo_pick"
|
||||||
|
style="?attr/image_button_style"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
app:srcCompat="@drawable/ic_attach_file_24dp" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/action_toggle_visibility"
|
||||||
|
style="?attr/image_button_style"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
app:srcCompat="@drawable/ic_public_24dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/action_toggle_nsfw"
|
||||||
|
style="?attr/image_button_style"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minWidth="0dp"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:textColor="@color/image_button_dark"
|
||||||
|
android:text="@string/toggle_nsfw" />
|
||||||
|
|
||||||
|
<android.support.v4.widget.Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/characters_left"
|
android:id="@+id/characters_left"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:text="500"
|
||||||
android:text="500" />
|
android:textColor="?android:textColorPrimary" />
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<Button
|
||||||
android:id="@+id/floating_btn"
|
android:id="@+id/floating_btn"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="bottom|end"
|
|
||||||
android:layout_margin="16dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/ic_send_24dp"/>
|
android:layout_marginLeft="10dp"
|
||||||
|
android:text="@string/action_send" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -83,7 +83,9 @@
|
||||||
<android.support.design.widget.FloatingActionButton
|
<android.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/floating_btn"
|
android:id="@+id/floating_btn"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="bottom|end"
|
app:layout_anchor="@id/pager"
|
||||||
|
app:layout_anchorGravity="bottom|end"
|
||||||
|
android:clickable="true"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/ic_create_24dp"/>
|
app:srcCompat="@drawable/ic_create_24dp"/>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:padding="16dp"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
|
@ -35,13 +36,6 @@
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_margin="@dimen/compose_options_margin"
|
|
||||||
android:id="@+id/compose_mark_sensitive"
|
|
||||||
android:text="@string/action_mark_sensitive" />
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
<item android:id="@+id/compose_photo_pick"
|
|
||||||
android:title="@string/action_photo_pick"
|
|
||||||
android:icon="@drawable/ic_attach_file_24dp"
|
|
||||||
app:showAsAction="always"/>
|
|
||||||
<item android:id="@+id/compose_options"
|
|
||||||
android:title="@string/action_compose_options"
|
|
||||||
android:icon="@drawable/ic_visibility_24dp"
|
|
||||||
app:showAsAction="always"/>
|
|
||||||
</menu>
|
|
|
@ -10,8 +10,8 @@
|
||||||
<dimen name="status_media_preview_height">96dp</dimen>
|
<dimen name="status_media_preview_height">96dp</dimen>
|
||||||
<dimen name="footer_text_padding">8dp</dimen>
|
<dimen name="footer_text_padding">8dp</dimen>
|
||||||
<dimen name="compose_media_preview_margin">8dp</dimen>
|
<dimen name="compose_media_preview_margin">8dp</dimen>
|
||||||
<dimen name="compose_media_preview_margin_bottom">16dp</dimen>
|
<dimen name="compose_media_preview_margin_bottom">0dp</dimen>
|
||||||
<dimen name="compose_media_preview_side">48dp</dimen>
|
<dimen name="compose_media_preview_side">120dp</dimen>
|
||||||
<dimen name="compose_options_margin">8dp</dimen>
|
<dimen name="compose_options_margin">8dp</dimen>
|
||||||
<dimen name="notification_icon_vertical_padding">8dp</dimen>
|
<dimen name="notification_icon_vertical_padding">8dp</dimen>
|
||||||
<dimen name="notification_icon_left_padding">40dp</dimen>
|
<dimen name="notification_icon_left_padding">40dp</dimen>
|
||||||
|
|
|
@ -134,9 +134,9 @@
|
||||||
<string name="dialog_title_finishing_media_upload">Finishing Media Upload</string>
|
<string name="dialog_title_finishing_media_upload">Finishing Media Upload</string>
|
||||||
<string name="dialog_message_uploading_media">Uploading…</string>
|
<string name="dialog_message_uploading_media">Uploading…</string>
|
||||||
|
|
||||||
<string name="visibility_public">Show on public timeline</string>
|
<string name="visibility_public">Everyone can see</string>
|
||||||
<string name="visibility_unlisted">Do not display on public timeline</string>
|
<string name="visibility_unlisted">Everyone can see, but not on public timelines</string>
|
||||||
<string name="visibility_private">Mark as private</string>
|
<string name="visibility_private">Only followers and mentions can see</string>
|
||||||
|
|
||||||
<string name="notification_service_description">Allows Tusky to check for Mastodon notifications.</string>
|
<string name="notification_service_description">Allows Tusky to check for Mastodon notifications.</string>
|
||||||
<string name="notification_service_several_mentions">%d new mentions</string>
|
<string name="notification_service_several_mentions">%d new mentions</string>
|
||||||
|
@ -163,5 +163,6 @@
|
||||||
<string name="error_unmuting">That user wasn\'t unmuted.</string>
|
<string name="error_unmuting">That user wasn\'t unmuted.</string>
|
||||||
<string name="error_muting">That user wasn\'t muted.</string>
|
<string name="error_muting">That user wasn\'t muted.</string>
|
||||||
<string name="search">Search accounts...</string>
|
<string name="search">Search accounts...</string>
|
||||||
|
<string name="toggle_nsfw">NSFW</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<item name="account_toolbar_popup_theme">@style/AppTheme.Account.ToolbarPopupTheme.Dark</item>
|
<item name="account_toolbar_popup_theme">@style/AppTheme.Account.ToolbarPopupTheme.Dark</item>
|
||||||
<item name="compose_media_button_tint">@color/compose_media_button_dark</item>
|
<item name="compose_media_button_tint">@color/compose_media_button_dark</item>
|
||||||
<item name="compose_media_button_disabled_tint">@color/compose_media_button_disabled_dark</item>
|
<item name="compose_media_button_disabled_tint">@color/compose_media_button_disabled_dark</item>
|
||||||
<item name="compose_mention_color">@color/compose_mention_dark</item>
|
<item name="compose_mention_color">@color/color_accent_dark</item>
|
||||||
<item name="compose_content_warning_bar_background">@drawable/border_background_dark</item>
|
<item name="compose_content_warning_bar_background">@drawable/border_background_dark</item>
|
||||||
<item name="notification_content">@color/notification_content_faded_dark</item>
|
<item name="notification_content">@color/notification_content_faded_dark</item>
|
||||||
<item name="notification_icon_tint">@color/notification_icon_tint_dark</item>
|
<item name="notification_icon_tint">@color/notification_icon_tint_dark</item>
|
||||||
|
|
Loading…
Reference in New Issue