-
15.gitignore
-
3.idea/.gitignore
-
1.idea/.name
-
6.idea/compiler.xml
-
21.idea/gradle.xml
-
6.idea/inspectionProfiles/Project_Default.xml
-
25.idea/jarRepositories.xml
-
9.idea/misc.xml
-
10.idea/runConfigurations.xml
-
6.idea/vcs.xml
-
1README.md
-
1app/.gitignore
-
64app/build.gradle
-
39app/google-services.json
-
21app/proguard-rules.pro
-
26app/src/androidTest/java/com/example/mave/ExampleInstrumentedTest.java
-
43app/src/main/AndroidManifest.xml
-
1app/src/main/assets/maver4k.json
-
31app/src/main/java/com/example/mave/BackPressCloseHandler.java
-
17app/src/main/java/com/example/mave/CreateRetrofit.java
-
24app/src/main/java/com/example/mave/Diary/Answer_Item.java
-
232app/src/main/java/com/example/mave/Diary/Create_Diary.java
-
65app/src/main/java/com/example/mave/Diary/Create_Question.java
-
251app/src/main/java/com/example/mave/Diary/FragmentPage2.java
-
123app/src/main/java/com/example/mave/Diary/Join_Group.java
-
43app/src/main/java/com/example/mave/Diary/Level_Up_Dialog.java
-
65app/src/main/java/com/example/mave/Diary/ListViewAdapter.java
-
67app/src/main/java/com/example/mave/Diary/ListViewAdapterForSub2.java
-
40app/src/main/java/com/example/mave/Diary/Not_Made_Diary_Dialog.java
-
268app/src/main/java/com/example/mave/Diary/Page2_sub.java
-
309app/src/main/java/com/example/mave/Diary/Page2_sub_answer.java
-
15app/src/main/java/com/example/mave/Diary/Question_Item.java
-
24app/src/main/java/com/example/mave/Dto/AnswerDto/AllAnswerRequest.java
-
36app/src/main/java/com/example/mave/Dto/AnswerDto/AllAnswerResponse.java
-
48app/src/main/java/com/example/mave/Dto/AnswerDto/RegistAnswerRequest.java
-
36app/src/main/java/com/example/mave/Dto/AnswerDto/RegistAnswerResponse.java
-
45app/src/main/java/com/example/mave/Dto/customQuestionDto/CreateCustomRequest.java
-
21app/src/main/java/com/example/mave/Dto/customQuestionDto/CreateCustomResponse.java
-
20app/src/main/java/com/example/mave/Dto/customQuestionDto/UseCustomRequest.java
-
20app/src/main/java/com/example/mave/Dto/customQuestionDto/UseCustomResponse.java
-
47app/src/main/java/com/example/mave/Dto/groupDto/CreateGroupRequest.java
-
36app/src/main/java/com/example/mave/Dto/groupDto/CreateGroupResponse.java
-
105app/src/main/java/com/example/mave/Dto/groupDto/FindGroupResponse.java
-
24app/src/main/java/com/example/mave/Dto/groupDto/JoinGroupRequest.java
-
24app/src/main/java/com/example/mave/Dto/groupDto/JoinGroupResponse.java
-
51app/src/main/java/com/example/mave/Dto/memeberDto/JoinMemberRequest.java
-
30app/src/main/java/com/example/mave/Dto/memeberDto/JoinMemberResponse.java
-
39app/src/main/java/com/example/mave/Dto/memeberDto/LoginRequest.java
-
25app/src/main/java/com/example/mave/Dto/memeberDto/LoginResponse.java
-
24app/src/main/java/com/example/mave/Dto/questionDto/TakeAllQuestionRequest.java
-
24app/src/main/java/com/example/mave/Dto/questionDto/TakeAllQuestionResponse.java
-
24app/src/main/java/com/example/mave/Dto/questionDto/TakeQuestionRequest.java
-
24app/src/main/java/com/example/mave/Dto/questionDto/TakeQuestionResponse.java
-
104app/src/main/java/com/example/mave/PhotoBook/FragmentPage1.java
-
29app/src/main/java/com/example/mave/PhotoBook/ItemData.java
-
111app/src/main/java/com/example/mave/PhotoBook/List_insert.java
-
67app/src/main/java/com/example/mave/PhotoBook/MyRecyclerAdapter.java
-
178app/src/main/java/com/example/mave/PreferenceManager.java
-
50app/src/main/java/com/example/mave/Settings/FragmentPage3.java
-
21app/src/main/java/com/example/mave/Settings/StateOfFlower.java
-
25app/src/main/java/com/example/mave/SharedViewModel.java
-
118app/src/main/java/com/example/mave/activities/LoginActivity.java
-
90app/src/main/java/com/example/mave/activities/MainActivity.java
-
92app/src/main/java/com/example/mave/activities/RegisterActivity.java
-
26app/src/main/java/com/example/mave/activities/SplashActivity.java
-
31app/src/main/java/com/example/mave/repository/AnswerRepository.java
-
99app/src/main/java/com/example/mave/repository/GroupRepository.java
-
36app/src/main/java/com/example/mave/repository/MemberRepository.java
-
39app/src/main/java/com/example/mave/repository/QuestionRepository.java
-
24app/src/main/java/com/example/mave/service/AnswerRetrofitService.java
-
31app/src/main/java/com/example/mave/service/CustomQuestionRetrofitService.java
-
27app/src/main/java/com/example/mave/service/GroupRetrofitService.java
-
21app/src/main/java/com/example/mave/service/MemberRetrofitService.java
-
25app/src/main/java/com/example/mave/service/QuestionRetrofitService.java
-
19app/src/main/res/anim/fab_close.xml
-
18app/src/main/res/anim/fab_open.xml
-
BINapp/src/main/res/drawable-hdpi/answer_circle.png
-
BINapp/src/main/res/drawable-hdpi/answer_wallpaper.png
-
BINapp/src/main/res/drawable-hdpi/backgroundwall.png
-
BINapp/src/main/res/drawable-hdpi/bg.png
-
BINapp/src/main/res/drawable-hdpi/diary_name.png
-
BINapp/src/main/res/drawable-hdpi/flowerdaisy.png
-
BINapp/src/main/res/drawable-hdpi/logout_icon.png
-
BINapp/src/main/res/drawable-hdpi/regtangle.png
-
BINapp/src/main/res/drawable-hdpi/status_rectangle.png
-
BINapp/src/main/res/drawable-ldpi/answer_circle.png
-
BINapp/src/main/res/drawable-ldpi/answer_wallpaper.png
-
BINapp/src/main/res/drawable-ldpi/backgroundwall.png
-
BINapp/src/main/res/drawable-ldpi/bg.png
-
BINapp/src/main/res/drawable-ldpi/diary_name.png
-
BINapp/src/main/res/drawable-ldpi/flowerdaisy.png
-
BINapp/src/main/res/drawable-ldpi/logout_icon.png
-
BINapp/src/main/res/drawable-ldpi/regtangle.png
-
BINapp/src/main/res/drawable-ldpi/status_rectangle.png
-
BINapp/src/main/res/drawable-mdpi/answer_circle.png
-
BINapp/src/main/res/drawable-mdpi/answer_wallpaper.png
-
BINapp/src/main/res/drawable-mdpi/backgroundwall.png
-
BINapp/src/main/res/drawable-mdpi/bg.png
-
BINapp/src/main/res/drawable-mdpi/diary_name.png
-
BINapp/src/main/res/drawable-mdpi/flowerdaisy.png
@ -0,0 +1,15 @@ |
|||||
|
*.iml |
||||
|
.gradle |
||||
|
/local.properties |
||||
|
/.idea/caches |
||||
|
/.idea/libraries |
||||
|
/.idea/modules.xml |
||||
|
/.idea/workspace.xml |
||||
|
/.idea/navEditor.xml |
||||
|
/.idea/assetWizardSettings.xml |
||||
|
.DS_Store |
||||
|
/build |
||||
|
/captures |
||||
|
.externalNativeBuild |
||||
|
.cxx |
||||
|
local.properties |
||||
@ -0,0 +1,3 @@ |
|||||
|
# Default ignored files |
||||
|
/shelf/ |
||||
|
/workspace.xml |
||||
@ -0,0 +1 @@ |
|||||
|
Mave |
||||
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="CompilerConfiguration"> |
||||
|
<bytecodeTargetLevel target="11" /> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,21 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="GradleMigrationSettings" migrationVersion="1" /> |
||||
|
<component name="GradleSettings"> |
||||
|
<option name="linkedExternalProjectsSettings"> |
||||
|
<GradleProjectSettings> |
||||
|
<option name="testRunner" value="PLATFORM" /> |
||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" /> |
||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" /> |
||||
|
<option name="modules"> |
||||
|
<set> |
||||
|
<option value="$PROJECT_DIR$" /> |
||||
|
<option value="$PROJECT_DIR$/app" /> |
||||
|
</set> |
||||
|
</option> |
||||
|
<option name="resolveModulePerSourceSet" value="false" /> |
||||
|
<option name="useQualifiedModuleNames" value="true" /> |
||||
|
</GradleProjectSettings> |
||||
|
</option> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,6 @@ |
|||||
|
<component name="InspectionProjectProfileManager"> |
||||
|
<profile version="1.0"> |
||||
|
<option name="myName" value="Project Default" /> |
||||
|
<inspection_tool class="Deprecation" enabled="false" level="WARNING" enabled_by_default="false" /> |
||||
|
</profile> |
||||
|
</component> |
||||
@ -0,0 +1,25 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="RemoteRepositoriesConfiguration"> |
||||
|
<remote-repository> |
||||
|
<option name="id" value="central" /> |
||||
|
<option name="name" value="Maven Central repository" /> |
||||
|
<option name="url" value="https://repo1.maven.org/maven2" /> |
||||
|
</remote-repository> |
||||
|
<remote-repository> |
||||
|
<option name="id" value="jboss.community" /> |
||||
|
<option name="name" value="JBoss Community repository" /> |
||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> |
||||
|
</remote-repository> |
||||
|
<remote-repository> |
||||
|
<option name="id" value="BintrayJCenter" /> |
||||
|
<option name="name" value="BintrayJCenter" /> |
||||
|
<option name="url" value="https://jcenter.bintray.com/" /> |
||||
|
</remote-repository> |
||||
|
<remote-repository> |
||||
|
<option name="id" value="Google" /> |
||||
|
<option name="name" value="Google" /> |
||||
|
<option name="url" value="https://dl.google.com/dl/android/maven2/" /> |
||||
|
</remote-repository> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,9 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
||||
|
<output url="file://$PROJECT_DIR$/build/classes" /> |
||||
|
</component> |
||||
|
<component name="ProjectType"> |
||||
|
<option name="id" value="Android" /> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="RunConfigurationProducerService"> |
||||
|
<option name="ignoredProducers"> |
||||
|
<set> |
||||
|
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" /> |
||||
|
</set> |
||||
|
</option> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="VcsDirectoryMappings"> |
||||
|
<mapping directory="" vcs="Git" /> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1 @@ |
|||||
|
# 캡스톤디자인 프로젝트 |
||||
@ -0,0 +1 @@ |
|||||
|
/build |
||||
@ -0,0 +1,64 @@ |
|||||
|
plugins { |
||||
|
id 'com.android.application' |
||||
|
} |
||||
|
|
||||
|
android { |
||||
|
compileSdkVersion 30 |
||||
|
buildToolsVersion "30.0.3" |
||||
|
|
||||
|
defaultConfig { |
||||
|
applicationId "com.example.mave" |
||||
|
minSdkVersion 23 |
||||
|
targetSdkVersion 30 |
||||
|
versionCode 1 |
||||
|
versionName "1.0" |
||||
|
|
||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
||||
|
} |
||||
|
|
||||
|
buildTypes { |
||||
|
release { |
||||
|
minifyEnabled false |
||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
compileOptions { |
||||
|
sourceCompatibility JavaVersion.VERSION_1_8 |
||||
|
targetCompatibility JavaVersion.VERSION_1_8 |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
dependencies { |
||||
|
|
||||
|
implementation 'androidx.appcompat:appcompat:1.3.0' |
||||
|
implementation 'com.google.android.material:material:1.2.0-alpha02' |
||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' |
||||
|
implementation 'com.airbnb.android:lottie:3.7.0' |
||||
|
implementation 'com.ismaeldivita.chipnavigation:chip-navigation-bar:1.3.4' |
||||
|
implementation "androidx.core:core-ktx:1.3.2" |
||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0' |
||||
|
implementation 'com.makeramen:roundedimageview:2.3.0' |
||||
|
implementation 'com.google.android.material:material:1.0.0-rc01' |
||||
|
implementation 'androidx.appcompat:appcompat:1.3.0-rc01' |
||||
|
implementation 'androidx.recyclerview:recyclerview:1.2.0' |
||||
|
implementation 'com.github.bumptech.glide:glide:4.12.0' |
||||
|
implementation "androidx.core:core:1.0.2" |
||||
|
implementation 'com.google.firebase:firebase-database:19.2.1' |
||||
|
implementation 'com.google.firebase:firebase-storage:19.1.1' |
||||
|
implementation 'androidx.recyclerview:recyclerview:1.2.0' |
||||
|
testImplementation 'junit:junit:4.13.2' |
||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2' |
||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' |
||||
|
implementation 'com.squareup.retrofit2:retrofit:2.6.4' |
||||
|
implementation 'com.squareup.retrofit2:converter-gson:2.6.4' |
||||
|
implementation 'com.squareup.retrofit2:converter-scalars:2.6.4' |
||||
|
implementation 'com.royrodriguez:transitionbutton:0.2.0' |
||||
|
implementation platform('com.google.firebase:firebase-bom:28.0.1') |
||||
|
implementation 'com.google.firebase:firebase-analytics' |
||||
|
implementation 'com.squareup.picasso:picasso:2.71828' |
||||
|
|
||||
|
} |
||||
|
|
||||
|
apply plugin: 'com.android.application' |
||||
|
apply plugin: 'com.google.gms.google-services' |
||||
@ -0,0 +1,39 @@ |
|||||
|
{ |
||||
|
"project_info": { |
||||
|
"project_number": "754954815432", |
||||
|
"project_id": "mave-server-f0cb5", |
||||
|
"storage_bucket": "mave-server-f0cb5.appspot.com" |
||||
|
}, |
||||
|
"client": [ |
||||
|
{ |
||||
|
"client_info": { |
||||
|
"mobilesdk_app_id": "1:754954815432:android:8ab1b62ee25c7445ce62fd", |
||||
|
"android_client_info": { |
||||
|
"package_name": "com.example.mave" |
||||
|
} |
||||
|
}, |
||||
|
"oauth_client": [ |
||||
|
{ |
||||
|
"client_id": "754954815432-42omf4m443k3uq8b2v247s9jgkke9bn7.apps.googleusercontent.com", |
||||
|
"client_type": 3 |
||||
|
} |
||||
|
], |
||||
|
"api_key": [ |
||||
|
{ |
||||
|
"current_key": "AIzaSyBmY0fTU0SJZbZaMEEqdo1_qJ8nnypDiUI" |
||||
|
} |
||||
|
], |
||||
|
"services": { |
||||
|
"appinvite_service": { |
||||
|
"other_platform_oauth_client": [ |
||||
|
{ |
||||
|
"client_id": "754954815432-42omf4m443k3uq8b2v247s9jgkke9bn7.apps.googleusercontent.com", |
||||
|
"client_type": 3 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"configuration_version": "1" |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
# Add project specific ProGuard rules here. |
||||
|
# You can control the set of applied configuration files using the |
||||
|
# proguardFiles setting in build.gradle. |
||||
|
# |
||||
|
# For more details, see |
||||
|
# http://developer.android.com/guide/developing/tools/proguard.html |
||||
|
|
||||
|
# If your project uses WebView with JS, uncomment the following |
||||
|
# and specify the fully qualified class name to the JavaScript interface |
||||
|
# class: |
||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
||||
|
# public *; |
||||
|
#} |
||||
|
|
||||
|
# Uncomment this to preserve the line number information for |
||||
|
# debugging stack traces. |
||||
|
#-keepattributes SourceFile,LineNumberTable |
||||
|
|
||||
|
# If you keep the line number information, uncomment this to |
||||
|
# hide the original source file name. |
||||
|
#-renamesourcefileattribute SourceFile |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.example.mave; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
|
||||
|
import androidx.test.platform.app.InstrumentationRegistry; |
||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4; |
||||
|
|
||||
|
import org.junit.Test; |
||||
|
import org.junit.runner.RunWith; |
||||
|
|
||||
|
import static org.junit.Assert.*; |
||||
|
|
||||
|
/** |
||||
|
* Instrumented test, which will execute on an Android device. |
||||
|
* |
||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
||||
|
*/ |
||||
|
@RunWith(AndroidJUnit4.class) |
||||
|
public class ExampleInstrumentedTest { |
||||
|
@Test |
||||
|
public void useAppContext() { |
||||
|
// Context of the app under test. |
||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); |
||||
|
assertEquals("com.example.mave", appContext.getPackageName()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||
|
package="com.example.mave"> |
||||
|
|
||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> |
||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" /> |
||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
||||
|
<uses-permission android:name="android.permission.VIBRATE"/> |
||||
|
<uses-permission android:name="android.permission.INTERNET" /> |
||||
|
|
||||
|
<application |
||||
|
android:allowBackup="true" |
||||
|
android:icon="@drawable/mave_logo" |
||||
|
android:label="@string/app_name" |
||||
|
android:roundIcon="@mipmap/ic_launcher_round" |
||||
|
android:supportsRtl="true" |
||||
|
android:theme="@style/Theme.Mave" |
||||
|
android:hardwareAccelerated="true" |
||||
|
android:usesCleartextTraffic="true"> |
||||
|
|
||||
|
<!-- <activity android:name=".activities.SplashActivity" />--> |
||||
|
<!-- <intent-filter>--> |
||||
|
<!-- <action android:name="android.intent.action.MAIN" />--> |
||||
|
<!-- <category android:name="android.intent.category.LAUNCHER" />--> |
||||
|
<!-- </intent-filter>--> |
||||
|
<!-- </activity>--> |
||||
|
<activity android:name=".activities.LoginActivity"> |
||||
|
<intent-filter> |
||||
|
<action android:name="android.intent.action.MAIN" /> |
||||
|
<category android:name="android.intent.category.LAUNCHER" /> |
||||
|
</intent-filter> |
||||
|
</activity> |
||||
|
<activity android:name=".activities.RegisterActivity" /> |
||||
|
<activity android:name=".activities.MainActivity"/> |
||||
|
<activity android:name=".PhotoBook.List_insert" /> |
||||
|
<activity android:name=".Diary.Page2_sub" /> |
||||
|
<activity android:name=".Diary.Page2_sub_answer" /> |
||||
|
<activity android:name=".Settings.StateOfFlower" /> |
||||
|
|
||||
|
</application> |
||||
|
|
||||
|
</manifest> |
||||
1
app/src/main/assets/maver4k.json
File diff suppressed because it is too large
View File
@ -0,0 +1,31 @@ |
|||||
|
package com.example.mave; |
||||
|
|
||||
|
import android.app.Activity; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
public class BackPressCloseHandler { |
||||
|
private long backKeyPressedTime = 0; |
||||
|
private Toast toast; |
||||
|
private Activity activity; |
||||
|
|
||||
|
public BackPressCloseHandler(Activity context) { |
||||
|
this.activity = context; |
||||
|
} |
||||
|
|
||||
|
public void onBackPressed() { |
||||
|
if (System.currentTimeMillis() > backKeyPressedTime + 2000) { |
||||
|
backKeyPressedTime = System.currentTimeMillis(); |
||||
|
showGuide(); |
||||
|
return; |
||||
|
} |
||||
|
if (System.currentTimeMillis() <= backKeyPressedTime + 2000) { |
||||
|
activity.finish(); |
||||
|
toast.cancel(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void showGuide() { |
||||
|
toast = Toast.makeText(activity, "\'뒤로\'버튼을 한번 더 누르시면 종료됩니다.", Toast.LENGTH_SHORT); |
||||
|
toast.show(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package com.example.mave; |
||||
|
|
||||
|
import retrofit2.Retrofit; |
||||
|
import retrofit2.converter.gson.GsonConverterFactory; |
||||
|
|
||||
|
public class CreateRetrofit { |
||||
|
|
||||
|
public static Retrofit createRetrofit() { |
||||
|
Retrofit retrofit = new Retrofit.Builder() |
||||
|
.baseUrl("http://192.168.173.171:8080/") |
||||
|
.addConverterFactory(GsonConverterFactory.create()) |
||||
|
.build(); |
||||
|
|
||||
|
return retrofit; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
public class Answer_Item { |
||||
|
|
||||
|
private String userId; |
||||
|
private String Answer; |
||||
|
|
||||
|
|
||||
|
public void setAnswer(String answer) { |
||||
|
this.Answer = answer; |
||||
|
} |
||||
|
|
||||
|
public String getAnswer() { |
||||
|
return Answer; |
||||
|
} |
||||
|
|
||||
|
public String getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,232 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.app.Dialog; |
||||
|
import android.app.TimePickerDialog; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.content.SharedPreferences; |
||||
|
import android.os.Build; |
||||
|
import android.os.Bundle; |
||||
|
import android.util.Log; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.TimePicker; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.annotation.RequiresApi; |
||||
|
|
||||
|
import com.example.mave.CreateRetrofit; |
||||
|
import com.example.mave.Dto.groupDto.CreateGroupRequest; |
||||
|
import com.example.mave.Dto.groupDto.CreateGroupResponse; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionResponse; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.activities.MainActivity; |
||||
|
import com.example.mave.repository.GroupRepository; |
||||
|
import com.example.mave.repository.MemberRepository; |
||||
|
import com.example.mave.repository.QuestionRepository; |
||||
|
import com.example.mave.service.GroupRetrofitService; |
||||
|
import com.example.mave.service.QuestionRetrofitService; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalTime; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.util.Calendar; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
|
||||
|
public class Create_Diary extends Dialog implements View.OnClickListener { |
||||
|
|
||||
|
static final String TAG = "Mave"; |
||||
|
private Button positiveButton; |
||||
|
private Button negativeButton; |
||||
|
private EditText editName; |
||||
|
private Context context; |
||||
|
private CustomDialogListener customDialogListener; |
||||
|
private String diaryName; |
||||
|
TimePickerDialog timePickerDialog; |
||||
|
SharedPreferences pref; |
||||
|
SharedPreferences.Editor editor; |
||||
|
|
||||
|
|
||||
|
public Create_Diary(Context context) { |
||||
|
super(context); |
||||
|
this.context = context; |
||||
|
} |
||||
|
|
||||
|
interface CustomDialogListener { |
||||
|
void onPositiveClicked(String diary_name); |
||||
|
|
||||
|
void onNegativeClicked(); |
||||
|
} |
||||
|
|
||||
|
public void setDialogListener(CustomDialogListener customDialogListener) { |
||||
|
this.customDialogListener = customDialogListener; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.create_diary); |
||||
|
//init |
||||
|
positiveButton = (Button) findViewById(R.id.btnPositive); |
||||
|
negativeButton = (Button) findViewById(R.id.btnNegative); |
||||
|
editName = (EditText) findViewById(R.id.editName); |
||||
|
|
||||
|
//버튼 클릭 리스너 등록 |
||||
|
positiveButton.setOnClickListener(this); |
||||
|
negativeButton.setOnClickListener(this); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
final Calendar c = Calendar.getInstance(); |
||||
|
int mHour = c.get(Calendar.HOUR); |
||||
|
int mMinute = c.get(Calendar.MINUTE); |
||||
|
switch (v.getId()) { |
||||
|
case R.id.btnPositive: //확인 버튼을 눌렀을 때 |
||||
|
//각각의 변수에 EidtText에서 가져온 값을 저장 |
||||
|
diaryName = editName.getText().toString(); |
||||
|
//인터페이스의 함수를 호출하여 변수에 저장된 값들을 Activity로 전달 |
||||
|
|
||||
|
customDialogListener.onPositiveClicked(diaryName); |
||||
|
TimePickerDialog timePickerDialog = new TimePickerDialog(getContext(), |
||||
|
new TimePickerDialog.OnTimeSetListener() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.O) |
||||
|
@Override |
||||
|
|
||||
|
public void onTimeSet(TimePicker view, int hourOfDay, int minute) { |
||||
|
|
||||
|
LocalTime questionTime = LocalTime.of(hourOfDay, minute); |
||||
|
GroupRepository instance = GroupRepository.getInstance(); |
||||
|
// 질문 받을 시간 내부 db에 저장 |
||||
|
instance.setQuestionTime(questionTime); |
||||
|
instance.setuser_Set_hour(hourOfDay); |
||||
|
instance.setuser_Set_minute(minute); |
||||
|
|
||||
|
Log.d(TAG, "질문 받을 시간은 !? - " + instance.getQuestionTime().toString()); |
||||
|
|
||||
|
requestCreateGroup(hourOfDay, minute); |
||||
|
|
||||
|
Log.d(TAG, "초기 질문 생성 !! - "); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
}, mHour, mMinute, false); |
||||
|
|
||||
|
timePickerDialog.show(); |
||||
|
|
||||
|
dismiss(); |
||||
|
break; |
||||
|
case R.id.btnNegative: //취소 버튼을 눌렀을 때 |
||||
|
cancel(); |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
Log.d(TAG, "설정한 그룹 이름은!? - " + diaryName); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
@RequiresApi(api = Build.VERSION_CODES.O) |
||||
|
private void requestCreateGroup(int hourOfDay, int minute) { |
||||
|
LocalDateTime fullDateTime = LocalDateTime.of( |
||||
|
LocalDateTime.now().getYear(), |
||||
|
LocalDateTime.now().getMonth(), |
||||
|
LocalDateTime.now().getDayOfMonth(), |
||||
|
hourOfDay, |
||||
|
minute |
||||
|
); |
||||
|
|
||||
|
String format = fullDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
||||
|
|
||||
|
|
||||
|
GroupRetrofitService groupRetrofitService = CreateRetrofit.createRetrofit().create(GroupRetrofitService.class); |
||||
|
String userId = MemberRepository.getInstance().getUserId(); |
||||
|
CreateGroupRequest request = new CreateGroupRequest(userId, diaryName,format); |
||||
|
|
||||
|
Call<CreateGroupResponse> call = groupRetrofitService.createGroup(request); |
||||
|
|
||||
|
call.enqueue(new Callback<CreateGroupResponse>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<CreateGroupResponse> call, Response<CreateGroupResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
CreateGroupResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
|
||||
|
// 그룹 id를 내부 db에 저장 |
||||
|
GroupRepository.getInstance().setGroupId(body.getGroupId()); |
||||
|
Log.d(TAG, "그룹 id 내부 db에 저장 완료!"); |
||||
|
|
||||
|
// 그룹 이름을 내부 db에 저장 |
||||
|
GroupRepository.getInstance().setGroupName(diaryName); |
||||
|
Log.d(TAG, "그룹 이름 내부 db에 저장 완료!"); |
||||
|
|
||||
|
GroupRepository.getInstance().setDiaryDate(body.getDiaryDate()); |
||||
|
Log.d(TAG, "그룹 D-Day 내부 db에 저장 완료!"); |
||||
|
|
||||
|
GroupRepository.completeDate = body.getDiaryDate(); |
||||
|
Log.d(TAG, "그룹 CompleteDate 내부 db에 저장 완료!"); |
||||
|
|
||||
|
questionRequest(); |
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<CreateGroupResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void questionRequest() { |
||||
|
// 서버에서 질문 받아오기 서버 DB에 질문 Update. |
||||
|
QuestionRetrofitService questionRetrofitService = CreateRetrofit.createRetrofit().create(QuestionRetrofitService.class); |
||||
|
GroupRepository groupDB = GroupRepository.getInstance(); |
||||
|
QuestionRepository questionDB = QuestionRepository.getInstance(); |
||||
|
|
||||
|
Log.d(TAG, "서버에 질문을 요청한 그룹 id는!? - " + groupDB.getGroupId()); |
||||
|
Log.d(TAG, "우리 그룹은 며칠째인가!? - " + groupDB.getDiaryDate()); |
||||
|
|
||||
|
TakeQuestionRequest request = new TakeQuestionRequest(groupDB.getGroupId()); |
||||
|
Call<TakeQuestionResponse> call = questionRetrofitService.takeQuestion(groupDB.getDiaryDate(), request); |
||||
|
|
||||
|
call.enqueue(new Callback<TakeQuestionResponse>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.N) |
||||
|
@Override |
||||
|
public void onResponse(Call<TakeQuestionResponse> call, Response<TakeQuestionResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
TakeQuestionResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
questionDB.setTodayQuestion(body.getQuestionContent()); |
||||
|
FragmentPage2.isJoined = true; |
||||
|
Intent intent = new Intent(getContext(),MainActivity.class); |
||||
|
getContext().startActivity(intent); |
||||
|
|
||||
|
|
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<TakeQuestionResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.app.Dialog; |
||||
|
import android.content.Context; |
||||
|
import android.os.Bundle; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
|
||||
|
public class Create_Question extends Dialog implements View.OnClickListener { |
||||
|
|
||||
|
private Button positiveButton; |
||||
|
private Button negativeButton; |
||||
|
private EditText editName; |
||||
|
private Context context; |
||||
|
private CustomDialogListener customDialogListener; |
||||
|
|
||||
|
public Create_Question(Context context) { |
||||
|
super(context); |
||||
|
this.context = context; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
interface CustomDialogListener{ |
||||
|
void onPositiveClicked(String custom_question); |
||||
|
void onNegativeClicked(); |
||||
|
} |
||||
|
public void setDialogListener(CustomDialogListener customDialogListener){ |
||||
|
this.customDialogListener = customDialogListener; |
||||
|
} |
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState){ |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.create_question); |
||||
|
|
||||
|
//init |
||||
|
positiveButton = (Button)findViewById(R.id.question_btnPositive); |
||||
|
negativeButton = (Button)findViewById(R.id.question_btnNegative); |
||||
|
editName = (EditText)findViewById(R.id.editquestion); |
||||
|
|
||||
|
//버튼 클릭 리스너 등록 |
||||
|
positiveButton.setOnClickListener(this); |
||||
|
negativeButton.setOnClickListener(this); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
switch (v.getId()){ |
||||
|
case R.id.question_btnPositive: //확인 버튼을 눌렀을 때 |
||||
|
//각각의 변수에 EidtText에서 가져온 값을 저장 |
||||
|
String Custom_Question = editName.getText().toString(); |
||||
|
//인터페이스의 함수를 호출하여 변수에 저장된 값들을 Activity로 전달 |
||||
|
customDialogListener.onPositiveClicked(Custom_Question); |
||||
|
dismiss(); |
||||
|
break; |
||||
|
case R.id.question_btnNegative: //취소 버튼을 눌렀을 때 |
||||
|
cancel(); |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,251 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.content.Intent; |
||||
|
import android.graphics.Color; |
||||
|
import android.graphics.drawable.ColorDrawable; |
||||
|
import android.os.Build; |
||||
|
import android.os.Bundle; |
||||
|
import android.util.Log; |
||||
|
import android.view.LayoutInflater; |
||||
|
import android.view.View; |
||||
|
import android.view.View.OnClickListener; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.view.Window; |
||||
|
import android.view.animation.Animation; |
||||
|
import android.view.animation.AnimationUtils; |
||||
|
import android.widget.ImageButton; |
||||
|
import android.widget.ImageView; |
||||
|
import android.widget.TextView; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.annotation.RequiresApi; |
||||
|
import androidx.fragment.app.Fragment; |
||||
|
|
||||
|
import com.example.mave.CreateRetrofit; |
||||
|
import com.example.mave.Dto.groupDto.FindGroupResponse; |
||||
|
import com.example.mave.Dto.groupDto.JoinGroupRequest; |
||||
|
import com.example.mave.PreferenceManager; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.repository.GroupRepository; |
||||
|
import com.example.mave.repository.MemberRepository; |
||||
|
import com.example.mave.service.GroupRetrofitService; |
||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalTime; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
import static com.example.mave.Diary.Create_Diary.TAG; |
||||
|
|
||||
|
public class FragmentPage2 extends Fragment { |
||||
|
|
||||
|
ViewGroup viewGroup; |
||||
|
|
||||
|
|
||||
|
public static Boolean isJoined = false; |
||||
|
public static Boolean isChanged = false; |
||||
|
|
||||
|
private Animation fab_open, fab_close; |
||||
|
private Boolean isFabOpen = false; |
||||
|
private FloatingActionButton fab, fab1, fab2; |
||||
|
private TextView DiaryName, diaryDate; |
||||
|
private ImageView flower; |
||||
|
final int[] flower_num = {R.drawable.state_1, R.drawable.state_2, R.drawable.state_3, R.drawable.state_4, R.drawable.state_5, R.drawable.state_6,R.drawable.state_7,R.drawable.state_8}; |
||||
|
|
||||
|
|
||||
|
@Nullable |
||||
|
@Override |
||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
||||
|
|
||||
|
setHasOptionsMenu(true); |
||||
|
// WindowUtils.makeStatusbarTransparent(getActivity()); |
||||
|
viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_page_2, container, false); |
||||
|
fab_open = AnimationUtils.loadAnimation(getContext(), R.anim.fab_open); |
||||
|
fab_close = AnimationUtils.loadAnimation(getContext(), R.anim.fab_close); |
||||
|
fab = (FloatingActionButton) viewGroup.findViewById(R.id.fab); |
||||
|
fab1 = (FloatingActionButton) viewGroup.findViewById(R.id.fab1); |
||||
|
fab2 = (FloatingActionButton) viewGroup.findViewById(R.id.fab2); |
||||
|
DiaryName = (TextView) viewGroup.findViewById(R.id.diarytitle); |
||||
|
diaryDate = (TextView) viewGroup.findViewById(R.id.diaryDate); |
||||
|
flower = (ImageView) viewGroup.findViewById(R.id.diary_flower); |
||||
|
|
||||
|
flower.setVisibility(View.INVISIBLE); |
||||
|
|
||||
|
|
||||
|
findGroup(); |
||||
|
|
||||
|
if (isJoined) { |
||||
|
fab.setVisibility(View.GONE); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
FloatingActionButton FloatingButton = (FloatingActionButton) viewGroup.findViewById(R.id.fab); |
||||
|
FloatingButton.setOnClickListener(new OnClickListener() { //플로팅버튼 눌렀을 때 이벤트 (하위 버튼 띄우기) |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
|
||||
|
|
||||
|
anim(); |
||||
|
|
||||
|
FloatingActionButton FloatingButton2 = (FloatingActionButton) viewGroup.findViewById(R.id.fab1); //플로팅버튼 눌렀을 때 이벤트(다이어리 만드는 버튼) |
||||
|
|
||||
|
|
||||
|
FloatingButton2.setOnClickListener(new OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
Create_Diary dialog = new Create_Diary(getContext()); |
||||
|
// 커스텀 다이얼로그 배경 투명 |
||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); |
||||
|
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
|
||||
|
dialog.setDialogListener(new Create_Diary.CustomDialogListener() { |
||||
|
@Override |
||||
|
public void onPositiveClicked(String diaryname) { |
||||
|
DiaryName.setText(diaryname); |
||||
|
diaryDate.setText(" D + 1 "); |
||||
|
flower.setVisibility(View.VISIBLE); |
||||
|
flower.setImageResource(flower_num[0]); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onNegativeClicked() { |
||||
|
//취소버튼 눌렀을 경우 구현될 코드 작성 |
||||
|
} |
||||
|
}); |
||||
|
dialog.show(); |
||||
|
anim(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
FloatingActionButton FloatingButton3 = (FloatingActionButton) viewGroup.findViewById(R.id.fab2); //플로팅버튼 눌렀을 때 이벤트(초대 버튼) |
||||
|
FloatingButton3.setOnClickListener(new OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
Join_Group dig_3 = new Join_Group(getActivity(), Join_Group.class); |
||||
|
// 커스텀 다이얼로그 배경 투명 |
||||
|
dig_3.requestWindowFeature(Window.FEATURE_NO_TITLE); |
||||
|
dig_3.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
dig_3.show(); |
||||
|
anim(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
ImageButton button = (ImageButton) viewGroup.findViewById(R.id.diary); |
||||
|
|
||||
|
button.setOnClickListener(new OnClickListener() { // 다이어리를 눌렀을 때 이벤트 |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
if (GroupRepository.getInstance().getGroupName() != null) { |
||||
|
Intent intent = new Intent(getActivity(), Page2_sub.class); |
||||
|
startActivity(intent); |
||||
|
|
||||
|
} else { |
||||
|
Not_Made_Diary_Dialog dig = new Not_Made_Diary_Dialog(getActivity(), Not_Made_Diary_Dialog.class); |
||||
|
// 커스텀 다이얼로그 배경 투명 |
||||
|
dig.requestWindowFeature(Window.FEATURE_NO_TITLE); |
||||
|
dig.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
dig.show(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
return viewGroup; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private void findGroup() { // 다이어리 프래그먼트 띄울 때 내가 어떤 그룹에 가입되어 있는지를 확인하기 위한 API |
||||
|
|
||||
|
GroupRetrofitService groupRetrofitService = CreateRetrofit.createRetrofit().create(GroupRetrofitService.class); |
||||
|
String userId = MemberRepository.getInstance().getUserId(); |
||||
|
JoinGroupRequest request = new JoinGroupRequest(userId); |
||||
|
Call<FindGroupResponse> call = groupRetrofitService.findGroup(request); |
||||
|
|
||||
|
call.enqueue(new Callback<FindGroupResponse>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.O) |
||||
|
@Override |
||||
|
public void onResponse(Call<FindGroupResponse> call, Response<FindGroupResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
FindGroupResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
|
||||
|
if (!isChanged) { |
||||
|
GroupRepository.getInstance().setGroupId(body.getGroupId()); |
||||
|
GroupRepository.getInstance().setGroupName(body.getGroupName()); |
||||
|
GroupRepository.getInstance().setFlowerStatus(body.getFlowerStatus()); |
||||
|
GroupRepository.getInstance().setDiaryDate(body.getDiaryDate()); |
||||
|
GroupRepository.getInstance().setCompleteDate(body.getCompleteDate()); |
||||
|
|
||||
|
DiaryName.setText(GroupRepository.getInstance().getGroupName()); |
||||
|
flower.setVisibility(View.VISIBLE); |
||||
|
flower.setImageResource(flower_num[GroupRepository.getInstance().getFlowerStatus()]); |
||||
|
|
||||
|
LocalDateTime parse = LocalDateTime.parse(body.getQuestionTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
||||
|
LocalTime questionTime = LocalTime.of(parse.getHour(), parse.getMinute()); |
||||
|
GroupRepository.getInstance().setQuestionTime(questionTime); |
||||
|
|
||||
|
Log.d(TAG, "설정 시간은 !? - " + questionTime); |
||||
|
Log.d(TAG, "D-day는 !? - " + body.getDiaryDate()); |
||||
|
|
||||
|
diaryDate.setText(" D + " + body.getDiaryDate()); |
||||
|
|
||||
|
isJoined = true; |
||||
|
|
||||
|
} |
||||
|
Log.d(TAG, "Day가 바뀌었나 !? - " + body.getDateChanged()); |
||||
|
|
||||
|
if (body.getDateChanged()) { |
||||
|
Page2_sub.isAlarmed = false; |
||||
|
Page2_sub.isCalled = false; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
DiaryName.setText("그룹에 가입해주세요!"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<FindGroupResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
||||
|
super.onViewCreated(view, savedInstanceState); |
||||
|
} |
||||
|
|
||||
|
public void anim() { |
||||
|
|
||||
|
if (isFabOpen) { |
||||
|
fab1.startAnimation(fab_close); |
||||
|
fab2.startAnimation(fab_close); |
||||
|
fab1.setClickable(false); |
||||
|
fab2.setClickable(false); |
||||
|
isFabOpen = false; |
||||
|
} else { |
||||
|
fab1.startAnimation(fab_open); |
||||
|
fab2.startAnimation(fab_open); |
||||
|
fab1.setClickable(true); |
||||
|
fab2.setClickable(true); |
||||
|
|
||||
|
isFabOpen = true; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,123 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.app.Dialog; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.graphics.Color; |
||||
|
import android.graphics.drawable.ColorDrawable; |
||||
|
import android.os.Build; |
||||
|
import android.os.Bundle; |
||||
|
import android.util.Log; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.annotation.RequiresApi; |
||||
|
|
||||
|
import com.example.mave.CreateRetrofit; |
||||
|
import com.example.mave.Dto.groupDto.JoinGroupRequest; |
||||
|
import com.example.mave.Dto.groupDto.JoinGroupResponse; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.activities.MainActivity; |
||||
|
import com.example.mave.repository.MemberRepository; |
||||
|
import com.example.mave.service.GroupRetrofitService; |
||||
|
|
||||
|
import java.util.Objects; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
import static com.example.mave.Diary.Create_Diary.TAG; |
||||
|
|
||||
|
public class Join_Group extends Dialog implements View.OnClickListener { |
||||
|
private Context mContext; |
||||
|
|
||||
|
|
||||
|
|
||||
|
private Button yes; |
||||
|
private Button no; |
||||
|
private EditText joinGroupId; |
||||
|
|
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.join_group); |
||||
|
|
||||
|
Objects.requireNonNull(getWindow()).setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
|
||||
|
yes = findViewById(R.id.btnPositive); |
||||
|
no = findViewById(R.id.btnNegative); |
||||
|
joinGroupId = findViewById(R.id.edit_join_group); |
||||
|
yes.setOnClickListener(this); |
||||
|
no.setOnClickListener(this); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Join_Group(Context context, Class<Join_Group> Join_Group_dialogClass) { |
||||
|
super(context); |
||||
|
this.mContext = mContext; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
switch (v.getId()) { |
||||
|
case R.id.btnPositive: //확인 버튼을 눌렀을 때 |
||||
|
|
||||
|
Long groupId = Long.parseLong(joinGroupId.getText().toString()); |
||||
|
joinGroup(groupId); |
||||
|
|
||||
|
Log.d(TAG, "그룹 가입 완료!! "); |
||||
|
|
||||
|
dismiss(); |
||||
|
break; |
||||
|
case R.id.btnNegative: //취소 버튼을 눌렀을 때 |
||||
|
cancel(); |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void joinGroup(Long groupId) { // 그룹에 가입하는 API 서버에 저장된 그룹 ID값을 입력해야 함 |
||||
|
GroupRetrofitService groupRetrofitService = CreateRetrofit.createRetrofit().create(GroupRetrofitService.class); |
||||
|
String userId = MemberRepository.getInstance().getUserId(); |
||||
|
JoinGroupRequest request = new JoinGroupRequest(userId); |
||||
|
Call<JoinGroupResponse> call = groupRetrofitService.joinGroup(groupId, request); |
||||
|
|
||||
|
call.enqueue(new Callback<JoinGroupResponse>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.O) |
||||
|
@Override |
||||
|
public void onResponse(Call<JoinGroupResponse> call, Response<JoinGroupResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
JoinGroupResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
|
||||
|
Intent intent = new Intent(getContext(),MainActivity.class); |
||||
|
FragmentPage2.isJoined = true; |
||||
|
getContext().startActivity(intent); |
||||
|
|
||||
|
|
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
Toast.makeText(getContext(),"찾으시는 그룹이 없습니다 ㅠㅠ",Toast.LENGTH_SHORT).show(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<JoinGroupResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,43 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.app.Dialog; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.graphics.Color; |
||||
|
import android.graphics.drawable.ColorDrawable; |
||||
|
import android.os.Bundle; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.activities.MainActivity; |
||||
|
|
||||
|
import java.util.Objects; |
||||
|
|
||||
|
public class Level_Up_Dialog extends Dialog { |
||||
|
private Context mContext; |
||||
|
Intent intent; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.level_up_dialog); |
||||
|
|
||||
|
Objects.requireNonNull(getWindow()).setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
|
||||
|
Button yes = findViewById(R.id.btn_level_up); |
||||
|
yes.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
intent = new Intent(getContext(), MainActivity.class); |
||||
|
getContext().startActivity(intent); |
||||
|
dismiss(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public Level_Up_Dialog(Context context, Class<Level_Up_Dialog> level_up_dialogClass) { |
||||
|
super(context); |
||||
|
this.mContext = mContext; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.util.Log; |
||||
|
import android.view.LayoutInflater; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.widget.BaseAdapter; |
||||
|
import android.widget.LinearLayout; |
||||
|
import android.widget.TextView; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.repository.GroupRepository; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
public class ListViewAdapter extends BaseAdapter { |
||||
|
|
||||
|
private Context mContext; |
||||
|
private ArrayList<Answer_Item> listItems = new ArrayList<Answer_Item>(); |
||||
|
|
||||
|
public ListViewAdapter(Context context){ |
||||
|
this.mContext = context; |
||||
|
} |
||||
|
@Override |
||||
|
public int getCount() { |
||||
|
return listItems.size(); |
||||
|
} |
||||
|
@Override |
||||
|
public Object getItem(int i) { |
||||
|
return listItems.get(i); |
||||
|
} |
||||
|
@Override |
||||
|
public long getItemId(int i) { |
||||
|
return i; |
||||
|
} |
||||
|
@Override |
||||
|
public View getView(int position, View convertView, ViewGroup parent) { |
||||
|
|
||||
|
// 레이아웃을 inflate해서 참조획득 |
||||
|
if(convertView == null){ |
||||
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
||||
|
convertView = inflater.inflate(R.layout.answer_add_list, parent, false); |
||||
|
} |
||||
|
|
||||
|
// 참조 획득 |
||||
|
TextView txt_title = (TextView)convertView.findViewById(R.id.txt_title); |
||||
|
TextView txt_userId = (TextView)convertView.findViewById(R.id.txt_name); |
||||
|
Answer_Item listItem = listItems.get(position); |
||||
|
// 가져온 데이터를 텍스트뷰에 입력 |
||||
|
txt_title.setText(listItem.getAnswer()); |
||||
|
txt_userId.setText(listItem.getUserId()); |
||||
|
|
||||
|
return convertView; |
||||
|
} |
||||
|
|
||||
|
public void addItem(String userId, String answer){ |
||||
|
Answer_Item listItem = new Answer_Item(); |
||||
|
listItem.setAnswer(answer); |
||||
|
listItem.setUserId(userId); |
||||
|
listItems.add(listItem); |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,67 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.util.Log; |
||||
|
import android.view.LayoutInflater; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.widget.BaseAdapter; |
||||
|
import android.widget.LinearLayout; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
public class ListViewAdapterForSub2 extends BaseAdapter { |
||||
|
|
||||
|
private Context mContext; |
||||
|
private ArrayList<Question_Item> listItems = new ArrayList<Question_Item>(); |
||||
|
|
||||
|
public ListViewAdapterForSub2(Context context){ |
||||
|
this.mContext = context; |
||||
|
} |
||||
|
@Override |
||||
|
public int getCount() { |
||||
|
return listItems.size(); |
||||
|
} |
||||
|
@Override |
||||
|
public Object getItem(int i) { |
||||
|
return listItems.get(i); |
||||
|
} |
||||
|
@Override |
||||
|
public long getItemId(int i) { |
||||
|
return i; |
||||
|
} |
||||
|
@Override |
||||
|
public View getView(int position, View convertView, ViewGroup parent) { |
||||
|
|
||||
|
// 레이아웃을 inflate해서 참조획득 |
||||
|
if(convertView == null){ |
||||
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
||||
|
convertView = inflater.inflate(R.layout.question_add_list, parent, false); |
||||
|
} |
||||
|
|
||||
|
// 참조 획득 |
||||
|
TextView txt_question = (TextView)convertView.findViewById(R.id.txt_question); |
||||
|
TextView txt_userId = (TextView)convertView.findViewById(R.id.txt_name); |
||||
|
|
||||
|
Question_Item listItem = listItems.get(position); |
||||
|
// 가져온 데이터를 텍스트뷰에 입력 |
||||
|
txt_question.setText(listItem.getQuestion()); |
||||
|
// LinearLayout question_linear = (LinearLayout)convertView.findViewById(R.id.question_linear); |
||||
|
// question_linear.setOnClickListener(new View.OnClickListener() { |
||||
|
// @Override |
||||
|
// public void onClick(View view) { |
||||
|
// Log.d("1123", "클릭된다"); |
||||
|
// } |
||||
|
// }); |
||||
|
return convertView; |
||||
|
} |
||||
|
|
||||
|
public void addItem(String Question){ |
||||
|
Question_Item listItem = new Question_Item(); |
||||
|
listItem.setQuestion(Question); |
||||
|
listItems.add(listItem); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.app.Dialog; |
||||
|
import android.content.Context; |
||||
|
import android.graphics.Color; |
||||
|
import android.graphics.drawable.ColorDrawable; |
||||
|
import android.os.Bundle; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
|
||||
|
import java.util.Objects; |
||||
|
|
||||
|
|
||||
|
public class Not_Made_Diary_Dialog extends Dialog { |
||||
|
|
||||
|
private Context mContext; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.not_made_diary_dialog); |
||||
|
|
||||
|
Objects.requireNonNull(getWindow()).setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
|
||||
|
Button yes = findViewById(R.id.btndiaryyes); |
||||
|
yes.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
dismiss(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public Not_Made_Diary_Dialog(Context context, Class<Not_Made_Diary_Dialog> not_made_diary_dialogClass) { |
||||
|
super(context); |
||||
|
this.mContext = mContext; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,268 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.app.NotificationChannel; |
||||
|
import android.app.NotificationManager; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.graphics.BitmapFactory; |
||||
|
import android.graphics.Color; |
||||
|
import android.graphics.drawable.ColorDrawable; |
||||
|
import android.os.Build; |
||||
|
import android.os.Bundle; |
||||
|
import android.util.Log; |
||||
|
import android.view.View; |
||||
|
import android.view.Window; |
||||
|
import android.widget.ListView; |
||||
|
import android.widget.TextView; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.annotation.RequiresApi; |
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
import androidx.core.app.NotificationCompat; |
||||
|
|
||||
|
import com.example.mave.CreateRetrofit; |
||||
|
import com.example.mave.Dto.customQuestionDto.CreateCustomRequest; |
||||
|
import com.example.mave.Dto.customQuestionDto.CreateCustomResponse; |
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionResponse; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.repository.GroupRepository; |
||||
|
import com.example.mave.repository.QuestionRepository; |
||||
|
import com.example.mave.service.CustomQuestionRetrofitService; |
||||
|
import com.example.mave.service.QuestionRetrofitService; |
||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
import java.time.LocalTime; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
import static com.example.mave.Diary.Create_Diary.TAG; |
||||
|
|
||||
|
public class Page2_sub extends AppCompatActivity { |
||||
|
|
||||
|
|
||||
|
public static Boolean isCalled = false; |
||||
|
public static Boolean isAlarmed = false; |
||||
|
|
||||
|
|
||||
|
private LocalTime questionTime; |
||||
|
private TextView todayQuestion; |
||||
|
private ListView listView; |
||||
|
private ListViewAdapterForSub2 adapter; |
||||
|
private Context mContext; |
||||
|
GroupRepository groupDB; |
||||
|
QuestionRepository questionDB; |
||||
|
|
||||
|
public static final String NOTIFICATION_CHANNEL_ID = "10001"; |
||||
|
|
||||
|
|
||||
|
@RequiresApi(api = Build.VERSION_CODES.O) |
||||
|
@Override |
||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.fragment_page2_sub); |
||||
|
getSupportActionBar().hide(); |
||||
|
// WindowUtils.makeStatusbarTransparent(this); |
||||
|
listView = findViewById(R.id.questionlist); |
||||
|
|
||||
|
mContext = this; |
||||
|
|
||||
|
adapter = new ListViewAdapterForSub2(Page2_sub.this); |
||||
|
listView.setAdapter(adapter); |
||||
|
|
||||
|
groupDB = GroupRepository.getInstance(); |
||||
|
questionDB = QuestionRepository.getInstance(); |
||||
|
|
||||
|
|
||||
|
todayQuestion = (TextView) findViewById(R.id.todayQuestion); // 오늘의 질문 버튼 |
||||
|
|
||||
|
// 설정 시간 넘었는지 체크 |
||||
|
questionTimeCheck(); |
||||
|
|
||||
|
// 질문을 받아왔는지 체크 |
||||
|
allQuestionRequest(groupDB.getDiaryDate()); |
||||
|
|
||||
|
|
||||
|
todayQuestion.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
Intent intent = new Intent(getApplicationContext(), Page2_sub_answer.class); |
||||
|
Log.d(TAG, "답변 화면으로 가기 전!! " + todayQuestion.getText().toString()); |
||||
|
intent.putExtra("todayQuestion", todayQuestion.getText().toString()); |
||||
|
startActivity(intent); |
||||
|
finish(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
FloatingActionButton FloatingButton = (FloatingActionButton) findViewById(R.id.customquestion); |
||||
|
FloatingButton.setOnClickListener(new View.OnClickListener() { //플로팅버튼 눌렀을 때 이벤트 |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
Create_Question dia = new Create_Question(Page2_sub.this); |
||||
|
// 커스텀 다이얼로그 배경 투명 |
||||
|
dia.requestWindowFeature(Window.FEATURE_NO_TITLE); |
||||
|
dia.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
dia.setDialogListener(new Create_Question.CustomDialogListener() { |
||||
|
@Override |
||||
|
public void onPositiveClicked(String custom_question) { |
||||
|
createCustomQuestion(custom_question); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onNegativeClicked() { |
||||
|
//취소버튼 눌렀을 경우 구현될 코드 작성 |
||||
|
} |
||||
|
}); |
||||
|
dia.show(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void allQuestionRequest(Long questionNumber) { |
||||
|
// 서버에서 질문 받아오기 |
||||
|
GroupRepository groupDB = GroupRepository.getInstance(); |
||||
|
QuestionRepository questionDB = QuestionRepository.getInstance(); |
||||
|
QuestionRetrofitService questionRetrofitService = CreateRetrofit.createRetrofit().create(QuestionRetrofitService.class); |
||||
|
|
||||
|
Log.d(TAG, "질문 받아옵니다!!"); |
||||
|
Log.d(TAG, "서버에 질문을 요청한 그룹 id는!? - " + groupDB.getGroupId().toString()); |
||||
|
Log.d(TAG, "우리 그룹은 며칠째인가!? - " + questionNumber); |
||||
|
|
||||
|
TakeAllQuestionRequest request = new TakeAllQuestionRequest(groupDB.getGroupId()); |
||||
|
Call<List<TakeAllQuestionResponse>> call = questionRetrofitService.takeAllQuestion(questionNumber, request); |
||||
|
|
||||
|
call.enqueue(new Callback<List<TakeAllQuestionResponse>>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.N) |
||||
|
@Override |
||||
|
public void onResponse(Call<List<TakeAllQuestionResponse>> call, Response<List<TakeAllQuestionResponse>> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
List<TakeAllQuestionResponse> body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
|
||||
|
Log.d(TAG, body.get(0).getQuestionContent()); |
||||
|
Log.d(TAG, String.valueOf(body.size())); |
||||
|
|
||||
|
questionDB.setTodayQuestion(body.get(0).getQuestionContent()); |
||||
|
todayQuestion.setText(questionDB.getTodayQuestion()); |
||||
|
|
||||
|
List<String> questionList = new ArrayList<>(); |
||||
|
for (int i = 1; i < body.size(); i++) { |
||||
|
Log.d(TAG, body.get(i).getQuestionContent()); |
||||
|
adapter.addItem(body.get(i).getQuestionContent()); |
||||
|
} |
||||
|
adapter.notifyDataSetChanged(); |
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<List<TakeAllQuestionResponse>> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@RequiresApi(api = Build.VERSION_CODES.O) |
||||
|
private void isAlarmCheck() { |
||||
|
if (!isAlarmed) { |
||||
|
Log.d(TAG, "알람이 울렸는가!? - " + String.valueOf(isAlarmed)); |
||||
|
NotificationSomethings(); |
||||
|
isAlarmed = true; |
||||
|
} else { |
||||
|
Log.d(TAG, "알람이 울렸는가!? - " + String.valueOf(isCalled)); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@RequiresApi(api = Build.VERSION_CODES.O) |
||||
|
private void questionTimeCheck() { |
||||
|
questionTime = GroupRepository.getInstance().getQuestionTime(); |
||||
|
Log.d(TAG, "설정한 시간은?? - " + questionTime); |
||||
|
LocalTime nowTime = LocalTime.now(); |
||||
|
Log.d(TAG, "지금 시간은?? - " + nowTime); |
||||
|
|
||||
|
Log.d(TAG, String.valueOf(nowTime.isAfter(questionTime))); |
||||
|
if (nowTime.isAfter(questionTime)) { |
||||
|
isAlarmCheck(); |
||||
|
} else { |
||||
|
Log.d(TAG, "아직 질문이 도착하지 않았습니다!"); // 아니면 말고 코드 넣으면 될 거 같습니다. |
||||
|
Toast.makeText(getApplicationContext(), "아직 질문이 도착하지 않았습니다 ㅠㅠ", Toast.LENGTH_LONG).show(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void NotificationSomethings() { |
||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); |
||||
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID) |
||||
|
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.mave_logo)) //BitMap 이미지 요구 |
||||
|
.setContentTitle("다이어리에 질문이 도착했습니다!") |
||||
|
.setContentText("알림바를 눌러 확인하고 답장 해보세요!") |
||||
|
// 더 많은 내용이라서 일부만 보여줘야 하는 경우 아래 주석을 제거하면 setContentText에 있는 문자열 대신 아래 문자열을 보여줌 |
||||
|
//.setStyle(new NotificationCompat.BigTextStyle().bigText("더 많은 내용을 보여줘야 하는 경우...")) |
||||
|
.setPriority(NotificationCompat.PRIORITY_DEFAULT) |
||||
|
.setAutoCancel(true); |
||||
|
//OREO API 26 이상에서는 채널 필요 |
||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
||||
|
builder.setSmallIcon(R.drawable.mave_logo2); //mipmap 사용시 Oreo 이상에서 시스템 UI 에러남 |
||||
|
CharSequence channelName = "노티페케이션 채널"; |
||||
|
String description = "오레오 이상을 위한 것임"; |
||||
|
int importance = NotificationManager.IMPORTANCE_HIGH; |
||||
|
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, importance); |
||||
|
channel.setDescription(description); |
||||
|
// 노티피케이션 채널을 시스템에 등록 |
||||
|
assert notificationManager != null; |
||||
|
notificationManager.createNotificationChannel(channel); |
||||
|
} else |
||||
|
builder.setSmallIcon(R.mipmap.ic_launcher); // Oreo 이하에서 mipmap 사용하지 않으면 Couldn't create icon: StatusBarIcon 에러남 |
||||
|
assert notificationManager != null; |
||||
|
notificationManager.notify(1234, builder.build()); // 고유숫자로 노티피케이션 동작시킴 |
||||
|
} |
||||
|
|
||||
|
private void createCustomQuestion(String customQuestion) { |
||||
|
CustomQuestionRetrofitService customQuestionRetrofitService = CreateRetrofit.createRetrofit().create(CustomQuestionRetrofitService.class); |
||||
|
CreateCustomRequest request = new CreateCustomRequest(customQuestion, |
||||
|
GroupRepository.getInstance().getDiaryDate(), |
||||
|
GroupRepository.getInstance().getGroupId()); |
||||
|
Call<CreateCustomResponse> call = customQuestionRetrofitService.createCustomQuestion(request); |
||||
|
|
||||
|
call.enqueue(new Callback<CreateCustomResponse>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.N) |
||||
|
@Override |
||||
|
public void onResponse(Call<CreateCustomResponse> call, Response<CreateCustomResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
CreateCustomResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
Log.d(TAG, "Custom 질문 보내기 성공!! "); |
||||
|
QuestionRepository.getInstance().setQuestion(customQuestion); |
||||
|
|
||||
|
} else { |
||||
|
|
||||
|
Log.d(TAG, "아직 질문이 도착하지 않았습니다!"); |
||||
|
Toast.makeText(getApplicationContext(), "아직 질문이 도착하지 않았습니다 ㅠㅠ", Toast.LENGTH_LONG).show(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<CreateCustomResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
@ -0,0 +1,309 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.content.SharedPreferences; |
||||
|
import android.graphics.Color; |
||||
|
import android.graphics.drawable.ColorDrawable; |
||||
|
import android.os.Build; |
||||
|
import android.os.Bundle; |
||||
|
|
||||
|
import androidx.annotation.RequiresApi; |
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
|
||||
|
import android.util.Log; |
||||
|
import android.view.View; |
||||
|
import android.view.Window; |
||||
|
import android.view.WindowManager; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.ImageButton; |
||||
|
import android.widget.ImageView; |
||||
|
import android.widget.ListView; |
||||
|
import android.widget.TextView; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import com.example.mave.CreateRetrofit; |
||||
|
import com.example.mave.Dto.AnswerDto.AllAnswerRequest; |
||||
|
import com.example.mave.Dto.AnswerDto.AllAnswerResponse; |
||||
|
import com.example.mave.Dto.AnswerDto.RegistAnswerRequest; |
||||
|
import com.example.mave.Dto.AnswerDto.RegistAnswerResponse; |
||||
|
import com.example.mave.Dto.customQuestionDto.CreateCustomRequest; |
||||
|
import com.example.mave.Dto.customQuestionDto.CreateCustomResponse; |
||||
|
import com.example.mave.Dto.customQuestionDto.UseCustomRequest; |
||||
|
import com.example.mave.Dto.customQuestionDto.UseCustomResponse; |
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionResponse; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionResponse; |
||||
|
import com.example.mave.PreferenceManager; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.activities.MainActivity; |
||||
|
import com.example.mave.repository.AnswerRepository; |
||||
|
import com.example.mave.repository.GroupRepository; |
||||
|
import com.example.mave.repository.MemberRepository; |
||||
|
import com.example.mave.repository.QuestionRepository; |
||||
|
import com.example.mave.service.AnswerRetrofitService; |
||||
|
import com.example.mave.service.CustomQuestionRetrofitService; |
||||
|
import com.example.mave.service.QuestionRetrofitService; |
||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
import java.lang.reflect.Member; |
||||
|
import java.security.acl.Group; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
import static com.example.mave.Diary.Create_Diary.TAG; |
||||
|
import static com.example.mave.repository.GroupRepository.*; |
||||
|
|
||||
|
|
||||
|
public class Page2_sub_answer extends AppCompatActivity { |
||||
|
|
||||
|
|
||||
|
private ListView listView; |
||||
|
private Button btn_add, btn_custom; |
||||
|
private EditText edt_title; |
||||
|
private ListViewAdapter adapter; |
||||
|
static int count = 0; |
||||
|
private ImageView flower; |
||||
|
private Context mContext; |
||||
|
private TextView TodayQuestion; |
||||
|
private ImageButton calendar; |
||||
|
SharedPreferences pref; |
||||
|
SharedPreferences.Editor editor; |
||||
|
|
||||
|
|
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.fragment_page2_sub_answer); |
||||
|
getSupportActionBar().hide(); |
||||
|
// WindowUtils.makeStatusbarTransparent(this); |
||||
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); // EditText 사용시 키보드 자판이 UI 가릴 때 영향 안주는 것 |
||||
|
edt_title = (EditText) findViewById(R.id.edt_answer); |
||||
|
btn_add = (Button) findViewById(R.id.btn_answer); |
||||
|
listView = (ListView) findViewById(R.id.listMemo); |
||||
|
flower = (ImageView) findViewById(R.id.diary_flower); |
||||
|
TodayQuestion = (TextView) findViewById(R.id.todayQuestion); |
||||
|
btn_custom = (Button) findViewById(R.id.customquestion); |
||||
|
calendar = (ImageButton) findViewById(R.id.imageButton2); |
||||
|
mContext = this; |
||||
|
Intent intent = getIntent(); |
||||
|
String todayQuestion = intent.getStringExtra("todayQuestion"); |
||||
|
|
||||
|
|
||||
|
adapter = new ListViewAdapter(Page2_sub_answer.this); |
||||
|
listView.setAdapter(adapter); |
||||
|
|
||||
|
|
||||
|
Log.d(TAG, "답변 화면 - 질문 가져오자!!"); |
||||
|
TodayQuestion.setText(todayQuestion); |
||||
|
|
||||
|
|
||||
|
Log.d(TAG, "답변 화면 - 답변 가져오자!!"); |
||||
|
takeAllAnswer(adapter); |
||||
|
|
||||
|
// 데이터 추가하기 |
||||
|
btn_add.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
adapter.addItem(MemberRepository.getInstance().getUserId(), edt_title.getText().toString()); |
||||
|
registAnswer(); |
||||
|
edt_title.setText(""); |
||||
|
count++; |
||||
|
adapter.notifyDataSetChanged(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public void registAnswer() { |
||||
|
|
||||
|
AnswerRetrofitService answerRetrofitService = CreateRetrofit.createRetrofit().create(AnswerRetrofitService.class); |
||||
|
RegistAnswerRequest request = new RegistAnswerRequest(MemberRepository.getInstance().getUserId(), getInstance().getGroupId(), edt_title.getText().toString()); |
||||
|
Call<RegistAnswerResponse> call = answerRetrofitService.registAnswer(getInstance().getCompleteDate(), request); |
||||
|
|
||||
|
call.enqueue(new Callback<RegistAnswerResponse>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<RegistAnswerResponse> call, Response<RegistAnswerResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
RegistAnswerResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
|
||||
|
|
||||
|
if (body.getFinish()) { |
||||
|
completeDate++; |
||||
|
checkCustom(); |
||||
|
Level_Up_Dialog dig_2 = new Level_Up_Dialog(Page2_sub_answer.this, Level_Up_Dialog.class); |
||||
|
// 커스텀 다이얼로그 배경 투명 |
||||
|
dig_2.requestWindowFeature(Window.FEATURE_NO_TITLE); |
||||
|
dig_2.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
||||
|
dig_2.show(); |
||||
|
} else { |
||||
|
Intent intent = new Intent(getApplicationContext(), MainActivity.class); |
||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |
||||
|
startActivity(intent); |
||||
|
finish(); |
||||
|
} |
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<RegistAnswerResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void takeAllAnswer(ListViewAdapter adapter) { |
||||
|
AnswerRetrofitService answerRetrofitService = CreateRetrofit.createRetrofit().create(AnswerRetrofitService.class); |
||||
|
AllAnswerRequest request = new AllAnswerRequest(getInstance().getGroupId()); |
||||
|
Call<List<AllAnswerResponse>> call = answerRetrofitService.allAnswer(getInstance().getDiaryDate(), request); |
||||
|
|
||||
|
call.enqueue(new Callback<List<AllAnswerResponse>>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<List<AllAnswerResponse>> call, Response<List<AllAnswerResponse>> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
List<AllAnswerResponse> body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
for (AllAnswerResponse allAnswerResponse : body) { |
||||
|
String answerContent = allAnswerResponse.getAnswerContent(); |
||||
|
String userId = allAnswerResponse.getUserId(); |
||||
|
if (userId.equals(MemberRepository.getInstance().getUserId())) { |
||||
|
edt_title.setVisibility(View.GONE); |
||||
|
btn_add.setVisibility(View.GONE); |
||||
|
} |
||||
|
adapter.addItem(userId, answerContent); |
||||
|
|
||||
|
} |
||||
|
adapter.notifyDataSetChanged(); |
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<List<AllAnswerResponse>> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void questionRequest(Long diaryDate) { |
||||
|
GroupRepository groupDB = getInstance(); |
||||
|
// 서버에서 질문 받아오기 |
||||
|
QuestionRetrofitService questionRetrofitService = CreateRetrofit.createRetrofit().create(QuestionRetrofitService.class); |
||||
|
|
||||
|
Log.d(TAG, "질문 생성합니다!!"); |
||||
|
Log.d(TAG, "서버에 질문을 요청한 그룹 id는!? - " + groupDB.getGroupId()); |
||||
|
Log.d(TAG, "우리 그룹은 며칠째인가!? - " + diaryDate); |
||||
|
|
||||
|
TakeQuestionRequest request = new TakeQuestionRequest(groupDB.getGroupId()); |
||||
|
Call<TakeQuestionResponse> call = questionRetrofitService.takeQuestion(diaryDate, request); |
||||
|
|
||||
|
call.enqueue(new Callback<TakeQuestionResponse>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.N) |
||||
|
@Override |
||||
|
public void onResponse(Call<TakeQuestionResponse> call, Response<TakeQuestionResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
TakeQuestionResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
|
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<TakeQuestionResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void checkCustom() throws NullPointerException { |
||||
|
CustomQuestionRetrofitService customQuestionRetrofitService = CreateRetrofit.createRetrofit().create(CustomQuestionRetrofitService.class); |
||||
|
CreateCustomRequest request = new CreateCustomRequest("customQuestion", |
||||
|
GroupRepository.getInstance().getDiaryDate(), |
||||
|
GroupRepository.getInstance().getGroupId()); |
||||
|
Call<CreateCustomResponse> call = customQuestionRetrofitService.checkCustom(request); |
||||
|
|
||||
|
call.enqueue(new Callback<CreateCustomResponse>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.N) |
||||
|
@Override |
||||
|
public void onResponse(Call<CreateCustomResponse> call, Response<CreateCustomResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
CreateCustomResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
Log.d(TAG, "Custom 질문 체크!!"); |
||||
|
|
||||
|
if (body.getQuestionContent() != null) { |
||||
|
Log.d(TAG, "Custom 질문 있다!!"); |
||||
|
Log.d(TAG, "커스텀 질문 가져오기"); |
||||
|
customQuestionRequest(); |
||||
|
} else { |
||||
|
Log.d(TAG, "그냥 질문 가져오기"); |
||||
|
questionRequest(completeDate); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<CreateCustomResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void customQuestionRequest() { |
||||
|
CustomQuestionRetrofitService customQuestionRetrofitService = CreateRetrofit.createRetrofit().create(CustomQuestionRetrofitService.class); |
||||
|
UseCustomRequest request = new UseCustomRequest(GroupRepository.getInstance().getGroupId()); |
||||
|
Call<UseCustomResponse> call = customQuestionRetrofitService.useCustomQuestion(diaryDate, request); |
||||
|
|
||||
|
call.enqueue(new Callback<UseCustomResponse>() { |
||||
|
@RequiresApi(api = Build.VERSION_CODES.N) |
||||
|
@Override |
||||
|
public void onResponse(Call<UseCustomResponse> call, Response<UseCustomResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
UseCustomResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
Log.d(TAG, "Custom 질문 만들어주세요!!"); |
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<UseCustomResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
package com.example.mave.Diary; |
||||
|
|
||||
|
public class Question_Item { |
||||
|
|
||||
|
private String Question; |
||||
|
|
||||
|
public void setQuestion(String Question) { |
||||
|
this.Question = Question; |
||||
|
} |
||||
|
|
||||
|
public String getQuestion() { |
||||
|
return Question; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Dto.AnswerDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class AllAnswerRequest { |
||||
|
|
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
public AllAnswerRequest() { |
||||
|
} |
||||
|
|
||||
|
public AllAnswerRequest(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.example.mave.Dto.AnswerDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class AllAnswerResponse { |
||||
|
|
||||
|
@SerializedName("userId") |
||||
|
private String userId; |
||||
|
|
||||
|
@SerializedName("answerContent") |
||||
|
private String answerContent; |
||||
|
|
||||
|
public AllAnswerResponse() { |
||||
|
} |
||||
|
|
||||
|
public AllAnswerResponse(String userId, String answerContent) { |
||||
|
this.userId = userId; |
||||
|
this.answerContent = answerContent; |
||||
|
} |
||||
|
|
||||
|
public String getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
public String getAnswerContent() { |
||||
|
return answerContent; |
||||
|
} |
||||
|
|
||||
|
public void setAnswerContent(String answerContent) { |
||||
|
this.answerContent = answerContent; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
package com.example.mave.Dto.AnswerDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class RegistAnswerRequest { |
||||
|
|
||||
|
@SerializedName("userId") |
||||
|
private String userId; |
||||
|
|
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
@SerializedName("answer") |
||||
|
private String answer; |
||||
|
|
||||
|
public RegistAnswerRequest() { |
||||
|
} |
||||
|
|
||||
|
public RegistAnswerRequest(String userId, Long groupId, String answer) { |
||||
|
this.userId = userId; |
||||
|
this.groupId = groupId; |
||||
|
this.answer = answer; |
||||
|
} |
||||
|
|
||||
|
public String getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public String getAnswer() { |
||||
|
return answer; |
||||
|
} |
||||
|
|
||||
|
public void setAnswer(String answer) { |
||||
|
this.answer = answer; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.example.mave.Dto.AnswerDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class RegistAnswerResponse { |
||||
|
|
||||
|
@SerializedName("answer") |
||||
|
private String answer; |
||||
|
|
||||
|
@SerializedName("isFinish") |
||||
|
private Boolean isFinish; |
||||
|
|
||||
|
public RegistAnswerResponse() { |
||||
|
} |
||||
|
|
||||
|
public RegistAnswerResponse(String answer, Boolean isFinish) { |
||||
|
this.answer = answer; |
||||
|
this.isFinish = isFinish; |
||||
|
} |
||||
|
|
||||
|
public String getAnswer() { |
||||
|
return answer; |
||||
|
} |
||||
|
|
||||
|
public void setAnswer(String answer) { |
||||
|
this.answer = answer; |
||||
|
} |
||||
|
|
||||
|
public Boolean getFinish() { |
||||
|
return isFinish; |
||||
|
} |
||||
|
|
||||
|
public void setFinish(Boolean finish) { |
||||
|
isFinish = finish; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
package com.example.mave.Dto.customQuestionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class CreateCustomRequest { |
||||
|
|
||||
|
@SerializedName("questionContent") |
||||
|
private String questionContent; |
||||
|
|
||||
|
@SerializedName("diaryDate") |
||||
|
private Long diaryDate; |
||||
|
|
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
public CreateCustomRequest(String questionContent, Long diaryDate, Long groupId) { |
||||
|
this.questionContent = questionContent; |
||||
|
this.diaryDate = diaryDate; |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public String getQuestionContent() { |
||||
|
return questionContent; |
||||
|
} |
||||
|
|
||||
|
public void setQuestionContent(String questionContent) { |
||||
|
this.questionContent = questionContent; |
||||
|
} |
||||
|
|
||||
|
public Long getDiaryDate() { |
||||
|
return diaryDate; |
||||
|
} |
||||
|
|
||||
|
public void setDiaryDate(Long diaryDate) { |
||||
|
this.diaryDate = diaryDate; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.example.mave.Dto.customQuestionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class CreateCustomResponse { |
||||
|
|
||||
|
@SerializedName("questionContent") |
||||
|
private String questionContent; |
||||
|
|
||||
|
public CreateCustomResponse() { |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String getQuestionContent() { |
||||
|
return questionContent; |
||||
|
} |
||||
|
|
||||
|
public void setQuestionContent(String questionContent) { |
||||
|
this.questionContent = questionContent; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.example.mave.Dto.customQuestionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class UseCustomRequest { |
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
public UseCustomRequest(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.example.mave.Dto.customQuestionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class UseCustomResponse { |
||||
|
|
||||
|
@SerializedName("questionContent") |
||||
|
private String questionContent; |
||||
|
|
||||
|
public UseCustomResponse() { |
||||
|
} |
||||
|
|
||||
|
public String getQuestionContent() { |
||||
|
return questionContent; |
||||
|
} |
||||
|
|
||||
|
public void setQuestionContent(String questionContent) { |
||||
|
this.questionContent = questionContent; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
package com.example.mave.Dto.groupDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalTime; |
||||
|
|
||||
|
public class CreateGroupRequest { |
||||
|
|
||||
|
@SerializedName("userId") |
||||
|
private String userId; |
||||
|
|
||||
|
@SerializedName("groupName") |
||||
|
private String groupName; |
||||
|
|
||||
|
@SerializedName("questionTime") |
||||
|
private String questionTime; |
||||
|
|
||||
|
|
||||
|
public CreateGroupRequest() { |
||||
|
} |
||||
|
|
||||
|
public CreateGroupRequest(String userId, String groupName, String questionTime) { |
||||
|
this.userId = userId; |
||||
|
this.groupName = groupName; |
||||
|
this.questionTime = questionTime; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
public String getGroupName() { |
||||
|
return groupName; |
||||
|
} |
||||
|
|
||||
|
public void setGroupName(String groupName) { |
||||
|
this.groupName = groupName; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.example.mave.Dto.groupDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class CreateGroupResponse { |
||||
|
|
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
@SerializedName("diaryDate") |
||||
|
private Long diaryDate; |
||||
|
|
||||
|
public CreateGroupResponse() { |
||||
|
} |
||||
|
|
||||
|
public CreateGroupResponse(Long groupId,Long diaryDate) { |
||||
|
this.groupId = groupId; |
||||
|
this.diaryDate = diaryDate; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public Long getDiaryDate() { |
||||
|
return diaryDate; |
||||
|
} |
||||
|
|
||||
|
public void setDiaryDate(Long diaryDate) { |
||||
|
this.diaryDate = diaryDate; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,105 @@ |
|||||
|
package com.example.mave.Dto.groupDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalTime; |
||||
|
|
||||
|
public class FindGroupResponse { |
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
@SerializedName("groupName") |
||||
|
private String groupName; |
||||
|
@SerializedName("flowerCount") |
||||
|
private int flowerCount; |
||||
|
@SerializedName("flowerStatus") |
||||
|
private int flowerStatus; |
||||
|
@SerializedName("questionTime") |
||||
|
private String questionTime; |
||||
|
@SerializedName("diaryDate") |
||||
|
private Long diaryDate; |
||||
|
@SerializedName("completeDate") |
||||
|
private Long completeDate; |
||||
|
@SerializedName("isDateChanged") |
||||
|
private Boolean isDateChanged; |
||||
|
|
||||
|
|
||||
|
|
||||
|
public FindGroupResponse() { |
||||
|
} |
||||
|
|
||||
|
public FindGroupResponse(Long groupId, String groupName, int flowerCount, int flowerStatus, String questionTime, Long diaryDate,Long completeDate, Boolean isDateChanged) { |
||||
|
this.groupId = groupId; |
||||
|
this.groupName = groupName; |
||||
|
this.flowerCount = flowerCount; |
||||
|
this.flowerStatus = flowerStatus; |
||||
|
this.questionTime = questionTime; |
||||
|
this.diaryDate = diaryDate; |
||||
|
this.completeDate = completeDate; |
||||
|
this.isDateChanged = isDateChanged; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public String getGroupName() { |
||||
|
return groupName; |
||||
|
} |
||||
|
|
||||
|
public void setGroupName(String groupName) { |
||||
|
this.groupName = groupName; |
||||
|
} |
||||
|
|
||||
|
public int getFlowerCount() { |
||||
|
return flowerCount; |
||||
|
} |
||||
|
|
||||
|
public void setFlowerCount(int flowerCount) { |
||||
|
this.flowerCount = flowerCount; |
||||
|
} |
||||
|
|
||||
|
public int getFlowerStatus() { |
||||
|
return flowerStatus; |
||||
|
} |
||||
|
|
||||
|
public void setFlowerStatus(int flowerStatus) { |
||||
|
this.flowerStatus = flowerStatus; |
||||
|
} |
||||
|
|
||||
|
public String getQuestionTime() { |
||||
|
return questionTime; |
||||
|
} |
||||
|
|
||||
|
public void setQuestionTime(String questionTime) { |
||||
|
this.questionTime = questionTime; |
||||
|
} |
||||
|
|
||||
|
public Long getDiaryDate() { |
||||
|
return diaryDate; |
||||
|
} |
||||
|
|
||||
|
public void setDiaryDate(Long diaryDate) { |
||||
|
this.diaryDate = diaryDate; |
||||
|
} |
||||
|
|
||||
|
public Boolean getDateChanged() { |
||||
|
return isDateChanged; |
||||
|
} |
||||
|
|
||||
|
public void setDateChanged(Boolean dateChanged) { |
||||
|
isDateChanged = dateChanged; |
||||
|
} |
||||
|
|
||||
|
public Long getCompleteDate() { |
||||
|
return completeDate; |
||||
|
} |
||||
|
|
||||
|
public void setCompleteDate(Long completeDate) { |
||||
|
this.completeDate = completeDate; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Dto.groupDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class JoinGroupRequest { |
||||
|
|
||||
|
@SerializedName("userId") |
||||
|
private String userId; |
||||
|
|
||||
|
public JoinGroupRequest() { |
||||
|
} |
||||
|
|
||||
|
public JoinGroupRequest(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
public String getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Dto.groupDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class JoinGroupResponse { |
||||
|
|
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
public JoinGroupResponse() { |
||||
|
} |
||||
|
|
||||
|
public JoinGroupResponse(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,51 @@ |
|||||
|
package com.example.mave.Dto.memeberDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
|
||||
|
public class JoinMemberRequest { |
||||
|
|
||||
|
|
||||
|
@SerializedName("userId") |
||||
|
private String userId; |
||||
|
|
||||
|
@SerializedName("userName") |
||||
|
private String userName; |
||||
|
|
||||
|
@SerializedName("password") |
||||
|
private String password; |
||||
|
|
||||
|
|
||||
|
public JoinMemberRequest() { |
||||
|
} |
||||
|
|
||||
|
public JoinMemberRequest(String userId, String userName, String password) { |
||||
|
this.userId = userId; |
||||
|
this.userName = userName; |
||||
|
this.password = password; |
||||
|
} |
||||
|
|
||||
|
public String getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
public String getUserName() { |
||||
|
return userName; |
||||
|
} |
||||
|
|
||||
|
public void setUserName(String userName) { |
||||
|
this.userName = userName; |
||||
|
} |
||||
|
|
||||
|
public String getPassword() { |
||||
|
return password; |
||||
|
} |
||||
|
|
||||
|
public void setPassword(String password) { |
||||
|
this.password = password; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.example.mave.Dto.memeberDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class JoinMemberResponse { |
||||
|
|
||||
|
@SerializedName("userId") |
||||
|
private Long userId; |
||||
|
|
||||
|
public JoinMemberResponse() { |
||||
|
} |
||||
|
|
||||
|
public JoinMemberResponse(Long userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
public Long getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(Long userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { return "MemberJoinResponse{" + |
||||
|
"userId=" + userId + |
||||
|
'}'; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.example.mave.Dto.memeberDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class LoginRequest { |
||||
|
|
||||
|
@SerializedName("userId") |
||||
|
private String userId; |
||||
|
|
||||
|
@SerializedName("password") |
||||
|
private String password; |
||||
|
|
||||
|
|
||||
|
public LoginRequest() { |
||||
|
} |
||||
|
|
||||
|
public LoginRequest(String userId, String password) { |
||||
|
this.userId = userId; |
||||
|
this.password = password; |
||||
|
} |
||||
|
|
||||
|
public String getUserId() { |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId) { |
||||
|
this.userId = userId; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String getPassword() { |
||||
|
return password; |
||||
|
} |
||||
|
|
||||
|
public void setPassword(String password) { |
||||
|
this.password = password; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.example.mave.Dto.memeberDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class LoginResponse { |
||||
|
|
||||
|
@SerializedName("isLoginOk") |
||||
|
private Boolean isLoginOk; |
||||
|
|
||||
|
public LoginResponse() { |
||||
|
} |
||||
|
|
||||
|
public LoginResponse(Boolean isLoginOk) { |
||||
|
this.isLoginOk = isLoginOk; |
||||
|
} |
||||
|
|
||||
|
public Boolean getLoginOk() { |
||||
|
return isLoginOk; |
||||
|
} |
||||
|
|
||||
|
public void setLoginOk(Boolean loginOk) { |
||||
|
isLoginOk = loginOk; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Dto.questionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class TakeAllQuestionRequest { |
||||
|
|
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
public TakeAllQuestionRequest() { |
||||
|
} |
||||
|
|
||||
|
public TakeAllQuestionRequest(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Dto.questionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class TakeAllQuestionResponse { |
||||
|
|
||||
|
@SerializedName("questionContent") |
||||
|
private String questionContent; |
||||
|
|
||||
|
public TakeAllQuestionResponse() { |
||||
|
} |
||||
|
|
||||
|
public TakeAllQuestionResponse(String questionContent) { |
||||
|
this.questionContent = questionContent; |
||||
|
} |
||||
|
|
||||
|
public String getQuestionContent() { |
||||
|
return questionContent; |
||||
|
} |
||||
|
|
||||
|
public void setQuestionContent(String questionContent) { |
||||
|
this.questionContent = questionContent; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Dto.questionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class TakeQuestionRequest { |
||||
|
|
||||
|
@SerializedName("groupId") |
||||
|
private Long groupId; |
||||
|
|
||||
|
public TakeQuestionRequest() { |
||||
|
} |
||||
|
|
||||
|
public TakeQuestionRequest(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return groupId; |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
this.groupId = groupId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.Dto.questionDto; |
||||
|
|
||||
|
import com.google.gson.annotations.SerializedName; |
||||
|
|
||||
|
public class TakeQuestionResponse { |
||||
|
|
||||
|
@SerializedName("questionContent") |
||||
|
private String questionContent; |
||||
|
|
||||
|
public TakeQuestionResponse() { |
||||
|
} |
||||
|
|
||||
|
public TakeQuestionResponse(String questionContent) { |
||||
|
this.questionContent = questionContent; |
||||
|
} |
||||
|
|
||||
|
public String getQuestionContent() { |
||||
|
return questionContent; |
||||
|
} |
||||
|
|
||||
|
public void setQuestionContent(String questionContent) { |
||||
|
this.questionContent = questionContent; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,104 @@ |
|||||
|
package com.example.mave.PhotoBook; |
||||
|
|
||||
|
import android.content.Intent; |
||||
|
import android.os.Bundle; |
||||
|
import android.view.LayoutInflater; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.widget.AdapterView; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.recyclerview.widget.GridLayoutManager; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Dictionary; |
||||
|
import java.util.List; |
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.fragment.app.Fragment; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.activities.MainActivity; |
||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton; |
||||
|
import com.google.firebase.database.ChildEventListener; |
||||
|
import com.google.firebase.database.DataSnapshot; |
||||
|
import com.google.firebase.database.DatabaseError; |
||||
|
import com.google.firebase.database.DatabaseReference; |
||||
|
import com.google.firebase.database.FirebaseDatabase; |
||||
|
import com.google.firebase.storage.FirebaseStorage; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
|
||||
|
public class FragmentPage1 extends Fragment { |
||||
|
|
||||
|
|
||||
|
final static int CODE = 1; |
||||
|
ViewGroup viewGroup; |
||||
|
|
||||
|
FirebaseDatabase mDatabase; |
||||
|
DatabaseReference mRef; |
||||
|
FirebaseStorage mStorage; |
||||
|
RecyclerView recyclerView; |
||||
|
MyRecyclerAdapter myRecyclerAdapter; |
||||
|
List<ItemData> itemdata; |
||||
|
|
||||
|
@Nullable |
||||
|
@Override |
||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
||||
|
|
||||
|
// WindowUtils.makeStatusbarTransparent(getActivity()); |
||||
|
viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_page_1, container, false); |
||||
|
mDatabase = FirebaseDatabase.getInstance(); // firebaseDatabase 인스턴스 생성 |
||||
|
mRef = mDatabase.getReference().child("mave"); // 생성된 database 를 참조하는 ref 생성 |
||||
|
mStorage = FirebaseStorage.getInstance(); // firebaseStorage 인스턴스 생성 |
||||
|
recyclerView = (RecyclerView) viewGroup.findViewById(R.id.photolist_recyclerview); |
||||
|
recyclerView.setHasFixedSize(true); |
||||
|
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2)); |
||||
|
itemdata = new ArrayList<ItemData>(); |
||||
|
myRecyclerAdapter = new MyRecyclerAdapter(getActivity(),itemdata); |
||||
|
recyclerView.setAdapter(myRecyclerAdapter); |
||||
|
|
||||
|
|
||||
|
FloatingActionButton FloatingButton3 = (FloatingActionButton) viewGroup.findViewById(R.id.page1_btn_add_picture); |
||||
|
FloatingButton3.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
Intent intent = new Intent(getActivity(), List_insert.class); |
||||
|
startActivityForResult(intent, CODE); |
||||
|
getActivity().finish(); |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
mRef.addChildEventListener(new ChildEventListener() { |
||||
|
@Override |
||||
|
public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String s) { |
||||
|
ItemData itemData = snapshot.getValue(ItemData.class); |
||||
|
itemdata.add(itemData); |
||||
|
myRecyclerAdapter.notifyDataSetChanged(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onChildChanged(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onChildRemoved(@NonNull DataSnapshot snapshot) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onChildMoved(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onCancelled(@NonNull DatabaseError error) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
return viewGroup; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.example.mave.PhotoBook; |
||||
|
|
||||
|
public class ItemData { |
||||
|
String image; |
||||
|
String Title; |
||||
|
String Content; |
||||
|
|
||||
|
public ItemData(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public ItemData(String title, String content, String image) { |
||||
|
Title = title; |
||||
|
Content = content; |
||||
|
this.image = image; |
||||
|
} |
||||
|
|
||||
|
public String getImage() { |
||||
|
return image; |
||||
|
} |
||||
|
|
||||
|
public String getTitle() { |
||||
|
return Title; |
||||
|
} |
||||
|
|
||||
|
public String getContent() { |
||||
|
return Content; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,111 @@ |
|||||
|
package com.example.mave.PhotoBook; |
||||
|
|
||||
|
import android.app.ProgressDialog; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.graphics.Bitmap; |
||||
|
import android.graphics.BitmapFactory; |
||||
|
import android.net.Uri; |
||||
|
import android.os.Bundle; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.ImageButton; |
||||
|
import android.widget.ImageView; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.activities.MainActivity; |
||||
|
import com.google.android.gms.tasks.Task; |
||||
|
import com.google.firebase.database.DatabaseReference; |
||||
|
import com.google.firebase.database.FirebaseDatabase; |
||||
|
import com.google.firebase.storage.FirebaseStorage; |
||||
|
import com.google.firebase.storage.StorageReference; |
||||
|
|
||||
|
import java.io.ByteArrayOutputStream; |
||||
|
import java.io.FileNotFoundException; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class List_insert extends AppCompatActivity { |
||||
|
|
||||
|
FirebaseDatabase mDatabase; |
||||
|
DatabaseReference mRef; |
||||
|
FirebaseStorage mStorage; |
||||
|
ImageButton selectImage; |
||||
|
EditText edtTitle, edtContent; |
||||
|
Button insertBtn; |
||||
|
private static final int Gallery_Code = 1; |
||||
|
Uri imageUrl = null; |
||||
|
ProgressDialog progressDialog; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.list_insert); |
||||
|
getSupportActionBar().hide(); |
||||
|
|
||||
|
selectImage = findViewById(R.id.selectImage); |
||||
|
edtTitle = findViewById(R.id.addTitle); |
||||
|
edtContent = findViewById(R.id.addContent); |
||||
|
insertBtn = findViewById(R.id.insertBtn); |
||||
|
|
||||
|
mDatabase = FirebaseDatabase.getInstance(); // firebaseDatabase 인스턴스 생성 |
||||
|
mRef = mDatabase.getReference().child("mave"); // 생성된 database 를 참조하는 ref 생성 |
||||
|
mStorage = FirebaseStorage.getInstance(); // firebaseStorage 인스턴스 생성 |
||||
|
progressDialog = new ProgressDialog(this); |
||||
|
|
||||
|
selectImage.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); |
||||
|
intent.setType("image/*"); |
||||
|
startActivityForResult(intent, Gallery_Code); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
||||
|
super.onActivityResult(requestCode, resultCode, data); |
||||
|
|
||||
|
if (requestCode == Gallery_Code && resultCode == RESULT_OK) { |
||||
|
imageUrl = data.getData(); |
||||
|
selectImage.setImageURI(imageUrl); |
||||
|
} |
||||
|
insertBtn.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
final String fn = edtTitle.getText().toString().trim(); |
||||
|
final String ln = edtContent.getText().toString().trim(); |
||||
|
|
||||
|
if (!(fn.isEmpty() && ln.isEmpty() && imageUrl != null)){ |
||||
|
progressDialog.setTitle("업로딩 중.."); |
||||
|
progressDialog.show(); |
||||
|
|
||||
|
StorageReference filepath = mStorage.getReference().child("이미지 post").child(imageUrl.getLastPathSegment()); |
||||
|
filepath.putFile(imageUrl).addOnSuccessListener(taskSnapshot -> { |
||||
|
Task<Uri> downloadUrl =taskSnapshot.getStorage().getDownloadUrl().addOnCompleteListener(task -> { |
||||
|
String t = task.getResult().toString(); |
||||
|
|
||||
|
DatabaseReference newPost = mRef.push(); |
||||
|
|
||||
|
newPost.child("Title").setValue(fn); |
||||
|
newPost.child("Content").setValue(ln); |
||||
|
newPost.child("image").setValue(task.getResult().toString()); |
||||
|
|
||||
|
progressDialog.dismiss(); |
||||
|
|
||||
|
Intent intent = new Intent(List_insert.this, MainActivity.class); |
||||
|
startActivity(intent); |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
package com.example.mave.PhotoBook; |
||||
|
|
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.view.LayoutInflater; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.widget.ImageView; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
import com.squareup.picasso.Picasso; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public class MyRecyclerAdapter extends RecyclerView.Adapter<MyRecyclerAdapter.ViewHolder> { |
||||
|
|
||||
|
Context context; |
||||
|
List<ItemData> itemdata; |
||||
|
|
||||
|
public MyRecyclerAdapter(Context context, List<ItemData> familyPhoto) { |
||||
|
this.context = context; |
||||
|
this.itemdata = familyPhoto; |
||||
|
} |
||||
|
|
||||
|
@NonNull |
||||
|
@Override |
||||
|
public MyRecyclerAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
|
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent,false); |
||||
|
return new ViewHolder(v); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { |
||||
|
ItemData itemData = itemdata.get(position); |
||||
|
holder.tvTitle.setText(itemData.getTitle()); |
||||
|
holder.tvContent.setText(itemData.getContent()); |
||||
|
|
||||
|
String imageUri = null; |
||||
|
imageUri = itemData.getImage(); |
||||
|
Picasso.get().load(imageUri).into(holder.imageView); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int getItemCount() { |
||||
|
return itemdata.size(); |
||||
|
} |
||||
|
|
||||
|
public class ViewHolder extends RecyclerView.ViewHolder { |
||||
|
|
||||
|
ImageView imageView; |
||||
|
TextView tvTitle, tvContent; |
||||
|
|
||||
|
public ViewHolder(@NonNull View itemView) { |
||||
|
super(itemView); |
||||
|
|
||||
|
imageView = itemView.findViewById(R.id.list_item_familypicture); |
||||
|
tvTitle = itemView.findViewById(R.id.list_item_title); |
||||
|
tvContent = itemView.findViewById(R.id.list_item_content); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,178 @@ |
|||||
|
package com.example.mave; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
import android.content.SharedPreferences; |
||||
|
|
||||
|
public class PreferenceManager { |
||||
|
|
||||
|
public static final String PREFERENCES_NAME = "rebuild_preference"; |
||||
|
|
||||
|
private static final String DEFAULT_VALUE_STRING = ""; |
||||
|
private static final boolean DEFAULT_VALUE_BOOLEAN = false; |
||||
|
private static final int DEFAULT_VALUE_INT = -1; |
||||
|
private static final long DEFAULT_VALUE_LONG = -1L; |
||||
|
private static final float DEFAULT_VALUE_FLOAT = -1F; |
||||
|
|
||||
|
private static SharedPreferences getPreferences(Context context) { |
||||
|
return context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* String 값 저장 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @param value |
||||
|
*/ |
||||
|
|
||||
|
public static void setString(Context context, String key, String value) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
SharedPreferences.Editor editor = prefs.edit(); |
||||
|
editor.putString(key, value); |
||||
|
editor.commit(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* boolean 값 저장 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @param value |
||||
|
*/ |
||||
|
|
||||
|
public static void setBoolean(Context context, String key, boolean value) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
SharedPreferences.Editor editor = prefs.edit(); |
||||
|
editor.putBoolean(key, value); |
||||
|
editor.commit(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* int 값 저장 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @param value |
||||
|
*/ |
||||
|
|
||||
|
public static void setInt(Context context, String key, int value) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
SharedPreferences.Editor editor = prefs.edit(); |
||||
|
editor.putInt(key, value); |
||||
|
editor.commit(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* long 값 저장 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @param value |
||||
|
*/ |
||||
|
|
||||
|
public static void setLong(Context context, String key, long value) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
SharedPreferences.Editor editor = prefs.edit(); |
||||
|
editor.putLong(key, value); |
||||
|
editor.commit(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* float 값 저장 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @param value |
||||
|
*/ |
||||
|
|
||||
|
public static void setFloat(Context context, String key, float value) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
SharedPreferences.Editor editor = prefs.edit(); |
||||
|
editor.putFloat(key, value); |
||||
|
editor.commit(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* String 값 로드 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public static String getString(Context context, String key) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
String value = prefs.getString(key, DEFAULT_VALUE_STRING); |
||||
|
return value; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* boolean 값 로드 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public static boolean getBoolean(Context context, String key) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
boolean value = prefs.getBoolean(key, DEFAULT_VALUE_BOOLEAN); |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* int 값 로드 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public static int getInt(Context context, String key) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
int value = prefs.getInt(key, DEFAULT_VALUE_INT); |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* long 값 로드 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public static long getLong(Context context, String key) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
long value = prefs.getLong(key, DEFAULT_VALUE_LONG); |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* float 값 로드 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public static float getFloat(Context context, String key) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
float value = prefs.getFloat(key, DEFAULT_VALUE_FLOAT); |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 키 값 삭제 |
||||
|
* @param context |
||||
|
* @param key |
||||
|
*/ |
||||
|
|
||||
|
public static void removeKey(Context context, String key) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
SharedPreferences.Editor edit = prefs.edit(); |
||||
|
edit.remove(key); |
||||
|
edit.commit(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 모든 저장 데이터 삭제 |
||||
|
* @param context*/ |
||||
|
public static void clear(Context context) { |
||||
|
SharedPreferences prefs = getPreferences(context); |
||||
|
SharedPreferences.Editor edit = prefs.edit(); |
||||
|
edit.clear(); |
||||
|
edit.commit(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.example.mave.Settings; |
||||
|
|
||||
|
import android.content.Intent; |
||||
|
import android.os.Bundle; |
||||
|
import android.view.LayoutInflater; |
||||
|
import android.view.View; |
||||
|
import android.view.ViewGroup; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.fragment.app.Fragment; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.repository.MemberRepository; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
public class FragmentPage3 extends Fragment { |
||||
|
ViewGroup viewGroup; |
||||
|
private TextView FlowerState,nickName; |
||||
|
|
||||
|
@Nullable |
||||
|
@Override |
||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
||||
|
setHasOptionsMenu(true); |
||||
|
|
||||
|
viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_page_3, container, false); |
||||
|
|
||||
|
// WindowUtils.makeStatusbarTransparent(getActivity()); |
||||
|
FlowerState = (TextView) viewGroup.findViewById(R.id.flowerState); |
||||
|
nickName = viewGroup.findViewById(R.id.NickName); |
||||
|
|
||||
|
nickName.setText(MemberRepository.getInstance().getUserId()); |
||||
|
|
||||
|
FlowerState.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
Intent intent = new Intent(getActivity(), StateOfFlower.class); |
||||
|
startActivity(intent); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
return viewGroup; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
||||
|
super.onViewCreated(view, savedInstanceState); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.example.mave.Settings; |
||||
|
|
||||
|
import android.os.Bundle; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
|
||||
|
public class StateOfFlower extends AppCompatActivity { |
||||
|
|
||||
|
private TextView FlowerState; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.fragment_page_3_flower); |
||||
|
getSupportActionBar().hide(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.example.mave; |
||||
|
|
||||
|
import androidx.lifecycle.LiveData; |
||||
|
import androidx.lifecycle.MutableLiveData; |
||||
|
import androidx.lifecycle.ViewModel; |
||||
|
|
||||
|
public class SharedViewModel extends ViewModel { |
||||
|
|
||||
|
private final MutableLiveData<String> liveData; |
||||
|
|
||||
|
public SharedViewModel() { |
||||
|
liveData = new MutableLiveData<>(); |
||||
|
} |
||||
|
|
||||
|
public LiveData getLiveData(){ |
||||
|
return liveData; |
||||
|
} |
||||
|
|
||||
|
public void setLiveData(String s){ |
||||
|
liveData.setValue(s); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,118 @@ |
|||||
|
package com.example.mave.activities; |
||||
|
|
||||
|
import android.content.Intent; |
||||
|
import android.os.Bundle; |
||||
|
import android.os.Handler; |
||||
|
import android.util.Log; |
||||
|
import android.view.View; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.TextView; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
|
||||
|
import com.example.mave.BackPressCloseHandler; |
||||
|
import com.example.mave.CreateRetrofit; |
||||
|
import com.example.mave.Dto.memeberDto.LoginRequest; |
||||
|
import com.example.mave.Dto.memeberDto.LoginResponse; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.repository.MemberRepository; |
||||
|
import com.example.mave.service.MemberRetrofitService; |
||||
|
import com.royrodriguez.transitionbutton.TransitionButton; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
import static com.example.mave.activities.RegisterActivity.TAG; |
||||
|
|
||||
|
public class LoginActivity extends AppCompatActivity { |
||||
|
|
||||
|
private TransitionButton transitionLoginBtn; |
||||
|
private BackPressCloseHandler backPressCloseHandler; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_login); |
||||
|
|
||||
|
WindowUtils.makeStatusbarTransparent(this); |
||||
|
getSupportActionBar().hide(); |
||||
|
|
||||
|
EditText userID = findViewById(R.id.userID); |
||||
|
EditText userPW = findViewById(R.id.userPW); |
||||
|
transitionLoginBtn = findViewById(R.id.transition_button); |
||||
|
TextView SignUp = findViewById(R.id.SignUp); |
||||
|
backPressCloseHandler = new BackPressCloseHandler(this); |
||||
|
transitionLoginBtn.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
|
||||
|
transitionLoginBtn.startAnimation(); // 로그인 버튼 탭 눌렀을 때 |
||||
|
|
||||
|
// Do your networking task or background work here. |
||||
|
final Handler handler = new Handler(); |
||||
|
handler.postDelayed(new Runnable() { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
/* ---------------------------Retrofit 통신--------------------------------------- */ |
||||
|
MemberRetrofitService memberRetrofitService = CreateRetrofit.createRetrofit().create(MemberRetrofitService.class); |
||||
|
LoginRequest request = new LoginRequest(userID.getText().toString(), userPW.getText().toString()); |
||||
|
Call<LoginResponse> call = memberRetrofitService.login(request); |
||||
|
|
||||
|
call.enqueue(new Callback<LoginResponse>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
LoginResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
Log.d(TAG, "Login 성공!!"); |
||||
|
MemberRepository.getInstance().setUserId(userID.getText().toString()); |
||||
|
transitionLoginBtn.stopAnimation(TransitionButton.StopAnimationStyle.EXPAND, new TransitionButton.OnAnimationStopEndListener() { |
||||
|
@Override |
||||
|
public void onAnimationStopEnd() { |
||||
|
Intent intent = new Intent(getBaseContext(), MainActivity.class); |
||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |
||||
|
startActivity(intent); |
||||
|
finish(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
transitionLoginBtn.stopAnimation(TransitionButton.StopAnimationStyle.SHAKE, null); |
||||
|
Log.d(TAG, "Login 실패 ㅠㅠ"); |
||||
|
Toast.makeText(LoginActivity.this, "다시 시도해주세요!!", Toast.LENGTH_SHORT).show(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<LoginResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
transitionLoginBtn.stopAnimation(TransitionButton.StopAnimationStyle.SHAKE, null); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, 1000); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
SignUp.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View v) { |
||||
|
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class); |
||||
|
startActivity(intent); |
||||
|
finish(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onBackPressed() { |
||||
|
//super.onBackPressed(); |
||||
|
backPressCloseHandler.onBackPressed(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,90 @@ |
|||||
|
package com.example.mave.activities; |
||||
|
|
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
import androidx.fragment.app.Fragment; |
||||
|
import androidx.fragment.app.FragmentManager; |
||||
|
|
||||
|
import android.app.AlarmManager; |
||||
|
import android.app.PendingIntent; |
||||
|
import android.content.ComponentName; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.content.pm.PackageManager; |
||||
|
import android.os.Build; |
||||
|
import android.os.Bundle; |
||||
|
import android.util.Log; |
||||
|
|
||||
|
import com.example.mave.BackPressCloseHandler; |
||||
|
import com.example.mave.PhotoBook.FragmentPage1; |
||||
|
import com.example.mave.Diary.FragmentPage2; |
||||
|
import com.example.mave.Settings.FragmentPage3; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.repository.GroupRepository; |
||||
|
import com.ismaeldivita.chipnavigation.ChipNavigationBar; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
import java.time.LocalTime; |
||||
|
|
||||
|
public class MainActivity extends AppCompatActivity { |
||||
|
private static final String TAG = MainActivity.class.getSimpleName(); |
||||
|
private ChipNavigationBar mBottomNV; |
||||
|
FragmentManager fragmentManager; |
||||
|
private BackPressCloseHandler backPressCloseHandler; |
||||
|
|
||||
|
private Fragment fragment; |
||||
|
LocalTime questionTime; |
||||
|
private AlarmManager alarmManager; |
||||
|
private PendingIntent pendingIntent; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
// WindowUtils.makeStatusbarTransparent(this); |
||||
|
|
||||
|
setContentView(R.layout.activity_main); |
||||
|
getSupportActionBar().hide(); |
||||
|
questionTime = GroupRepository.getInstance().getQuestionTime(); |
||||
|
|
||||
|
|
||||
|
Intent intent = getIntent(); |
||||
|
if(intent != null) {//푸시알림을 선택해서 실행한것이 아닌경우 예외처리 |
||||
|
String notificationData = intent.getStringExtra("test"); |
||||
|
if(notificationData != null) |
||||
|
Log.d("FCM_TEST", notificationData); |
||||
|
} |
||||
|
|
||||
|
backPressCloseHandler = new BackPressCloseHandler(this); |
||||
|
/*<======================================================================================================>*/ |
||||
|
if (savedInstanceState == null) { |
||||
|
//mBottomNV.setItemSelected(R.id.content_layout, true); |
||||
|
fragmentManager = getSupportFragmentManager(); |
||||
|
FragmentPage2 fragmentPage2 = new FragmentPage2(); |
||||
|
fragmentManager.beginTransaction().replace(R.id.content_layout, fragmentPage2).commit(); |
||||
|
} |
||||
|
mBottomNV = findViewById(R.id.nav_view_chip); |
||||
|
mBottomNV.setItemSelected(R.id.Diary, true); |
||||
|
getSupportFragmentManager().beginTransaction().replace(R.id.content_layout, new FragmentPage2()).commit(); |
||||
|
mBottomNV.setOnItemSelectedListener(new ChipNavigationBar.OnItemSelectedListener() { |
||||
|
@Override |
||||
|
public void onItemSelected(int i) { |
||||
|
switch (i) { |
||||
|
case R.id.Album: |
||||
|
fragment=new FragmentPage1(); |
||||
|
break; |
||||
|
case R.id.Diary: |
||||
|
fragment=new FragmentPage2(); |
||||
|
break; |
||||
|
case R.id.Setting: |
||||
|
fragment=new FragmentPage3(); |
||||
|
break; |
||||
|
} |
||||
|
if(fragment != null) { |
||||
|
getSupportFragmentManager().beginTransaction().replace(R.id.content_layout, fragment).commit(); |
||||
|
} } }); |
||||
|
} |
||||
|
@Override |
||||
|
public void onBackPressed() { |
||||
|
//super.onBackPressed(); |
||||
|
backPressCloseHandler.onBackPressed(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
package com.example.mave.activities; |
||||
|
|
||||
|
import android.content.Intent; |
||||
|
import android.os.Bundle; |
||||
|
import android.util.Log; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.Toast; |
||||
|
|
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
|
||||
|
import com.example.mave.CreateRetrofit; |
||||
|
import com.example.mave.Dto.memeberDto.JoinMemberRequest; |
||||
|
import com.example.mave.Dto.memeberDto.JoinMemberResponse; |
||||
|
import com.example.mave.R; |
||||
|
import com.example.mave.service.MemberRetrofitService; |
||||
|
import com.royrodriguez.transitionbutton.utils.WindowUtils; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; |
||||
|
|
||||
|
public class RegisterActivity extends AppCompatActivity { |
||||
|
|
||||
|
static final String TAG = "Mave"; |
||||
|
|
||||
|
public Button registerBtn; |
||||
|
public EditText userID, userName, userPW; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_register); |
||||
|
getSupportActionBar().hide(); |
||||
|
WindowUtils.makeStatusbarTransparent(this); |
||||
|
|
||||
|
registerBtn = findViewById(R.id.registerBtn); |
||||
|
userID = findViewById(R.id.userID); |
||||
|
userName = findViewById(R.id.userName); |
||||
|
userPW = findViewById(R.id.userPW); |
||||
|
|
||||
|
registerBtn.setOnClickListener(new View.OnClickListener() { |
||||
|
@Override |
||||
|
public void onClick(View view) { |
||||
|
|
||||
|
MemberRetrofitService memberRetrofitService = CreateRetrofit.createRetrofit().create(MemberRetrofitService.class); |
||||
|
JoinMemberRequest request = new JoinMemberRequest(userID.getText().toString(), userName.getText().toString(), userPW.getText().toString()); |
||||
|
Call<JoinMemberResponse> call = memberRetrofitService.joinMember(request); |
||||
|
|
||||
|
call.enqueue(new Callback<JoinMemberResponse>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<JoinMemberResponse> call, Response<JoinMemberResponse> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
|
||||
|
JoinMemberResponse body = response.body(); |
||||
|
Log.d(TAG, "response 성공!!"); |
||||
|
Log.d(TAG, "회원가입 성공!!"); |
||||
|
Intent intent = new Intent(getApplicationContext(), LoginActivity.class); |
||||
|
getApplicationContext().startActivity(intent.addFlags(FLAG_ACTIVITY_NEW_TASK)); |
||||
|
startActivity(intent); |
||||
|
finish(); |
||||
|
|
||||
|
|
||||
|
} else { |
||||
|
Log.d(TAG, "response 실패 ㅠㅠ"); |
||||
|
Log.d(TAG, "회원가입 실패 ㅠㅠ"); |
||||
|
Toast.makeText(RegisterActivity.this, "다시 시도해주세요!!!", Toast.LENGTH_SHORT).show(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<JoinMemberResponse> call, Throwable t) { |
||||
|
Log.d(TAG, "onFailure => " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onBackPressed() { |
||||
|
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class); |
||||
|
startActivity(intent); |
||||
|
finish(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.example.mave.activities; |
||||
|
|
||||
|
import android.content.Intent; |
||||
|
import android.os.Bundle; |
||||
|
import android.os.Handler; |
||||
|
|
||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||
|
|
||||
|
import com.example.mave.R; |
||||
|
|
||||
|
public class SplashActivity extends AppCompatActivity { |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.splash_activity); |
||||
|
getSupportActionBar().hide(); |
||||
|
|
||||
|
new Handler().postDelayed(new Runnable() { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
Intent intent = new Intent(SplashActivity.this, LoginActivity.class); |
||||
|
startActivities(new Intent[]{intent}); |
||||
|
finish(); |
||||
|
} |
||||
|
}, 3100); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.example.mave.repository; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
public class AnswerRepository { |
||||
|
|
||||
|
private static final AnswerRepository answerRepository = new AnswerRepository(); |
||||
|
|
||||
|
private static Map<String, List<String>> answerInfo = new HashMap<>(); |
||||
|
|
||||
|
ArrayList<String> answerList = new ArrayList<>(); |
||||
|
|
||||
|
private AnswerRepository() { |
||||
|
} |
||||
|
|
||||
|
public static AnswerRepository getInstance(){ |
||||
|
return answerRepository; |
||||
|
} |
||||
|
|
||||
|
public List<String> getAnswerList(){ |
||||
|
return answerInfo.get("answerList"); |
||||
|
} |
||||
|
|
||||
|
public void setAnswerList(String answer){ |
||||
|
answerList.add(answer); |
||||
|
answerInfo.put("answerList",answerList); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,99 @@ |
|||||
|
package com.example.mave.repository; |
||||
|
|
||||
|
import java.time.LocalTime; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
public class GroupRepository { |
||||
|
|
||||
|
public static Long diaryDate = 0l; |
||||
|
public static Long completeDate = 0l; |
||||
|
|
||||
|
private static final GroupRepository groupRepository = new GroupRepository(); |
||||
|
|
||||
|
private static Map<String,String> groupInfo = new HashMap<>(); |
||||
|
private static Map<String, LocalTime> questionTime = new HashMap<>(); |
||||
|
private static Map<String, Integer> user_Set_hour = new HashMap<>(); |
||||
|
private static Map<String, Integer> user_Set_minute = new HashMap<>(); |
||||
|
|
||||
|
private String groupId; |
||||
|
private String groupName; |
||||
|
private String flowerStatus; |
||||
|
|
||||
|
private GroupRepository(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static GroupRepository getInstance(){ |
||||
|
return groupRepository; |
||||
|
} |
||||
|
|
||||
|
public Long getGroupId() { |
||||
|
return Long.parseLong(groupInfo.get("groupId")); |
||||
|
} |
||||
|
|
||||
|
public void setGroupId(Long groupId) { |
||||
|
groupInfo.put("groupId",groupId.toString()); |
||||
|
} |
||||
|
|
||||
|
public String getGroupName() { |
||||
|
return groupInfo.get("groupName"); |
||||
|
} |
||||
|
|
||||
|
public void setGroupName(String groupName) { |
||||
|
groupInfo.put("groupName",groupName); |
||||
|
} |
||||
|
|
||||
|
public int getFlowerStatus() { |
||||
|
return Integer.parseInt(groupInfo.get("flowerStatus")); |
||||
|
} |
||||
|
|
||||
|
public void setFlowerStatus(int flowerStatus) { |
||||
|
groupInfo.put("flowerStatus",String.valueOf(flowerStatus)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void setQuestionTime(LocalTime localTime){ |
||||
|
questionTime.put("questionTime",localTime); |
||||
|
} |
||||
|
|
||||
|
public LocalTime getQuestionTime(){ |
||||
|
return questionTime.get("questionTime"); |
||||
|
} |
||||
|
|
||||
|
public void setDiaryDate(Long date){ |
||||
|
this.diaryDate = date; |
||||
|
} |
||||
|
|
||||
|
public Long getDiaryDate(){ |
||||
|
return diaryDate; |
||||
|
} |
||||
|
|
||||
|
public void setCompleteDate(Long date){ |
||||
|
this.completeDate = date; |
||||
|
} |
||||
|
|
||||
|
public Long getCompleteDate(){ |
||||
|
return completeDate; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void setuser_Set_hour(int user_set_hour){ |
||||
|
user_Set_hour.put("user_set_hour", user_set_hour); |
||||
|
|
||||
|
} |
||||
|
public int getuser_Set_hour(){ |
||||
|
int user_set_hour = user_Set_hour.get("user_set_hour"); |
||||
|
return user_set_hour; |
||||
|
} |
||||
|
|
||||
|
public void setuser_Set_minute(int user_set_minute){ |
||||
|
user_Set_minute.put("user_set_minute", user_set_minute); |
||||
|
|
||||
|
} |
||||
|
public int getuser_Set_minute(){ |
||||
|
int user_set_minute = user_Set_minute.get("user_set_minute"); |
||||
|
return user_set_minute; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.example.mave.repository; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.time.LocalTime; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
public class MemberRepository { |
||||
|
|
||||
|
private static final MemberRepository memberRepository = new MemberRepository(); |
||||
|
|
||||
|
private static Map<String,String> userInfo = new HashMap<>(); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
private MemberRepository() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static MemberRepository getInstance(){ |
||||
|
return memberRepository; |
||||
|
} |
||||
|
|
||||
|
public void setUserId(String userId){ |
||||
|
userInfo.put("userId",userId); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String getUserId(){ |
||||
|
String userId = userInfo.get("userId"); |
||||
|
return userId; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.example.mave.repository; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
public class QuestionRepository { |
||||
|
|
||||
|
private static final QuestionRepository questionRepository = new QuestionRepository(); |
||||
|
|
||||
|
private static Map<String, String> customQuestionInfo = new HashMap<>(); |
||||
|
private static Map<String, String> todayQuestionInfo = new HashMap<>(); |
||||
|
|
||||
|
|
||||
|
private QuestionRepository() { |
||||
|
} |
||||
|
|
||||
|
public static QuestionRepository getInstance(){ |
||||
|
return questionRepository; |
||||
|
} |
||||
|
|
||||
|
public String getTodayQuestion(){ |
||||
|
return todayQuestionInfo.get("questionContent"); |
||||
|
} |
||||
|
|
||||
|
public void setTodayQuestion(String questionContent){ |
||||
|
todayQuestionInfo.put("questionContent",questionContent); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void setQuestion(String customQuestion){ |
||||
|
customQuestionInfo.put("customQuestion", customQuestion); |
||||
|
} |
||||
|
|
||||
|
public String getQuestion(){ |
||||
|
return customQuestionInfo.get("customQuestion"); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.example.mave.service; |
||||
|
|
||||
|
import com.example.mave.Dto.AnswerDto.AllAnswerRequest; |
||||
|
import com.example.mave.Dto.AnswerDto.AllAnswerResponse; |
||||
|
import com.example.mave.Dto.AnswerDto.RegistAnswerRequest; |
||||
|
import com.example.mave.Dto.AnswerDto.RegistAnswerResponse; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.http.Body; |
||||
|
import retrofit2.http.POST; |
||||
|
import retrofit2.http.Path; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface AnswerRetrofitService { |
||||
|
|
||||
|
@POST("api/answer/{questionNumber}") |
||||
|
Call<RegistAnswerResponse> registAnswer(@Path("questionNumber") Long questionNumber, |
||||
|
@Body RegistAnswerRequest request); |
||||
|
|
||||
|
@POST("api/allAnswer/{questionNumber}") |
||||
|
Call<List<AllAnswerResponse>> allAnswer(@Path("questionNumber") Long questionNumber, |
||||
|
@Body AllAnswerRequest request); |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.example.mave.service; |
||||
|
|
||||
|
|
||||
|
import com.example.mave.Dto.customQuestionDto.CreateCustomRequest; |
||||
|
import com.example.mave.Dto.customQuestionDto.CreateCustomResponse; |
||||
|
import com.example.mave.Dto.customQuestionDto.UseCustomRequest; |
||||
|
import com.example.mave.Dto.customQuestionDto.UseCustomResponse; |
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionResponse; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionResponse; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.http.Body; |
||||
|
import retrofit2.http.POST; |
||||
|
import retrofit2.http.Path; |
||||
|
|
||||
|
public interface CustomQuestionRetrofitService { |
||||
|
|
||||
|
@POST("/api/custom") |
||||
|
Call<CreateCustomResponse> createCustomQuestion(@Body CreateCustomRequest request); |
||||
|
|
||||
|
@POST("/api/custom/search") |
||||
|
Call<CreateCustomResponse> checkCustom(@Body CreateCustomRequest request); |
||||
|
|
||||
|
@POST("/api/custom/{questionNumber}") |
||||
|
Call<UseCustomResponse>useCustomQuestion(@Path("questionNumber") Long questionNumber, |
||||
|
@Body UseCustomRequest request); |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
package com.example.mave.service; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.example.mave.Dto.groupDto.CreateGroupRequest; |
||||
|
import com.example.mave.Dto.groupDto.CreateGroupResponse; |
||||
|
import com.example.mave.Dto.groupDto.FindGroupResponse; |
||||
|
import com.example.mave.Dto.groupDto.JoinGroupRequest; |
||||
|
import com.example.mave.Dto.groupDto.JoinGroupResponse; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.http.Body; |
||||
|
import retrofit2.http.POST; |
||||
|
import retrofit2.http.Path; |
||||
|
|
||||
|
public interface GroupRetrofitService { |
||||
|
|
||||
|
@POST("api/groups") |
||||
|
Call<CreateGroupResponse> createGroup(@Body CreateGroupRequest request); |
||||
|
|
||||
|
@POST("api/groups/{groupId}") |
||||
|
Call<JoinGroupResponse> joinGroup(@Path("groupId") Long id, |
||||
|
@Body JoinGroupRequest request); |
||||
|
|
||||
|
@POST("api/findGroups") |
||||
|
Call<FindGroupResponse> findGroup(@Body JoinGroupRequest request); |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.example.mave.service; |
||||
|
|
||||
|
import com.example.mave.Dto.memeberDto.JoinMemberRequest; |
||||
|
import com.example.mave.Dto.memeberDto.JoinMemberResponse; |
||||
|
import com.example.mave.Dto.memeberDto.LoginRequest; |
||||
|
import com.example.mave.Dto.memeberDto.LoginResponse; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.http.Body; |
||||
|
import retrofit2.http.POST; |
||||
|
|
||||
|
public interface MemberRetrofitService { |
||||
|
|
||||
|
|
||||
|
@POST("api/members") |
||||
|
Call<JoinMemberResponse> joinMember(@Body JoinMemberRequest request); |
||||
|
|
||||
|
@POST("api/members/login") |
||||
|
Call<LoginResponse> login(@Body LoginRequest request); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.example.mave.service; |
||||
|
|
||||
|
|
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeAllQuestionResponse; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionRequest; |
||||
|
import com.example.mave.Dto.questionDto.TakeQuestionResponse; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.http.Body; |
||||
|
import retrofit2.http.POST; |
||||
|
import retrofit2.http.Path; |
||||
|
|
||||
|
public interface QuestionRetrofitService { |
||||
|
|
||||
|
@POST("api/question/{questionNumber}") |
||||
|
Call<TakeQuestionResponse> takeQuestion(@Path("questionNumber") Long questionNumber, |
||||
|
@Body TakeQuestionRequest request); |
||||
|
|
||||
|
@POST("/api/allQuestion/{questionNumber}") |
||||
|
Call<List<TakeAllQuestionResponse>>takeAllQuestion(@Path("questionNumber") Long questionNumber, |
||||
|
@Body TakeAllQuestionRequest request); |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:fillAfter="true"> |
||||
|
<scale |
||||
|
android:duration="300" |
||||
|
android:fromXScale="0.8" |
||||
|
android:fromYScale="0.8" |
||||
|
android:interpolator="@android:anim/linear_interpolator" |
||||
|
android:pivotX="50%" |
||||
|
android:pivotY="50%" |
||||
|
android:toXScale="0.0" |
||||
|
android:toYScale="0.0" /> |
||||
|
<alpha |
||||
|
android:duration="300" |
||||
|
android:fromAlpha="1.0" |
||||
|
android:interpolator="@android:anim/accelerate_interpolator" |
||||
|
android:toAlpha="0.0" /> |
||||
|
|
||||
|
</set> |
||||
@ -0,0 +1,18 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
android:fillAfter="true"> |
||||
|
<scale |
||||
|
android:duration="300" |
||||
|
android:fromXScale="0.0" |
||||
|
android:fromYScale="0.0" |
||||
|
android:interpolator="@android:anim/linear_interpolator" |
||||
|
android:pivotX="50%" |
||||
|
android:pivotY="50%" |
||||
|
android:toXScale="0.8" |
||||
|
android:toYScale="0.8" /> |
||||
|
<alpha |
||||
|
android:duration="300" |
||||
|
android:fromAlpha="0.0" |
||||
|
android:interpolator="@android:anim/accelerate_interpolator" |
||||
|
android:toAlpha="1.0" /> |
||||
|
</set> |
||||
|
After Width: 137 | Height: 137 | Size: 5.5 KiB |
|
After Width: 518 | Height: 153 | Size: 7.7 KiB |
|
After Width: 527 | Height: 182 | Size: 7.5 KiB |
|
After Width: 518 | Height: 201 | Size: 4.7 KiB |
|
After Width: 603 | Height: 788 | Size: 134 KiB |
|
After Width: 179 | Height: 158 | Size: 16 KiB |
|
After Width: 60 | Height: 60 | Size: 824 B |
|
After Width: 518 | Height: 660 | Size: 10 KiB |
|
After Width: 590 | Height: 335 | Size: 5.7 KiB |
|
After Width: 69 | Height: 69 | Size: 2.5 KiB |
|
After Width: 259 | Height: 77 | Size: 3.1 KiB |
|
After Width: 264 | Height: 91 | Size: 3.1 KiB |
|
After Width: 259 | Height: 101 | Size: 1.9 KiB |
|
After Width: 302 | Height: 394 | Size: 42 KiB |
|
After Width: 90 | Height: 79 | Size: 5.8 KiB |
|
After Width: 30 | Height: 30 | Size: 467 B |
|
After Width: 259 | Height: 330 | Size: 3.8 KiB |
|
After Width: 295 | Height: 168 | Size: 2.0 KiB |
|
After Width: 91 | Height: 91 | Size: 3.4 KiB |
|
After Width: 345 | Height: 102 | Size: 4.6 KiB |
|
After Width: 351 | Height: 121 | Size: 4.4 KiB |
|
After Width: 345 | Height: 134 | Size: 2.5 KiB |
|
After Width: 402 | Height: 525 | Size: 66 KiB |
|
After Width: 119 | Height: 105 | Size: 9.6 KiB |