mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Create UI path to new conversation screen
This commit is contained in:
parent
858b34306b
commit
b4328d1aa3
@ -14,7 +14,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0px"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/contact_selection_activity__enter_name_or_number"
|
||||
android:hint="@string/activity_contact_selection_search_bar_placeholder"
|
||||
android:inputType="textPersonName"
|
||||
style="@style/TextSecure.TitleTextStyle"
|
||||
android:background="@android:color/transparent"
|
||||
@ -33,26 +33,26 @@
|
||||
android:paddingEnd="10dp"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView android:id="@+id/search_dialpad"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="@drawable/circle_touch_highlight_background"
|
||||
android:src="@drawable/ic_dialpad_white_24dp" />
|
||||
<!--<ImageView android:id="@+id/search_dialpad"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_gravity="center_vertical"-->
|
||||
<!--android:gravity="center_vertical"-->
|
||||
<!--android:clickable="true"-->
|
||||
<!--android:focusable="true"-->
|
||||
<!--android:background="@drawable/circle_touch_highlight_background"-->
|
||||
<!--android:src="@drawable/ic_dialpad_white_24dp" />-->
|
||||
|
||||
<ImageView android:id="@+id/search_keyboard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:clickable="true"
|
||||
android:visibility="gone"
|
||||
android:focusable="true"
|
||||
android:background="@drawable/circle_touch_highlight_background"
|
||||
android:src="@drawable/ic_keyboard_white_24dp" />
|
||||
<!--<ImageView android:id="@+id/search_keyboard"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_gravity="center_vertical"-->
|
||||
<!--android:gravity="center_vertical"-->
|
||||
<!--android:clickable="true"-->
|
||||
<!--android:visibility="gone"-->
|
||||
<!--android:focusable="true"-->
|
||||
<!--android:background="@drawable/circle_touch_highlight_background"-->
|
||||
<!--android:src="@drawable/ic_keyboard_white_24dp" />-->
|
||||
|
||||
<ImageView android:id="@+id/search_clear"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -1529,8 +1529,14 @@
|
||||
<string name="activity_key_pair_copy_button_title">Copy</string>
|
||||
<string name="activity_key_pair_mnemonic_copied_message">Copied to Clipboard</string>
|
||||
<string name="activity_key_pair_register_button_title">Register</string>
|
||||
<!-- Settings -->
|
||||
<!-- Settings activity -->
|
||||
<string name="activity_settings_share_public_key_button_title">Share Public Key</string>
|
||||
<string name="activity_settings_public_key_copied_message">Copied to Clipboard</string>
|
||||
<string name="activity_settings_show_seed_button_title">Show Seed</string>
|
||||
<string name="activity_settings_seed_dialog_title">Your Seed</string>
|
||||
<string name="activity_settings_seed_dialog_copy_button_title">Copy</string>
|
||||
<string name="activity_settings_seed_dialog_cancel_button_title">Cancel</string>
|
||||
<string name="activity_settings_seed_copied_message">Copied to Clipboard</string>
|
||||
<!-- Contact selection activity -->
|
||||
<string name="activity_contact_selection_search_bar_placeholder">Search by name or public key</string>
|
||||
|
||||
</resources>
|
||||
|
@ -37,4 +37,8 @@
|
||||
android:title="@string/activity_settings_share_public_key_button_title"
|
||||
android:icon="@drawable/ic_textsms_24dp"/>
|
||||
|
||||
<Preference android:key="preference_category_seed"
|
||||
android:title="@string/activity_settings_show_seed_button_title"
|
||||
android:icon="@drawable/ic_security_24dp"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@ -21,6 +21,7 @@ import android.annotation.TargetApi;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.TypedArray;
|
||||
@ -34,9 +35,11 @@ import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||
import org.thoughtcrime.securesms.preferences.AdvancedPreferenceFragment;
|
||||
import org.thoughtcrime.securesms.preferences.AppProtectionPreferenceFragment;
|
||||
import org.thoughtcrime.securesms.preferences.AppearancePreferenceFragment;
|
||||
@ -48,9 +51,11 @@ import org.thoughtcrime.securesms.preferences.widgets.ProfilePreference;
|
||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.IdentityUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.loki.crypto.MnemonicCodec;
|
||||
import org.whispersystems.signalservice.loki.utilities.SerializationKt;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* The Activity for application preference display and management.
|
||||
@ -74,6 +79,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
private static final String PREFERENCE_CATEGORY_DEVICES = "preference_category_devices";
|
||||
private static final String PREFERENCE_CATEGORY_ADVANCED = "preference_category_advanced";
|
||||
private static final String PREFERENCE_CATEGORY_PUBLIC_KEY = "preference_category_public_key";
|
||||
private static final String PREFERENCE_CATEGORY_SEED = "preference_category_seed";
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||
@ -162,6 +168,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_ADVANCED));
|
||||
this.findPreference(PREFERENCE_CATEGORY_PUBLIC_KEY)
|
||||
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_PUBLIC_KEY));
|
||||
this.findPreference(PREFERENCE_CATEGORY_SEED)
|
||||
.setOnPreferenceClickListener(new CategoryClickListener((PREFERENCE_CATEGORY_SEED)));
|
||||
|
||||
if (VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
tintIcons(getActivity());
|
||||
@ -213,7 +221,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
Drawable chats = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_forum_white_24dp));
|
||||
Drawable devices = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_laptop_white_24dp));
|
||||
Drawable advanced = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_advanced_white_24dp));
|
||||
Drawable publicKey = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_share_white_24dp));
|
||||
Drawable publicKey = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_textsms_24dp));
|
||||
Drawable seed = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_security_24dp));
|
||||
|
||||
int[] tintAttr = new int[]{R.attr.pref_icon_tint};
|
||||
TypedArray typedArray = context.obtainStyledAttributes(tintAttr);
|
||||
@ -227,6 +236,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
DrawableCompat.setTint(chats, color);
|
||||
DrawableCompat.setTint(devices, color);
|
||||
DrawableCompat.setTint(advanced, color);
|
||||
DrawableCompat.setTint(publicKey, color);
|
||||
DrawableCompat.setTint(seed, color);
|
||||
|
||||
this.findPreference(PREFERENCE_CATEGORY_SMS_MMS).setIcon(sms);
|
||||
this.findPreference(PREFERENCE_CATEGORY_NOTIFICATIONS).setIcon(notifications);
|
||||
@ -236,6 +247,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
this.findPreference(PREFERENCE_CATEGORY_DEVICES).setIcon(devices);
|
||||
this.findPreference(PREFERENCE_CATEGORY_ADVANCED).setIcon(advanced);
|
||||
this.findPreference(PREFERENCE_CATEGORY_PUBLIC_KEY).setIcon(publicKey);
|
||||
this.findPreference(PREFERENCE_CATEGORY_SEED).setIcon(seed);
|
||||
}
|
||||
|
||||
private class CategoryClickListener implements Preference.OnPreferenceClickListener {
|
||||
@ -280,6 +292,22 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
shareIntent.setType("text/plain");
|
||||
startActivity(shareIntent);
|
||||
break;
|
||||
case PREFERENCE_CATEGORY_SEED:
|
||||
File languageFileDirectory = new File(getContext().getApplicationInfo().dataDir);
|
||||
String hexEncodedPrivateKey = SerializationKt.getHexEncodedPrivateKey(IdentityKeyUtil.getIdentityKeyPair(getContext()));
|
||||
String seed = new MnemonicCodec(languageFileDirectory).encode(hexEncodedPrivateKey, MnemonicCodec.Language.Configuration.Companion.getEnglish());
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle(R.string.activity_settings_seed_dialog_title)
|
||||
.setMessage(seed)
|
||||
.setPositiveButton(R.string.activity_settings_seed_dialog_copy_button_title, (DialogInterface.OnClickListener) (dialog, which) -> {
|
||||
ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("seed", seed);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(getContext(), R.string.activity_settings_seed_copied_message, Toast.LENGTH_SHORT).show();
|
||||
})
|
||||
.setNeutralButton(R.string.activity_settings_seed_dialog_cancel_button_title, null)
|
||||
.show();
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.database.Cursor;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
@ -33,7 +32,6 @@ import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -51,7 +49,6 @@ import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -99,26 +96,28 @@ public class ContactSelectionListFragment extends Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
Permissions.with(this)
|
||||
.request(Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS)
|
||||
.ifNecessary()
|
||||
.onAllGranted(() -> {
|
||||
if (!TextSecurePreferences.hasSuccessfullyRetrievedDirectory(getActivity())) {
|
||||
handleContactPermissionGranted();
|
||||
} else {
|
||||
this.getLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
})
|
||||
.onAnyDenied(() -> {
|
||||
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
handleContactPermissionGranted();
|
||||
|
||||
if (getActivity().getIntent().getBooleanExtra(RECENTS, false)) {
|
||||
getLoaderManager().initLoader(0, null, ContactSelectionListFragment.this);
|
||||
} else {
|
||||
initializeNoContactsPermission();
|
||||
}
|
||||
})
|
||||
.execute();
|
||||
// Permissions.with(this)
|
||||
// .request(Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS)
|
||||
// .ifNecessary()
|
||||
// .onAllGranted(() -> {
|
||||
// if (!TextSecurePreferences.hasSuccessfullyRetrievedDirectory(getActivity())) {
|
||||
// handleContactPermissionGranted();
|
||||
// } else {
|
||||
// this.getLoaderManager().initLoader(0, null, this);
|
||||
// }
|
||||
// })
|
||||
// .onAnyDenied(() -> {
|
||||
// getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
//
|
||||
// if (getActivity().getIntent().getBooleanExtra(RECENTS, false)) {
|
||||
// getLoaderManager().initLoader(0, null, ContactSelectionListFragment.this);
|
||||
// } else {
|
||||
// initializeNoContactsPermission();
|
||||
// }
|
||||
// })
|
||||
// .execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,10 +18,7 @@ package org.thoughtcrime.securesms;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
@ -91,12 +88,12 @@ public class NewConversationActivity extends ContactSelectionActivity {
|
||||
startActivity(new Intent(this, InviteActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onPrepareOptionsPanel(View view, Menu menu) {
|
||||
MenuInflater inflater = this.getMenuInflater();
|
||||
menu.clear();
|
||||
inflater.inflate(R.menu.new_conversation_activity, menu);
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
return true;
|
||||
}
|
||||
// @Override
|
||||
// protected boolean onPrepareOptionsPanel(View view, Menu menu) {
|
||||
// MenuInflater inflater = this.getMenuInflater();
|
||||
// menu.clear();
|
||||
// inflater.inflate(R.menu.new_conversation_activity, menu);
|
||||
// super.onPrepareOptionsMenu(menu);
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
public class ContactFilterToolbar extends Toolbar {
|
||||
@ -22,8 +21,8 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
|
||||
private EditText searchText;
|
||||
private AnimatingToggle toggle;
|
||||
private ImageView keyboardToggle;
|
||||
private ImageView dialpadToggle;
|
||||
// private ImageView keyboardToggle;
|
||||
// private ImageView dialpadToggle;
|
||||
private ImageView clearToggle;
|
||||
private LinearLayout toggleContainer;
|
||||
|
||||
@ -41,36 +40,36 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
|
||||
this.searchText = ViewUtil.findById(this, R.id.search_view);
|
||||
this.toggle = ViewUtil.findById(this, R.id.button_toggle);
|
||||
this.keyboardToggle = ViewUtil.findById(this, R.id.search_keyboard);
|
||||
this.dialpadToggle = ViewUtil.findById(this, R.id.search_dialpad);
|
||||
// this.keyboardToggle = ViewUtil.findById(this, R.id.search_keyboard);
|
||||
// this.dialpadToggle = ViewUtil.findById(this, R.id.search_dialpad);
|
||||
this.clearToggle = ViewUtil.findById(this, R.id.search_clear);
|
||||
this.toggleContainer = ViewUtil.findById(this, R.id.toggle_container);
|
||||
|
||||
this.keyboardToggle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
|
||||
ServiceUtil.getInputMethodManager(getContext()).showSoftInput(searchText, 0);
|
||||
displayTogglingView(dialpadToggle);
|
||||
}
|
||||
});
|
||||
// this.keyboardToggle.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// searchText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
|
||||
// ServiceUtil.getInputMethodManager(getContext()).showSoftInput(searchText, 0);
|
||||
// displayTogglingView(dialpadToggle);
|
||||
// }
|
||||
// });
|
||||
|
||||
this.dialpadToggle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchText.setInputType(InputType.TYPE_CLASS_PHONE);
|
||||
ServiceUtil.getInputMethodManager(getContext()).showSoftInput(searchText, 0);
|
||||
displayTogglingView(keyboardToggle);
|
||||
}
|
||||
});
|
||||
// this.dialpadToggle.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// searchText.setInputType(InputType.TYPE_CLASS_PHONE);
|
||||
// ServiceUtil.getInputMethodManager(getContext()).showSoftInput(searchText, 0);
|
||||
// displayTogglingView(keyboardToggle);
|
||||
// }
|
||||
// });
|
||||
|
||||
this.clearToggle.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchText.setText("");
|
||||
|
||||
if (SearchUtil.isTextInput(searchText)) displayTogglingView(dialpadToggle);
|
||||
else displayTogglingView(keyboardToggle);
|
||||
// if (SearchUtil.isTextInput(searchText)) displayTogglingView(dialpadToggle);
|
||||
// else displayTogglingView(keyboardToggle);
|
||||
}
|
||||
});
|
||||
|
||||
@ -88,15 +87,17 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!SearchUtil.isEmpty(searchText)) displayTogglingView(clearToggle);
|
||||
else if (SearchUtil.isTextInput(searchText)) displayTogglingView(dialpadToggle);
|
||||
else if (SearchUtil.isPhoneInput(searchText)) displayTogglingView(keyboardToggle);
|
||||
else displayTogglingView(null);
|
||||
// else if (SearchUtil.isTextInput(searchText)) displayTogglingView(dialpadToggle);
|
||||
// else if (SearchUtil.isPhoneInput(searchText)) displayTogglingView(keyboardToggle);
|
||||
notifyListener();
|
||||
}
|
||||
});
|
||||
|
||||
setLogo(null);
|
||||
setContentInsetStartWithNavigation(0);
|
||||
expandTapArea(toggleContainer, dialpadToggle);
|
||||
displayTogglingView(null);
|
||||
// expandTapArea(toggleContainer, dialpadToggle);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
@ -114,7 +115,9 @@ public class ContactFilterToolbar extends Toolbar {
|
||||
|
||||
private void displayTogglingView(View view) {
|
||||
toggle.display(view);
|
||||
expandTapArea(toggleContainer, view);
|
||||
if (view != null) {
|
||||
expandTapArea(toggleContainer, view);
|
||||
}
|
||||
}
|
||||
|
||||
private void expandTapArea(final View container, final View child) {
|
||||
|
Loading…
Reference in New Issue
Block a user