From 9a2b08199c076e3a0377c691bb24f49298866699 Mon Sep 17 00:00:00 2001 From: Sohn Young Jin Date: Thu, 5 Aug 2021 17:46:21 +0900 Subject: [PATCH 1/8] Update RegisterActivity codes and xml Add TextInputLayout and TextInputEditText style to themes.xml. Set the spinner design to be the same as the border of the TextInputLayout. Change ui id. Add license image ImageView border. --- .../com/uof/uof_mobile/LoginActivity.java | 6 +- .../com/uof/uof_mobile/RegisterActivity.java | 148 +++---- .../selector_textinputlayout_register.xml | 6 + ...xml => background_registertypespinner.xml} | 5 +- .../main/res/drawable/border_licenseimage.xml | 10 + app/src/main/res/drawable/box_border.xml | 6 - app/src/main/res/layout/activity_register.xml | 395 ++++++++---------- app/src/main/res/values-night/themes.xml | 2 +- app/src/main/res/values/array.xml | 12 +- app/src/main/res/values/themes.xml | 18 +- 10 files changed, 275 insertions(+), 333 deletions(-) create mode 100644 app/src/main/res/color/selector_textinputlayout_register.xml rename app/src/main/res/drawable/{spinner_background.xml => background_registertypespinner.xml} (78%) create mode 100644 app/src/main/res/drawable/border_licenseimage.xml delete mode 100644 app/src/main/res/drawable/box_border.xml diff --git a/app/src/main/java/com/uof/uof_mobile/LoginActivity.java b/app/src/main/java/com/uof/uof_mobile/LoginActivity.java index 9bdf2c1c..1d54b5ca 100644 --- a/app/src/main/java/com/uof/uof_mobile/LoginActivity.java +++ b/app/src/main/java/com/uof/uof_mobile/LoginActivity.java @@ -324,17 +324,15 @@ public void afterTextChanged(Editable editable) { new RegisterTypeDialogListener() { @Override public void onCustomerClick() { - Toast.makeText(LoginActivity.this, "일반 고객", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(LoginActivity.this, RegisterActivity.class); - intent.putExtra("RegisterType", 1); //고객 + intent.putExtra("RegisterType", 0); //고객 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); //파트너 + intent.putExtra("RegisterType", 1); //파트너 startActivity(intent); //다음 activity로 넘어가기 } diff --git a/app/src/main/java/com/uof/uof_mobile/RegisterActivity.java b/app/src/main/java/com/uof/uof_mobile/RegisterActivity.java index e05380f9..f2454620 100644 --- a/app/src/main/java/com/uof/uof_mobile/RegisterActivity.java +++ b/app/src/main/java/com/uof/uof_mobile/RegisterActivity.java @@ -1,23 +1,20 @@ 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 androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatButton; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.LinearLayoutCompat; -import java.util.Locale; +import com.google.android.material.textfield.TextInputLayout; public class RegisterActivity extends AppCompatActivity { private LinearLayoutCompat llregistercustomer; @@ -27,33 +24,37 @@ public class RegisterActivity extends AppCompatActivity { 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; + private AppCompatButton btnregistercustomerregister; + + private TextInputLayout tilRegisterUofPartnerId; + private TextInputLayout tilRegisterUofPartnerPw; + private TextInputLayout tilRegisterUofPartnerPwChk; + private TextInputLayout tilRegisterUofPartnerName; + private TextInputLayout tilRegisterUofPartnerPhone; + private TextInputLayout tilRegisterCompanyName; + private TextInputLayout tilRegisterLicenseNumber; + private Spinner spRegisterCompanyType; + private TextInputLayout tilRegisterCompanyAddress; + private AppCompatButton btnRegisterUofPartnerRegister; + private AppCompatImageView ivRegisterLicenseImage; + private AppCompatButton btnRegisterLicenseImage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); - init(); + init(); } + private void init() { + //데이터 받아오기 + Intent loadIntent = getIntent(); + int registerType = loadIntent.getExtras().getInt("RegisterType"); + llregistercustomer = findViewById(R.id.ll_register_customer); + llregisterpartner = findViewById(R.id.ll_register_uofpartner); - //데이터 받아오기 - Intent intent = getIntent(); /*데이터 수신*/ tilregistercustomerid = findViewById(R.id.til_register_customerid); tilregistercustomerpw = findViewById(R.id.til_register_customerpw); tilregistercustomerpwchk = findViewById(R.id.til_register_customerpwchk); @@ -61,90 +62,63 @@ private void init() { 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){ + tilRegisterUofPartnerId = findViewById(R.id.til_register_uofpartnerid); + tilRegisterUofPartnerPw = findViewById(R.id.til_register_uofpartnerpw); + tilRegisterUofPartnerPwChk = findViewById(R.id.til_register_uofpartnerpwchk); + tilRegisterUofPartnerName = findViewById(R.id.til_register_uofpartnername); + tilRegisterUofPartnerPhone = findViewById(R.id.til_register_uofpartnerphone); + tilRegisterCompanyName = findViewById(R.id.til_register_companyname); + tilRegisterLicenseNumber = findViewById(R.id.til_register_licensenumber); + btnRegisterLicenseImage = findViewById(R.id.btn_register_licenseimage); + ivRegisterLicenseImage = findViewById(R.id.iv_register_licenseimage); + btnRegisterUofPartnerRegister = findViewById(R.id.btn_register_uofpartnerregister); + spRegisterCompanyType = findViewById(R.id.sp_register_companytype); + tilRegisterCompanyAddress = findViewById(R.id.til_register_companyaddress); + + // 회원가입 유형 확인 + if (registerType == 0) { + // 일반 고객 llregistercustomer.setVisibility(View.VISIBLE); llregisterpartner.setVisibility(View.GONE); - } - else{ + } else { + // U.O.F 파트너 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); //어댑터에 연결해줍니다. + spRegisterCompanyType.setPrompt("회사 유형"); + ArrayAdapter companyType = ArrayAdapter.createFromResource(getApplicationContext(), R.array.array_companytype, android.R.layout.simple_spinner_dropdown_item); + companyType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + spRegisterCompanyType.setAdapter(companyType); - spregistertype.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + spRegisterCompanyType.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)를 통해서 해당 값을 받아올수있습니다. + Toast.makeText(getApplicationContext(), (String) spRegisterCompanyType.getItemAtPosition(position) + "이 선택되었습니다.", Toast.LENGTH_SHORT).show(); + } @Override - public void onNothingSelected(AdapterView parent) { } + 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); - } + btnRegisterLicenseImage.setOnClickListener(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); + ivRegisterLicenseImage.setImageURI(selectedImageUri); } } } \ No newline at end of file diff --git a/app/src/main/res/color/selector_textinputlayout_register.xml b/app/src/main/res/color/selector_textinputlayout_register.xml new file mode 100644 index 00000000..429ad898 --- /dev/null +++ b/app/src/main/res/color/selector_textinputlayout_register.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/spinner_background.xml b/app/src/main/res/drawable/background_registertypespinner.xml similarity index 78% rename from app/src/main/res/drawable/spinner_background.xml rename to app/src/main/res/drawable/background_registertypespinner.xml index 93b2a14a..f91a5bcf 100644 --- a/app/src/main/res/drawable/spinner_background.xml +++ b/app/src/main/res/drawable/background_registertypespinner.xml @@ -9,6 +9,9 @@ + android:color="#6C6C6C"/> + + \ No newline at end of file diff --git a/app/src/main/res/drawable/border_licenseimage.xml b/app/src/main/res/drawable/border_licenseimage.xml new file mode 100644 index 00000000..a69fe561 --- /dev/null +++ b/app/src/main/res/drawable/border_licenseimage.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/box_border.xml b/app/src/main/res/drawable/box_border.xml deleted file mode 100644 index f69bdada..00000000 --- a/app/src/main/res/drawable/box_border.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_register.xml b/app/src/main/res/layout/activity_register.xml index e37bc524..394eb244 100644 --- a/app/src/main/res/layout/activity_register.xml +++ b/app/src/main/res/layout/activity_register.xml @@ -7,29 +7,26 @@ android:orientation="vertical" tools:context=".RegisterActivity"> - //일반유저 회원가입 + - @@ -40,441 +37,395 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" - android:background="#F2F2F2" android:orientation="vertical"> + android:orientation="vertical" + android:padding="16dp"> - + + style="@style/TextInputLayout_Register" + android:layout_marginBottom="8dp"> - + - + - + + style="@style/TextInputLayout_Register" + android:layout_marginBottom="8dp"> - + + style="@style/TextInputLayout_Register"> -