mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
tune down entering email addresses manually (#3064)
* reword 'QR code' to 'Invite Code' * reword adding classic email * remove the 'new contact' things together * add 'new classic contact' shortcut only for non-chatmail; it is still always available in the three-dot menu of 'new contact' * use same menu for qr show/scan * add 'new classic contact' * remove 'scan' button from 'new classic contact' (ppl usually came from 'scan') * rename to 'add contact manually' * stay with 'qr code' for now
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#80B0B0B0"
|
||||
android:endColor="@color/transparent"
|
||||
android:type="linear" />
|
||||
|
||||
</shape>
|
||||
@@ -1,10 +0,0 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="@color/transparent"
|
||||
android:endColor="#80B0B0B0"
|
||||
android:type="linear" />
|
||||
|
||||
</shape>
|
||||
@@ -10,15 +10,10 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_root_start_shifted"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="16dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_begin="14dp" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_root_start"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -33,72 +28,13 @@
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_end="16dp" />
|
||||
|
||||
<androidx.legacy.widget.Space
|
||||
android:id="@+id/fab_spacer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<Button
|
||||
style="@style/ButtonSecondary"
|
||||
android:id="@+id/qrscan_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:text="@string/qrscan_title"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableStartCompat="@drawable/baseline_qr_code_24"
|
||||
app:drawableLeftCompat="@drawable/baseline_qr_code_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/fab_spacer"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/or_divider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="@id/qrscan_btn"
|
||||
app:layout_constraintEnd_toEndOf="@id/qrscan_btn"
|
||||
app:layout_constraintTop_toBottomOf="@id/qrscan_btn">
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/divider_start"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_weight="0"
|
||||
android:gravity="center"
|
||||
android:text="@string/or_separator"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textColor="@color/gray50"/>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/divider_end"/>
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/or_divider">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/name_text"
|
||||
|
||||
@@ -1,13 +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:title="@string/paste_from_clipboard"
|
||||
android:id="@+id/paste"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:title="@string/load_qr_code_as_image"
|
||||
android:id="@+id/load_from_image"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
@@ -7,10 +7,22 @@
|
||||
android:icon="@drawable/ic_share_white_24dp"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item android:title="@string/menu_new_classic_contact"
|
||||
android:id="@+id/new_classic_contact"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:title="@string/menu_copy_to_clipboard"
|
||||
android:id="@+id/copy"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:title="@string/paste_from_clipboard"
|
||||
android:id="@+id/paste"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:title="@string/load_qr_code_as_image"
|
||||
android:id="@+id/load_from_image"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item android:title="@string/withdraw_qr_code"
|
||||
android:id="@+id/withdraw"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
@@ -199,6 +199,7 @@
|
||||
|
||||
<!-- menu labels (or icon, buttons...) -->
|
||||
<string name="menu_new_contact">New Contact</string>
|
||||
<string name="menu_new_classic_contact">Add Contact Manually</string>
|
||||
<string name="menu_new_chat">New Chat</string>
|
||||
<string name="menu_new_group">New Group</string>
|
||||
<string name="clone_chat">Clone Chat</string>
|
||||
|
||||
@@ -6,7 +6,7 @@ public class DcContact {
|
||||
public final static int DC_CONTACT_ID_INFO = 2;
|
||||
public final static int DC_CONTACT_ID_DEVICE = 5;
|
||||
public final static int DC_CONTACT_ID_LAST_SPECIAL = 9;
|
||||
public final static int DC_CONTACT_ID_NEW_CONTACT = -1; // used by the UI, not valid to the core
|
||||
public final static int DC_CONTACT_ID_NEW_CLASSIC_CONTACT= -1; // used by the UI, not valid to the core
|
||||
public final static int DC_CONTACT_ID_NEW_GROUP = -2; // - " -
|
||||
public final static int DC_CONTACT_ID_ADD_MEMBER = -3; // - " -
|
||||
public final static int DC_CONTACT_ID_QR_INVITE = -4; // - " -
|
||||
|
||||
@@ -350,7 +350,7 @@ public class ContactSelectionListFragment extends Fragment
|
||||
int specialId = contact.getSpecialId();
|
||||
String addr = contact.getNumber();
|
||||
if (!isMulti() || !selectedContacts.contains(addr)) {
|
||||
if (specialId == DcContact.DC_CONTACT_ID_NEW_CONTACT) {
|
||||
if (specialId == DcContact.DC_CONTACT_ID_NEW_CLASSIC_CONTACT) {
|
||||
Intent intent = new Intent(getContext(), NewContactActivity.class);
|
||||
if (dcContext.mayBeValidAddr(cursorFilter)) {
|
||||
intent.putExtra(NewContactActivity.ADDR_EXTRA, cursorFilter);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class NewConversationActivity extends ContactSelectionActivity {
|
||||
if (!textToShare.isEmpty()) {
|
||||
getIntent().putExtra(TEXT_EXTRA, textToShare);
|
||||
}
|
||||
onContactSelected(DcContact.DC_CONTACT_ID_NEW_CONTACT, recipientsArray[0]);
|
||||
onContactSelected(DcContact.DC_CONTACT_ID_NEW_CLASSIC_CONTACT, recipientsArray[0]);
|
||||
} else {
|
||||
Intent shareIntent = new Intent(this, ShareActivity.class);
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, textToShare);
|
||||
|
||||
@@ -46,15 +46,15 @@ public class DcContactsLoader extends AsyncLoader<DcContactsLoader.Ret> {
|
||||
{
|
||||
additional_items = Util.appendInt(additional_items, DcContact.DC_CONTACT_ID_QR_INVITE);
|
||||
}
|
||||
if (addCreateContactLink && !dcContext.isChatmail())
|
||||
{
|
||||
additional_items = Util.appendInt(additional_items, DcContact.DC_CONTACT_ID_NEW_CLASSIC_CONTACT);
|
||||
}
|
||||
if (query == null && addCreateGroupLinks) {
|
||||
additional_items = Util.appendInt(additional_items, DcContact.DC_CONTACT_ID_NEW_GROUP);
|
||||
final boolean broadcastsEnabled = Prefs.isNewBroadcastListAvailable(getContext());
|
||||
if (broadcastsEnabled) additional_items = Util.appendInt(additional_items, DcContact.DC_CONTACT_ID_NEW_BROADCAST_LIST);
|
||||
}
|
||||
if (addCreateContactLink)
|
||||
{
|
||||
additional_items = Util.appendInt(additional_items, DcContact.DC_CONTACT_ID_NEW_CONTACT);
|
||||
}
|
||||
int all_ids[] = new int[contact_ids.length + additional_items.length];
|
||||
System.arraycopy(additional_items, 0, all_ids, 0, additional_items.length);
|
||||
System.arraycopy(contact_ids, 0, all_ids, additional_items.length, contact_ids.length);
|
||||
|
||||
@@ -271,15 +271,15 @@ public class ContactSelectionListAdapter extends RecyclerView.Adapter
|
||||
String addr = null;
|
||||
boolean itemMultiSelect = multiSelect;
|
||||
|
||||
if (id == DcContact.DC_CONTACT_ID_NEW_CONTACT) {
|
||||
name = context.getString(R.string.menu_new_contact);
|
||||
if (id == DcContact.DC_CONTACT_ID_NEW_CLASSIC_CONTACT) {
|
||||
name = context.getString(R.string.menu_new_classic_contact);
|
||||
itemMultiSelect = false; // the item creates a new contact in the list that will be selected instead
|
||||
} else if (id == DcContact.DC_CONTACT_ID_NEW_GROUP) {
|
||||
name = context.getString(R.string.menu_new_group);
|
||||
} else if (id == DcContact.DC_CONTACT_ID_NEW_BROADCAST_LIST) {
|
||||
name = context.getString(R.string.new_broadcast_list);
|
||||
} else if (id == DcContact.DC_CONTACT_ID_QR_INVITE) {
|
||||
name = context.getString(R.string.qrscan_title);
|
||||
name = context.getString(R.string.menu_new_contact);
|
||||
} else {
|
||||
dcContact = getContact(i);
|
||||
name = dcContact.getDisplayName();
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientM
|
||||
this.name = name;
|
||||
this.number = number;
|
||||
|
||||
if (specialId==DcContact.DC_CONTACT_ID_NEW_CONTACT || specialId==DcContact.DC_CONTACT_ID_NEW_GROUP
|
||||
if (specialId==DcContact.DC_CONTACT_ID_NEW_CLASSIC_CONTACT || specialId==DcContact.DC_CONTACT_ID_NEW_GROUP
|
||||
|| specialId==DcContact.DC_CONTACT_ID_NEW_BROADCAST_LIST
|
||||
|| specialId==DcContact.DC_CONTACT_ID_ADD_MEMBER || specialId==DcContact.DC_CONTACT_ID_QR_INVITE) {
|
||||
this.recipient = null;
|
||||
|
||||
@@ -40,16 +40,13 @@ public class NewContactActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.menu_new_contact);
|
||||
actionBar.setTitle(R.string.menu_new_classic_contact);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
|
||||
}
|
||||
|
||||
nameInput = ViewUtil.findById(this, R.id.name_text);
|
||||
addrInput = ViewUtil.findById(this, R.id.email_text);
|
||||
Button qrscanBtn = ViewUtil.findById(this, R.id.qrscan_btn);
|
||||
|
||||
qrscanBtn.setOnClickListener((view) -> new IntentIntegrator(this).setCaptureActivity(QrActivity.class).initiateScan());
|
||||
addrInput.setText(getIntent().getStringExtra(ADDR_EXTRA));
|
||||
addrInput.setOnFocusChangeListener((view, focused) -> {
|
||||
String addr = addrInput.getText() == null? "" : addrInput.getText().toString();
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.view.MenuCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
@@ -30,6 +31,7 @@ import com.google.zxing.common.HybridBinarizer;
|
||||
|
||||
import org.thoughtcrime.securesms.BaseActionBarActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.contacts.NewContactActivity;
|
||||
import org.thoughtcrime.securesms.mms.AttachmentManager;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
@@ -68,7 +70,7 @@ public class QrActivity extends BaseActionBarActivity {
|
||||
|
||||
setSupportActionBar(ViewUtil.findById(this, R.id.toolbar));
|
||||
assert getSupportActionBar() != null;
|
||||
getSupportActionBar().setTitle(R.string.qr_code);
|
||||
getSupportActionBar().setTitle(R.string.menu_new_contact);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
int lastSelectedTab = PreferenceManager.getDefaultSharedPreferences(this).getInt("qrTab", TAB_SHOW);
|
||||
@@ -110,11 +112,7 @@ public class QrActivity extends BaseActionBarActivity {
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
menu.clear();
|
||||
if(tabLayout.getSelectedTabPosition() == TAB_SHOW) {
|
||||
getMenuInflater().inflate(R.menu.qr_show, menu);
|
||||
} else {
|
||||
getMenuInflater().inflate(R.menu.qr_scan, menu);
|
||||
}
|
||||
getMenuInflater().inflate(R.menu.qr_show, menu);
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@@ -133,6 +131,9 @@ public class QrActivity extends BaseActionBarActivity {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.new_classic_contact:
|
||||
this.startActivity(new Intent(this, NewContactActivity.class));
|
||||
break;
|
||||
case R.id.share:
|
||||
qrShowFragment.shareInviteURL();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user