forked from arthurzaczek/launcherforblind
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e66847
commit 399761c
Showing
9 changed files
with
138 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" > | ||
|
||
<TextView | ||
android:id="@+id/txtMain" | ||
style="@style/Main" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_centerInParent="true" | ||
android:gravity="center" | ||
android:text="@string/missedcalls" /> | ||
|
||
<TextView | ||
android:id="@+id/txtHelp" | ||
style="@style/Help" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/txtMain" | ||
android:gravity="center" | ||
android:text="@string/main_help" /> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package net.zaczek.launcherforblind; | ||
|
||
import net.zaczek.launcherforblind.activitysupport.AbstractCursorActivity; | ||
import net.zaczek.launcherforblind.listentries.ListEntry; | ||
import net.zaczek.launcherforblind.listentries.MissedCallListEntry; | ||
import android.database.Cursor; | ||
import android.os.Bundle; | ||
import android.provider.CallLog; | ||
import android.text.format.DateUtils; | ||
import android.util.Log; | ||
import android.widget.TextView; | ||
|
||
public class MissedCallsActivity extends AbstractCursorActivity { | ||
private static final String TAG = "launcherforblind"; | ||
|
||
private static final String[] PROJECTION = new String[] { | ||
CallLog.Calls.CACHED_NAME, CallLog.Calls.NUMBER, CallLog.Calls.DATE }; | ||
private static final String SELECTION = CallLog.Calls.TYPE + " = " + CallLog.Calls.MISSED_TYPE; | ||
|
||
private boolean confirmed = false; | ||
private TextView txtMain; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
Log.i(TAG, "onCreate"); | ||
setContentView(R.layout.missedcalls); | ||
|
||
txtMain = (TextView) findViewById(R.id.txtMain); | ||
} | ||
|
||
@Override | ||
protected Cursor getCursor() { | ||
Cursor c = managedQuery(CallLog.Calls.CONTENT_URI, PROJECTION, SELECTION, null, | ||
CallLog.Calls.DEFAULT_SORT_ORDER); | ||
return c; | ||
} | ||
|
||
@Override | ||
protected ListEntry getListEntry(Cursor c) { | ||
int time = c.getInt(2); | ||
return new MissedCallListEntry(c.getString(0), c.getString(1), | ||
DateUtils.formatElapsedTime(time)); | ||
} | ||
|
||
@Override | ||
protected void giveFeedback(String label) { | ||
txtMain.setText(label); | ||
confirmed = false; | ||
} | ||
|
||
@Override | ||
protected void onDoubleTap() { | ||
super.onDoubleTap(); | ||
final MissedCallListEntry current = (MissedCallListEntry)getCurrentListEntry(); | ||
if(current == null) return; | ||
|
||
if (!confirmed) { | ||
Helper.confirmDial(this, current.getLabel()); | ||
confirmed = true; | ||
} else { | ||
// actually dial | ||
Helper.dial(this, current.getNumber()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/net/zaczek/launcherforblind/listentries/MissedCallListEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.zaczek.launcherforblind.listentries; | ||
|
||
public class MissedCallListEntry extends AbstractListEntry { | ||
String mNumber; | ||
String mDate; | ||
|
||
public MissedCallListEntry(String label, String number, String date) { | ||
super(label); | ||
mNumber = number; | ||
mDate = date; | ||
} | ||
|
||
@Override | ||
public String getLabelToSay() { | ||
return getLabel() + ", " + mDate; | ||
} | ||
|
||
@Override | ||
public void onSelected() { | ||
} | ||
|
||
public String getNumber() { | ||
return mNumber; | ||
} | ||
|
||
@Override | ||
public String getTextToSay() { | ||
return null; | ||
} | ||
} |