diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ed1b89b..6ab9860 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -39,16 +39,22 @@ - + + + + + + + task) { } String token = task.getResult().getToken(); - Map map = new HashMap<>(); map.put("pushToken",token); FirebaseDatabase.getInstance().getReference().child("users").child(uid).updateChildren(map); diff --git a/app/src/main/java/com/example/appjam_willson/MainActivities/HelperFragment1_null.java b/app/src/main/java/com/example/appjam_willson/MainActivities/HelperFragment1_null.java index 7ce6740..a56e178 100644 --- a/app/src/main/java/com/example/appjam_willson/MainActivities/HelperFragment1_null.java +++ b/app/src/main/java/com/example/appjam_willson/MainActivities/HelperFragment1_null.java @@ -1,6 +1,7 @@ package com.example.appjam_willson.MainActivities; +import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; @@ -8,6 +9,7 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.Nullable; @@ -25,21 +27,22 @@ public HelperFragment1_null(){ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_helper_request_empty_received,null); - ImageView willsonImage_receive = (ImageView) getActivity().findViewById(R.id.willsonImage_receive); - ImageView willsonImage_chat = (ImageView) getActivity().findViewById(R.id.willsonImage_chat); - ImageView willsonImage_profile = (ImageView) getActivity().findViewById(R.id.willsonImage_profile); - ImageView willsonImage_mypage = (ImageView) getActivity().findViewById(R.id.willsonImage_mypage); + ImageView willsonImage_receive = getActivity().findViewById(R.id.willsonImage_receive); + ImageView willsonImage_chat = getActivity().findViewById(R.id.willsonImage_chat); + ImageView willsonImage_profile = getActivity().findViewById(R.id.willsonImage_profile); + ImageView willsonImage_mypage = getActivity().findViewById(R.id.willsonImage_mypage); - TextView willsonText_receive = (TextView) getActivity().findViewById(R.id.willsonText_receive); - TextView willsonText_chat = (TextView) getActivity().findViewById(R.id.willsonText_chat); - TextView willsonText_profile = (TextView) getActivity().findViewById(R.id.willsonText_profile); - TextView willsonText_mypage = (TextView) getActivity().findViewById(R.id.willsonText_mypage); + TextView willsonText_receive = getActivity().findViewById(R.id.willsonText_receive); + TextView willsonText_chat = getActivity().findViewById(R.id.willsonText_chat); + TextView willsonText_profile = getActivity().findViewById(R.id.willsonText_profile); + TextView willsonText_mypage = getActivity().findViewById(R.id.willsonText_mypage); + + LinearLayout change = view.findViewById(R.id.helper_toAsker); /* LayoutInflater inflater_tab; inflater_tab = getLayoutInflater(); View view_tab = inflater_tab.inflate(R.layout.activity_helper, null);*/ - Button btn = view.findViewById(R.id.helper_profile_edit_btn); /* final ImageView willsonImage_receive= view_tab.findViewById(R.id.willsonImage_receive); @@ -53,12 +56,19 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, final TextView willsonText_mypage= view_tab.findViewById(R.id.willsonText_mypage);*/ + change.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(getActivity(),MainActivity.class); + startActivity(intent); + } + }); + btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* willsonImage_profile.setImageResource(R.drawable.helper_tab_03_profile_active); willsonImage_receive.setImageResource(R.drawable.tab_02_request_nonactive); - willsonText_profile.setTextColor(Color.parseColor("#2f2f2f")); willsonText_receive.setTextColor(Color.parseColor("#9e9e9e"));*/ diff --git a/app/src/main/java/com/example/appjam_willson/MainActivities/MainActivity.java b/app/src/main/java/com/example/appjam_willson/MainActivities/MainActivity.java index 75f6fdd..5feb52b 100644 --- a/app/src/main/java/com/example/appjam_willson/MainActivities/MainActivity.java +++ b/app/src/main/java/com/example/appjam_willson/MainActivities/MainActivity.java @@ -115,16 +115,14 @@ public void onClick(View v) { button3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { -// changeImage(image_chat, image_home, image_mypage, image_request); -// changeTextColor(text_chat, text_home, text_request, text_mypage); -// -// MainFragment3 fragment = new MainFragment3(); -// getSupportFragmentManager().beginTransaction().replace(R.id.main_frame, fragment).commit(); - thirdTap(); + changeImage(image_chat, image_home, image_mypage, image_request); + changeTextColor(text_chat, text_home, text_request, text_mypage); + MainFragment3 fragment = new MainFragment3(); getSupportFragmentManager().beginTransaction().replace(R.id.main_frame, fragment).commit(); + } }); @@ -140,10 +138,7 @@ public void onClick(View v) { }); } - public static void thirdTap(){ - changeImage(image_chat, image_home, image_mypage, image_request); - changeTextColor(text_chat, text_home, text_request, text_mypage); - } + diff --git a/app/src/main/java/com/example/appjam_willson/MainActivities/MainFragment.java b/app/src/main/java/com/example/appjam_willson/MainActivities/MainFragment.java index ad7ab31..9e1a4c1 100644 --- a/app/src/main/java/com/example/appjam_willson/MainActivities/MainFragment.java +++ b/app/src/main/java/com/example/appjam_willson/MainActivities/MainFragment.java @@ -38,8 +38,10 @@ import com.example.appjam_willson.R; import com.example.appjam_willson.model.CreateWorryModel; import com.example.appjam_willson.model.CreateWorryResponseModel; +import com.example.appjam_willson.model.HelperCheckResponseModel; import com.example.appjam_willson.model.HelperStoryModel; import com.example.appjam_willson.model.WorryCategoryListAddResponseModel; +import com.google.android.material.theme.MaterialComponentsViewInflater; import java.util.ArrayList; import java.util.List; @@ -157,10 +159,10 @@ public void onClick(View view) { changeMode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - //헬퍼 가입했는지 아닌지 판단해서 - //Intent intent = new Intent(getActivity() , HelperActivity.class); - Intent intent = new Intent(getActivity() , HelperSignUpStartActivity.class); - startActivity(intent); + + Call user_profile = RetrofitService.getInstance().getService().helper_exist_check_get(token); + user_profile.enqueue(check_retrofitCallback); + } }); @@ -205,6 +207,28 @@ public void onClick(View v) { return view; } + + private Callback check_retrofitCallback = new Callback() { + @Override + public void onResponse(Call call, Response response) { + HelperCheckResponseModel result = response.body(); + if(result.data.status){ + Intent intent = new Intent(getActivity(),HelperActivity.class); + startActivity(intent); + } + else{ + Intent intent = new Intent(getActivity() , HelperSignUpStartActivity.class); + startActivity(intent); + + } + + } + + @Override + public void onFailure(Call call, Throwable t) { + Log.d(">>>>>>헬퍼 등록 체크 실패>>>>>>>","실패래요~~~~"); + } + }; @Override public void onActivityResult(int requestCode, int resultCode, Intent data){ super.onActivityResult(requestCode, resultCode, data); @@ -250,7 +274,22 @@ public void onResponse(Call call, Response call, Throwable t) { } }; + private void changeImage(ImageView first, ImageView second, ImageView third, ImageView fourth) { + first.setSelected(true); + second.setSelected(false); + third.setSelected(false); + fourth.setSelected(false); + } + + private void changeTextColor(TextView first, TextView second, TextView third, TextView fourth) { + first.setTextColor(Color.parseColor("#2f2f2f")); + second.setTextColor(Color.parseColor("#9e9e9e")); + third.setTextColor(Color.parseColor("#9e9e9e")); + fourth.setTextColor(Color.parseColor("#9e9e9e")); + } + + // private Callback review_retrofitCallback = new Callback() { // // @Override diff --git a/app/src/main/java/com/example/appjam_willson/NetworkService/RetrofitAPI.java b/app/src/main/java/com/example/appjam_willson/NetworkService/RetrofitAPI.java index f817c68..461325a 100644 --- a/app/src/main/java/com/example/appjam_willson/NetworkService/RetrofitAPI.java +++ b/app/src/main/java/com/example/appjam_willson/NetworkService/RetrofitAPI.java @@ -8,6 +8,7 @@ import com.example.appjam_willson.model.ExitChatModel; import com.example.appjam_willson.model.ExitChatResponseModel; import com.example.appjam_willson.model.FeelingStatusListResponseModel; +import com.example.appjam_willson.model.HelperCheckResponseModel; import com.example.appjam_willson.model.HelperProfileEditModel; import com.example.appjam_willson.model.HelperProfileEditResponseModel; import com.example.appjam_willson.model.HelperProfileWatchResponseModel; @@ -107,4 +108,7 @@ Call exit_chat_put(@Header("willson-token") String token, @GET("review/story") Call main_review_get(@Header("willson-token") String token); + + @GET("helper/check") + Call helper_exist_check_get(@Header("willson-token") String token); } \ No newline at end of file diff --git a/app/src/main/java/com/example/appjam_willson/model/HelperCheckResponseModel.java b/app/src/main/java/com/example/appjam_willson/model/HelperCheckResponseModel.java new file mode 100644 index 0000000..164178c --- /dev/null +++ b/app/src/main/java/com/example/appjam_willson/model/HelperCheckResponseModel.java @@ -0,0 +1,12 @@ +package com.example.appjam_willson.model; + +public class HelperCheckResponseModel { + public String message; + public int code; + public Data data; + + + public class Data{ + public boolean status; + } +} diff --git a/app/src/main/res/layout/activity_helper.xml b/app/src/main/res/layout/activity_helper.xml index ef26da2..d730ce7 100644 --- a/app/src/main/res/layout/activity_helper.xml +++ b/app/src/main/res/layout/activity_helper.xml @@ -72,7 +72,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/willsonText_chat" - android:text="보낸 요청" + android:text="채팅" android:textColor="@color/grey" android:textSize="12sp" android:gravity="center" diff --git a/app/src/main/res/layout/activity_helper_request_empty_received.xml b/app/src/main/res/layout/activity_helper_request_empty_received.xml index f64e65c..995cab0 100644 --- a/app/src/main/res/layout/activity_helper_request_empty_received.xml +++ b/app/src/main/res/layout/activity_helper_request_empty_received.xml @@ -5,10 +5,12 @@ xmlns:android="http://schemas.android.com/apk/res/android"> @@ -24,15 +26,14 @@ android:textColor="@color/dark_purple" android:lineSpacingExtra="1sp" android:text="질문자전환" + android:paddingRight="20dp" android:layout_gravity="center_vertical" android:gravity="center_vertical" android:textStyle="normal" android:fontFamily="@font/nanum_square_b" /> - +