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

Commit 0b158f4f authored by Wysie's avatar Wysie
Browse files

Release 0.7

- Added preference to hide frequently called
- Added menu option to clear frequently called (will be hidden if you hide it)
- Added preference to enable rotation to landscape mode
parent d2ddab08
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@
        android:title="@string/menu_import_export" />

    <!-- Wysie -->
    <item
        android:id="@+id/menu_clear_freq_called"
        android:icon="@android:drawable/ic_menu_close_clear_cancel"
        android:title="@string/fav_clear_freq" />        
    
    <item
        android:id="@+id/menu_preferences"
        android:icon="@android:drawable/ic_menu_preferences"
+14 −1
Original line number Diff line number Diff line
@@ -1235,6 +1235,10 @@
    <string name="alert_clear_cl_all_outgoing">Are you sure you want to clear all outgoing call records?</string>
    <string name="alert_clear_cl_all_missed">Are you sure you want to clear all missed call records?</string>
    
    <!-- Wysie: Favourites strings -->
    <string name="fav_clear_freq">Clear frequently called</string>
    <string name="alert_clear_freq_called_msg">Are you sure you want to clear all frequently called entries?</string>
    
    <!-- Wysie: Preferences strings -->
    
    <!-- Preferences: Dialer -->
@@ -1270,15 +1274,24 @@
    <string name="title_contacts_show_dial_button">Show dial button</string>
    <string name="summary_contacts_show_dial_button">Show a dial button for contacts with numbers</string>
    
    <!-- Preferences: Favourites -->
    <string name="title_favourites_hide_freq_call">Hide frequently called</string>
    <string name="summary_favourites_hide_freq_call">The actual data is not cleared, but hidden.</string>
    <string name="title_favs_ask_before_clear">Ask before clearing</string>
    <string name="summaryon_favs_ask_before_clear">Ask before clearing frequently called</string>
    <string name="summaryoff_favs_ask_before_clear">Frequently called entries will be cleared without asking</string>
    
    <!-- Preferences: Misc -->
    <string name="title_misc_category">Miscellaneous</string>
    <string name="title_sensor_rotation">Enable sensor rotation</string>
    <string name="summary_sensor_rotation">If enabled, it will rotate based on system\'s settings"</string>
    
    <!-- Wysie: About strings -->    
    <string name="title_about">About</string>
    <string name="title_about_name">Mod Name</string>
    <string name="summary_about_name">WyContacts Eclair</string>
    <string name="title_about_version">Version</string>
    <string name="summary_about_version">0.6</string>
    <string name="summary_about_version">0.7</string>
    <string name="title_about_credits">Credits</string>
    <string name="summary_about_credits">ChainsDD, geesun, niuchl, rac2030 and the rest of XDA! :)</string>
    
+18 −0
Original line number Diff line number Diff line
@@ -136,8 +136,26 @@
            android:title="@string/title_contacts_show_pic"
            android:defaultValue="true" />
        -->
        <CheckBoxPreference
            android:key="favourites_hide_freq_called"
            android:title="@string/title_favourites_hide_freq_call"
            android:summary="@string/summary_favourites_hide_freq_call"
            android:disableDependentsState="true"
            android:defaultValue="false" />
        <CheckBoxPreference
            android:key="favourites_ask_before_clear"
            android:title="@string/title_favs_ask_before_clear"
            android:summaryOn="@string/summaryon_favs_ask_before_clear"
            android:summaryOff="@string/summaryoff_favs_ask_before_clear"
	        android:dependency="favourites_hide_freq_called"
            android:defaultValue="false" />
    </PreferenceCategory>  
    <PreferenceCategory android:title="@string/title_misc_category">
        <CheckBoxPreference
            android:key="misc_sensor_rotation"
            android:title="@string/title_sensor_rotation"
            android:summary="@string/summary_sensor_rotation"
            android:defaultValue="false" />
        <PreferenceScreen
            android:key="misc_about"
            android:title="@string/title_about"> 
+59 −2
Original line number Diff line number Diff line
@@ -418,6 +418,7 @@ public class ContactsListActivity extends ListActivity implements
    private static boolean showContactsPic;
    private static boolean showFavsDialButton;
    private static boolean showFavsPic;
    private MenuItem mClearFreqCalled;

    static {
        sContactsIdMatcher = new UriMatcher(UriMatcher.NO_MATCH);
@@ -876,6 +877,7 @@ public class ContactsListActivity extends ListActivity implements

        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.list, menu);
        mClearFreqCalled = menu.findItem(R.id.menu_clear_freq_called);
        return true;
    }

@@ -883,6 +885,12 @@ public class ContactsListActivity extends ListActivity implements
    public boolean onPrepareOptionsMenu(Menu menu) {
        final boolean defaultMode = (mMode == MODE_DEFAULT);
        menu.findItem(R.id.menu_display_groups).setVisible(defaultMode);
        if (mFavs && !ePrefs.getBoolean("favourites_hide_freq_called", false)) {       
            mClearFreqCalled.setVisible(true);
        }
        else {
   			mClearFreqCalled.setVisible(false);
        }
        return true;
    }

@@ -915,8 +923,27 @@ public class ContactsListActivity extends ListActivity implements
                startActivity(intent);
                return true;
            }
            //Wysie
            case R.id.menu_clear_freq_called: {
                if (ePrefs.getBoolean("favourites_ask_before_clear", false)) {
            		AlertDialog.Builder alert = new AlertDialog.Builder(this);
            		alert.setTitle(R.string.fav_clear_freq);
            		alert.setMessage(R.string.alert_clear_freq_called_msg);
            		alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
    				public void onClick(DialogInterface dialog, int whichButton) {
    					clearFrequentlyCalled();
    				}});
	    		    alert.show();
            	}
            	else {
            		clearFrequentlyCalled();
            	}            	
            	return true;
            }
            //Wysie
            case R.id.menu_preferences: {
                startActivity(new Intent(this, ContactsPreferences.class));
                return true;
            }
        }
        return false;
@@ -1531,8 +1558,14 @@ public class ContactsListActivity extends ListActivity implements
                return Contacts.CONTENT_URI;
            }
            case MODE_STREQUENT: {
                //Wysie: Return a different Uri if hide frequently called is enabled
                if (ePrefs.getBoolean("favourites_hide_freq_called", false)) {
                    return Contacts.CONTENT_URI;
                }
                else {
                    return Contacts.CONTENT_STREQUENT_URI;
                }
            }
            case MODE_LEGACY_PICK_PERSON:
            case MODE_LEGACY_PICK_OR_CREATE_PERSON: {
                return People.CONTENT_URI;
@@ -1821,7 +1854,17 @@ public class ContactsListActivity extends ListActivity implements
                break;

            case MODE_STREQUENT:
                //Wysie: Query is different if hide_freq_called is enabled
                if (ePrefs.getBoolean("favourites_hide_freq_called", false)) {
                    mQueryHandler.startQuery(QUERY_TOKEN, null, uri,
                            projection, Contacts.STARRED + "=1", null,
                            getSortOrder(projection));
                }
            	else {
	                mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, null, null, null);
        	    }
        	    
                //mQueryHandler.startQuery(QUERY_TOKEN, null, uri, projection, null, null, null);
                break;

            case MODE_PICK_PHONE:
@@ -3009,4 +3052,18 @@ public class ContactsListActivity extends ListActivity implements
            mHandler.clearImageFecthing();
        }
    }
    
    //Wysie: Method to clear frequently called                 
    private void clearFrequentlyCalled() {
	    ContentValues values = new ContentValues();
	    values.put(Contacts.TIMES_CONTACTED, "0");
	    final String[] PROJECTION = new String[] { Contacts._ID };
	
    	Cursor c = getContentResolver().query(Contacts.CONTENT_URI, PROJECTION, Contacts.TIMES_CONTACTED + " > 0", null, null); 	
        if(c.moveToFirst()) {
    		do {
                getContentResolver().update(ContentUris.withAppendedId(Contacts.CONTENT_URI, c.getLong(0)), values, null, null);
            } while(c.moveToNext());
        }
    }
}
+25 −0
Original line number Diff line number Diff line
@@ -32,6 +32,11 @@ import android.util.Log;
import android.view.Window;
import android.widget.TabHost;

//Wysie
import android.content.pm.ActivityInfo;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * The dialer activity that has one tab with the virtual 12key
 * dialer, a tab with recent calls in it, a tab with the contacts and
@@ -61,10 +66,15 @@ public class DialtactsActivity extends TabActivity implements TabHost.OnTabChang
    private String mFilterText;
    private Uri mDialUri;
    
    //Wysie
    private SharedPreferences ePrefs;

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        
        ePrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

        final Intent intent = getIntent();
        fixIntent(intent);

@@ -86,6 +96,21 @@ public class DialtactsActivity extends TabActivity implements TabHost.OnTabChang
                && icicle == null) {
            setupFilterText(intent);
        }        

    }
    
    //Wysie
    @Override
    protected void onResume() {
        super.onResume();
        
        //Wysie: Set rotation if necessary
        if(ePrefs.getBoolean("misc_sensor_rotation", false)) {
            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        }
        else {
        	this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
        }
    }

    @Override