mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Design improvements
Task lists are now correctly hidden in wide mode Edit task save button shows
This commit is contained in:
@@ -85,7 +85,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
// Create the fragment
|
// Create the fragment
|
||||||
TaskListsDialogFragment taskListFragment = TaskListsDialogFragment.newInstance(
|
TaskListsDialogFragment taskListFragment = TaskListsDialogFragment.newInstance(
|
||||||
(MainFragment)fragmentManager.findFragmentById(R.id.fragment_main));
|
(MainFragment)fragmentManager.findFragmentById(R.id.fragment_main));
|
||||||
String title = getString(R.string.action_edit_task);
|
String title = getString(R.string.task_list_edit);
|
||||||
|
|
||||||
// Set the arguments
|
// Set the arguments
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
@@ -3,6 +3,7 @@ package com.wismna.geoffroy.donext.fragments;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
@@ -80,7 +81,7 @@ public abstract class DynamicDialogFragment extends DialogFragment {
|
|||||||
onNegativeButtonClick();
|
onNegativeButtonClick();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (mButtonCount == 2) {
|
if (mButtonCount >= 2) {
|
||||||
builder.setPositiveButton(args.getString("button_positive"), new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(args.getString("button_positive"), new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
onPositiveButtonClick(view);
|
onPositiveButtonClick(view);
|
||||||
@@ -111,7 +112,7 @@ public abstract class DynamicDialogFragment extends DialogFragment {
|
|||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
assert args != null;
|
assert args != null;
|
||||||
// Show the neutral button if needed
|
// Show the neutral button if needed
|
||||||
if (mButtonCount < 3) {
|
if (mButtonCount == 2) {
|
||||||
menu.removeItem(R.id.menu_neutral_button);
|
menu.removeItem(R.id.menu_neutral_button);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -119,7 +120,7 @@ public abstract class DynamicDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show the positive button if needed
|
// Show the positive button if needed
|
||||||
if (mButtonCount < 2) {
|
if (mButtonCount == 1) {
|
||||||
menu.removeItem(R.id.menu_positive_button);
|
menu.removeItem(R.id.menu_positive_button);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -192,6 +193,19 @@ public abstract class DynamicDialogFragment extends DialogFragment {
|
|||||||
return getView().findViewById(id);
|
return getView().findViewById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Helper method to clear focus by giving it to the parent layout */
|
||||||
|
protected void clearFocus() {
|
||||||
|
View view = getView();
|
||||||
|
if (view != null) {
|
||||||
|
view.requestFocus();
|
||||||
|
|
||||||
|
// Hide keyboard
|
||||||
|
InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Sets the title of the Fragment from the Tag */
|
/** Sets the title of the Fragment from the Tag */
|
||||||
private Toolbar setToolbarTitle(View view) {
|
private Toolbar setToolbarTitle(View view) {
|
||||||
Toolbar toolbar = view.findViewById(R.id.dialog_toolbar);
|
Toolbar toolbar = view.findViewById(R.id.dialog_toolbar);
|
||||||
|
@@ -7,6 +7,8 @@ import android.os.Build;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.constraint.ConstraintLayout;
|
||||||
|
import android.support.constraint.Guideline;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
@@ -152,10 +154,14 @@ public class MainFragment extends Fragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Move guideline to hide task list
|
||||||
|
Guideline guideline = mView.findViewById(R.id.center_guideline);
|
||||||
|
ConstraintLayout.LayoutParams lp = (ConstraintLayout.LayoutParams) guideline.getLayoutParams();
|
||||||
|
lp.guidePercent = taskLists.size() == 1 && !isHistoryActivity ? 0 : (float) 0.2;
|
||||||
|
guideline.setLayoutParams(lp);
|
||||||
|
|
||||||
ListView listView = mView.findViewById(R.id.list);
|
ListView listView = mView.findViewById(R.id.list);
|
||||||
// Hide the list if there is only one task list
|
// Hide the list if there is only one task list
|
||||||
listView.setVisibility(taskLists.size() == 1 && !isHistoryActivity ? View.GONE : View.VISIBLE);
|
|
||||||
//listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, taskLists));
|
|
||||||
listView.setAdapter(new ArrayAdapter<>(activity, R.layout.list_tasklist_item, taskLists));
|
listView.setAdapter(new ArrayAdapter<>(activity, R.layout.list_tasklist_item, taskLists));
|
||||||
//listView.setSelection(lastOpenedList);
|
//listView.setSelection(lastOpenedList);
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@@ -78,6 +78,7 @@ public class TaskFormDialogFragment extends DynamicDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTaskValues(activity);
|
setTaskValues(activity);
|
||||||
|
clearFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -198,18 +198,6 @@ public class TaskListsDialogFragment extends DynamicDialogFragment implements
|
|||||||
toggleVisibleCreateNewTaskListLayout();
|
toggleVisibleCreateNewTaskListLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Helper method to clear focus by giving it to the parent layout */
|
|
||||||
private void clearFocus() {
|
|
||||||
View view = getView();
|
|
||||||
if (view != null) {
|
|
||||||
view.requestFocus();
|
|
||||||
|
|
||||||
// Hide keyboard
|
|
||||||
InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
||||||
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class GetTaskListsTask extends AsyncTask<TaskListDataAccess, Void, List<TaskList>> {
|
private static class GetTaskListsTask extends AsyncTask<TaskListDataAccess, Void, List<TaskList>> {
|
||||||
private WeakReference<TaskListsDialogFragment> fragmentReference;
|
private WeakReference<TaskListsDialogFragment> fragmentReference;
|
||||||
|
|
||||||
|
@@ -65,4 +65,5 @@
|
|||||||
<string name="action_view_task">Tâche</string>
|
<string name="action_view_task">Tâche</string>
|
||||||
<string name="donext_description">DoNext est un nouveau genre de gestionnaire de tâches, basé sur le principe que créer trop de tâches est contre-productif. Faites plutôt glisser vos tâches vers la gauche ou la droite pour les mettre à la fin de votre liste et travailler dessus plus tard !</string>
|
<string name="donext_description">DoNext est un nouveau genre de gestionnaire de tâches, basé sur le principe que créer trop de tâches est contre-productif. Faites plutôt glisser vos tâches vers la gauche ou la droite pour les mettre à la fin de votre liste et travailler dessus plus tard !</string>
|
||||||
<string name="default_task_list_name">Mes tâches</string>
|
<string name="default_task_list_name">Mes tâches</string>
|
||||||
|
<string name="task_list_edit">Editer les listes de tâches</string>
|
||||||
</resources>
|
</resources>
|
@@ -20,6 +20,7 @@
|
|||||||
<string name="task_list_confirmation_delete">Delete task list?</string>
|
<string name="task_list_confirmation_delete">Delete task list?</string>
|
||||||
<string name="task_list_drag_handle">Drag handle</string>
|
<string name="task_list_drag_handle">Drag handle</string>
|
||||||
<string name="task_list_no_lists">Create a new task list</string>
|
<string name="task_list_no_lists">Create a new task list</string>
|
||||||
|
<string name="task_list_edit">Edit task lists</string>
|
||||||
<string name="task_list_ok">OK</string>
|
<string name="task_list_ok">OK</string>
|
||||||
|
|
||||||
<!-- Strings related to new task dialog -->
|
<!-- Strings related to new task dialog -->
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 39 KiB |
Reference in New Issue
Block a user