diff --git a/build.gradle b/build.gradle index 536ce22f5..829aece8a 100644 --- a/build.gradle +++ b/build.gradle @@ -89,6 +89,8 @@ dependencies { compile group: 'com.rubiconproject.oss', name: 'jchronic', version: '0.2.6', transitive: false compile group: 'org.scala-saddle', name: 'google-rfc-2445', version: '20110304', transitive: false + compile group: 'net.i2p.android.ext', name: 'floatingactionbutton', version: '1.8.0' + compile(group: 'com.google.apis', name: 'google-api-services-tasks', version: 'v1-rev33-1.18.0-rc') { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } diff --git a/src/main/java/com/faizmalkani/floatingactionbutton/FloatingActionButton.java b/src/main/java/com/faizmalkani/floatingactionbutton/FloatingActionButton.java deleted file mode 100644 index e4e175fb6..000000000 --- a/src/main/java/com/faizmalkani/floatingactionbutton/FloatingActionButton.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.faizmalkani.floatingactionbutton; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.View; - -import org.tasks.R; - -import static com.todoroo.andlib.utility.AndroidUtilities.atLeastHoneycomb; - -public class FloatingActionButton extends View { - - private final Paint mButtonPaint = new Paint(Paint.ANTI_ALIAS_FLAG) {{ - setStyle(Style.FILL); - }}; - private final Paint mButtonPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG) {{ - setStyle(Style.STROKE); - }}; - private final Paint mDrawablePaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private Bitmap mBitmap; - private int tint; - private int stroke; - - public FloatingActionButton(Context context) { - this(context, null); - } - - public FloatingActionButton(Context context, AttributeSet attributeSet) { - this(context, attributeSet, 0); - } - - public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - - TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.FloatingActionButton); - tint = a.getColor(R.styleable.FloatingActionButton_tint, Color.WHITE); - stroke = a.getColor(R.styleable.FloatingActionButton_stroke, Color.TRANSPARENT); - mButtonPaint.setColor(tint); - mButtonPaintStroke.setColor(stroke); - mButtonPaint.setShadowLayer( - a.getFloat(R.styleable.FloatingActionButton_shadowRadius, 10.0f), - a.getFloat(R.styleable.FloatingActionButton_shadowDx, 0.0f), - a.getFloat(R.styleable.FloatingActionButton_shadowDy, 3.5f), - a.getInteger(R.styleable.FloatingActionButton_shadowColor, Color.argb(100, 0, 0, 0))); - - Drawable drawable = a.getDrawable(R.styleable.FloatingActionButton_drawable); - if (null != drawable) { - mBitmap = ((BitmapDrawable) drawable).getBitmap(); - } - setWillNotDraw(false); - if (atLeastHoneycomb()) { - setLayerType(View.LAYER_TYPE_SOFTWARE, null); - } - } - - private static int darkenColor(int color) { - float[] hsv = new float[3]; - Color.colorToHSV(color, hsv); - hsv[2] *= 0.8f; - return Color.HSVToColor(hsv); - } - - @Override - protected void onDraw(Canvas canvas) { - canvas.drawCircle(getWidth() / 2, getHeight() / 2, (float) (getWidth() / 2.6), mButtonPaint); - canvas.drawCircle(getWidth() / 2, getHeight() / 2, (float) (getWidth() / 2.6), mButtonPaintStroke); - if (null != mBitmap) { - canvas.drawBitmap(mBitmap, (getWidth() - mBitmap.getWidth()) / 2, - (getHeight() - mBitmap.getHeight()) / 2, mDrawablePaint); - } - } - - @Override - public boolean onTouchEvent(MotionEvent event) { - int color; - if (event.getAction() == MotionEvent.ACTION_UP) { - color = tint; - } else { - color = darkenColor(tint); - } - mButtonPaint.setColor(color); - invalidate(); - return super.onTouchEvent(event); - } -} \ No newline at end of file diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java index 31444d371..205164644 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java @@ -34,7 +34,6 @@ import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; -import com.faizmalkani.floatingactionbutton.FloatingActionButton; import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.sql.Criterion; @@ -274,8 +273,7 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel Bundle savedInstanceState) { ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate( R.layout.task_list_activity, container, false); - FloatingActionButton fab = (FloatingActionButton) parent.findViewById(R.id.fab); - fab.setOnClickListener(new OnClickListener() { + parent.findViewById(R.id.fab).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (ActivityPreferences.isTabletSized(context)) { diff --git a/src/main/res/layout/task_list_activity.xml b/src/main/res/layout/task_list_activity.xml index 22124e4ac..44cca73d8 100644 --- a/src/main/res/layout/task_list_activity.xml +++ b/src/main/res/layout/task_list_activity.xml @@ -3,9 +3,8 @@ ** ** See the file "LICENSE" for the full license governing this code. --> - - + android:layout_marginEnd="16dp" /> - + diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index be1494382..c22fffa14 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -52,18 +52,12 @@ + + + - + - - - - - - - - - diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index 7bcd582e0..76c0d6712 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -67,6 +67,10 @@ @drawable/ic_action_reload @drawable/ic_action_calendar_month @drawable/ic_action_help + + ?attr/asAbBackgroundColor + #476472 + @android:color/white