mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Finished translations (and connected layout issues)
Adds text behind task swipe
This commit is contained in:
1
DoNExt/.idea/.name
generated
1
DoNExt/.idea/.name
generated
@@ -1 +0,0 @@
|
||||
DoNExt
|
8
DoNExt/.idea/dictionaries/geoffroy.xml
generated
8
DoNExt/.idea/dictionaries/geoffroy.xml
generated
@@ -1,8 +0,0 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="geoffroy">
|
||||
<words>
|
||||
<w>geoffroy</w>
|
||||
<w>wismna</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
3
DoNExt/.idea/gradle.xml
generated
3
DoNExt/.idea/gradle.xml
generated
@@ -5,8 +5,7 @@
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.14.1" />
|
||||
<option name="gradleJvm" value="1.7" />
|
||||
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
@@ -8,8 +8,8 @@ android {
|
||||
applicationId "com.wismna.geoffroy.donext"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 11
|
||||
versionName "1.0.0"
|
||||
versionCode 12
|
||||
versionName "1.1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@@ -239,7 +239,7 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
||||
*/
|
||||
public class SectionsPagerAdapter extends SmartFragmentStatePagerAdapter {
|
||||
|
||||
public SectionsPagerAdapter(FragmentManager fm) {
|
||||
SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,18 @@
|
||||
package com.wismna.geoffroy.donext.helpers;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.view.View;
|
||||
|
||||
import com.wismna.geoffroy.donext.R;
|
||||
|
||||
/**
|
||||
* Created by geoffroy on 15-12-04.
|
||||
* Helper class that handles all swipe events on a Task
|
||||
@@ -44,31 +51,73 @@ public class TaskTouchHelper extends ItemTouchHelper.SimpleCallback {
|
||||
@Override
|
||||
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
|
||||
float dX, float dY, int actionState, boolean isCurrentlyActive) {
|
||||
// TODO: add NEXT and DONE texts while swiping (eventually buttons?)
|
||||
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
|
||||
// Get RecyclerView item from the ViewHolder
|
||||
View itemView = viewHolder.itemView;
|
||||
//View backgroundView = recyclerView.getRootView().findViewById(R.id.task_list_background);
|
||||
//View textView;
|
||||
/*if (dX > 0) {
|
||||
textView = recyclerView.getRootView().findViewById(R.id.task_background_next);
|
||||
} else {
|
||||
textView = recyclerView.getRootView().findViewById(R.id.task_background_done);
|
||||
}
|
||||
//backgroundView.setY(itemView.getTop());
|
||||
|
||||
Paint p = new Paint();
|
||||
p.setARGB(255, 222, 222, 222);
|
||||
if (dX > 0) {
|
||||
if (isCurrentlyActive) {
|
||||
backgroundView.setVisibility(View.VISIBLE);
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
backgroundView.setVisibility(View.GONE);
|
||||
textView.setVisibility(View.GONE);
|
||||
}*/
|
||||
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
|
||||
Paint background = new Paint();
|
||||
background.setARGB(255, 222, 222, 222);
|
||||
|
||||
TextPaint textPaint = new TextPaint();
|
||||
textPaint.setAntiAlias(true);
|
||||
textPaint.setTextSize(25 * itemView.getResources().getDisplayMetrics().density);
|
||||
textPaint.setColor(Color.WHITE);
|
||||
|
||||
int heightOffset = 55;
|
||||
int widthOffset = 30;
|
||||
// Set your color for positive displacement
|
||||
if (dX > 0) {
|
||||
//p.setARGB(255, 204, 229, 255);
|
||||
|
||||
// Draw Rect with varying right side, equal to displacement dX
|
||||
c.drawRect((float) itemView.getLeft(), (float) itemView.getTop(), dX,
|
||||
(float) itemView.getBottom(), p);
|
||||
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);
|
||||
|
||||
} else {
|
||||
// Set your color for negative displacement
|
||||
//p.setARGB(255, 204, 255, 229);
|
||||
|
||||
// Draw Rect with varying left side, equal to the item's right side plus negative displacement dX
|
||||
c.drawRect((float) itemView.getRight() + dX, (float) itemView.getTop(),
|
||||
(float) itemView.getRight(), (float) itemView.getBottom(), p);
|
||||
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);
|
||||
}
|
||||
//textView.draw(c);
|
||||
}
|
||||
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
|
||||
|
@@ -25,7 +25,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
<Button
|
||||
android:id="@+id/task_list_delete"
|
||||
android:layout_width="80dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:text="@string/task_list_delete" />
|
||||
|
@@ -18,16 +18,50 @@
|
||||
android:layout_centerHorizontal="true" />
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/task_list_view"
|
||||
android:name="com.wismna.geoffroy.donext.activities.TaskFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/text_margin"
|
||||
android:layout_marginRight="@dimen/text_margin"
|
||||
android:layout_below="@id/total_task_cycles"
|
||||
android:name="com.wismna.geoffroy.donext.activities.TaskFragment"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
app:layout_heightPercent="90%"
|
||||
tools:context=".fragments.TasksFragment"
|
||||
tools:listitem="@layout/fragment_task_detailed" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/task_list_background"
|
||||
android:layout_marginLeft="@dimen/text_margin"
|
||||
android:layout_marginRight="@dimen/text_margin"
|
||||
android:layout_below="@id/total_task_cycles"
|
||||
android:layout_height="70dp"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/colorAccent"
|
||||
android:visibility="gone">
|
||||
<TextView
|
||||
android:id="@+id/task_background_done"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/task_confirmation_done_button"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:visibility="gone"/>
|
||||
<TextView
|
||||
android:id="@+id/task_background_next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/task_confirmation_next_button"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:visibility="gone"/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/remaining_task_count"
|
||||
android:layout_width="150dp"
|
||||
|
@@ -31,6 +31,10 @@
|
||||
<string name="settings_confirm_message">Changer l\'état de la tâche en</string>
|
||||
<string name="settings_max_lists_label">Nombre de listes maximum:</string>
|
||||
<string name="settings_task_layout">Apparence des tâches:</string>
|
||||
<string-array name="settings_task_layouts">
|
||||
<item>Simple</item>
|
||||
<item>Détaillée</item>
|
||||
</string-array>
|
||||
<string name="snackabar_action_deleted">supprimée</string>
|
||||
<string name="snackabar_action_done">terminée</string>
|
||||
<string name="snackabar_action_next">suivante</string>
|
||||
@@ -56,7 +60,7 @@
|
||||
<string name="task_list_new_list_hint">Nom de la liste</string>
|
||||
<string name="task_no_tasks">Super! Aucune tâche en cours!</string>
|
||||
<string name="task_remaining">%1$d tâche%2$s restante%2$s</string>
|
||||
<string name="task_total">%1$d tâch%2$s</string>
|
||||
<string name="task_total">%1$d tâche%2$s</string>
|
||||
<string name="task_total_cycles">%1$d cycle%2$s</string>
|
||||
<string name="title_activity_task_list">TaskListActivity</string>
|
||||
</resources>
|
Reference in New Issue
Block a user