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

Commit d180c678 authored by Wysie's avatar Wysie
Browse files

Release 2.7

- Cleaned up code
- Added option to auto-hide virtual keyboard when scrolling in Contacts.
parent 61a54a5f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -820,6 +820,10 @@
    <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="title_auto_show_keyboard">Auto-show virtual keyboard</string>
    <string name="summary_auto_show_keyboard">Virtual keyboard will be shown upon entering Contacts</string>
    <string name="title_auto_hide_keyboard">Auto-hide keyboard</string>
    <string name="summary_auto_hide_keyboard">Virtual keyboard will be hidden upon scrolling</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>
@@ -854,7 +858,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.62</string>
    <string name="summary_about_version">2.7</string>
    <string name="title_about_credits">Credits</string>
    <string name="summary_about_credits">ChainsDD, geesun and the rest of XDA! :)</string>
    
+5 −0
Original line number Diff line number Diff line
@@ -198,6 +198,11 @@
            android:summaryOn="@string/summaryon_contacts_show_separators"
            android:summaryOff="@string/summaryoff_contacts_show_separators"
            android:defaultValue="true" />
        <CheckBoxPreference
            android:key="contacts_auto_hide_vk"
            android:title="@string/title_auto_hide_keyboard"
            android:summary="@string/summary_auto_hide_keyboard"
            android:defaultValue="false" />
        <PreferenceScreen
            android:key="view_contact"
            android:title="@string/title_view_contact"
+76 −28
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import android.util.Log;
import android.util.SparseArray;
import android.view.ContextMenu;
import android.view.Gravity;
import android.view.inputmethod.InputMethodManager;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -74,7 +75,10 @@ import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AlphabetIndexer;
import android.widget.Filter;
@@ -99,7 +103,7 @@ import android.bluetooth.BluetoothDevice;
 * Displays a list of contacts. Usually is embedded into the ContactsActivity.
 */
public final class ContactsListActivity extends ListActivity
        implements View.OnCreateContextMenuListener, DialogInterface.OnClickListener {
        implements View.OnCreateContextMenuListener, DialogInterface.OnClickListener, ListView.OnScrollListener {
    private static final String TAG = "ContactsListActivity";

    private static final boolean ENABLE_ACTION_ICON_OVERLAYS = false;
@@ -346,6 +350,8 @@ public final class ContactsListActivity extends ListActivity
    private static boolean showFavsDialButton;
    private static boolean showFavsLabel;
    private static boolean showFavsPic;
    private static boolean autoHideKeyboard;
    //private static boolean firstTimeShowVK;
    
    //Wysie_Soh: Variable to show only contacts with phones when inserting or editing a contact
    private static boolean showOnlyPhonesEditCreateMode = false;
@@ -410,6 +416,26 @@ public final class ContactsListActivity extends ListActivity
        }
    }
    
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        //Do nothing
    }
    
    public void onScrollStateChanged(AbsListView view, int scrollState) {
        if (mContactsTab && autoHideKeyboard) {
            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            switch (scrollState) {
            case OnScrollListener.SCROLL_STATE_IDLE:
                break;
            case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
                mgr.hideSoftInputFromWindow(view.getWindowToken(), 0);
                break;
            case OnScrollListener.SCROLL_STATE_FLING:
                mgr.hideSoftInputFromWindow(view.getWindowToken(), 0);
                break;
            }
        }
    }

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
@@ -558,6 +584,7 @@ public final class ContactsListActivity extends ListActivity
        if ((mMode & MODE_MASK_NO_FILTER) != MODE_MASK_NO_FILTER) {
            list.setTextFilterEnabled(true);
        }
        list.setOnScrollListener(this);       

        if ((mMode & MODE_MASK_CREATE_NEW) != 0) {
            // Add the header for creating a new contact
@@ -734,9 +761,35 @@ public final class ContactsListActivity extends ListActivity
        setEmptyText();
    }
    
    

    @Override
    protected void onResume() {        
        super.onResume();
        
        showContactsNumber = ePrefs.getBoolean("contacts_show_number", true);
        showContactsDialButton = ePrefs.getBoolean("contacts_show_dial_button", true);
        showContactsLabel = ePrefs.getBoolean("contacts_show_label", true);
        showContactsPic = ePrefs.getBoolean("contacts_show_pic", true);
        showFavsNumber = ePrefs.getBoolean("favs_show_number", true);
        showFavsDialButton = ePrefs.getBoolean("favs_show_dial_button", true);
        showFavsLabel = ePrefs.getBoolean("favs_show_label", true);
        showFavsPic = ePrefs.getBoolean("favs_show_pic", true);
        autoHideKeyboard = ePrefs.getBoolean("contacts_auto_hide_vk", false);
        if (mContactsTab) {
            mDisplaySectionHeaders = ePrefs.getBoolean("contacts_show_alphabetical_separators", true);
            //firstTimeShowVK = true;
        }
        
            
        //Wysie_Soh: if mMode == MODE_STREQUENT or MODE_FREQUENT, mDisplaySectionHeaders is already set to false
        //Doing so means that the section separators will be shown in all other mModes. If I'm not wrong,
        //The default Eclair Contacts only shows the section separators in "Contacts" tab mode.
        //if (!(mMode == MODE_STREQUENT || mMode == MODE_FREQUENT)) {
        //    mDisplaySectionHeaders = ePrefs.getBoolean("contacts_show_alphabetical_separators", true);
        //}           
        //Wysie_Soh: Decide whether to display headers or not based on preferences
        
        boolean runQuery = true;
        Activity parent = getParent();

@@ -781,6 +834,7 @@ public final class ContactsListActivity extends ListActivity
            // Run the filtered query on the adapter
            ((ContactItemListAdapter) getListAdapter()).onContentChanged();
        }

    }

    private void updateGroup() {
@@ -812,6 +866,12 @@ public final class ContactsListActivity extends ListActivity
    protected void onStop() {
        super.onStop();
        
        /*        
        InputMethodManager mgr = (InputMethodManager)
                getSystemService(Context.INPUT_METHOD_SERVICE);
        mgr.hideSoftInputFromWindow(mList.getWindowToken(), 0);
        */

        // We don't want the list to display the empty state, since when we resume it will still
        // be there and show up while the new query is happening. After the async query finished
        // in response to onRestart() setLoading(false) will be called.
@@ -1284,9 +1344,9 @@ public final class ContactsListActivity extends ListActivity
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        // Hide soft keyboard, if visible
        InputMethodManager inputMethodManager = (InputMethodManager)
        InputMethodManager mgr = (InputMethodManager)
                getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(mList.getWindowToken(), 0);
        mgr.hideSoftInputFromWindow(mList.getWindowToken(), 0);

        if (mMode == MODE_INSERT_OR_EDIT_CONTACT) {
            Intent intent;
@@ -1940,6 +2000,7 @@ public final class ContactsListActivity extends ListActivity
                mFavTab = true;
            }
            

        }

        private SectionIndexer getNewIndexer(Cursor cursor) {
@@ -2025,30 +2086,17 @@ public final class ContactsListActivity extends ListActivity
                v = convertView;
            }          
            
            //Wysie_Soh: if mMode == MODE_STREQUENT or MODE_FREQUENT, mDisplaySectionHeaders is already set to false
            //Doing so means that the section separators will be shown in all other mModes. If I'm not wrong,
            //The default Eclair Contacts only shows the section separators in "Contacts" tab mode.
            //if (!(mMode == MODE_STREQUENT || mMode == MODE_FREQUENT)) {
            //    mDisplaySectionHeaders = ePrefs.getBoolean("contacts_show_alphabetical_separators", true);
            //}           

            //Wysie_Soh: Decide whether to display headers or not based on preferences            
            if (mContactsTab) {
                mDisplaySectionHeaders = ePrefs.getBoolean("contacts_show_alphabetical_separators", true);
            }
            
            showContactsNumber = ePrefs.getBoolean("contacts_show_number", true);
            showContactsDialButton = ePrefs.getBoolean("contacts_show_dial_button", true);
            showContactsLabel = ePrefs.getBoolean("contacts_show_label", true);
            showContactsPic = ePrefs.getBoolean("contacts_show_pic", true);
            showFavsNumber = ePrefs.getBoolean("favs_show_number", true);
            showFavsDialButton = ePrefs.getBoolean("favs_show_dial_button", true);
            showFavsLabel = ePrefs.getBoolean("favs_show_label", true);
            showFavsPic = ePrefs.getBoolean("favs_show_pic", true);
            
            bindView(v, mContext, mCursor);
            bindSectionHeader(v, realPosition, mDisplaySectionHeaders);
            
            /*
            if (mContactsTab && firstTimeShowVK) {
                InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                mgr.showSoftInput(getListView(), InputMethodManager.SHOW_IMPLICIT);
                firstTimeShowVK = false;
            }
            */
            
            return v;
        }
        
+56 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.SQLException;
@@ -32,6 +33,8 @@ import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.Contacts.Groups;
import android.provider.Contacts.GroupMembership;
import android.provider.Contacts.People;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
@@ -54,6 +57,7 @@ public class GroupsListActivity extends ListActivity {

    private static final int RENAME_GROUP_ID = 1;
    private static final int DELETE_GROUP_ID = 2;  
    private static final int SEND_GROUP_SMS = 3;

    private static final String[] GROUPS_PROJECTION = new String[] {
        Groups._ID, // 0
@@ -174,6 +178,7 @@ public class GroupsListActivity extends ListActivity {
		
		menu.add(0, RENAME_GROUP_ID, 0, R.string.context_rename_group);
		menu.add(0, DELETE_GROUP_ID, 0, R.string.context_delete_group);	
        //menu.add(0, SEND_GROUP_SMS, 0, "Send group sms");
    }

    @Override
@@ -258,11 +263,60 @@ public class GroupsListActivity extends ListActivity {
                    fillData();
    	        }
	            return true;
	            
            /*
            case SEND_GROUP_SMS:
                String numbers = getGroupNumbers(id);
                Intent smsIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("sms", numbers, null));
                startActivity(smsIntent);
                
                return true;
            */
                
		}
        
		return super.onContextItemSelected(item);
	}
	
	/*
    //Wysie_Soh: Group entries stuffs
    final String[] GROUP_MEMBERSHIP_PROJECTION = new String[] {
        GroupMembership.GROUP_ID, //0
        GroupMembership.PERSON_ID //1
    };
        
    final String[] PHONE_NUMBERS_PROJECTION = new String[] {
        People._ID, //0
        People.NUMBER //1
    };
	
	private String getGroupNumbers(long groupId) {
        ContentResolver resolver = getContentResolver();
        Cursor groupCursor = resolver.query(GroupMembership.CONTENT_URI, GROUP_MEMBERSHIP_PROJECTION,
        	GroupMembership.GROUP_ID + "='5'", null, null);
        Cursor cur = null;
        StringBuilder numbers = new StringBuilder();
                
        if (groupCursor != null && groupCursor.moveToFirst()) {
            Log.d("WYSIE", "HERE 1");
            do {
                cur = resolver.query(People.CONTENT_URI, PHONE_NUMBERS_PROJECTION, People._ID + "=?", new String[] { groupCursor.getString(1) }, null);
                if (cur != null && cur.moveToFirst()) {
                    Log.d("WYSIE", "HERE 2");
                    numbers.append(cur.getString(1) + ";");
                    cur.close();
                }
            } while (groupCursor.moveToNext());
            groupCursor.close();
        }
        
        Log.d("WYSIE", numbers.toString());
        
        return numbers.toString();       
        
	}
	*/
	
	private void showToast(String message) {
	    Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
        toast.show();
+9 −9
Original line number Diff line number Diff line
@@ -356,15 +356,6 @@ public class RecentCallsListActivity extends ListActivity
                v = convertView;
            }
            
            relativeTime = prefs.getBoolean("cl_relative_time", false);
            is24hour = DateFormat.is24HourFormat(mContext);
            showSeconds = prefs.getBoolean("cl_show_seconds", true);
            showDialButton = prefs.getBoolean("cl_show_dial_button", true);
            showContactPic = prefs.getBoolean("cl_show_pic", true);
            showNumber = prefs.getBoolean("cl_show_number", true);
            showLabel = prefs.getBoolean("cl_show_label", true);
            useExpGroup = prefs.getBoolean("cl_use_exp_grouping", false);
            
            bindView(v, mContext, position);
            return v;
        }
@@ -1072,6 +1063,15 @@ public class RecentCallsListActivity extends ListActivity
        personIdCache.clear();
        */
        
        relativeTime = prefs.getBoolean("cl_relative_time", false);
        is24hour = DateFormat.is24HourFormat(this);
        showSeconds = prefs.getBoolean("cl_show_seconds", true);
        showDialButton = prefs.getBoolean("cl_show_dial_button", true);
        showContactPic = prefs.getBoolean("cl_show_pic", true);
        showNumber = prefs.getBoolean("cl_show_number", true);
        showLabel = prefs.getBoolean("cl_show_label", true);
        useExpGroup = prefs.getBoolean("cl_use_exp_grouping", false);
    
        // The adapter caches looked up numbers, clear it so they will get
        // looked up again.    	
        if (mArrayAdapter != null) {