Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace tabs with 4 spaces in java files. Update code style to not ke… #546

Merged
merged 1 commit into from
Dec 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ public void getNgrams(String word, Set<String> ngrams)
{
/*
* Add another String with a space and the first n-1 characters of the word.
*
* We could just call
*
* ngrams.add(" " + word.substring(0, Math.min(len, n - 1));
*
* But it's probably way more efficient like this:
*/
*
* We could just call
*
* ngrams.add(" " + word.substring(0, Math.min(len, n - 1));
*
* But it's probably way more efficient like this:
*/
char[] tempArray = mTempArray;

int count = Math.min(len, n - 1);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public int deleteInTransaction(final SQLiteDatabase db, Uri uri, String selectio
}
/*
* Deleting task lists is only allowed to sync adapters. They must provide ACCOUNT_NAME and ACCOUNT_TYPE.
*/
*/
case LIST_ID:
// add _id to selection and fall through
selection = updateSelection(selectId(uri), selection);
Expand Down Expand Up @@ -760,7 +760,7 @@ public int deleteInTransaction(final SQLiteDatabase db, Uri uri, String selectio
}
/*
* Task won't be removed, just marked as deleted if the caller isn't a sync adapter. Sync adapters can remove tasks immediately.
*/
*/
case TASK_ID:
// add id to selection and fall through
selection = updateSelection(selectId(uri), selection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ private void clearParentId(SQLiteDatabase db, long taskId, Cursor oldValues)
{
int type = oldValues.getInt(oldValues.getColumnIndex(Relation.RELATED_TYPE));

/*
/*
* This is more complicated than it may sound. We don't know the order in which relations are created, updated or removed. So it's possible that a new
* parent relationship has been created and the old one is removed afterwards. In that case we can not simply clear the PARENT_ID.
*
* FIXME: For now we ignore that fact. But we should fix it.
*/
* parent relationship has been created and the old one is removed afterwards. In that case we can not simply clear the PARENT_ID.
*
* FIXME: For now we ignore that fact. But we should fix it.
*/

if (type == Relation.RELTYPE_PARENT)
{
Expand All @@ -252,9 +252,9 @@ 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
*/
*
* FIXME: properly handle this case
*/
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ else if (!isSyncAdapter && percent != null)
task.set(TaskAdapter.IS_NEW, status == null || status == Tasks.STATUS_NEEDS_ACTION);
task.set(TaskAdapter.IS_CLOSED, status != null && (status == Tasks.STATUS_COMPLETED || status == Tasks.STATUS_CANCELLED));

/*
/*
* Update PERCENT_COMPLETE and COMPLETED (if not given). Sync adapters should know what they're doing, so don't update anything if caller is a sync
* adapter.
*/
* adapter.
*/
if (status == Tasks.STATUS_COMPLETED && !isSyncAdapter)
{
task.set(TaskAdapter.PERCENT_COMPLETE, 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ private Long moveTask(SQLiteDatabase db, TaskAdapter task, long oldList, long ne
{
/*
* The task has been moved to a different list. Sync adapters are not expected to support this (especially since the new list may belong to a completely
* different account or even account-type), so we emulate a copy & delete operation.
*
* All sync adapter fields of the task are cleared, so it looks like a new task. In addition we create a new deleted task in the old list having the old
* sync adapter field values. This means that the _ID field of the "deleted" task will not equal the _ID field f the original task. Sync adapters should
* handle that correctly.
*/
* different account or even account-type), so we emulate a copy & delete operation.
*
* All sync adapter fields of the task are cleared, so it looks like a new task. In addition we create a new deleted task in the old list having the old
* sync adapter field values. This means that the _ID field of the "deleted" task will not equal the _ID field f the original task. Sync adapters should
* handle that correctly.
*/

Long result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ public void stopDetecting()
/**
* The shadow to be drawn above the {@link #draggedItem}.
*/
// private final Drawable dragTopShadowDrawable;
// private final Drawable dragTopShadowDrawable;
/**
* The shadow to be drawn below the {@link #draggedItem}.
*/
// private final Drawable dragBottomShadowDrawable;
// private final int dragShadowHeight;
// private final Drawable dragBottomShadowDrawable;
// private final int dragShadowHeight;

/**
* See {@link #setContainerScrollView(android.widget.ScrollView)}.
Expand Down Expand Up @@ -287,24 +287,24 @@ public DragLinearLayout(Context context, AttributeSet attrs)

final Resources resources = getResources();
// changed by dmfs: don't use shadows
// dragTopShadowDrawable = ContextCompat.getDrawable(context, R.drawable.ab_solid_shadow_holo_flipped);
// dragBottomShadowDrawable = ContextCompat.getDrawable(context, R.drawable.ab_solid_shadow_holo);
// dragShadowHeight = resources.getDimensionPixelSize(R.dimen.downwards_drop_shadow_height);
// dragTopShadowDrawable = ContextCompat.getDrawable(context, R.drawable.ab_solid_shadow_holo_flipped);
// dragBottomShadowDrawable = ContextCompat.getDrawable(context, R.drawable.ab_solid_shadow_holo);
// dragShadowHeight = resources.getDimensionPixelSize(R.dimen.downwards_drop_shadow_height);

// changed by dmfs: don't use DragLinearLayout_scrollSensitiveHeight from resources, use default
scrollSensitiveAreaHeight =
(int) (DEFAULT_SCROLL_SENSITIVE_AREA_HEIGHT_DP * resources.getDisplayMetrics().density + 0.5f);

// TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.DragLinearLayout, 0, 0);
// try
// {
// scrollSensitiveAreaHeight = a.getDimensionPixelSize(R.styleable.DragLinearLayout_scrollSensitiveHeight,
// (int) (DEFAULT_SCROLL_SENSITIVE_AREA_HEIGHT_DP * resources.getDisplayMetrics().density + 0.5f));
// }
// finally
// {
// a.recycle();
// }
// TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.DragLinearLayout, 0, 0);
// try
// {
// scrollSensitiveAreaHeight = a.getDimensionPixelSize(R.styleable.DragLinearLayout_scrollSensitiveHeight,
// (int) (DEFAULT_SCROLL_SENSITIVE_AREA_HEIGHT_DP * resources.getDisplayMetrics().density + 0.5f));
// }
// finally
// {
// a.recycle();
// }

nominalDistanceScaled = (int) (NOMINAL_DISTANCE * resources.getDisplayMetrics().density + 0.5f);
}
Expand Down Expand Up @@ -527,9 +527,9 @@ public void onAnimationUpdate(ValueAnimator animation)
draggedItem.setTotalOffset(((Float) animation.getAnimatedValue()).intValue());

final int shadowAlpha = (int) ((1 - animation.getAnimatedFraction()) * 255);
// if (null != dragTopShadowDrawable)
// dragTopShadowDrawable.setAlpha(shadowAlpha);
// dragBottomShadowDrawable.setAlpha(shadowAlpha);
// if (null != dragTopShadowDrawable)
// dragTopShadowDrawable.setAlpha(shadowAlpha);
// dragBottomShadowDrawable.setAlpha(shadowAlpha);
invalidate();
}
});
Expand All @@ -553,9 +553,9 @@ public void onAnimationEnd(Animator animation)
draggedItem.settleAnimation = null;
draggedItem.stopDetecting();

// if (null != dragTopShadowDrawable)
// dragTopShadowDrawable.setAlpha(255);
// dragBottomShadowDrawable.setAlpha(255);
// if (null != dragTopShadowDrawable)
// dragTopShadowDrawable.setAlpha(255);
// dragBottomShadowDrawable.setAlpha(255);

// restore layout transition
if (layoutTransition != null && getLayoutTransition() == null)
Expand Down Expand Up @@ -773,33 +773,33 @@ protected void dispatchDraw(@NonNull Canvas canvas)
final int top = draggedItem.viewDrawable.getBounds().top;
final int bottom = draggedItem.viewDrawable.getBounds().bottom;

// dragBottomShadowDrawable.setBounds(left, bottom, right, bottom + dragShadowHeight);
// dragBottomShadowDrawable.draw(canvas);
// dragBottomShadowDrawable.setBounds(left, bottom, right, bottom + dragShadowHeight);
// dragBottomShadowDrawable.draw(canvas);
//
// if (null != dragTopShadowDrawable)
// {
// dragTopShadowDrawable.setBounds(left, top - dragShadowHeight, right, top);
// dragTopShadowDrawable.draw(canvas);
// }
// if (null != dragTopShadowDrawable)
// {
// dragTopShadowDrawable.setBounds(left, top - dragShadowHeight, right, top);
// dragTopShadowDrawable.draw(canvas);
// }

canvas.restore();
}
}


/*
/*
* Note regarding touch handling: In general, we have three cases - 1) User taps outside any children. #onInterceptTouchEvent receives DOWN #onTouchEvent
* receives DOWN draggedItem.detecting == false, we return false and no further events are received 2) User taps on non-interactive drag handle / child,
* e.g. TextView or ImageView. #onInterceptTouchEvent receives DOWN DragHandleOnTouchListener (attached to each draggable child) #onTouch receives DOWN
* #startDetectingDrag is called, draggedItem is now detecting view does not handle touch, so our #onTouchEvent receives DOWN draggedItem.detecting == true,
* we #startDrag() and proceed to handle the drag 3) User taps on interactive drag handle / child, e.g. Button. #onInterceptTouchEvent receives DOWN
* DragHandleOnTouchListener (attached to each draggable child) #onTouch receives DOWN #startDetectingDrag is called, draggedItem is now detecting view
* handles touch, so our #onTouchEvent is not called yet #onInterceptTouchEvent receives ACTION_MOVE if dy > touch slop, we assume user wants to drag and
* intercept the event #onTouchEvent receives further ACTION_MOVE events, proceed to handle the drag
*
* For cases 2) and 3), lifting the active pointer at any point in the sequence of events triggers #onTouchEnd and the draggedItem, if detecting, is
* #stopDetecting.
*/
* receives DOWN draggedItem.detecting == false, we return false and no further events are received 2) User taps on non-interactive drag handle / child,
* e.g. TextView or ImageView. #onInterceptTouchEvent receives DOWN DragHandleOnTouchListener (attached to each draggable child) #onTouch receives DOWN
* #startDetectingDrag is called, draggedItem is now detecting view does not handle touch, so our #onTouchEvent receives DOWN draggedItem.detecting == true,
* we #startDrag() and proceed to handle the drag 3) User taps on interactive drag handle / child, e.g. Button. #onInterceptTouchEvent receives DOWN
* DragHandleOnTouchListener (attached to each draggable child) #onTouch receives DOWN #startDetectingDrag is called, draggedItem is now detecting view
* handles touch, so our #onTouchEvent is not called yet #onInterceptTouchEvent receives ACTION_MOVE if dy > touch slop, we assume user wants to drag and
* intercept the event #onTouchEvent receives further ACTION_MOVE events, proceed to handle the drag
*
* For cases 2) and 3), lifting the active pointer at any point in the sequence of events triggers #onTouchEnd and the draggedItem, if detecting, is
* #stopDetecting.
*/


@Override
Expand Down
8 changes: 4 additions & 4 deletions opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ private void updateView()
{
/*
* If the model loads very slowly then this function may be called after onDetach. In this case check if Activity is <code>null</code> and return if
* <code>true</code>. Also return if we don't have values or the values are still loading.
*/
* <code>true</code>. Also return if we don't have values or the values are still loading.
*/
Activity activity = getActivity();
if (activity == null || mValues == null || mValues.isLoading())
{
Expand Down Expand Up @@ -569,9 +569,9 @@ public void onContentLoaded(ContentSet contentSet)
Sources.loadModelAsync(mAppContext, contentSet.getAsString(Tasks.ACCOUNT_TYPE), EditTaskFragment.this);
}

/*
/*
* Don't start the model loader here, let onItemSelected do that.
*/
*/
setListUri(TaskLists.getContentUri(mAuthority), LIST_LOADER_VISIBLE_LISTS_FILTER);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public boolean onChildClick(ExpandableListView parent, View v, int groupPosition
}
/*
* In contrast to a ListView an ExpandableListView does not set the activated item on it's own. So we have to do that here.
*/
*/
setActivatedItem(groupPosition, childPosition);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void onDelete(Uri taskUri)
{
/*
* The task we're showing has been deleted, just finish.
*/
*/
finish();
}

Expand Down
10 changes: 5 additions & 5 deletions opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public void loadUri(Uri uri)
{
/*
* Unregister the observer for any previously shown task first.
*/
*/
mAppContext.getContentResolver().unregisterContentObserver(mObserver);
persistTask();
}
Expand All @@ -381,7 +381,7 @@ public void loadUri(Uri uri)
{
/*
* Create a new ContentSet and load the values for the given Uri. Also register listener and observer for changes in the ContentSet and the Uri.
*/
*/
mContentSet = new ContentSet(uri);
mContentSet.addOnChangeListener(this, null, true);
mAppContext.getContentResolver().registerContentObserver(uri, false, mObserver);
Expand All @@ -391,7 +391,7 @@ public void loadUri(Uri uri)
{
/*
* Immediately update the view with the empty task uri, i.e. clear the view.
*/
*/
mContentSet = null;
if (mContent != null)
{
Expand All @@ -403,7 +403,7 @@ public void loadUri(Uri uri)
{
/*
* getActivity().invalidateOptionsMenu() doesn't work in Android 2.x so use the compat lib
*/
*/
ActivityCompat.invalidateOptionsMenu(getActivity());
}

Expand Down Expand Up @@ -494,7 +494,7 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
{
/*
* Don't show any options if we don't have a task to show.
*/
*/
if (mTaskUri != null)
{
menu = mToolBar.getMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a
{
/*
* Iterate over all the widgets of this type and update them individually.
*/
*/
for (int i = 0; i < appWidgetIds.length; i++)
{
Log.d(TAG, "updating widget " + i);
Expand Down Expand Up @@ -186,7 +186,7 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a

widget.setPendingIntentTemplate(R.id.task_list_widget_lv, clickPI);

/* Finally update the widget */
/* Finally update the widget */
appWidgetManager.updateAppWidget(appWidgetIds[i], widget);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a
}
}

/*
/*
* Create and set a {@link PendingIntent} to view the task when the list is clicked.
*/
*/
Intent itemClickIntent = new Intent();
itemClickIntent.setAction(Intent.ACTION_VIEW);
itemClickIntent.putExtra(TaskListActivity.EXTRA_FORCE_LIST_SELECTION, true);
Expand Down
12 changes: 6 additions & 6 deletions opentasks/src/main/java/org/dmfs/tasks/model/ContentSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ public void ensureUpdates(Set<String> keys)
ContentValues tempValues = new ContentValues(mBeforeContentValues);
/*
* Remove all values from tempValues that already are in mAfterContentValues or that are not required to be updated.
*
* This is tricky because we can't rely on ContentValues.keySet(). That's why we have to iterate all keys and remove the ones we don't have to update.
* Since we can't modify tempValues while iterating over its keys we have to create a temporary Set.
*
* TODO: find a better way to solve this
*/
*
* This is tricky because we can't rely on ContentValues.keySet(). That's why we have to iterate all keys and remove the ones we don't have to update.
* Since we can't modify tempValues while iterating over its keys we have to create a temporary Set.
*
* TODO: find a better way to solve this
*/
for (Entry<String, Object> entry : new HashSet<Entry<String, Object>>(tempValues.valueSet()))
{
String key = entry.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public void inflate()

Context context = getContext();

/*
/*
* Add a couple of fields to the model.
*/
*/
// task list color
addField(new FieldDescriptor(context, R.id.task_field_list_color, R.string.task_list, null, TaskFieldAdapters.LIST_COLOR)
.setViewLayout(LIST_COLOR_VIEW).setEditorLayout(LIST_COLOR_VIEW).setNoAutoAdd(true));
Expand Down
Loading