Remove unused code

Alex Baker 13 years ago
parent 9906b181db
commit 8b584788b8

@ -34,10 +34,6 @@ public final class Functions {
return new Field("(strftime('%s','now')*1000)");
}
public static Field fromNow(long millis) {
return new Field("(strftime('%s','now')*1000 + " + millis + ")");
}
public static Field strftime(LongProperty field, String format) {
return new Field("(strftime('" + format + "', datetime(" + field.toString() + "/1000, 'unixepoch', 'localtime')))");
}

@ -562,38 +562,6 @@ public class AndroidUtilities {
}
}
/**
* From Android MyTracks project (http://mytracks.googlecode.com/).
* Licensed under the Apache Public License v2
*
* @param activity
* @param id
* @return
*/
public static CharSequence readFile(Context activity, int id) {
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
activity.getResources().openRawResource(id)));
String line;
StringBuilder buffer = new StringBuilder();
while ((line = in.readLine()) != null) {
buffer.append(line).append('\n');
}
return buffer;
} catch (IOException e) {
return ""; //$NON-NLS-1$
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// Ignore
}
}
}
}
public static String readInputStream(InputStream input) {
BufferedReader in = null;
try {

@ -70,11 +70,6 @@ abstract public class SyncProviderUtilities {
return getPrefs().getString(getIdentifier() + PREF_TOKEN, null);
}
/**
* Returns something like "Logged in as: user@gmail.com"
*/
abstract public String getLoggedInUserName();
/**
* Sets the authentication token. Set to null to clear.
*/

@ -182,7 +182,7 @@ public class ActFmInvoker {
}
}
public JSONObject postSync(String data, MultipartEntity entity, boolean changesHappened, String tok) throws IOException {
public JSONObject postSync(String data, MultipartEntity entity, String tok) throws IOException {
try {
String timeString = DateUtilities.timeToIso8601(DateUtilities.now(), true);

@ -172,28 +172,4 @@ public class ActFmPreferenceService extends SyncProviderUtilities {
Preferences.setBoolean(PREF_LOCAL_PREMIUM, false);
Preferences.setBoolean(PREF_PREMIUM, false);
}
@Override
public String getLoggedInUserName() {
String name = Preferences.getStringValue(PREF_NAME);
if (TextUtils.isEmpty(name)) {
String firstName = Preferences.getStringValue(PREF_FIRST_NAME);
if (!TextUtils.isEmpty(firstName)) {
name = firstName;
}
String lastName = Preferences.getStringValue(PREF_FIRST_NAME);
if (!TextUtils.isEmpty(lastName)) {
if (!TextUtils.isEmpty(name)) {
name += " "; //$NON-NLS-1$
}
name += lastName;
}
if (name == null) {
name = ""; //$NON-NLS-1$
}
}
return name;
}
}

@ -281,13 +281,11 @@ public class ActFmSyncThread {
if (!messageBatch.isEmpty() && checkForToken()) {
JSONPayloadBuilder payload = new JSONPayloadBuilder();
MultipartEntity entity = new MultipartEntity();
boolean containsChangesHappened = false;
for (int i = 0; i < messageBatch.size(); i++) {
ClientToServerMessage<?> message = messageBatch.get(i);
boolean success = payload.addMessage(message, entity);
if (success) {
if (message instanceof ChangesHappened) {
containsChangesHappened = true;
}
} else {
messageBatch.remove(i);
@ -307,7 +305,7 @@ public class ActFmSyncThread {
JSONArray errors = null;
try {
JSONObject response = actFmInvoker.postSync(payload.closeAndReturnString(), entity, containsChangesHappened, token);
JSONObject response = actFmInvoker.postSync(payload.closeAndReturnString(), entity, token);
// process responses
String time = response.optString("time");
JSONArray serverMessagesJson = response.optJSONArray("messages");

@ -1,63 +0,0 @@
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.todoroo.astrid.activity;
import android.app.Activity;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.service.TaskService;
/**
* Displays an EULA ("End User License Agreement") that the user has to accept
* before using the application. Your application should call
* {@link Eula#showEula(android.app.Activity)} in the onCreate() method of the
* first activity. If the user accepts the EULA, it will never be shown again.
* If the user refuses, {@link android.app.Activity#finish()} is invoked on your
* activity.
*/
public final class Eula {
public static final String PREFERENCE_EULA_ACCEPTED = "eula.accepted"; //$NON-NLS-1$
@Autowired
TaskService taskService;
private static void accept(Activity activity) {
if (activity instanceof EulaCallback) {
((EulaCallback) activity).eulaAccepted();
}
Preferences.setBoolean(PREFERENCE_EULA_ACCEPTED, true);
}
private static void refuse(Activity activity) {
if (activity instanceof EulaCallback) {
((EulaCallback) activity).eulaRefused();
}
activity.finish();
}
public static interface EulaCallback {
public void eulaAccepted();
public void eulaRefused();
}
private Eula() {
// don't construct me
DependencyInjectionService.getInstance().inject(this);
}
}

@ -267,18 +267,6 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele
return newFragment;
}
/**
* Convenience method for calling instantiateWithFilterAndExtras(Filter, Bundle, Class<?>) with
* TaskListFragment as the default component
*
* @param filter
* @param extras
* @return
*/
public static TaskListFragment instantiateWithFilterAndExtras(Filter filter, Bundle extras) {
return instantiateWithFilterAndExtras(filter, extras, null);
}
/**
* Container Activity must implement this interface and we ensure that it
* does during the onAttach() callback

@ -46,12 +46,6 @@ public final class GtasksMetadataService extends SyncMetadataService<GtasksTaskC
DependencyInjectionService.getInstance().inject(this);
}
@Override
public GtasksTaskContainer createContainerFromLocalTask(Task task,
ArrayList<Metadata> metadata) {
return new GtasksTaskContainer(task, metadata);
}
@Override
public Criterion getLocalMatchCriteria(GtasksTaskContainer remoteTask) {
return GtasksMetadata.ID.eq(remoteTask.gtaskMetadata.getValue(GtasksMetadata.ID));

@ -56,9 +56,4 @@ public class GtasksPreferenceService extends SyncProviderUtilities {
* Pref that is set once migration to new GTasks API has occurred
*/
public static final String PREF_MIGRATION_HAS_OCCURRED = IDENTIFIER + "_migrated"; //$NON-NLS-1$
@Override
public String getLoggedInUserName() {
return Preferences.getStringValue(PREF_USER_NAME);
}
}

@ -127,9 +127,4 @@ public class OpencrxCoreUtils extends SyncProviderUtilities {
public int getSyncIntervalKey() {
return 0;
}
@Override
public String getLoggedInUserName() {
return ""; //$NON-NLS-1$
}
}

@ -34,18 +34,6 @@ public abstract class MarketStrategy {
return false;
}
public static class NoMarketStrategy extends MarketStrategy {
@Override
public Intent generateMarketLink(String packageName) {
return null;
}
@Override
public String strategyId() {
return "no_market"; //$NON-NLS-1$
}
}
public static class AndroidMarketStrategy extends MarketStrategy {
@Override

@ -27,7 +27,6 @@ import com.todoroo.astrid.actfm.sync.EmptyTitleOutstandingEntryMigration;
import com.todoroo.astrid.actfm.sync.messages.ConvertSelfUserIdsToZero;
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.activity.Eula;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.core.PluginServices;
@ -718,7 +717,6 @@ public final class UpgradeService {
if (gtasksPreferenceService.isLoggedIn()) {
taskService.clearDetails(Criterion.all);
}
Preferences.setBoolean(Eula.PREFERENCE_EULA_ACCEPTED, true);
}
if (from >= V3_0_0 && from < V3_6_0) {
newVersionString(changeLog, "3.6.0 (11/13/10)", new String[]{

@ -50,18 +50,12 @@ public class ContactListAdapter extends CursorAdapter {
Email._ID, Email.CONTACT_ID, ContactsContract.Contacts.DISPLAY_NAME, Email.DATA
};
private boolean completeSharedTags = false;
public ContactListAdapter(Activity activity, Cursor c) {
super(activity, c);
mContent = activity.getContentResolver();
DependencyInjectionService.getInstance().inject(this);
}
public void setCompleteSharedTags(boolean completeSharedTags) {
this.completeSharedTags = completeSharedTags;
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
final LayoutInflater inflater = LayoutInflater.from(context);
@ -155,21 +149,7 @@ public class ContactListAdapter extends CursorAdapter {
Cursor peopleCursor = mContent.query(uri, PEOPLE_PROJECTION,
null, null, sort);
if (!completeSharedTags) {
return peopleCursor;
}
Criterion crit = Criterion.all;
if (constraint != null) {
crit = Functions.upper(TagData.NAME).like("%" + constraint.toString().toUpperCase() + "%");
} else {
crit = Criterion.none;
}
Cursor tagCursor = tagDataService.query(Query.select(TagData.ID, TagData.NAME, TagData.PICTURE, TagData.THUMB).
where(Criterion.and(TagData.USER_ID.eq(0), TagData.MEMBER_COUNT.gt(0),
crit)).orderBy(Order.desc(TagData.NAME)));
return new MergeCursor(new Cursor[]{tagCursor, peopleCursor});
return peopleCursor;
}
private final ContentResolver mContent;

@ -49,11 +49,6 @@ abstract public class SyncMetadataService<TYPE extends SyncContainer> {
*/
abstract public SyncProviderUtilities getUtilities();
/**
* create a task container based on the given data
*/
abstract public TYPE createContainerFromLocalTask(Task task, ArrayList<Metadata> metadata);
/**
* @return criterion for matching all metadata keys that your provider synchronizes
*/

Loading…
Cancel
Save