diff --git a/DoNExt/app/build.gradle b/DoNExt/app/build.gradle
index 170505a..a6a0a02 100644
--- a/DoNExt/app/build.gradle
+++ b/DoNExt/app/build.gradle
@@ -8,8 +8,8 @@ android {
applicationId "com.wismna.geoffroy.donext"
minSdkVersion 19
targetSdkVersion 25
- versionCode 21
- versionName "1.4.6"
+ versionCode 22
+ versionName "1.4.7"
}
buildTypes {
release {
diff --git a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TaskFormDialogFragment.java b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TaskFormDialogFragment.java
index e425769..2c56acf 100644
--- a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TaskFormDialogFragment.java
+++ b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TaskFormDialogFragment.java
@@ -126,6 +126,26 @@ public class TaskFormDialogFragment extends DynamicDialogFragment {
}
});
+ // Handle priority changes
+ final TextView tooltip = (TextView) findViewById(R.id.new_task_priority_tooltip);
+ SeekBar seekBar = (SeekBar) findViewById(R.id.new_task_priority);
+ seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ tooltip.setText(getResources().getStringArray(R.array.task_priority)[progress]);
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ tooltip.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ tooltip.setVisibility(View.GONE);
+ }
+ });
+ tooltip.setText(getResources().getStringArray(R.array.task_priority)[seekBar.getProgress()]);
// Set other properties if they exist
if (task != null) {
@@ -133,7 +153,7 @@ public class TaskFormDialogFragment extends DynamicDialogFragment {
titleText.setText(task.getName());
EditText descText = (EditText) findViewById(R.id.new_task_description);
descText.setText(task.getDescription());
- SeekBar seekBar = (SeekBar) findViewById(R.id.new_task_priority);
+
seekBar.setProgress(task.getPriority());
// Set Due Date
diff --git a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TasksFragment.java b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TasksFragment.java
index 421f272..45946e1 100644
--- a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TasksFragment.java
+++ b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/fragments/TasksFragment.java
@@ -113,8 +113,8 @@ public class TasksFragment extends Fragment implements
// Set ItemTouch helper in RecyclerView to handle swipe move on elements
final Resources resources = getResources();
ItemTouchHelper.Callback callback = new TaskTouchHelper(this,
- ContextCompat.getColor(context, R.color.colorAccent),
- ContextCompat.getColor(context, R.color.colorPrimary));
+ ContextCompat.getColor(context, R.color.colorPrimary),
+ ContextCompat.getColor(context, R.color.colorAccent));
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(recyclerView);
diff --git a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/helpers/TaskTouchHelper.java b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/helpers/TaskTouchHelper.java
index 65ce2d2..d67d352 100644
--- a/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/helpers/TaskTouchHelper.java
+++ b/DoNExt/app/src/main/java/com/wismna/geoffroy/donext/helpers/TaskTouchHelper.java
@@ -23,14 +23,14 @@ public class TaskTouchHelper extends ItemTouchHelper.SimpleCallback {
}
private final TaskTouchHelperAdapter mAdapter;
- private int colorDone;
- private int colorNext;
+ private int colorRight;
+ private int colorLeft;
- public TaskTouchHelper(TaskTouchHelperAdapter adapter, int colorDone, int colorNext){
+ public TaskTouchHelper(TaskTouchHelperAdapter adapter, int colorRight, int colorLeft){
// No drag moves, no swipes (except for 1st element, see getSwipeDirs method)
super(0, 0);
- this.colorDone = colorDone;
- this.colorNext = colorNext;
+ this.colorRight = colorRight;
+ this.colorLeft = colorLeft;
this.mAdapter = adapter;
}
@@ -59,72 +59,48 @@ public class TaskTouchHelper extends ItemTouchHelper.SimpleCallback {
View itemView = viewHolder.itemView;
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
- Paint background = new Paint();
- TextPaint textPaint = new TextPaint();
- textPaint.setAntiAlias(true);
- textPaint.setTextSize(25 * itemView.getResources().getDisplayMetrics().density);
- textPaint.setColor(Color.WHITE);
-
- int heightOffset = itemView.getHeight() / 2 - (int)textPaint.getTextSize() / 2;
- int widthOffset = 30;
if (dX > 0) {
- // Set your color for positive displacement
- //background.setARGB(255, 222, 222, 222);
- //p.setARGB(255, 204, 229, 255);
- background.setColor(colorNext);
- // Draw Rect with varying right side, equal to displacement dX
Rect rect = new Rect(itemView.getLeft(), itemView.getTop(), (int) dX,
itemView.getBottom());
- c.drawRect(rect, background);
-
- // Draw text in the rectangle
- String text = itemView.getResources().getString(R.string.task_confirmation_next_button).toUpperCase();
- int width = (int) textPaint.measureText(text);
- float textXCoordinate = rect.left + widthOffset;
- c.translate(textXCoordinate, dY + heightOffset);
- StaticLayout staticLayout = new StaticLayout(text, textPaint, width, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false);
- staticLayout.draw(c);
- //textView = recyclerView.getRootView().findViewById(R.id.task_background_next);
-
+ setBackground(c, itemView, rect, dX, dY,
+ colorLeft, R.string.task_confirmation_next_button);
} else {
- // Set your color for negative displacement
- background.setColor(colorDone);
- //p.setARGB(255, 204, 255, 229);
// Draw Rect with varying left side, equal to the item's right side plus negative displacement dX
Rect rect = new Rect(itemView.getRight() + (int)dX, itemView.getTop(),
itemView.getRight(), itemView.getBottom());
- c.drawRect(rect, background);
-
- // Draw text in the rectangle
- String text = itemView.getResources().getString(R.string.task_confirmation_done_button).toUpperCase();
- int width = (int) textPaint.measureText(text);
- float textXCoordinate = rect.right - width - widthOffset;
- c.translate(textXCoordinate, dY + heightOffset);
- StaticLayout staticLayout = new StaticLayout(text, textPaint, width, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false);
- staticLayout.draw(c);
- //textView = recyclerView.getRootView().findViewById(R.id.task_background_done);
+ setBackground(c, itemView, rect, dX, dY,
+ colorRight, R.string.task_confirmation_done_button);
}
- //textView.draw(c);
}
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
}
- /*@Override
- public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
- if (actionState != ItemTouchHelper.ACTION_STATE_IDLE)
- {
- viewHolder.itemView.setBackgroundColor(Color.LTGRAY);
- }
+ private void setBackground(Canvas c, View itemView,
+ Rect rect, float dX, float dY, int color, int textId) {
- super.onSelectedChanged(viewHolder, actionState);
+ TextPaint textPaint = new TextPaint();
+ textPaint.setAntiAlias(true);
+ textPaint.setTextSize(25 * itemView.getResources().getDisplayMetrics().density);
+ textPaint.setColor(Color.WHITE);
+
+ int heightOffset = itemView.getHeight() / 2 - (int)textPaint.getTextSize() / 2;
+ int widthOffset = 30;
+
+ Paint background = new Paint();
+ // Set your color for negative displacement
+ background.setColor(color);
+ // Draw Rect with varying left side, equal to the item's right side plus negative displacement dX
+ c.drawRect(rect, background);
+
+ // Draw text in the rectangle
+ String text = itemView.getResources().getString(textId).toUpperCase();
+ int width = (int) textPaint.measureText(text);
+ float textXCoordinate;
+ if (dX > 0) textXCoordinate = rect.left + widthOffset;
+ else textXCoordinate = rect.right - width - widthOffset;
+ c.translate(textXCoordinate, dY + heightOffset);
+ StaticLayout staticLayout = new StaticLayout(text, textPaint, width, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false);
+ staticLayout.draw(c);
}
-
- @Override
- public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
- super.clearView(recyclerView, viewHolder);
-
- viewHolder.itemView.setAlpha(1.0f);
- viewHolder.itemView.setBackgroundColor(0);
- }*/
}
diff --git a/DoNExt/app/src/main/res/layout/content_task_form.xml b/DoNExt/app/src/main/res/layout/content_task_form.xml
index 181e582..7bca1a3 100644
--- a/DoNExt/app/src/main/res/layout/content_task_form.xml
+++ b/DoNExt/app/src/main/res/layout/content_task_form.xml
@@ -64,6 +64,19 @@
android:layout_height="30dp"
android:layout_toEndOf="@id/new_task_priority_label"
android:layout_below="@id/new_task_description" />
+
Simple
- Détaillée
+
+ - Basse
+ - Moyenne
+ - Haute
+
\ No newline at end of file
diff --git a/DoNExt/app/src/main/res/values/arrays.xml b/DoNExt/app/src/main/res/values/arrays.xml
index 41e6ef2..16e3fe3 100644
--- a/DoNExt/app/src/main/res/values/arrays.xml
+++ b/DoNExt/app/src/main/res/values/arrays.xml
@@ -17,4 +17,9 @@
- 1
- 2
+
+ - Low
+ - Medium
+ - High
+
\ No newline at end of file
diff --git a/DoNExt/build.gradle b/DoNExt/build.gradle
index 1ea4bd0..b78a0b8 100644
--- a/DoNExt/build.gradle
+++ b/DoNExt/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.0'
+ classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files