Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[U.O.F-Mobile] 전반적인 회원가입 액티비티 디자인 수정, 기능 추가 #28

Merged
merged 2 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/src/main/java/com/uof/uof_mobile/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,17 @@ public void afterTextChanged(Editable editable) {
@Override
public void onCustomerClick() {
Toast.makeText(LoginActivity.this, "일반 고객", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
intent.putExtra("RegisterType", 1); //고객
startActivity(intent); //다음 activity로 넘어가기
}

@Override
public void onUofPartnerClick() {
Toast.makeText(LoginActivity.this, "U.O.F 파트너", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
intent.putExtra("RegisterType", 2); //파트너
startActivity(intent); //다음 activity로 넘어가기
}

@Override
Expand Down
136 changes: 136 additions & 0 deletions app/src/main/java/com/uof/uof_mobile/RegisterActivity.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,150 @@
package com.uof.uof_mobile;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.LinearLayoutCompat;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.material.textfield.TextInputLayout;

import java.util.Locale;

public class RegisterActivity extends AppCompatActivity {
private LinearLayoutCompat llregistercustomer;
private LinearLayoutCompat llregisterpartner;
private TextInputLayout tilregistercustomerid;
private TextInputLayout tilregistercustomerpw;
private TextInputLayout tilregistercustomerpwchk;
private TextInputLayout tilregistercustomername;
private TextInputLayout tilregistercustomerphone;
private Button btnregistercustomerregister;

private TextInputLayout tilregisterpartnerid;
private TextInputLayout tilregisterpartnerpw;
private TextInputLayout tilregisterpartnerpwchk;
private TextInputLayout tilregisterpartnername;
private TextInputLayout tilregisterpartnerphone;
private TextInputLayout tilregistercompanyname;
private TextInputLayout tilregistercompanynumber;
private Spinner spregistertype;
private Spinner spregisterlocal;
private Button btnregisterpartnerregister;
private ImageView imgregistercompanytimageview;
private Button btnregistercompanyimageg;

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

}
private void init() {


//데이터 받아오기
Intent intent = getIntent(); /*데이터 수신*/
tilregistercustomerid = findViewById(R.id.til_register_customerid);
tilregistercustomerpw = findViewById(R.id.til_register_customerpw);
tilregistercustomerpwchk = findViewById(R.id.til_register_customerpwchk);
tilregistercustomername = findViewById(R.id.til_register_customername);
tilregistercustomerphone = findViewById(R.id.til_register_customerphone);
btnregistercustomerregister = findViewById(R.id.btn_register_customerregister);

tilregisterpartnerid = findViewById(R.id.til_register_partnerid);
tilregisterpartnerpw = findViewById(R.id.til_register_partnerpw);
tilregisterpartnerpwchk = findViewById(R.id.til_register_partnerpwchk);
tilregisterpartnername = findViewById(R.id.til_register_partnername);
tilregisterpartnerphone = findViewById(R.id.til_register_partnerphone);
tilregistercompanyname = findViewById(R.id.til_register_companyname);
tilregistercompanynumber = findViewById(R.id.til_register_companynumber);
btnregisterpartnerregister = findViewById(R.id.btn_register_partnerregister);
llregistercustomer = findViewById(R.id.ll_register_customer);
llregisterpartner = findViewById(R.id.ll_register_partner);
btnregistercompanyimageg = (Button)findViewById(R.id.btn_register_companyimage);
imgregistercompanytimageview = (ImageView)findViewById(R.id.img_register_companyimageview);

//데이터 받기
int str1 = intent.getExtras().getInt("RegisterType");
if(str1==1){
llregistercustomer.setVisibility(View.VISIBLE);
llregisterpartner.setVisibility(View.GONE);
}
else{
llregisterpartner.setVisibility(View.VISIBLE);
llregistercustomer.setVisibility(View.GONE);
}

//스피너
spregistertype = findViewById(R.id.sp_register_type);
spregistertype.setPrompt("회사 유형");

ArrayAdapter monthAdapter = ArrayAdapter.createFromResource(this, R.array.companytype_array, android.R.layout.simple_spinner_dropdown_item);
//R.array.test는 저희가 정의해놓은 1월~12월 / android.R.layout.simple_spinner_dropdown_item은 기본으로 제공해주는 형식입니다.
monthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spregistertype.setAdapter(monthAdapter); //어댑터에 연결해줍니다.


spregistertype.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(),(String)spregistertype.getItemAtPosition(position)+"이 선택되었습니다.",Toast.LENGTH_SHORT).show();
} //이 오버라이드 메소드에서 position은 몇번째 값이 클릭됬는지 알 수 있습니다.
//getItemAtPosition(position)를 통해서 해당 값을 받아올수있습니다.

@Override
public void onNothingSelected(AdapterView<?> parent) { }

});

spregisterlocal = findViewById(R.id.sp_register_local);
spregisterlocal.setPrompt("지역");

ArrayAdapter monthAdapter2 = ArrayAdapter.createFromResource(this, R.array.local_array, android.R.layout.simple_spinner_dropdown_item);
//R.array.test는 저희가 정의해놓은 1월~12월 / android.R.layout.simple_spinner_dropdown_item은 기본으로 제공해주는 형식입니다.
monthAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spregisterlocal.setAdapter(monthAdapter2); //어댑터에 연결해줍니다.


spregisterlocal.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(),(String)spregisterlocal.getItemAtPosition(position)+"이 선택되었습니다.",Toast.LENGTH_SHORT).show();
} //이 오버라이드 메소드에서 position은 몇번째 값이 클릭됬는지 알 수 있습니다.
//getItemAtPosition(position)를 통해서 해당 값을 받아올수있습니다.

@Override
public void onNothingSelected(AdapterView<?> parent) { }

});

btnregistercompanyimageg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, 1);
}
});
}
@Override
//이미지 업로드
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == RESULT_OK) {
Uri selectedImageUri = data.getData();
imgregistercompanytimageview.setImageURI(selectedImageUri);
}
}
}
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/box_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version ="1.0" encoding ="utf-8"?><!-- Learn More about how to use App Actions: https://developer.android.com/guide/actions/index.html -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:thickness="0dp">
<stroke android:width="1dp" android:color="#AAAAAA"/>
<solid android:color="#ffffff"/>
</shape>
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/spinner_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid
android:color="#ffffff">

</solid>
<!-- 1dp 크기의 #000000 색 테두리 -->
<stroke
android:width="1dp"
android:color="#000000"/>

</shape>
145 changes: 0 additions & 145 deletions app/src/main/res/layout/activity_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,151 +114,6 @@
android:textSize="15sp"
android:textStyle="bold" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll_login_registerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="4"
android:orientation="vertical">

<TextView
android:id="@+id/tv_login_name3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:text="나만의 키오스크\nUOF"
android:textAlignment="center"
android:textSize="32sp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent" />

</androidx.appcompat.widget.LinearLayoutCompat>

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_login_registername"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="이름"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_login_registerid"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="아이디"
android:inputType="textUri" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_login_registerpw"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:passwordToggleEnabled="true">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="비밀번호"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_login_registerpwchk"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:passwordToggleEnabled="true">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="비밀번호확인"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>

<TextView
android:id="@+id/tv_login_plzphone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="serif"
android:text="전화번호 입력"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textSize="15sp"
android:textStyle="bold" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_login_registerphonenumber"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ex)01012345678"
android:inputType="phone"
android:maxLength="11" />
</com.google.android.material.textfield.TextInputLayout>

<Button
android:id="@+id/btn_login_register"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:text="회원가입"
android:textSize="20sp"
android:textStyle="bold" />

<TextView
android:id="@+id/tv_login_returnlogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:fontFamily="serif"
android:text="로그인 하러 가기"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/holo_blue_dark"
android:textSize="15sp"
android:textStyle="bold" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>

</androidx.appcompat.widget.LinearLayoutCompat>

Expand Down
Loading