Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
genwo123 committed Nov 21, 2022
0 parents commit 42758d8
Show file tree
Hide file tree
Showing 51 changed files with 1,460 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
40 changes: 40 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 32

defaultConfig {
applicationId "com.example.realnona2"
minSdk 29
targetSdk 32
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.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation 'com.android.volley:volley:1.2.1'//서버통신 관련 라이브러리
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.realnona2;

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.realnona2", appContext.getPackageName());
}
}
36 changes: 36 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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.realnona2">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Realnona2"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".MainActivity">
</activity>
<activity android:name=".F_F_Login_form_Activity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".F_F_SighUp_form_Activity"></activity>

</application>

</manifest>
29 changes: 29 additions & 0 deletions app/src/main/java/com/example/realnona2/F_F_Login_Request.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.example.realnona2;


import com.android.volley.AuthFailureError;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;

import java.util.HashMap;
import java.util.Map;

public class F_F_Login_Request extends StringRequest {

//서버 URL 설정(php 파일 연동)
final static private String URL = "http://nonaphp.dothome.co.kr/Login.php";
private Map<String, String> map;

public F_F_Login_Request(String UserEmail, String UserPwd, Response.Listener<String> listener) {
super(Method.POST, URL, listener, null);

map = new HashMap<>();
map.put("UserEmail", UserEmail);
map.put("UserPwd", UserPwd);
}

@Override
protected Map<String, String>getParams() throws AuthFailureError {
return map;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.example.realnona2;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.Volley;

import org.json.JSONException;
import org.json.JSONObject;

public class F_F_Login_form_Activity extends AppCompatActivity {

private EditText login_email, login_password;
private Button login_button, join_button;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.f_f_activity_login);

login_email = findViewById( R.id.login_email );
login_password = findViewById( R.id.login_password );

join_button = findViewById( R.id.F_V_signup_btn);
join_button.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent( F_F_Login_form_Activity.this, F_F_SighUp_form_Activity.class );
startActivity( intent );
}
});


login_button = findViewById( R.id.login_button );
login_button.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View view) {
String UserEmail = login_email.getText().toString();
String UserPwd = login_password.getText().toString();

Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject( response );
boolean success = jsonObject.getBoolean( "success" );

if(success) {//로그인 성공시

String UserEmail = jsonObject.getString( "UserEmail" );
String UserPwd = jsonObject.getString( "UserPwd" );
String UserName = jsonObject.getString( "UserName" );

Toast.makeText( getApplicationContext(), String.format("%s님 환영합니다.", UserName), Toast.LENGTH_SHORT ).show();
Intent intent = new Intent( F_F_Login_form_Activity.this, MainActivity.class );

intent.putExtra( "UserEmail", UserEmail );
intent.putExtra( "UserPwd", UserPwd );
intent.putExtra( "UserName", UserName );

startActivity( intent );

} else {//로그인 실패시
Toast.makeText( getApplicationContext(), "로그인에 실패하셨습니다.", Toast.LENGTH_SHORT ).show();
return;
}

} catch (JSONException e) {
e.printStackTrace();
}
}
};
F_F_Login_Request FFLoginRequest = new F_F_Login_Request( UserEmail, UserPwd, responseListener );
RequestQueue queue = Volley.newRequestQueue( F_F_Login_form_Activity.this );
queue.add(FFLoginRequest);

}
});
}
}
Loading

0 comments on commit 42758d8

Please sign in to comment.