first version of responsible- and dashboard-assignment. still needs testing and pushing assignment-changes to producteev-service. see TODO in ProducteevControlSet.

pull/14/head
Arne Jans 14 years ago
parent 315584ce2e
commit a9130b3ba4

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid"
android:versionName="3.1.0" android:versionCode="146"
android:installLocation="internalOnly">
android:versionName="3.1.0" android:versionCode="146">
<!-- android:installLocation="internalOnly"> -->
<!-- widgets, alarms, and services will break if Astrid is installed on SD card -->

@ -10,5 +10,5 @@
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-8
target=Motorola, Inc.:MILESTONE:7
apk-configurations=

@ -299,6 +299,35 @@ public class ProducteevInvoker {
"id_label", idLabel);
}
/**
* change responsible of a task
*
* @param idTask
* @param idResponsible
*
* @return array: tasks/view
*/
public JSONObject tasksSetResponsible(long idTask, long idResponsible) throws ApiServiceException, IOException {
return callAuthenticated("tasks/set_responsible.json",
"token", token,
"id_task", idTask,
"id_responsible", idResponsible);
}
/**
* change responsible of a task
*
* @param idTask
* @param idResponsible
*
* @return array: tasks/view
*/
public JSONObject tasksUnsetResponsible(long idTask) throws ApiServiceException, IOException {
return callAuthenticated("tasks/unset_responsible.json",
"token", token,
"id_task", idTask);
}
/**
* create a note attached to a task
*
@ -361,6 +390,19 @@ public class ProducteevInvoker {
"id_colleague", idColleague);
}
/**
* return the list of users who can access a specific dashboard
*
* @param idDashboard
* @param dashboard array-information about the dashboard, if this ...
*/
public JSONArray dashboardsAccess(long idDashboard, String dashboard) throws ApiServiceException, IOException {
return getResponse(callAuthenticated("dashboards/access",
"token", token,
"id_dashboard", idDashboard,
"dashboard", dashboard),"dashboard");
}
// --- invocation
private final ProducteevRestClient restClient = new ProducteevRestClient();

@ -1,5 +1,8 @@
package com.todoroo.astrid.producteev.sync;
import java.util.ArrayList;
import java.util.StringTokenizer;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.astrid.model.StoreObject;
@ -27,4 +30,71 @@ public class ProducteevDashboard {
public static final StringProperty USERS = new StringProperty(StoreObject.TABLE,
StoreObject.VALUE2.name);
// data class-part
private long id;
private String name;
private ArrayList<ProducteevUser> users = null;
public ProducteevDashboard (StoreObject dashboardData) {
this(dashboardData.getValue(REMOTE_ID),dashboardData.getValue(NAME),dashboardData.getValue(USERS));
}
/**
* Constructor for a dashboard.
*
* @param id id of the remote dashboard
* @param name name of the remote dashboard
* @param usercsv csv-userstring as returned by a StoreObject-dashboard with property ProducteevDashboard.USERS
*/
public ProducteevDashboard(long id, String name, String usercsv) {
this.id = id;
this.name = name;
StringTokenizer tokenizer = new StringTokenizer(usercsv, ";");
int usercount = tokenizer.countTokens();
while (tokenizer.hasMoreTokens()) {
String userdata = tokenizer.nextToken();
int delim_index = userdata.indexOf(",");
String userid = userdata.substring(0, delim_index);
String username = userdata.substring(delim_index+1);
int name_gap = username.indexOf(" ");
String firstname = (name_gap == -1 ? username : username.substring(0,name_gap));
String lastname = (name_gap == -1 ? null : username.substring(name_gap+1));
if (users == null) {
users = new ArrayList<ProducteevUser>(usercount);
}
users.add(new ProducteevUser(Long.parseLong(userid),null,firstname,lastname));
}
}
/**
* @return the id
*/
public long getId() {
return id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* return the name of this dashboard
*/
@Override
public String toString() {
return name;
}
/**
* @return the users
*/
public ArrayList<ProducteevUser> getUsers() {
return users;
}
}

@ -209,6 +209,8 @@ public final class ProducteevDataService {
private StoreObject[] dashboards = null;
private ArrayList colleagues;
/**
* Reads dashboards
*/
@ -284,4 +286,4 @@ public final class ProducteevDataService {
// clear dashboard cache
dashboards = null;
}
}
}

@ -86,5 +86,18 @@
<!-- Prod Login password not specified-->
<string name="producteev_MLA_password_empty">Password was not specified!</string>
</resources>
<!-- ================================================ labels for layout-elements == -->
<!-- label for task-assignment spinner on taskeditactivity -->
<string name="producteev_TEA_task_assign_label">Assign this task to this person:</string>
<!-- Spinner-item for unassigned tasks on taskeditactivity -->
<string name="producteev_TEA_task_unassigned">&lt;Unassigned&gt;</string>
<!-- label for dashboard-assignment spinner on taskeditactivity -->
<string name="producteev_TEA_dashboard_assign_label">Assign this task to this workspace:</string>
<!-- Spinner-item for default dashboard on taskeditactivity -->
<string name="producteev_TEA_dashboard_default">&lt;Default&gt;</string>
</resources>

@ -27,14 +27,14 @@ import java.util.List;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.TabActivity;
import android.app.DatePickerDialog.OnDateSetListener;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.DialogInterface.OnCancelListener;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.format.DateUtils;
@ -44,7 +44,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
@ -59,6 +58,7 @@ import android.widget.TabHost;
import android.widget.TimePicker;
import android.widget.Toast;
import android.widget.ToggleButton;
import android.widget.AdapterView.OnItemSelectedListener;
import com.flurry.android.FlurryAgent;
import com.timsu.astrid.R;
@ -72,7 +72,9 @@ import com.todoroo.astrid.alarms.AlarmControlSet;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.gcal.GCalControlSet;
import com.todoroo.astrid.model.AddOn;
import com.todoroo.astrid.model.Task;
import com.todoroo.astrid.producteev.ProducteevControlSet;
import com.todoroo.astrid.producteev.ProducteevUtilities;
import com.todoroo.astrid.repeats.RepeatControlSet;
import com.todoroo.astrid.service.AddOnService;
@ -217,6 +219,10 @@ public final class TaskEditActivity extends TabActivity {
controls.add(new RepeatControlSet(this, extrasAddons));
LinearLayout addonsAddons = (LinearLayout) findViewById(R.id.tab_addons_addons);
AddOn producteevAddon = addOnService.getAddOn(Constants.PACKAGE, "Producteev");
if (addOnService.isInstalled(producteevAddon) && ProducteevUtilities.INSTANCE.isLoggedIn()) {
controls.add(new ProducteevControlSet(this, addonsAddons));
}
if(addOnService.hasPowerPack()) {
controls.add(new GCalControlSet(this, addonsAddons));
controls.add(new TimerControlSet(this, addonsAddons));

@ -183,6 +183,27 @@ public class AddOnService {
return "30820265308201cea00302010202044954bd9c300d06092a864886f70d01010505003076310b3009060355040613025553310b3009060355040813024341311230100603550407130950616c6f20416c746f31183016060355040a130f6173747269642e6c7632352e636f6d311b3019060355040b131241737472696420446576656c6f706d656e74310f300d0603550403130654696d2053753020170d3038313232363131313835325a180f32303633303932393131313835325a3076310b3009060355040613025553310b3009060355040813024341311230100603550407130950616c6f20416c746f31183016060355040a130f6173747269642e6c7632352e636f6d311b3019060355040b131241737472696420446576656c6f706d656e74310f300d0603550403130654696d20537530819f300d06092a864886f70d010101050003818d00308189028181008b8f39e02a50e5f50723bb71208e99bd72dd3cb6266054809cce0dc33a38ebf79c2a1ab74264cc6c88d44a5092e34f45fc28c53188ebe5b7511f0e14862598a82e1a84b0c99e62b0603737c09501b92f723d9e561a0eedbc16ab494e93a513d170135e0e55af6bb40a9af1186df4cfe53ec3a6144336f9f8a338341656c5a3bd0203010001300d06092a864886f70d01010505000381810016352860629e5e17d2d747943170ddb8c01f014932cb4462f52295c2f764970e93fa461c73b44a678ecf8ab8480702fb746221a98ade8ab7562cae151be78973dfa47144d70b8d0b73220dd741755f62cc9230264f570ec21a4ab1f11b0528d799d3662d06354b56d0d7d28d05c260876a98151fb4e89b6ce2a5010c52b3e365".equals(packageInfo.signatures[0].toCharsString());
}
/**
* Get one AddOn-descriptor by packageName and title.
*
* @param packageName could be Constants.PACKAGE or one of AddOnService-constants
* @param title the descriptive title, as in "Producteev" or "Astrid Power Pack"
* @return the addon-descriptor, if it is available (registered here in getAddOns), otherwise null
*/
public AddOn getAddOn(String packageName, String title) {
if (title == null || packageName == null)
return null;
AddOn addon = null;
AddOn[] addons = getAddOns();
for (int i = 0; i < addons.length ; i++) {
if (packageName.equals(addons[i].getPackageName()) && title.equals(addons[i].getTitle())) {
addon = addons[i];
}
}
return addon;
}
/**
* Get a list of add-ons
*

Loading…
Cancel
Save