This commit is contained in:
Florian Haar
2018-10-12 11:10:10 +02:00
8 changed files with 60 additions and 31 deletions
+1 -1
View File
@@ -871,7 +871,7 @@ LOCAL_STATIC_LIBRARIES := etpan sasl2 sqlite crypto libiconv
# "breakpad" was placed after "crypto", NativeLoader.cpp after dc_wrapper.c
LOCAL_CFLAGS := -w -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno -std=c99
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
LOCAL_SRC_FILES := \
+4 -4
View File
@@ -1,5 +1,5 @@
APP_PLATFORM := android-14
APP_ABI := armeabi armeabi-v7a x86
APP_PLATFORM := android-9
APP_STL := stlport_static
APP_CPPFLAGS += -fexceptions
APP_OPTIM := debug
NDK_TOOLCHAIN_VERSION := 4.9
APP_STL := gnustl_static
+1 -3
View File
@@ -590,15 +590,13 @@ JNIEXPORT void Java_com_b44t_messenger_DcContext_setConfig(JNIEnv *env, jobject
JNIEXPORT jstring Java_com_b44t_messenger_DcContext_getConfig(JNIEnv *env, jobject obj, jstring key, jstring def/*may be NULL*/)
{
CHAR_REF(key);
CHAR_REF(def);
char* temp = dc_get_config(get_dc_context(env, obj), keyPtr, defPtr /*is NULL if value is NULL, CHAR_REF() handles this*/);
char* temp = dc_get_config(get_dc_context(env, obj), keyPtr);
jstring ret = NULL;
if (temp) {
ret = JSTRING_NEW(temp);
}
free(temp);
CHAR_UNREF(key);
CHAR_UNREF(def);
return ret; /* returns NULL only if key is unset and "def" is NULL */
}
+2
View File
@@ -752,6 +752,8 @@
<string name="ContactSelectionListFragment_signal_requires_the_contacts_permission_in_order_to_display_your_contacts">Delta Chat requires the Contacts permission in order to display your contacts, but it has been permanently denied. Please continue to the app settings menu, select \"Permissions\", and enable \"Contacts\".</string>
<string name="ContactSelectionListFragment_error_retrieving_contacts_check_your_network_connection">Error retrieving contacts, check your network connection</string>
<string name="ContactSelectionListFragment_error_deleting_contacts_check_existing_conversations">Error deleting contacts, some contacts couldn\'t get deleted. Please delete existing conversations before.</string>
<string name="ContactSelectionListFragment_contact_delete_confirmation_title">Delete contacts?</string>
<string name="ContactSelectionListFragment_contact_delete_confirmation_message">This will permanently delete the selected contacts.\n\nContacts with ongoing chats and contacts from the system\'s address book cannot be deleted permanently.</string>
<!-- blocked_contacts_fragment -->
<string name="blocked_contacts_fragment__no_blocked_contacts">No blocked contacts</string>
@@ -19,6 +19,8 @@ package org.thoughtcrime.securesms;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
@@ -27,10 +29,11 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.view.ActionMode;
import android.util.SparseIntArray;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -53,6 +56,7 @@ import org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter;
import org.thoughtcrime.securesms.contacts.ContactSelectionListItem;
import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.util.Dialogs;
import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.ViewUtil;
@@ -161,6 +165,12 @@ public class ContactSelectionListFragment extends Fragment
public void onDestroyActionMode(ActionMode actionMode) {
ContactSelectionListFragment.this.actionMode = null;
getContactSelectionListAdapter().resetActionModeSelection();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
TypedArray color = getActivity().getTheme().obtainStyledAttributes(new int[] {android.R.attr.statusBarColor});
getActivity().getWindow().setStatusBarColor(color.getColor(0, Color.BLACK));
color.recycle();
}
}
};
@@ -176,23 +186,25 @@ public class ContactSelectionListFragment extends Fragment
}
private void handleDeleteSelected() {
ContactSelectionListAdapter adapter = getContactSelectionListAdapter();
final SparseIntArray actionModeSelection = adapter.getActionModeSelection().clone();
new Thread(() -> {
boolean failed = false;
for (int index = 0; index < actionModeSelection.size(); index++) {
int contactId = actionModeSelection.valueAt(index);
boolean currentFailed = !dcContext.deleteContact(contactId);
failed = currentFailed || failed;
}
if (failed) {
Util.runOnMain(()-> {
Toast.makeText(getActivity(), R.string.ContactSelectionListFragment_error_deleting_contacts_check_existing_conversations, Toast.LENGTH_LONG).show();
});
}
}).start();
adapter.resetActionModeSelection();
actionMode.finish();
Dialogs.showResponseDialog(getActivity(), getString(R.string.ContactSelectionListFragment_contact_delete_confirmation_title), getString(R.string.ContactSelectionListFragment_contact_delete_confirmation_message), (dialogInterface, i) -> {
ContactSelectionListAdapter adapter = getContactSelectionListAdapter();
final SparseIntArray actionModeSelection = adapter.getActionModeSelection().clone();
new Thread(() -> {
boolean failed = false;
for (int index = 0; index < actionModeSelection.size(); index++) {
int contactId = actionModeSelection.valueAt(index);
boolean currentFailed = !dcContext.deleteContact(contactId);
failed = currentFailed || failed;
}
if (failed) {
Util.runOnMain(()-> {
Toast.makeText(getActivity(), R.string.ContactSelectionListFragment_error_deleting_contacts_check_existing_conversations, Toast.LENGTH_LONG).show();
});
}
}).start();
adapter.resetActionModeSelection();
actionMode.finish();
});
}
private ContactSelectionListAdapter getContactSelectionListAdapter() {
@@ -355,7 +367,7 @@ public class ContactSelectionListFragment extends Fragment
@Override
public void onItemLongClick(ContactSelectionListItem view) {
if (actionMode == null) {
actionMode = Objects.requireNonNull(getActivity()).startActionMode(actionModeCallback);
actionMode = ((AppCompatActivity)getActivity()).startSupportActionMode(actionModeCallback);
} else {
finishActionModeIfSelectionIsEmpty();
}
@@ -376,14 +376,20 @@ public class ConversationItem extends LinearLayout
bodyText.setFocusable(false);
bodyText.setTextSize(TypedValue.COMPLEX_UNIT_SP, TextSecurePreferences.getMessageBodyTextSize(context));
String text = messageRecord.getText();
if (messageRecord.isSetupMessage()) {
bodyText.setText(context.getString(R.string.autocrypt__asm_tap_body));
bodyText.setText(context.getString(R.string.autocrypt__asm_tap_body));
bodyText.setVisibility(View.VISIBLE);
}
else if (text.isEmpty()) {
bodyText.setVisibility(View.GONE);
}
else {
bodyText.setText(linkifyMessageBody(new SpannableString(messageRecord.getText()), batchSelected.isEmpty()));
bodyText.setText(linkifyMessageBody(new SpannableString(text), batchSelected.isEmpty()));
bodyText.setVisibility(View.VISIBLE);
}
bodyText.setVisibility(View.VISIBLE);
}
private void setMediaAttributes(@NonNull DcMsg messageRecord,
@@ -17,11 +17,22 @@
package org.thoughtcrime.securesms.util;
import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import org.thoughtcrime.securesms.R;
public class Dialogs {
public static void showResponseDialog(Context context, String title, String message, DialogInterface.OnClickListener listener) {
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setIconAttribute(R.attr.dialog_alert_icon);
dialog.setPositiveButton(android.R.string.ok, listener);
dialog.setNegativeButton(android.R.string.cancel, null);
dialog.show();
}
public static void showAlertDialog(Context context, String title, String message) {
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.setTitle(title);