diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
index 3ca529f3..3fa42f99 100644
--- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
+++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
@@ -18,7 +18,6 @@ package com.keylesspalace.tusky;
import android.Manifest;
import android.app.ProgressDialog;
import android.content.ContentResolver;
-import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -108,7 +107,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
private static final int PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1;
private static final int MEDIA_SIZE_UNKNOWN = -1;
private static final int COMPOSE_SUCCESS = -1;
- private static final int THUMBNAIL_SIZE = 128;
+ private static final int THUMBNAIL_SIZE = 128; // pixels
private String inReplyToId;
private EditText textEditor;
@@ -346,8 +345,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
actionBar.setHomeAsUpIndicator(closeIcon);
}
- SharedPreferences preferences = getSharedPreferences(
- getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
+ SharedPreferences preferences = getPrivatePreferences();
floatingBtn = (Button) findViewById(R.id.floating_btn);
pickBtn = (ImageButton) findViewById(R.id.compose_photo_pick);
@@ -595,26 +593,53 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
floatingBtn.setEnabled(true);
}
+ private void addLockToSendButton() {
+ floatingBtn.setText(R.string.action_send);
+ Drawable lock = AppCompatResources.getDrawable(this, R.drawable.send_private);
+ if (lock != null) {
+ lock.setBounds(0, 0, lock.getIntrinsicWidth(), lock.getIntrinsicHeight());
+ floatingBtn.setCompoundDrawables(null, null, lock, null);
+ }
+ }
+
private void setStatusVisibility(String visibility) {
statusVisibility = visibility;
switch (visibility) {
case "public": {
floatingBtn.setText(R.string.action_send_public);
floatingBtn.setCompoundDrawables(null, null, null, null);
+ Drawable globe = AppCompatResources.getDrawable(this, R.drawable.ic_public_24dp);
+ if (globe != null) {
+ visibilityBtn.setImageDrawable(globe);
+ }
break;
}
case "private": {
- floatingBtn.setText(R.string.action_send);
- Drawable lock = AppCompatResources.getDrawable(this, R.drawable.send_private);
+ addLockToSendButton();
+ Drawable lock = AppCompatResources.getDrawable(this,
+ R.drawable.ic_lock_outline_24dp);
if (lock != null) {
- lock.setBounds(0, 0, lock.getIntrinsicWidth(), lock.getIntrinsicHeight());
- floatingBtn.setCompoundDrawables(null, null, lock, null);
+ visibilityBtn.setImageDrawable(lock);
}
break;
}
+ case "direct": {
+ addLockToSendButton();
+ Drawable envelope = AppCompatResources.getDrawable(this, R.drawable.ic_email_24dp);
+ if (envelope != null) {
+ visibilityBtn.setImageDrawable(envelope);
+ }
+ break;
+ }
+ case "unlisted":
default: {
floatingBtn.setText(R.string.action_send);
floatingBtn.setCompoundDrawables(null, null, null, null);
+ Drawable openLock = AppCompatResources.getDrawable(this,
+ R.drawable.ic_lock_open_24dp);
+ if (openLock != null) {
+ visibilityBtn.setImageDrawable(openLock);
+ }
break;
}
}
@@ -728,11 +753,9 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
* the status they reply to and that behaviour needs to be kept separate. */
return;
}
- SharedPreferences preferences = getSharedPreferences(
- getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = preferences.edit();
- editor.putString("rememberedVisibility", statusVisibility);
- editor.apply();
+ getPrivatePreferences().edit()
+ .putString("rememberedVisibility", statusVisibility)
+ .apply();
}
private EditText createEditText(String[] contentMimeTypes) {
@@ -967,12 +990,11 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
String imageFileName = "Tusky_" + timeStamp + "_";
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
- File image = File.createTempFile(
+ return File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
- return image;
}
private void initiateCameraApp() {
@@ -1250,19 +1272,11 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
long mediaSize = getMediaSize(getContentResolver(), uri);
pickMedia(uri, mediaSize);
} else if (requestCode == MEDIA_TAKE_PHOTO_RESULT && resultCode == RESULT_OK) {
- queueCameraResult();
+ long mediaSize = getMediaSize(getContentResolver(), photoUploadUri);
+ pickMedia(photoUploadUri, mediaSize);
}
}
- private void queueCameraResult() {
- ContentResolver contentResolver = getContentResolver();
-
- Cursor returnCursor = contentResolver.query(photoUploadUri, null, null, null, null);
- int sizeIndex = returnCursor.getColumnIndex(OpenableColumns.SIZE);
- returnCursor.moveToFirst();
- pickMedia(photoUploadUri, returnCursor.getLong(sizeIndex));
- }
-
private void pickMedia(Uri uri, long mediaSize) {
ContentResolver contentResolver = getContentResolver();
if (mediaSize == MEDIA_SIZE_UNKNOWN) {
diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeOptionsFragment.java b/app/src/main/java/com/keylesspalace/tusky/ComposeOptionsFragment.java
index 25dbd4b8..3f3e1c0b 100644
--- a/app/src/main/java/com/keylesspalace/tusky/ComposeOptionsFragment.java
+++ b/app/src/main/java/com/keylesspalace/tusky/ComposeOptionsFragment.java
@@ -73,10 +73,14 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
radioCheckedId = R.id.radio_unlisted;
}
if (statusVisibility != null) {
- if (statusVisibility.equals("unlisted")) {
- radioCheckedId = R.id.radio_unlisted;
+ if (statusVisibility.equals("public")) {
+ radioCheckedId = R.id.radio_public;
} else if (statusVisibility.equals("private")) {
radioCheckedId = R.id.radio_private;
+ } else if (statusVisibility.equals("unlisted")) {
+ radioCheckedId = R.id.radio_unlisted;
+ } else if (statusVisibility.equals("direct")) {
+ radioCheckedId = R.id.radio_direct;
}
}
radio.check(radioCheckedId);
@@ -113,6 +117,10 @@ public class ComposeOptionsFragment extends BottomSheetDialogFragment {
visibility = "private";
break;
}
+ case R.id.radio_direct: {
+ visibility = "direct";
+ break;
+ }
}
listener.onVisibilityChanged(visibility);
}
diff --git a/app/src/main/res/color/drawer_visibility_panel_item.xml b/app/src/main/res/color/drawer_visibility_panel_item.xml
new file mode 100644
index 00000000..9849dfa9
--- /dev/null
+++ b/app/src/main/res/color/drawer_visibility_panel_item.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_email_24dp.xml b/app/src/main/res/drawable/ic_email_24dp.xml
new file mode 100644
index 00000000..a050d6f8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_email_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_lock_open_24dp.xml b/app/src/main/res/drawable/ic_lock_open_24dp.xml
new file mode 100644
index 00000000..72d7d123
--- /dev/null
+++ b/app/src/main/res/drawable/ic_lock_open_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_lock_outline_24dp.xml b/app/src/main/res/drawable/ic_lock_outline_24dp.xml
new file mode 100644
index 00000000..a0145706
--- /dev/null
+++ b/app/src/main/res/drawable/ic_lock_outline_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/fragment_compose_options.xml b/app/src/main/res/layout/fragment_compose_options.xml
index 986fc6e7..818cf656 100644
--- a/app/src/main/res/layout/fragment_compose_options.xml
+++ b/app/src/main/res/layout/fragment_compose_options.xml
@@ -15,23 +15,48 @@
+
+
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index b3f96b32..2e67ba49 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -109,9 +109,10 @@
Média mis en ligne avec succès
Mise en ligne…
- Afficher dans les fils publics
- Ne pas afficher dans les fils publics
- N’afficher que pour vos abonné⋅e⋅s
+ Public: Afficher dans les fils publics
+ Non-listé: Ne pas afficher dans les fils publics
+ Privé: N\'afficher que pour vos abonné⋅e⋅s
+ Direct: N\'afficher que pour les personnes mentionnées
Notifications
Modifier la notification
diff --git a/app/src/main/res/values-nl/strings.xmp b/app/src/main/res/values-nl/strings.xml
similarity index 99%
rename from app/src/main/res/values-nl/strings.xmp
rename to app/src/main/res/values-nl/strings.xml
index 323010bd..1d747478 100644
--- a/app/src/main/res/values-nl/strings.xmp
+++ b/app/src/main/res/values-nl/strings.xml
@@ -13,7 +13,7 @@
Bestandstype kan niet worden geüpload.
Bestand kan niet worden geopend.
Toestemming nodig om media te kunnen lezen.
- Afbeeldingen en video's kunnen niet allebei aan dezelfde toot worden toegevoegd.
+ Afbeeldingen en video\'s kunnen niet allebei aan dezelfde toot worden toegevoegd.
Uploaden mislukt.
Tenminste één toot moet worden gerapporteerd.
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cd165f3a..d559aeec 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -125,9 +125,10 @@
Uploading…
Download
- Everyone can view
- Everyone can view, but not on public timelines
- Only followers and mentions can view
+ Public: Post to public timelines
+ Unlisted: Do not show in public timelines
+ Private: Post to followers only
+ Direct: Post to mentioned users only
Notifications
Edit Notifications