@ -1,80 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2012 Todoroo Inc
|
|
||||||
*
|
|
||||||
* See the file "LICENSE" for the full license governing this code.
|
|
||||||
*/
|
|
||||||
package com.todoroo.astrid.core;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.graphics.Path;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws filters
|
|
||||||
*
|
|
||||||
* @author Tim Su <tim@todoroo.com>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class FilterView extends View {
|
|
||||||
|
|
||||||
private int start = 0, end = 0, max = 1;
|
|
||||||
|
|
||||||
private static final int FILTER_COLOR = Color.rgb(0x1f, 0x78, 0xb4);
|
|
||||||
private static final int BG_COLOR = Color.rgb(0xe9, 0xe9, 0xe9);
|
|
||||||
private static final int TEXT_COLOR = Color.WHITE;
|
|
||||||
|
|
||||||
// --- boilerplate
|
|
||||||
|
|
||||||
public void setStart(int start) {
|
|
||||||
this.start = start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnd(int end) {
|
|
||||||
this.end = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMax(int max) {
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilterView(Context context, AttributeSet attrs, int defStyle) {
|
|
||||||
super(context, attrs, defStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilterView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilterView(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- painting code
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDraw(Canvas canvas) {
|
|
||||||
Paint paint = new Paint();
|
|
||||||
paint.setColor(BG_COLOR);
|
|
||||||
paint.setStyle(Paint.Style.FILL);
|
|
||||||
canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
|
|
||||||
|
|
||||||
paint.setColor(FILTER_COLOR);
|
|
||||||
Path path = new Path();
|
|
||||||
path.moveTo(getWidth() * (0.5f - 0.5f * start / max), 0);
|
|
||||||
path.lineTo(getWidth() * (0.5f + 0.5f * start / max), 0);
|
|
||||||
path.lineTo(getWidth() * (0.5f + 0.5f * end / max), getHeight());
|
|
||||||
path.lineTo(getWidth() * (0.5f - 0.5f * end / max), getHeight());
|
|
||||||
path.close();
|
|
||||||
canvas.drawPath(path, paint);
|
|
||||||
|
|
||||||
paint.setColor(TEXT_COLOR);
|
|
||||||
paint.setTextAlign(Paint.Align.CENTER);
|
|
||||||
paint.setTextSize(16);
|
|
||||||
canvas.drawText(Integer.toString(end), getWidth() / 2, getHeight() / 2 + 8, paint);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 926 B |
Before Width: | Height: | Size: 939 B |
Before Width: | Height: | Size: 807 B |
Before Width: | Height: | Size: 954 B |
@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/asContentBackground"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include layout="@layout/toolbar" />
|
||||||
|
|
||||||
|
<include layout="@layout/toolbar_separator" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="top">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tag_label"
|
||||||
|
style="@style/TextAppearance"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:text="@string/name" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/tag_name"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/tag_label"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:background="#00000000"
|
||||||
|
android:hint="@string/enter_tag_name"
|
||||||
|
android:imeOptions="flagNoExtractUi"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?attr/asTextColorHint"
|
||||||
|
android:textColorHint="?attr/asTextColorHint"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|