Skip to content

Commit

Permalink
automated code inspect (#700)
Browse files Browse the repository at this point in the history
javadoc fixes and more
  • Loading branch information
BO41 authored and dmfs committed Sep 25, 2018
1 parent 5f4e901 commit d5496fc
Show file tree
Hide file tree
Showing 45 changed files with 65 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ private static void updateEntry(SQLiteDatabase db, long taskId, long propertyId,
* The row id of the task.
* @param propertyId
* The row id of the property.
* @param The
* entry type of the relation (title, description, property).
*/
private static void insertNGramRelations(SQLiteDatabase db, Set<Long> ngramIds, long taskId, Long propertyId, int contentType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private boolean applyingBatch()
@Override
public Uri insert(Uri uri, ContentValues values)
{
Uri result = null;
Uri result;
boolean callerIsSyncAdapter = isCallerSyncAdapter(uri);
boolean applyingBatch = applyingBatch();
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
Expand Down Expand Up @@ -198,7 +198,7 @@ public int bulkInsert(Uri uri, ContentValues[] values)
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs)
{
int count = 0;
int count;
boolean callerIsSyncAdapter = isCallerSyncAdapter(uri);
boolean applyingBatch = applyingBatch();
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
Expand Down Expand Up @@ -229,7 +229,7 @@ public int update(Uri uri, ContentValues values, String selection, String[] sele
@Override
public int delete(Uri uri, String selection, String[] selectionArgs)
{
int count = 0;
int count;
boolean callerIsSyncAdapter = isCallerSyncAdapter(uri);
boolean applyingBatch = applyingBatch();
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,8 @@ public int deleteInTransaction(final SQLiteDatabase db, Uri uri, String selectio
@Override
public Uri insertInTransaction(final SQLiteDatabase db, Uri uri, final ContentValues values, final boolean isSyncAdapter)
{
long rowId = 0;
Uri result_uri = null;
long rowId;
Uri result_uri;

String accountName = getAccountName(uri);
String accountType = getAccountType(uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ else if (type == Relation.RELTYPE_CHILD)
db.update(TaskDatabaseHelper.Tables.TASKS, taskValues, Tasks._ID + "=" + oldValues.getLong(relIdCol), null);
}
}
else if (type == Relation.RELTYPE_SIBLING)
{
// else if (type == Relation.RELTYPE_SIBLING)
// {
/*
* This was a link to a sibling, since it's no longer our sibling either it or we're orphaned now We won't know unless we check all relations.
*
* FIXME: properly handle this case
*/
}
// }
}
}
2 changes: 1 addition & 1 deletion opentasks/lint.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<lint></lint>
<lint/>
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ public static InputTextDialogFragment newInstance(String title, String hint, Str
*
* @param title
* The title of the dialog.
* @param message
* The text of the message field.
* @param hint
* The hint of the input field.
*
Expand All @@ -124,9 +122,6 @@ public static InputTextDialogFragment newInstance(String title, String hint, Str
*
* @param title
* The title of the dialog.
* @param message
* The text of the message field.
*
* @return A new {@link InputTextDialogFragment}.
*/
public static InputTextDialogFragment newInstance(String title, String hint)
Expand Down
10 changes: 0 additions & 10 deletions opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ public interface OnTextInputListener
/**
* Create a {@link QuickAddDialogFragment} with the given title and initial text value.
*
* @param titleId
* The resource id of the title.
* @param initalText
* The initial text in the input field.
*
* @return A new {@link QuickAddDialogFragment}.
*/
public static QuickAddDialogFragment newInstance(long listId)
Expand All @@ -173,11 +168,6 @@ public static QuickAddDialogFragment newInstance(long listId)
/**
* Create a {@link QuickAddDialogFragment} with the given title and initial text value.
*
* @param titleId
* The resource id of the title.
* @param initalText
* The initial text in the input field.
*
* @return A new {@link QuickAddDialogFragment}.
*/
public static QuickAddDialogFragment newInstance(ContentSet content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public void doneSaveListState()


/**
* This class is used to display a list of accounts. The list can be modified by the {@link #addAccount(Account)} and {@link #clear()} method. The dialog is
* This class is used to display a list of accounts. The dialog is
* supposed to display accounts, which support the insert intent to create new task list. The selection must be done before. The adapter will show all
* accounts, which are added.
*
Expand Down
7 changes: 1 addition & 6 deletions opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ public class TaskListFragment extends SupportFragment
private final static AbstractFilter COMPLETED_FILTER = new ConstantFilter(Tasks.IS_CLOSED + "=0");

/**
* The group descriptor to use. At present this can be either {@link ByDueDate#GROUP_DESCRIPTOR}, {@link ByCompleted#GROUP_DESCRIPTOR} or
* {@link ByList#GROUP_DESCRIPTOR}.
* The group descriptor to use.
*/
private ExpandableGroupDescriptor mGroupDescriptor;

Expand Down Expand Up @@ -192,8 +191,6 @@ public interface Callbacks
* The {@link Uri} of the selected task.
* @param forceReload
* Whether to reload the task or not.
* @param sender
* The sender of the callback.
*/
void onItemSelected(Uri taskUri, boolean forceReload, int pagePosition);

Expand Down Expand Up @@ -599,8 +596,6 @@ public void onClick(DialogInterface dialog, int which)
*
* @param taskUri
* The {@link Uri} of the task.
* @param taskTitle
* The name/title of the task.
*/
private void openTaskEditor(final Uri taskUri, final String accountType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.dmfs.tasks.groupings.filters;

import java.util.Collections;
import java.util.List;


Expand Down Expand Up @@ -61,10 +62,7 @@ public void getSelectionArgs(List<String> selectionArgs)
if (mSelectionArgs != null)
{
// append all arguments, if any
for (String arg : mSelectionArgs)
{
selectionArgs.add(arg);
}
Collections.addAll(selectionArgs, mSelectionArgs);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ private String getGMTOffsetString(long millis)
long absmillis = (millis < 0) ? -millis : millis;
int minutes = (int) ((absmillis / (1000 * 60)) % 60);
int hours = (int) ((absmillis / (1000 * 60 * 60)) % 24);
StringBuilder builder = new StringBuilder("(GMT");
builder.append((millis >= 0) ? '+' : '-');
builder.append(String.format("%02d:%02d", hours, minutes)).append(") ");
return builder.toString();
return String.format("(GMT%c%02d:%02d) ", millis >= 0 ? '+' : '-', hours, minutes);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ public TimeZone get(Cursor cursor)
/**
* Returns whether this is an "all-day timezone".
*
* @param cursor
* The cursor to read from.
*
* @return <code>true</code> if the cursor points to an all-day date.
*/
public boolean isAllDay(ContentSet values)
Expand All @@ -167,9 +164,6 @@ public boolean isAllDay(ContentSet values)
/**
* Returns whether this is an "all-day timezone".
*
* @param cursor
* The cursor to read from.
*
* @return <code>true</code> if the cursor points to an all-day date.
*/
public boolean isAllDay(ContentValues values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public Boolean apply(ContentSet currentValues, Boolean oldValue, Boolean newValu
}

}
else if ((newValue == null || !newValue) && oldValue != null && oldValue)
{
// else if ((newValue == null || !newValue) && oldValue != null && oldValue)
// {
// ideally we move the time to 00:00:00 in the new time zone. Unfortunately we don't know the time zone at this point
// TODO: move the time to 00:00:00 in the new time zone, somehow
}
// }
}
return newValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static void sendDueAlarmNotification(Context context, String title, Uri t
{
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

String dueString = "";
String dueString;
if (dueAllDay)
{
dueString = context.getString(R.string.notification_task_due_today);
Expand Down Expand Up @@ -159,7 +159,7 @@ public static void sendDueAlarmNotification(Context context, String title, Uri t
public static void sendStartNotification(Context context, String title, Uri taskUri, int notificationId, long startDate, boolean startAllDay,
String timezone, boolean silent)
{
String startString = "";
String startString;
if (startAllDay)
{
startString = context.getString(R.string.notification_task_start_today);
Expand Down Expand Up @@ -423,7 +423,7 @@ public static String formatTime(Context context, Time time)

// return combined date and time
String timeString = new DateFormatter(context).format(time, DateFormatContext.NOTIFICATION_VIEW_TIME);
return new StringBuilder().append(dateString).append(", ").append(timeString).toString();
return dateString + ", " + timeString;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ public static PendingIntent getUnpinActionIntent(Context context, int notificati
private static PendingIntent getDelayActionIntent(Context context, int notificationId, Uri taskUri, long due, boolean delay1h, String timezone,
boolean allday)
{
String action = null;
String action;
if (delay1h)
{
action = ACTION_DELAY_1H;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import android.database.Cursor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


Expand All @@ -45,10 +46,7 @@ public class ContentValueMapper
*/
public ContentValueMapper addString(String... columnNames)
{
for (String column : columnNames)
{
StringColumns.add(column);
}
Collections.addAll(StringColumns, columnNames);
return this;
}

Expand All @@ -63,10 +61,7 @@ public ContentValueMapper addString(String... columnNames)
*/
public ContentValueMapper addInteger(String... columnNames)
{
for (String column : columnNames)
{
IntegerColumns.add(column);
}
Collections.addAll(IntegerColumns, columnNames);
return this;
}

Expand All @@ -81,10 +76,7 @@ public ContentValueMapper addInteger(String... columnNames)
*/
public ContentValueMapper addLong(String... columnNames)
{
for (String column : columnNames)
{
LongColumns.add(column);
}
Collections.addAll(LongColumns, columnNames);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ public DateFormatter(Context context)
*
* @param date
* The due date to format.
* @param useToday
* <code>true</code> to write "today" instead of the date when the date is on the present day
*
* @return A string with the formatted due date.
*/
public String format(Time date, DateFormatContext dateContext)
Expand All @@ -255,9 +252,6 @@ public String format(DateTime date, DateFormatContext dateContext)
*
* @param date
* The due date to format.
* @param useToday
* <code>true</code> to write "today" instead of the date when the date is on the present day
*
* @return A string with the formatted due date.
*/
public String format(Time date, Time now, DateFormatContext dateContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public CursorLoader getCursorLoader(Context context, Cursor cursor, AbstractFilt
String selectionString = null;
if (selection != null)
{
selectionString = selection.toString();
selectionString = selection;
}
return new CursorLoader(context, mUri, mProjection, selectionString, selectionArgs, mSortOrder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ public interface OnFlingListener
* The parent {@link ListView} of the element that was flung.
* @param listElement
* The list element that is flinging
* @param pos
* The position of the item that was flung
* @param direction
* Flag to indicate in which direction the fling was performed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public SearchChildDescriptor(String authority, String queryColumn, String[] proj


/**
* Get a new {@link CursorLoader} and update it's selection arguments with the values in {@code cursor} as defined by {@code selectionColumns} in
* {@link #ExpandableChildDescriptor(Uri, String[], String, String, int...)}. Also applies any selection defined by <code>filter</code>.
* Get a new {@link CursorLoader} and update it's selection arguments with the values in {@code cursor} as defined by {@code selectionColumns}. Also applies any selection defined by <code>filter</code>.
*
* @param context
* A {@link Context}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ private Dialog getDatePickerWithSamsungWorkaround()
// The datepicker on Samsung Android 5.0 devices crashes for certain languages, e.g. french and polish
// We fall back to the holo datepicker in this case. German and English are confirmed to work.
if (Build.VERSION.SDK_INT == VERSION_CODES.LOLLIPOP && Build.MANUFACTURER.equalsIgnoreCase("samsung")
&& !("en".equals(Locale.getDefault().getLanguage().toString())))
&& !("en".equals(Locale.getDefault().getLanguage())))
{
// get holo picker
DatePickerDialog dialog = new DatePickerDialog(getContext(), R.style.DatePickerHolo, TimeFieldEditor.this, mDateTime.year, mDateTime.month,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/ic_checkmark_blank"
android:state_checked="false"></item>
android:state_checked="false"/>
<item android:drawable="@drawable/ic_checkmark_dark"
android:state_checked="true"></item>
android:state_checked="true"/>

</selector>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/ic_checkmark_blank"
android:state_checked="false"></item>
android:state_checked="false"/>
<item android:drawable="@drawable/ic_checkmark_light"
android:state_checked="true"></item>
android:state_checked="true"/>

</selector>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/rect_shape_corners_white_insert"
android:state_checked="false"></item>
android:state_checked="false"/>
<item android:drawable="@android:color/transparent"
android:state_checked="true"></item>
android:state_checked="true"/>

</selector>
2 changes: 1 addition & 1 deletion opentasks/src/main/res/layout/boolean_field_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:layout_gravity="center"
android:layout_margin="0dp"
android:padding="0dp"
android:duplicateParentState="true"></CheckBox>
android:duplicateParentState="true"/>

<TextView
android:id="@android:id/title"
Expand Down
Loading

0 comments on commit d5496fc

Please sign in to comment.