From 96c6aaf026f26cf210eb01e8669cbe4f83cae83d Mon Sep 17 00:00:00 2001 From: Namira Date: Sun, 29 May 2022 23:51:23 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=8A=AC=EB=9D=BC=EC=9D=B4=EB=93=9C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 19 +- app/build.gradle | 2 + .../example/fixfit/DietScheduleActivity.java | 4 +- .../example/fixfit/ToDoRoutineActivity.java | 55 ++- .../res/layout/activity_diet_schedule.xml | 362 ++++++++++-------- app/src/main/res/layout/activity_main.xml | 63 ++- app/src/main/res/layout/frag_home.xml | 18 +- app/src/main/res/layout/frag_routine.xml | 74 +++- app/src/main/res/values/colors.xml | 1 - 9 files changed, 348 insertions(+), 250 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index a2797b8..790f2e1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,8 +5,6 @@ - - @@ -18,26 +16,23 @@ - + - - - - + @@ -45,7 +40,12 @@ - + + + + + + @@ -87,9 +87,6 @@ - - - diff --git a/app/build.gradle b/app/build.gradle index 33b9fa5..a5d4393 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -79,4 +79,6 @@ dependencies { implementation 'com.squareup.retrofit2:retrofit:2.1.0' implementation 'com.squareup.retrofit2:converter-gson:2.1.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1' + + implementation 'com.hudomju:swipe-to-dismiss-undo:1.0' } \ No newline at end of file diff --git a/app/src/main/java/com/example/fixfit/DietScheduleActivity.java b/app/src/main/java/com/example/fixfit/DietScheduleActivity.java index 6ecf481..68f0863 100644 --- a/app/src/main/java/com/example/fixfit/DietScheduleActivity.java +++ b/app/src/main/java/com/example/fixfit/DietScheduleActivity.java @@ -26,6 +26,7 @@ public class DietScheduleActivity extends AppCompatActivity { private TextView timeView; private TextView monthView; private TextView monthSpecView; + private TextView change; private int year; private int month; @@ -38,6 +39,7 @@ protected void onCreate(Bundle savedInstanceState) { timeView = findViewById(R.id.frag_schedule_time); monthView = findViewById(R.id.frag_schedule_month); monthSpecView = findViewById(R.id.frag_schedule_month_spec); + change = findViewById(R.id.change); initSchedule(); @@ -47,7 +49,7 @@ protected void onCreate(Bundle savedInstanceState) { initData(); - timeView.setOnClickListener(new View.OnClickListener() { + change.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { YearMonthPickerDialog pd = new YearMonthPickerDialog(year, month); diff --git a/app/src/main/java/com/example/fixfit/ToDoRoutineActivity.java b/app/src/main/java/com/example/fixfit/ToDoRoutineActivity.java index 5502c60..905cfbe 100644 --- a/app/src/main/java/com/example/fixfit/ToDoRoutineActivity.java +++ b/app/src/main/java/com/example/fixfit/ToDoRoutineActivity.java @@ -2,17 +2,24 @@ import androidx.appcompat.app.AppCompatActivity; +import android.annotation.SuppressLint; import android.content.SharedPreferences; import android.os.Bundle; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.AbsListView; +import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ListView; +import android.widget.Toast; import com.example.fixfit.fragment.InputRoutineDialog; +import com.hudomju.swipe.SwipeToDismissTouchListener; +import com.hudomju.swipe.adapter.ListViewAdapter; import java.util.ArrayList; import java.util.Calendar; @@ -28,6 +35,10 @@ public class ToDoRoutineActivity extends AppCompatActivity { private SharedPreferences preferences; + private SwipeToDismissTouchListener touchListener; + + + @SuppressLint("ClickableViewAccessibility") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -38,9 +49,26 @@ protected void onCreate(Bundle savedInstanceState) { list = findViewById(R.id.routine_list); adapter = new RoutineAdapter(); + touchListener = new SwipeToDismissTouchListener<>( + new ListViewAdapter(list), + new SwipeToDismissTouchListener.DismissCallbacks() { + @Override + public boolean canDismiss(int position) { + return true; + } + + @Override + public void onDismiss(ListViewAdapter view, int position) { + + } + }); + list.setAdapter(adapter); loadRoutines(); + + list.setOnTouchListener(touchListener); + list.setOnScrollListener((AbsListView.OnScrollListener) touchListener.makeScrollListener()); } public void loadRoutines() { @@ -87,6 +115,11 @@ public long getItemId(int position) { return 0; } + public void remove(int position) { + routines.remove(position); + notifyDataSetChanged(); + } + @Override public View getView(int position, View convertView, ViewGroup parent) { if(position < routines.size()) { @@ -110,13 +143,13 @@ public View getView(int position, View convertView, ViewGroup parent) { checkBox.setChecked(false); } - convertView.findViewById(R.id.frag_routine_remove).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - routines.remove(position); - adapter.notifyDataSetChanged(); - } - }); +// convertView.findViewById(R.id.frag_routine_remove).setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// routines.remove(position); +// adapter.notifyDataSetChanged(); +// } +// }); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @@ -131,6 +164,14 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { editor.apply(); } }); + + convertView.findViewById(R.id.delete).setOnClickListener(view -> { + adapter.remove(position); + }); + + convertView.findViewById(R.id.undo).setOnClickListener(view -> { + touchListener.undoPendingDismiss(); + }); } else { convertView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.frag_routine_plus, parent, false); convertView.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/res/layout/activity_diet_schedule.xml b/app/src/main/res/layout/activity_diet_schedule.xml index ad2566c..9fe4a6a 100644 --- a/app/src/main/res/layout/activity_diet_schedule.xml +++ b/app/src/main/res/layout/activity_diet_schedule.xml @@ -1,9 +1,9 @@ @@ -28,7 +28,7 @@ android:layout_height="60dp" android:layout_marginVertical="10dp" android:padding="5dp" - android:src="@drawable/ic_baseline_food_bank_24"/> + android:src="@drawable/ic_baseline_food_bank_24" /> + android:src="@drawable/ic_logo_fixfit" /> + android:layout_height="1dp" /> - + + + + + + + + android:text="4" + android:textSize="40sp" /> + android:text="April" + android:textSize="20sp" /> + + android:gravity="center" + android:text="SUN" + android:textColor="#ff0000" /> + android:gravity="center" + android:text="MON" + android:textColor="#000000" /> + android:gravity="center" + android:text="TUE" + android:textColor="#000000" /> + android:gravity="center" + android:text="WED" + android:textColor="#000000" /> + android:gravity="center" + android:text="THU" + android:textColor="#000000" /> + android:gravity="center" + android:text="FRI" + android:textColor="#000000" /> + android:gravity="center" + android:text="SAT" + android:textColor="#0000ff" /> + + android:layout_weight="1" + android:background="@color/black" /> + + android:layout_weight="1" + android:background="@color/black" /> + + android:layout_weight="1" + android:background="@color/black" /> + + android:layout_weight="1" + android:background="@color/black" /> + + android:layout_weight="1" + android:background="@color/black" /> + + android:layout_weight="1" + android:background="@color/black" /> + + android:layout_weight="1" + android:background="@color/black" /> + android:layout_height="wrap_content" + android:layout_margin="1dp"> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_margin="1dp"> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_margin="1dp"> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + + android:layout_height="wrap_content" + android:layout_margin="1dp"> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + + android:layout_height="wrap_content" + android:layout_margin="1dp"> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + + android:layout_height="wrap_content" + android:layout_margin="1dp"> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> + android:layout_height="wrap_content" + android:layout_weight="1" /> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 6335221..eb05b01 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -18,26 +18,25 @@ + android:scaleType="fitXY" + android:id="@+id/ImgProfile" + android:background="@drawable/default_profile" /> @@ -45,38 +44,39 @@ + android:layout_margin="15dp" + android:orientation="vertical" + > + @@ -121,18 +118,18 @@ + android:layout_height="490dp" + android:id="@+id/frameLayout"/> diff --git a/app/src/main/res/layout/frag_home.xml b/app/src/main/res/layout/frag_home.xml index e9bf443..9d53be7 100644 --- a/app/src/main/res/layout/frag_home.xml +++ b/app/src/main/res/layout/frag_home.xml @@ -37,9 +37,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="거북목 판정" - android:textSize="20sp" - android:textColor="@color/text_color" - android:fontFamily="@font/suncheon_b" + android:textSize="20dp" android:layout_gravity="center|bottom"/> @@ -78,16 +76,12 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|center" android:text="자세 교정" - android:textSize="20sp" - android:textColor="@color/text_color" - android:fontFamily="@font/suncheon_b"/> + android:textSize="20dp" /> @@ -125,9 +119,7 @@ android:layout_height="wrap_content" android:layout_marginTop="20dp" android:text="식단 기록" - android:textSize="20sp" - android:textColor="@color/text_color" - android:fontFamily="@font/suncheon_b" + android:textSize="20dp" android:layout_gravity="center|bottom"/> @@ -168,8 +160,6 @@ android:layout_marginTop="20dp" android:text="운동 기록" android:textSize="20dp" - android:textColor="@color/text_color" - android:fontFamily="@font/suncheon_b" android:layout_gravity="bottom|center" /> diff --git a/app/src/main/res/layout/frag_routine.xml b/app/src/main/res/layout/frag_routine.xml index 6679877..51ff0d9 100644 --- a/app/src/main/res/layout/frag_routine.xml +++ b/app/src/main/res/layout/frag_routine.xml @@ -1,24 +1,60 @@ - - - - - + + + + + + + + + + + android:visibility="gone" + android:layout_height="match_parent" + android:orientation="horizontal" + android:weightSum="3"> + + + + + + - \ No newline at end of file + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a57f2a1..b7ebef8 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -14,7 +14,6 @@ #FF548B #FFAF47 #fde6c8 - #FF000000 #57F92E #0090FF From 7e3cb1deebc6255ccdfbc59c0fdb5f4ca4896fc5 Mon Sep 17 00:00:00 2001 From: Namira Date: Sun, 29 May 2022 23:56:50 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/drawable/ic_baseline_keyboard_arrow_right_24.xml | 5 +++++ app/src/main/res/layout/frag_routine.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml diff --git a/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml b/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml new file mode 100644 index 0000000..5f961c5 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/frag_routine.xml b/app/src/main/res/layout/frag_routine.xml index 51ff0d9..4106b44 100644 --- a/app/src/main/res/layout/frag_routine.xml +++ b/app/src/main/res/layout/frag_routine.xml @@ -14,7 +14,7 @@ android:id="@+id/frag_routine_remove" android:layout_width="50dp" android:layout_height="50dp" - android:src="@drawable/ic_launcher_foreground" /> + android:src="@drawable/ic_baseline_keyboard_arrow_right_24" />