Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71eec244 authored by Wysie's avatar Wysie
Browse files

Release 2.31.

Fixed a bug whereby the temporary file created when taking a photo (for adding/editing of contact) will not get deleted if the user chooses to cancel his actions halfway.
Added copy when viewing a Contact information. Everything is copiable except for Ringtone and Groups.
Added preference for showing "Text" action for mobile numbers only. The code was actually 1/2 done already, I believe by ChainsDD.
parent bad2cd57
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -805,8 +805,14 @@
    <string name="title_contacts_show_separators">Show alphabetical separators</string>
    <string name="summaryon_contacts_show_separators">Alphabetical separators will be shown in the contacts list</string>
    <string name="summaryoff_contacts_show_separators">Alphabetical separators will be hidden in the contacts list</string>
    
    <string name="groups_manager_title">Manage groups preferences</string>    
    <string name="title_view_contact">View contact</string>
    <string name="summary_view_contact">Set preferences when viewing an individual contact</string>
    <string name="title_show_text_mobile_only">Text action for mobile only</string>
    <string name="summaryon_show_text_mobile_only">Only mobile numbers will have a text/sms action</string>
    <string name="summaryoff_show_text_mobile_only">All numbers will have a text/sms action</string>
    
    <string name="groups_manager_title">Manage groups</string>
    <string name="groups_manager_summary">Set preferences in groups manager</string>
    <string name="title_groups_ask_before_del">Ask before deleting</string>
    <string name="summaryon_groups_ask_before_del">Ask before deleting group</string>
    <string name="summaryoff_groups_ask_before_del">Groups will be deleted without asking</string>
@@ -825,7 +831,7 @@
    <string name="title_about_name">Mod Name</string>
    <string name="summary_about_name">Wysie Contacts</string>
    <string name="title_about_version">Version</string>
    <string name="summary_about_version">2.3</string>
    <string name="summary_about_version">2.31</string>
    <string name="title_about_credits">Credits</string>
    <string name="summary_about_credits">ChainsDD and the rest of XDA! :)</string>
    
+21 −9
Original line number Diff line number Diff line
@@ -130,6 +130,16 @@
            android:key="contacts_show_pic"
            android:title="@string/title_contacts_show_pic"
            android:defaultValue="true" />
        <CheckBoxPreference
            android:key="contacts_show_alphabetical_separators"
            android:title="@string/title_contacts_show_separators"
            android:summaryOn="@string/summaryon_contacts_show_separators"
            android:summaryOff="@string/summaryoff_contacts_show_separators"
            android:defaultValue="true" />
        <PreferenceScreen
            android:key="view_contact"
            android:title="@string/title_view_contact"
            android:summary="@string/summary_view_contact">
            <ListPreference
                android:key="contacts_view_contact_pic_size"
                android:title="@string/title_contacts_view_pic_size"
@@ -139,14 +149,16 @@
                android:entryValues="@array/view_contact_pic_sizes_values"
                android:defaultValue="78" />
            <CheckBoxPreference
            android:key="contacts_show_alphabetical_separators"
            android:title="@string/title_contacts_show_separators"
            android:summaryOn="@string/summaryon_contacts_show_separators"
            android:summaryOff="@string/summaryoff_contacts_show_separators"
            android:defaultValue="true" />
                android:key="contacts_show_text_mobile_only"
                android:title="@string/title_show_text_mobile_only"
                android:summaryOn="@string/summaryon_show_text_mobile_only"
                android:summaryOff="@string/summaryoff_show_text_mobile_only"
                android:defaultValue="false" />                
        </PreferenceScreen>
        <PreferenceScreen
            android:key="groups_management"
            android:title="@string/groups_manager_title"> 
            android:title="@string/groups_manager_title"
            android:summary="@string/groups_manager_summary"> 
            <CheckBoxPreference
                android:key="groups_ask_before_del"
                android:title="@string/title_groups_ask_before_del"
+9 −4
Original line number Diff line number Diff line
@@ -270,10 +270,9 @@ public final class EditContactActivity extends Activity implements View.OnClickL
        case R.id.photoImage: {
            doAddPhotoAction();
            
            //Wysie_Soh: Hide the virtual keyboard. Irritating visual glitch :P. Commented out for now. This somehow causes the keyboard input
            //to have no effect when the image selection is over :(.
            //InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            //mgr.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            //Wysie_Soh: Hide the virtual keyboard. Irritating visual glitch :P.
            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            mgr.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            break;
        }

@@ -613,6 +612,11 @@ public final class EditContactActivity extends Activity implements View.OnClickL
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode != RESULT_OK) {
            //Delete temp file if it exists
            File f = new File(mImageCaptureUri.getPath());            
            if (f.exists()) {
                f.delete();
            }
            return;
        }

@@ -687,6 +691,7 @@ public final class EditContactActivity extends Activity implements View.OnClickL
            break;
        }
        }

    }

    @Override
+78 −12
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import android.provider.Contacts.Organizations;
import android.provider.Contacts.People;
import android.provider.Contacts.Phones;
import android.provider.Contacts.Presence;
import android.text.ClipboardManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.ContextMenu;
@@ -142,6 +143,9 @@ public class ViewContactActivity extends ListActivity

    public static final int MENU_GROUP_BT = 1;
    
    private static final int MENU_COPY_LABEL = 8;
    private static final int MENU_COPY_DATA = 9;

    private Uri mUri;
    private ContentResolver mResolver;
    private ViewAdapter mAdapter;
@@ -227,7 +231,6 @@ public class ViewContactActivity extends ListActivity
    private ImageView mPhotoView;
    private int mNoPhotoResource;
    private CheckBox mStarView;
    private boolean mShowSmsLinksForAllPhones;
    private Context _context;

    @Override
@@ -275,9 +278,6 @@ public class ViewContactActivity extends ListActivity
        mSections.add(mOtherEntries);
        mSections.add(mGroupEntries);

        //TODO Read this value from a preference
        mShowSmsLinksForAllPhones = true;

        mCursor = mResolver.query(mUri, CONTACT_PROJECTION, null, null, null);

        /**
@@ -468,26 +468,58 @@ public class ViewContactActivity extends ListActivity
            return;
        }
        
        String copyLabel = null;

        ViewEntry entry = ContactEntryAdapter.getEntry(mSections, info.position, SHOW_SEPARATORS);
        switch (entry.kind) {
            case Contacts.KIND_PHONE: {
                menu.add(0, 0, 0, R.string.menu_call).setIntent(entry.intent);
                menu.add(0, 0, 0, R.string.menu_sendSMS).setIntent(entry.auxIntent);
                copyLabel = "number";
                if (entry.primaryIcon == -1) {
                    menu.add(0, MENU_ITEM_MAKE_DEFAULT, 0, R.string.menu_makeDefaultNumber);
                }
                break;
            }
            
            case ViewEntry.KIND_SMS: {
                copyLabel = "number";
                break;
            }

            case Contacts.KIND_EMAIL: {
                menu.add(0, 0, 0, R.string.menu_sendEmail).setIntent(entry.intent);
                copyLabel = "email address";
                break;
            }
            
            case Contacts.KIND_IM: {
                copyLabel = "IM address";
                break;
            }

            case Contacts.KIND_POSTAL: {
                menu.add(0, 0, 0, R.string.menu_viewAddress).setIntent(entry.intent);
                copyLabel = "address";
                break;
            }
            
            case Contacts.KIND_ORGANIZATION: {
                menu.add(0, MENU_COPY_LABEL, 0, "Copy organization");
                copyLabel = "position";
                break;
            }
            
            case ViewEntry.KIND_CONTACT: {
                if ((entry.label).equals(getString(R.string.label_notes))) {
                    copyLabel = "notes";
                }
                break;
            }
        }
        
        if (copyLabel != null) {            
            menu.add(0, MENU_COPY_DATA, 0, "Copy " + copyLabel);
        }
    }

@@ -648,6 +680,43 @@ public class ViewContactActivity extends ListActivity
                 }
                 return true;
            }
            case MENU_COPY_LABEL: {
                AdapterView.AdapterContextMenuInfo info;
                try {
                    info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
                } catch (ClassCastException e) {
                    Log.e(TAG, "bad menuInfo", e);
                    break;
                }

                ViewEntry entry = ContactEntryAdapter.getEntry(mSections, info.position,
                        SHOW_SEPARATORS);
                        
                if (entry != null) {
                    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                    clipboard.setText(entry.label);
                 }                 
                 return true;
            }
            case MENU_COPY_DATA: {
                AdapterView.AdapterContextMenuInfo info;
                try {
                    info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
                } catch (ClassCastException e) {
                    Log.e(TAG, "bad menuInfo", e);
                    break;
                }

                ViewEntry entry = ContactEntryAdapter.getEntry(mSections, info.position,
                        SHOW_SEPARATORS);
                        
                if (entry != null) {
                    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                    clipboard.setText(entry.data);
                 }                 
                 return true;
            }
            
        }
        return super.onContextItemSelected(item);
    }
@@ -834,7 +903,7 @@ public class ViewContactActivity extends ListActivity
                entry.actionIcon = android.R.drawable.sym_action_call;
                mPhoneEntries.add(entry);

                if (type == Phones.TYPE_MOBILE || mShowSmsLinksForAllPhones) {
                if (type == Phones.TYPE_MOBILE || !ePrefs.getBoolean("contacts_show_text_mobile_only", false)) {
                    // Add an SMS entry
                    ViewEntry smsEntry = new ViewEntry();
                    smsEntry.label = buildActionString(R.string.actionText, displayLabel, true);
@@ -879,7 +948,6 @@ public class ViewContactActivity extends ListActivity
                entry.uri = uri;
                entry.kind = kind;
                

                switch (kind) {
                    case Contacts.KIND_EMAIL:
                        entry.label = buildActionString(R.string.actionEmail,
@@ -905,6 +973,7 @@ public class ViewContactActivity extends ListActivity
                        entry2.label = getString(R.string.view_contact_navigate);
                        entry2.data = data;
                        entry2.maxLines = 4;
                        entry2.kind = kind;
                        entry2.actionIcon = R.drawable.sym_action_navi;
                        Intent i = startNavigation(data);
                        
@@ -1053,7 +1122,6 @@ public class ViewContactActivity extends ListActivity
            organizationsCursor.close();
        }


        // Build the other entries
        String note = personCursor.getString(CONTACT_NOTES_COLUMN);
        if (!TextUtils.isEmpty(note)) {
@@ -1143,8 +1211,6 @@ public class ViewContactActivity extends ListActivity
        			groups.append("\n" + groupNamesArray.get(i));
        	}        	
        	
        	//Log.d("Testing", groups.toString());
        	
        	ViewEntry entry = new ViewEntry();
        	entry.label = getString(R.string.view_contact_groups);
        	entry.data = groups.toString();