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

Commit c3772f17 authored by Wysie's avatar Wysie
Browse files

Release 2.51:

- Fine-tuned the group call logging portion layout.
- Also, most of the contacts should group properly now. I did some workarounds to get most of them to group. Android's PhoneNumberUtils can't seem to compare numbers properly all the time, which kinda sucks. In addition to using PhoneNumberUtils.compare(), I also queried and pulled out the id of the Person (Contact). Lastly, I wrote a sloppy method which compares the last 8 digits of numbers, and if they are equal, they are grouped together.
- Also, my previous functions of "Remove all [Number]" was bugged. Again, I can't do much due to PhoneNumberUtils not working perfectly, but it should remove all numbers now, as long as they are 8 digits or more. Previously, if you had:
91234567, +6591234567, and 010891234567. and you selected "Remove all 91234567", only 91234567 will be removed, and the other 2 with country codes will not. It now works as expected, but the code is honestly not the best way possible. Unfortunately I am unfamiliar with country codes and such .
- Cleaned up the code, most of the strings are now in strings.xml.
- Ability to view call log directly from a contact.
- The dialog shown when copying a number, address, etc. now contains the address itself, instead of the word "address"
- Added more options to the context menu when viewing an individual's call log
- The incoming/outgoing/missed call icon when viewing an individual's call log will now dial the number of that particular entry.
- I should've called it 2.6. Lol.
parent 56f6587c
Loading
Loading
Loading
Loading
+23 −21
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@
            android:gravity="center_vertical"
        />
        
        <View android:id="@+id/divider1"
        <com.android.contacts.ui.widget.DontPressWithParentImageView android:id="@+id/divider1"
            android:layout_width="1px"
            android:layout_height="fill_parent"
            android:layout_marginBottom="5dip"
@@ -80,17 +80,16 @@
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:background="@android:drawable/list_selector_background"
        android:paddingLeft="5dip"
    >
    
        <ImageView android:id="@+id/icon"
        <com.android.contacts.ui.widget.DontPressWithParentImageView android:id="@+id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="4dip"
            android:paddingRight="4dip"
            android:layout_height="fill_parent"
            android:paddingLeft="7dip"
            android:paddingRight="5dip"
            android:gravity="center"
            android:scaleType="centerInside"
            android:background="@drawable/call_background"
        />
        
        <RelativeLayout 
@@ -98,25 +97,15 @@
            android:layout_height="fill_parent"
            android:paddingTop="5dip"
        >
        
            <TextView android:id="@+id/type"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="11dip"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textStyle="bold"   
                android:text="@string/menu_sendTextMessage"
            />
            
            <TextView android:id="@+id/duration"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="11dip"
                android:layout_marginLeft="5dip"
                android:layout_alignParentRight="true"
                android:layout_alignBaseline="@id/type"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:singleLine="true"
                android:ellipsize="marquee"
            />
            
            <TextView android:id="@+id/time"
@@ -127,10 +116,23 @@
                android:singleLine="true"
                android:layout_marginBottom="8dip"
                android:layout_marginTop="-8dip"
                android:layout_marginLeft="11dip"
                android:layout_marginLeft="5dip"
                android:textAppearance="?android:attr/textAppearanceSmall"
            />
        
            <TextView android:id="@+id/type"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dip"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:layout_toLeftOf="@id/duration"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:gravity="center_vertical|left"            
                android:singleLine="true"
                android:ellipsize="marquee"
            />           

        </RelativeLayout>
    </LinearLayout>
</LinearLayout>
+17 −1
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
        android:layout_toLeftOf="@id/divider"
        android:layout_alignWithParentIfMissing="true"
        android:layout_marginRight="9dip"
        android:layout_marginLeft="3dip"
    />
    
    <!-- Wysie_Soh: Default values
@@ -107,12 +108,27 @@
        android:textAppearance="?android:attr/textAppearanceSmall"
    />
    
    <TextView android:id="@+id/count"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/call_type_icon"
        android:layout_above="@id/date"
        android:layout_alignBaseline="@id/call_type_icon"
        android:layout_marginLeft="5dip"
        android:layout_alignParentTop="true"
        android:layout_alignWithParentIfMissing="true"

        android:textAppearance="?android:attr/textAppearanceMedium"
        android:singleLine="true"
        android:gravity="center_vertical"
    />    

    <TextView android:id="@+id/line1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@id/photo"
        android:layout_toLeftOf="@+id/call_type_icon"
        android:layout_toLeftOf="@id/count"
        android:layout_above="@id/label"
        android:layout_alignWithParentIfMissing="true"

+6 −4
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
        <item>2</item>
        <item>3</item>
        <item>4</item>
        <item>5</item>
    </string-array>
    
    <string-array name="digits_colors">
@@ -60,10 +61,11 @@
        
    <string-array name="vm_handlers">
	    <item>Google Voice/com.google.android.apps.googlevoice/.SplashActivity</item>
	<item>HulloMail/com.hullomail.android.messaging.us/.HulloMail</item>
	<item>PF Voicemail/com.phonefusion.voicemailplus.android/.VoicemailPlus</item>
	    <item>HulloMail UK Visual Voicemail/com.hullomail.android.messaging/.HulloMail</item>
	    <item>HulloMail US Visual Voicemail/com.hullomail.android.messaging.us/.HulloMail</item>
	    <item>PhoneFusion Visual Voicemail/com.phonefusion.voicemailplus.android/.VoicemailPlus</item>
        <item>T-Mobile Visual Voicemail/com.oz.mobile.android.voicemail.application/.application</item>
        <item>YouMail/com.loadedbanana.android.youmail/.activity.MessageList</item>        
        <item>YouMail Visual Voicemail/com.loadedbanana.android.youmail/.activity.MessageList</item>        
    </string-array>
    
    <string-array name="view_contact_pic_sizes">
+20 −2
Original line number Diff line number Diff line
@@ -841,13 +841,23 @@
    <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.5</string>
    <string name="summary_about_version">2.51</string>
    <string name="title_about_credits">Credits</string>
    <string name="summary_about_credits">ChainsDD and the rest of XDA! :)</string>
    
    <!-- Wysie_Soh: Call log strings -->  
    <string name="alert_clear_call_log_title">Clear call log</string>
    <string name="alert_clear_call_log_message">Are you sure you want to clear all call records?</string>
    <string name="menu_cl_clear_type">Remove all %s</string>
    
    <string name="alert_clear_cl_person">Are you sure you want to clear all call records of %s?</string>
    <string name="alert_clear_cl_person_incoming">Are you sure you want to clear all incoming call records from %s?</string>
    <string name="alert_clear_cl_person_outgoing">Are you sure you want to clear all outgoing call records to %s?</string>
    <string name="alert_clear_cl_person_missed">Are you sure you want to clear all missed call records from %s?</string>
    
    <string name="alert_clear_cl_all_incoming">Are you sure you want to clear all incoming call records?</string>
    <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_Soh: Frequently called strings -->
    <string name="alert_clear_freq_called">Clear frequently called</string>
@@ -856,6 +866,8 @@
    <!-- Wysie_Soh: View contact strings -->
    <string name="view_contact_navigate">Navigate to</string>
    <string name="view_contact_groups">Groups</string>
    <string name="view_call_log">View call log</string>
    <string name="view_contact_select_cl_number">Select number to view log</string>
    
    <!-- Wysie_Soh: Groups management -->
    <string name="help_title">Usage</string>
@@ -871,4 +883,10 @@
    <string name="alert_rename_group_message">Enter new group name</string>
    <string name="alert_delete_group_message">Are you sure you want to delete?</string>
    
    <!-- Wysie_Soh: Others -->
    <!-- Toast for call detail screen when couldn't read the requested details -->
    <string name="toast_call_detail_error_wysie">No call log found for the requested number</string>
    <string name="menu_copy_string">Copy \"%s\"</string>
    <string name="cl_total_cl">Total Duration</string>
    
</resources>
+78 −28
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.provider.Contacts.Phones;
import android.provider.Contacts.Intents.Insert;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.ClipboardManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log;
@@ -70,7 +71,8 @@ import java.util.List;
public class CallDetailActivity extends ListActivity implements View.OnCreateContextMenuListener {
    private static final String TAG = "CallDetail";

    private TextView mCallType;
    //private TextView mCallType;
    private TextView mCallNumber;
    private ImageView mCallTypeIcon;
    private TextView mCallTime;
    private TextView mCallDuration;
@@ -119,6 +121,9 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
    private static final int MENU_ITEM_VIEW_CONTACT = 6;
    private static final int MENU_ITEM_ADD_CONTACT = 7;
    
    private static final int MENU_ITEM_CALL = 8;
    private static final int MENU_COPY_NUM = 9;
    
    private ViewAdapter adapter;
    private List<ViewEntryData> logs;
    private SharedPreferences prefs;
@@ -198,13 +203,26 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
    	String number = bundle.getString("NUMBER");
    	//Toast.makeText(this, number, Toast.LENGTH_LONG).show();    	
        
        StringBuilder where = new StringBuilder();
        where.append(Calls.NUMBER);
        where.append(" = '" + number + "'");
        
        Cursor callCursor = getContentResolver().query(Calls.CONTENT_URI, CALL_LOG_PROJECTION,where.toString(), null,
        Uri callUri = Uri.withAppendedPath(Calls.CONTENT_FILTER_URI, Uri.encode(number));        
        Cursor callCursor = getContentResolver().query(callUri, CALL_LOG_PROJECTION, null, null,
        		Calls.DEFAULT_SORT_ORDER);
        		
        //Wysie_Soh: Loop to find shortest number, and requery.
        //For some reason, eg. if you have 91234567 and +6591234567 and say, 010891234567
        //they might not be detected as the same number. This is especially.
        //Might change to binary search in future.
        if (callCursor != null && callCursor.moveToFirst()) {
            do {
                if (number.length() > callCursor.getString(NUMBER_COLUMN_INDEX).length()) {
                    number = callCursor.getString(NUMBER_COLUMN_INDEX);
                }
            }while(callCursor.moveToNext());
        }
        
        //Wysie_Soh:Requery with shortest number found. This will ensure we get all entries.       
        callUri = Uri.withAppendedPath(Calls.CONTENT_FILTER_URI, Uri.encode(number));
        callCursor = getContentResolver().query(callUri, CALL_LOG_PROJECTION, null, null,
        		Calls.DEFAULT_SORT_ORDER);        
        mNumber = number;
        
    	ContentResolver resolver = getContentResolver();
@@ -267,13 +285,14 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
            		data.date = callCursor.getLong(DATE_COLUMN_INDEX);
            		data.duration = callCursor.getLong(DURATION_COLUMN_INDEX);
            		data.callType = callCursor.getInt(CALL_TYPE_COLUMN_INDEX);
            		data.number = callCursor.getString(NUMBER_COLUMN_INDEX);            		
	                
            		logs.add(data);	              
            	}while(callCursor.moveToNext());
            } else {
                // Something went wrong reading in our primary data, so we're going to
                // bail out and show error to users.
                Toast.makeText(this, R.string.toast_call_detail_error,
                Toast.makeText(this, R.string.toast_call_detail_error_wysie,
                        Toast.LENGTH_SHORT).show();
                finish();
            }
@@ -354,6 +373,7 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
        	 long date = entry.date;
        	 long duration = entry.duration;
        	 int callType = entry.callType; 
        	 final String num = entry.number;

            
        	RelativeLayout layout = (RelativeLayout) convertView.findViewById(R.id.line_action);
@@ -404,9 +424,12 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
            	layout.setVisibility(View.GONE);
            	layout_logs.setVisibility(View.VISIBLE);
                ImageView mCallTypeIcon = (ImageView) convertView.findViewById(R.id.icon);
                mCallTypeIcon.setOnClickListener(this);
                mCallTypeIcon.setTag(num);
                TextView tvTime = (TextView) convertView.findViewById(R.id.time);
                TextView tvDuration = (TextView) convertView.findViewById(R.id.duration);
                TextView tvType = (TextView) convertView.findViewById(R.id.type);
                //TextView tvType = (TextView) convertView.findViewById(R.id.type);
                TextView tvNum = (TextView) convertView.findViewById(R.id.type);
                // Pull out string in format [relative], [date]
                CharSequence dateClause = DateUtils.formatDateRange(mContext, date, date,
                        DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE |
@@ -421,34 +444,47 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
                	tvDuration.setText(formatDuration(duration));
                }
    
                // Set the call type icon and caption                
                // Set the call type icon          
                switch (callType) {
                    case Calls.INCOMING_TYPE:
                        mCallTypeIcon.setImageResource(R.drawable.ic_call_log_header_incoming_call);
                        tvType.setText(R.string.type_incoming);
                        //tvType.setText(R.string.type_incoming);
                       
                        break;
    
                    case Calls.OUTGOING_TYPE:
                        mCallTypeIcon.setImageResource(R.drawable.ic_call_log_header_outgoing_call);
                        tvType.setText(R.string.type_outgoing);
                        //tvType.setText(R.string.type_outgoing);
                        
                        break;
    
                    case Calls.MISSED_TYPE:
                        mCallTypeIcon.setImageResource(R.drawable.ic_call_log_header_missed_call);
                        tvType.setText(R.string.type_missed);
                        //tvType.setText(R.string.type_missed);
                        
                        break;
                }
                
                tvNum.setText(num);
                                
                convertView.setTag(entry);
            }
            
            return convertView;
        }
        
        //Wysie_Soh: Only the calltype and the icons in the first row have onclick events. In case of the first row,
        //try will succeed. Otherwise it will go to catch.
		public void onClick(View v) {
            Intent intent = (Intent) v.getTag();
		    Intent intent = null;
		    
		    try {
                intent = (Intent) v.getTag();
            }
            catch (ClassCastException e) {
                intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
                        Uri.fromParts("tel", (String)v.getTag(), null));
            }
            
            if(intent != null)
                mContext.startActivity(intent);
@@ -541,6 +577,11 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
            return;
        }
        
        ViewEntryData entryData = (ViewEntryData)adapter.getItem(menuInfo.position);
        
        //Wysie_Soh: WIP
        menu.add(0, MENU_ITEM_CALL, 0, getString(R.string.recentCalls_callNumber, entryData.number));
        menu.add(0, MENU_COPY_NUM, 0, getString(R.string.menu_copy_string, entryData.number));
        menu.add(0, MENU_ITEM_DELETE, 0, R.string.recentCalls_removeFromRecentList);
    }
    
@@ -549,6 +590,16 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
        ViewEntryData entryData = (ViewEntryData)adapter.getItem(info.position);
	
		switch(item.getItemId()) {
		    case MENU_ITEM_CALL:
                Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
                            Uri.fromParts("tel", entryData.number, null));
                startActivity(callIntent);
                return true;
            case MENU_COPY_NUM:
                if (entryData != null) {
                    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                    clipboard.setText(entryData.number);
                 }
		    case MENU_ITEM_DELETE:
		        getContentResolver().delete(Calls.CONTENT_URI, "Calls._ID=?", new String[] { Long.toString(entryData.id) } );
                logs.remove(entryData);
@@ -570,7 +621,7 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            alert.setTitle(R.string.alert_clear_call_log_title);
            alert.setMessage("Are you sure you want to clear all call records of " + mNumber + "?");
            alert.setMessage(getString(R.string.alert_clear_cl_person, mNumber));
      
            alert.setPositiveButton(android.R.string.ok,
                    new DialogInterface.OnClickListener() {
@@ -601,11 +652,11 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
        String message = null;
        
        if (type == Calls.INCOMING_TYPE) {
            message = "Are you sure you want to clear all incoming call records from " + mNumber + "?" ;            
            message = getString(R.string.alert_clear_cl_person_incoming, mNumber);
        } else if (type == Calls.OUTGOING_TYPE) {
            message = "Are you sure you want to clear all outgoing call records to " + mNumber + "?" ;
            message = getString(R.string.alert_clear_cl_person_outgoing, mNumber);
        } else if (type == Calls.MISSED_TYPE) {
            message = "Are you sure you want to clear all missed call records from " + mNumber + "?" ;
            message = getString(R.string.alert_clear_cl_person_missed, mNumber);
        }
        
        if (prefs.getBoolean("cl_ask_before_clear", false)) {
@@ -634,7 +685,6 @@ public class CallDetailActivity extends ListActivity implements View.OnCreateCon
        updateData();
        if(logs.size() != 1) { //1 because the top row is for calling/smsing
            adapter.notifyDataSetInvalidated();
            Log.d("WYSIE", "Data Changed 2");
        }
        else {                	
            finish();
Loading