From fc096d42beafa654bb53c8f0c570d59abd3286c4 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 21 Sep 2018 23:41:16 +0200 Subject: [PATCH] remove unneded play-services and sms code --- AndroidManifest.xml | 36 ------ .../securesms/ConversationListItem.java | 2 - .../PlayServicesProblemActivity.java | 30 ----- .../PlayServicesProblemFragment.java | 64 ----------- .../securesms/SmsSendtoActivity.java | 108 ------------------ .../securesms/webrtc/VoiceCallShare.java | 50 -------- 6 files changed, 290 deletions(-) delete mode 100644 src/org/thoughtcrime/securesms/PlayServicesProblemActivity.java delete mode 100644 src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java delete mode 100644 src/org/thoughtcrime/securesms/SmsSendtoActivity.java delete mode 100644 src/org/thoughtcrime/securesms/webrtc/VoiceCallShare.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 0745865a4..302fe5f9b 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -299,42 +299,6 @@ android:clearTaskOnLaunch="true" android:finishOnTaskLaunch="true" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/org/thoughtcrime/securesms/ConversationListItem.java b/src/org/thoughtcrime/securesms/ConversationListItem.java index 9f2479337..40eb80233 100644 --- a/src/org/thoughtcrime/securesms/ConversationListItem.java +++ b/src/org/thoughtcrime/securesms/ConversationListItem.java @@ -59,8 +59,6 @@ import java.util.List; import java.util.Locale; import java.util.Set; -import static org.thoughtcrime.securesms.util.SpanUtil.color; - public class ConversationListItem extends RelativeLayout implements RecipientModifiedListener, BindableConversationListItem, Unbindable diff --git a/src/org/thoughtcrime/securesms/PlayServicesProblemActivity.java b/src/org/thoughtcrime/securesms/PlayServicesProblemActivity.java deleted file mode 100644 index 216fab99f..000000000 --- a/src/org/thoughtcrime/securesms/PlayServicesProblemActivity.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2014 Open Whisper Systems - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.thoughtcrime.securesms; - -import android.os.Bundle; -import android.support.v4.app.FragmentActivity; - -public class PlayServicesProblemActivity extends FragmentActivity { - - @Override - public void onCreate(Bundle bundle) { - super.onCreate(bundle); - PlayServicesProblemFragment fragment = new PlayServicesProblemFragment(); - fragment.show(getSupportFragmentManager(), "dialog"); - } -} diff --git a/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java b/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java deleted file mode 100644 index 898b881a9..000000000 --- a/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (C) 2014 Open Whisper Systems - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.thoughtcrime.securesms; - -import android.app.Activity; -import android.app.Dialog; -import android.content.DialogInterface; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; - -import com.google.android.gms.common.GooglePlayServicesUtil; - -public class PlayServicesProblemFragment extends DialogFragment { - - @Override - public @NonNull Dialog onCreateDialog(@NonNull Bundle bundle) { - int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()); - Dialog dialog = GooglePlayServicesUtil.getErrorDialog(code, getActivity(), 9111); - - if (dialog == null) { - return new AlertDialog.Builder(getActivity()) - .setNegativeButton(android.R.string.ok, null) - .setMessage(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning) - .create(); - } else { - return dialog; - } - } - - @Override - public void onCancel(DialogInterface dialog) { - super.onCancel(dialog); - finish(); - } - - @Override - public void onDismiss(DialogInterface dialog) { - super.onDismiss(dialog); - finish(); - } - - private void finish() { - Activity activity = getActivity(); - if (activity != null) activity.finish(); - } - -} diff --git a/src/org/thoughtcrime/securesms/SmsSendtoActivity.java b/src/org/thoughtcrime/securesms/SmsSendtoActivity.java deleted file mode 100644 index 8134e3dcf..000000000 --- a/src/org/thoughtcrime/securesms/SmsSendtoActivity.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.thoughtcrime.securesms; - -import android.app.Activity; -import android.content.Intent; -import android.database.Cursor; -import android.os.Bundle; -import android.provider.ContactsContract; -import android.support.annotation.NonNull; -import android.text.TextUtils; -import android.util.Log; -import android.widget.Toast; - -import org.thoughtcrime.securesms.database.Address; -import org.thoughtcrime.securesms.database.DatabaseFactory; -import org.thoughtcrime.securesms.recipients.Recipient; -import org.thoughtcrime.securesms.util.Rfc5724Uri; - -import java.net.URISyntaxException; - -public class SmsSendtoActivity extends Activity { - - private static final String TAG = SmsSendtoActivity.class.getSimpleName(); - - @Override - protected void onCreate(Bundle savedInstanceState) { - startActivity(getNextIntent(getIntent())); - finish(); - super.onCreate(savedInstanceState); - } - - private Intent getNextIntent(Intent original) { - DestinationAndBody destination; - - if (original.getAction().equals(Intent.ACTION_SENDTO)) { - destination = getDestinationForSendTo(original); - } else if (original.getData() != null && "content".equals(original.getData().getScheme())) { - destination = getDestinationForSyncAdapter(original); - } else { - destination = getDestinationForView(original); - } - - final Intent nextIntent; - - if (TextUtils.isEmpty(destination.destination)) { - nextIntent = new Intent(this, NewConversationActivity.class); - nextIntent.putExtra(ConversationActivity.TEXT_EXTRA, destination.getBody()); - Toast.makeText(this, R.string.ConversationActivity_specify_recipient, Toast.LENGTH_LONG).show(); - } else { - Recipient recipient = Recipient.from(this, Address.fromExternal(this, destination.getDestination()), true); - long threadId = DatabaseFactory.getThreadDatabase(this).getThreadIdIfExistsFor(recipient); - - nextIntent = new Intent(this, ConversationActivity.class); - nextIntent.putExtra(ConversationActivity.TEXT_EXTRA, destination.getBody()); - nextIntent.putExtra(ConversationActivity.THREAD_ID_EXTRA, threadId); - nextIntent.putExtra(ConversationActivity.ADDRESS_EXTRA, recipient.getAddress()); - } - return nextIntent; - } - - private @NonNull DestinationAndBody getDestinationForSendTo(Intent intent) { - return new DestinationAndBody(intent.getData().getSchemeSpecificPart(), - intent.getStringExtra("sms_body")); - } - - private @NonNull DestinationAndBody getDestinationForView(Intent intent) { - try { - Rfc5724Uri smsUri = new Rfc5724Uri(intent.getData().toString()); - return new DestinationAndBody(smsUri.getPath(), smsUri.getQueryParams().get("body")); - } catch (URISyntaxException e) { - Log.w(TAG, "unable to parse RFC5724 URI from intent", e); - return new DestinationAndBody("", ""); - } - } - - private @NonNull DestinationAndBody getDestinationForSyncAdapter(Intent intent) { - Cursor cursor = null; - - try { - cursor = getContentResolver().query(intent.getData(), null, null, null, null); - - if (cursor != null && cursor.moveToNext()) { - return new DestinationAndBody(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.RawContacts.Data.DATA1)), ""); - } - - return new DestinationAndBody("", ""); - } finally { - if (cursor != null) cursor.close(); - } - } - - private static class DestinationAndBody { - private final String destination; - private final String body; - - private DestinationAndBody(String destination, String body) { - this.destination = destination; - this.body = body; - } - - public String getDestination() { - return destination; - } - - public String getBody() { - return body; - } - } -} diff --git a/src/org/thoughtcrime/securesms/webrtc/VoiceCallShare.java b/src/org/thoughtcrime/securesms/webrtc/VoiceCallShare.java deleted file mode 100644 index ddf7f217a..000000000 --- a/src/org/thoughtcrime/securesms/webrtc/VoiceCallShare.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.thoughtcrime.securesms.webrtc; - -import android.app.Activity; -import android.content.Intent; -import android.database.Cursor; -import android.os.Bundle; -import android.provider.ContactsContract; -import android.text.TextUtils; - -import org.thoughtcrime.securesms.WebRtcCallActivity; -import org.thoughtcrime.securesms.database.Address; -import org.thoughtcrime.securesms.service.WebRtcCallService; - -public class VoiceCallShare extends Activity { - - private static final String TAG = VoiceCallShare.class.getSimpleName(); - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - - if (getIntent().getData() != null && "content".equals(getIntent().getData().getScheme())) { - Cursor cursor = null; - - try { - cursor = getContentResolver().query(getIntent().getData(), null, null, null, null); - - if (cursor != null && cursor.moveToNext()) { - String destination = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.RawContacts.Data.DATA1)); - Address address = Address.fromExternal(this, destination); - - if (!TextUtils.isEmpty(destination)) { - Intent serviceIntent = new Intent(this, WebRtcCallService.class); - serviceIntent.setAction(WebRtcCallService.ACTION_OUTGOING_CALL); - serviceIntent.putExtra(WebRtcCallService.EXTRA_REMOTE_ADDRESS, address); - startService(serviceIntent); - - Intent activityIntent = new Intent(this, WebRtcCallActivity.class); - activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(activityIntent); - } - } - } finally { - if (cursor != null) cursor.close(); - } - } - - finish(); - } -}