New logo, get task rabbit updates and location is set even if you don't tap into it

pull/14/head
Andrew Shaw 13 years ago
parent 853b59ebda
commit 5cd71584a5

@ -21,6 +21,7 @@ import android.graphics.Color;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@ -114,6 +115,7 @@ public class EditPeopleControlSet extends PopupControlSet {
public interface AssignedChangedListener {
public boolean showTaskRabbitForUser(String name, JSONObject json);
public boolean shouldShowTaskRabbit();
public boolean didPostToTaskRabbit();
}
int selected = 0; //need to remember last selected state for task rabbit
@ -389,6 +391,9 @@ public class EditPeopleControlSet extends PopupControlSet {
if (l.shouldShowTaskRabbit()) {
taskRabbitUser = new AssignedToUser(activity.getString(R.string.actfm_EPA_task_rabbit), new JSONObject().put("default_picture", R.drawable.task_rabbit_image));
listValues.add(taskRabbitUser);
if(l.didPostToTaskRabbit() && assignedIndex <= 0){
assignedIndex = listValues.size()-1;
}
}
}
@ -457,8 +462,10 @@ public class EditPeopleControlSet extends PopupControlSet {
for (AssignedChangedListener l : listeners) {
if(l.showTaskRabbitForUser(user.label, user.user)) {
assignedList.setItemChecked(selected, true);
assignedList.setItemChecked(position, false);
// assignedList.setItemChecked(selected, true);
// assignedList.setItemChecked(position, false);
assignedDisplay.setText(user.toString());
assignedCustom.setText(""); //$NON-NLS-1$
DialogUtilities.dismissDialog(activity, dialog);
return;
}
@ -529,8 +536,17 @@ public class EditPeopleControlSet extends PopupControlSet {
assignedView = assignedCustom;
} else {
AssignedToUser item = (AssignedToUser) assignedList.getAdapter().getItem(assignedList.getCheckedItemPosition());
if (item != null)
if (item != null) {
if (item.equals(taskRabbitUser)) { //don't want to ever set the user as the task rabbit user
Log.d("Edit People control set", "Equals task rabbit");
item = (AssignedToUser) assignedList.getAdapter().getItem(0);
selected = 0;
}
else {
Log.d("Edit People control set", "Does not equal task rabbit");
}
userJson = item.user;
}
}
if (userJson != null) {

@ -274,6 +274,7 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList
int arrayID = arrayType.getResourceId(i, 0);
if (arrayID == R.string.tr_set_key_location) {
TaskRabbitLocationControlSet set = new TaskRabbitLocationControlSet(this, R.layout.task_rabbit_row, titleID, i);
set.location = currentLocation;
controls.add(set);
}
else if(arrayID == R.string.tr_set_key_deadline) {

@ -201,8 +201,7 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
private String taskRabbitURL(String method) {
return TaskRabbitActivity.TASK_RABBIT_URL + "/api/v1/"+ method;
return String.format("%S/api/v1/%S?client_id=%S&client_application=%S", TaskRabbitActivity.TASK_RABBIT_URL, method, TaskRabbitActivity.TASK_RABBIT_CLIENT_ID, TaskRabbitActivity.TASK_RABBIT_CLIENT_APPLICATION_ID);
}
/** Fire task rabbit if assigned **/
@ -358,4 +357,15 @@ public class TaskRabbitControlSet extends TaskEditControlSet implements Assigned
// TODO Auto-generated method stub
}
@Override
public boolean didPostToTaskRabbit() {
if (taskRabbitTask == null) return false;
return taskRabbitTask.getTaskID() > 0;
}
}

@ -30,7 +30,7 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements
private final TextView displayText;
private final TextView displayEdit;
private final Activity activity;
private Location location;
public Location location;
private String locationName;
public int REQUEST_CODE_TASK_RABBIT_LOCATION = 6;
@ -133,7 +133,7 @@ public class TaskRabbitLocationControlSet extends TaskEditControlSet implements
}
public void updateCurrentLocation(Location currentLocation) {
if (location != null) {
if (location == null) {
location = currentLocation;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

@ -22,8 +22,9 @@
<EditText
android:id="@+id/search_text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:minHeight="50dip"
android:hint="Enter address"/>
<ImageButton

@ -9,7 +9,7 @@
android:id="@+id/content"
android:layout_width="280dip"
android:layout_height="wrap_content"
android:background="@drawable/list_popover_bg"
android:background="?attr/asListPopoverBg"
android:layout_below="@+id/gdi_arrow_up"/>
<ImageView

@ -509,20 +509,21 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
// EditPeopleControlSet relies on the "tags" transitory created by the
// TagsControlSet, so we put the tags control before the people control
// EditPeopleControlSet also relies on taskRabbitControl set being added
// that way it can tell if it needs to show task rabbit in the spinner
controls.add(peopleControlSet = new EditPeopleControlSet(getActivity(), this,
peopleControlSet = new EditPeopleControlSet(getActivity(), this,
R.layout.control_set_assigned,
R.layout.control_set_default_display,
R.string.actfm_EPA_assign_label_long, REQUEST_LOG_IN));
controlSetMap.put(getString(R.string.TEA_ctrl_who_pref),
peopleControlSet);
R.string.actfm_EPA_assign_label_long, REQUEST_LOG_IN);
if(Locale.getDefault().getCountry().equals("US")) {
taskRabbitControl = new TaskRabbitControlSet(this, R.layout.control_set_default_display);
controls.add(taskRabbitControl);
peopleControlSet.addListener(taskRabbitControl);
}
controls.add(peopleControlSet);
controlSetMap.put(getString(R.string.TEA_ctrl_who_pref),
peopleControlSet);
RepeatControlSet repeatControls = new RepeatControlSet(getActivity(),
R.layout.control_set_repeat,

@ -30,6 +30,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
@ -407,18 +408,19 @@ public class WebServicesView extends LinearLayout {
protected void initializeTaskRabbit() {
if(taskRabbitControl != null && taskRabbitControl.isEnabledForTRLocation == true) {
addSectionHeader("Task Rabbit");
addSectionHeader("Outsource this task to someone");
final LinearLayout body = new LinearLayout(activity);
body.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
ROW_HEIGHT));
body.setOrientation(LinearLayout.VERTICAL);
ImageView imageView = new ImageView(getContext());
imageView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
ROW_HEIGHT));
imageView.setImageResource(R.drawable.task_rabbit_logo);
imageView.setScaleType(ScaleType.CENTER_INSIDE);
body.addView(imageView);
body.setOnClickListener(new OnClickListener() {
@ -433,8 +435,6 @@ public class WebServicesView extends LinearLayout {
addSectionDivider();
}
else {
}
}

Loading…
Cancel
Save