Merge pull request #649 from mar-v-in/automatic-contact-discovery
Automatic contact discovery and more
This commit is contained in:
@@ -252,7 +252,7 @@ public class KeyListFragment extends LoaderFragment
|
||||
static final int INDEX_HAS_ANY_SECRET = 6;
|
||||
|
||||
static final String ORDER =
|
||||
KeyRings.HAS_ANY_SECRET + " DESC, " + KeyRings.USER_ID + " ASC";
|
||||
KeyRings.HAS_ANY_SECRET + " DESC, UPPER(" + KeyRings.USER_ID + ") ASC";
|
||||
|
||||
|
||||
@Override
|
||||
@@ -592,7 +592,7 @@ public class KeyListFragment extends LoaderFragment
|
||||
String userId = mCursor.getString(KeyListFragment.INDEX_USER_ID);
|
||||
String headerText = convertView.getResources().getString(R.string.user_id_no_name);
|
||||
if (userId != null && userId.length() > 0) {
|
||||
headerText = "" + userId.subSequence(0, 1).charAt(0);
|
||||
headerText = "" + userId.charAt(0);
|
||||
}
|
||||
holder.mText.setText(headerText);
|
||||
holder.mCount.setVisibility(View.GONE);
|
||||
@@ -621,7 +621,7 @@ public class KeyListFragment extends LoaderFragment
|
||||
// otherwise, return the first character of the name as ID
|
||||
String userId = mCursor.getString(KeyListFragment.INDEX_USER_ID);
|
||||
if (userId != null && userId.length() > 0) {
|
||||
return userId.charAt(0);
|
||||
return Character.toUpperCase(userId.charAt(0));
|
||||
} else {
|
||||
return Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
@@ -32,6 +33,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
@@ -47,6 +49,7 @@ import com.devspark.appmsg.AppMsg;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.ContactHelper;
|
||||
import org.sufficientlysecure.keychain.helper.ExportHelper;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
@@ -124,7 +127,7 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
||||
switchToTab = intent.getExtras().getInt(EXTRA_SELECTED_TAB);
|
||||
}
|
||||
|
||||
Uri dataUri = getIntent().getData();
|
||||
Uri dataUri = getDataUri();
|
||||
if (dataUri == null) {
|
||||
Log.e(Constants.TAG, "Data missing. Should be Uri of key!");
|
||||
finish();
|
||||
@@ -214,6 +217,14 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
||||
mSlidingTabLayout.setViewPager(mViewPager);
|
||||
}
|
||||
|
||||
private Uri getDataUri() {
|
||||
Uri dataUri = getIntent().getData();
|
||||
if (dataUri != null && dataUri.getHost().equals(ContactsContract.AUTHORITY)) {
|
||||
dataUri = ContactHelper.dataUriFromContactUri(this, dataUri);
|
||||
}
|
||||
return dataUri;
|
||||
}
|
||||
|
||||
private void loadData(Uri dataUri) {
|
||||
mDataUri = dataUri;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user