diff --git a/AndroidAssignment/.idea/misc.xml b/AndroidAssignment/.idea/misc.xml deleted file mode 100644 index 831c5f5..0000000 --- a/AndroidAssignment/.idea/misc.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeActivity.kt b/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeActivity.kt deleted file mode 100644 index 8edffeb..0000000 --- a/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeActivity.kt +++ /dev/null @@ -1,39 +0,0 @@ -package org.sopt.androidassignment - -import android.content.ActivityNotFoundException -import android.content.Intent -import android.content.Intent.createChooser -import android.net.Uri -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.widget.Toast -import org.sopt.androidassignment.databinding.ActivityHomeBinding - - -class HomeActivity : AppCompatActivity() { - - private lateinit var binding : ActivityHomeBinding - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - binding = ActivityHomeBinding.inflate(layoutInflater) - val address : Intent = Uri.parse("https://github.com/briandr97").let{webpage->Intent(Intent.ACTION_VIEW, webpage)} - - //val webIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/briandr97")) - - - binding.btHomeGit.setOnClickListener{ - //val intent = Intent(Intent.ACTION_SEND) - //val title = resources.getString(R.string.chooser_title) - //val chooser = createChooser(intent, title) - try{ - startActivity(address) - }catch(e:ActivityNotFoundException){ - Toast.makeText(this, "실행할 수 있는 앱이 없습니다.", Toast.LENGTH_SHORT).show() - } - } - - setContentView(binding.root) - } -} \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignInActivity.kt b/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignInActivity.kt deleted file mode 100644 index f62663f..0000000 --- a/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignInActivity.kt +++ /dev/null @@ -1,46 +0,0 @@ -package org.sopt.androidassignment - -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.widget.Toast -import org.sopt.androidassignment.databinding.ActivitySignInBinding - -class SignInActivity : AppCompatActivity() { - - private lateinit var binding : ActivitySignInBinding - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - binding = ActivitySignInBinding.inflate(layoutInflater) - - val intent = Intent(this, HomeActivity::class.java) - binding.btLogin.setOnClickListener{ - var str = binding.etId.getText() - var pw = binding.etPw.getText() - if(!str.isEmpty() && !pw.isEmpty()){ - Toast.makeText(this, "${str}님 환영합니다.", Toast.LENGTH_SHORT).show() - startActivity(intent) - } - else{ - Toast.makeText(this, "로그인 실패", Toast.LENGTH_SHORT).show() - } - } - - val intent2 = Intent(this, SignUpActivity::class.java) - binding.btSignin.setOnClickListener{ - startActivity(intent2) - } - - val id = getIntent().getStringExtra("id") - val pw = getIntent().getStringExtra("pw") - - binding.etId.setText(id) - binding.etPw.setText(pw) - - - - setContentView(binding.root) - } -} \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/res/drawable/button_round.xml b/AndroidAssignment/app/src/main/res/drawable/button_round.xml deleted file mode 100644 index db46f6b..0000000 --- a/AndroidAssignment/app/src/main/res/drawable/button_round.xml +++ /dev/null @@ -1,16 +0,0 @@ - - //10만큼 각모서리에 - - - - //내부 색 설정 - //각 모서리를 12dp만큼 둥글게 만들겠다ㅣ. - - \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/res/layout/activity_home.xml b/AndroidAssignment/app/src/main/res/layout/activity_home.xml deleted file mode 100644 index 60b6327..0000000 --- a/AndroidAssignment/app/src/main/res/layout/activity_home.xml +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / - - \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/res/values/strings.xml b/AndroidAssignment/app/src/main/res/values/strings.xml deleted file mode 100644 index 48936d3..0000000 --- a/AndroidAssignment/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - AndroidAssignment - \ No newline at end of file diff --git a/AndroidAssignment/.gitignore b/assignment/AndroidAssignment/.gitignore similarity index 100% rename from AndroidAssignment/.gitignore rename to assignment/AndroidAssignment/.gitignore diff --git a/AndroidAssignment/.idea/.gitignore b/assignment/AndroidAssignment/.idea/.gitignore similarity index 100% rename from AndroidAssignment/.idea/.gitignore rename to assignment/AndroidAssignment/.idea/.gitignore diff --git a/AndroidAssignment/.idea/codeStyles/Project.xml b/assignment/AndroidAssignment/.idea/codeStyles/Project.xml similarity index 100% rename from AndroidAssignment/.idea/codeStyles/Project.xml rename to assignment/AndroidAssignment/.idea/codeStyles/Project.xml diff --git a/AndroidAssignment/.idea/codeStyles/codeStyleConfig.xml b/assignment/AndroidAssignment/.idea/codeStyles/codeStyleConfig.xml similarity index 100% rename from AndroidAssignment/.idea/codeStyles/codeStyleConfig.xml rename to assignment/AndroidAssignment/.idea/codeStyles/codeStyleConfig.xml diff --git a/AndroidAssignment/.idea/compiler.xml b/assignment/AndroidAssignment/.idea/compiler.xml similarity index 100% rename from AndroidAssignment/.idea/compiler.xml rename to assignment/AndroidAssignment/.idea/compiler.xml diff --git a/AndroidAssignment/.idea/gradle.xml b/assignment/AndroidAssignment/.idea/gradle.xml similarity index 100% rename from AndroidAssignment/.idea/gradle.xml rename to assignment/AndroidAssignment/.idea/gradle.xml diff --git a/assignment/AndroidAssignment/.idea/misc.xml b/assignment/AndroidAssignment/.idea/misc.xml new file mode 100644 index 0000000..93abe6b --- /dev/null +++ b/assignment/AndroidAssignment/.idea/misc.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/AndroidAssignment/.idea/vcs.xml b/assignment/AndroidAssignment/.idea/vcs.xml similarity index 83% rename from AndroidAssignment/.idea/vcs.xml rename to assignment/AndroidAssignment/.idea/vcs.xml index 8e7ad31..b3e3d1c 100644 --- a/AndroidAssignment/.idea/vcs.xml +++ b/assignment/AndroidAssignment/.idea/vcs.xml @@ -1,6 +1,7 @@ + diff --git a/AndroidAssignment/app/.gitignore b/assignment/AndroidAssignment/app/.gitignore similarity index 100% rename from AndroidAssignment/app/.gitignore rename to assignment/AndroidAssignment/app/.gitignore diff --git a/AndroidAssignment/app/build.gradle b/assignment/AndroidAssignment/app/build.gradle similarity index 76% rename from AndroidAssignment/app/build.gradle rename to assignment/AndroidAssignment/app/build.gradle index 8c5b1fd..4cbc288 100644 --- a/AndroidAssignment/app/build.gradle +++ b/assignment/AndroidAssignment/app/build.gradle @@ -40,6 +40,13 @@ android { dependencies { + implementation "com.squareup.retrofit2:retrofit:2.9.0" //서버 연결을 위한 Retrofit2 + implementation "com.squareup.retrofit2:converter-gson:2.9.0" //Retrofit2에서 gson 사용을 위한 컨버터 + implementation "com.google.code.gson:gson:2.8.6" // gson + + implementation 'com.github.bumptech.glide:glide:4.12.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' + implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'com.google.android.material:material:1.4.0' diff --git a/AndroidAssignment/app/proguard-rules.pro b/assignment/AndroidAssignment/app/proguard-rules.pro similarity index 100% rename from AndroidAssignment/app/proguard-rules.pro rename to assignment/AndroidAssignment/app/proguard-rules.pro diff --git a/AndroidAssignment/app/src/androidTest/java/org/sopt/androidassignment/ExampleInstrumentedTest.kt b/assignment/AndroidAssignment/app/src/androidTest/java/org/sopt/androidassignment/ExampleInstrumentedTest.kt similarity index 100% rename from AndroidAssignment/app/src/androidTest/java/org/sopt/androidassignment/ExampleInstrumentedTest.kt rename to assignment/AndroidAssignment/app/src/androidTest/java/org/sopt/androidassignment/ExampleInstrumentedTest.kt diff --git a/AndroidAssignment/app/src/main/AndroidManifest.xml b/assignment/AndroidAssignment/app/src/main/AndroidManifest.xml similarity index 86% rename from AndroidAssignment/app/src/main/AndroidManifest.xml rename to assignment/AndroidAssignment/app/src/main/AndroidManifest.xml index c5b446a..e7dbe1c 100644 --- a/AndroidAssignment/app/src/main/AndroidManifest.xml +++ b/assignment/AndroidAssignment/app/src/main/AndroidManifest.xml @@ -6,18 +6,14 @@ - - + diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/CameraFragment.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/CameraFragment.kt new file mode 100644 index 0000000..c09f9c3 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/CameraFragment.kt @@ -0,0 +1,59 @@ +package org.sopt.androidassignment + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [CameraFragment.newInstance] factory method to + * create an instance of this fragment. + */ +class CameraFragment : Fragment() { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_camera, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment CameraFragment. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + CameraFragment().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerAdapter.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerAdapter.kt new file mode 100644 index 0000000..9966dbf --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerAdapter.kt @@ -0,0 +1,33 @@ +package org.sopt.androidassignment + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import org.sopt.androidassignment.databinding.GitFollowerListBinding + +class FollowerAdapter : RecyclerView.Adapter(){ + val userList = mutableListOf() + + override fun onCreateViewHolder( + parent: ViewGroup, + viewType: Int + ): FollowerViewHolder { + val binding = GitFollowerListBinding.inflate(LayoutInflater.from(parent.context), parent, false) + return FollowerViewHolder(binding) + } + + override fun onBindViewHolder(holder: FollowerAdapter.FollowerViewHolder, position: Int) { + holder.onBind(userList[position]) + } + + override fun getItemCount(): Int = userList.size + + class FollowerViewHolder(private val binding : GitFollowerListBinding) + : RecyclerView.ViewHolder(binding.root){ + fun onBind(data:FollowerData){ + binding.tvFollowerName.text = data.name + binding.tvFollowerIntroduce.text = data.introduction + } + } + +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerData.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerData.kt new file mode 100644 index 0000000..3032a1d --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerData.kt @@ -0,0 +1,5 @@ +package org.sopt.androidassignment + +data class FollowerData( + val name : String, + val introduction : String) diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerListFragment.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerListFragment.kt new file mode 100644 index 0000000..88e7116 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/FollowerListFragment.kt @@ -0,0 +1,45 @@ +package org.sopt.androidassignment + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import org.sopt.androidassignment.databinding.FragmentFollowerListBinding + +class FollowerList : Fragment() { + private var _binding:FragmentFollowerListBinding? = null + private val binding get() = _binding!! + private lateinit var followerAdapter: FollowerAdapter + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + _binding = FragmentFollowerListBinding.inflate(layoutInflater, container, false) + initAdapter() + return binding.root + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + private fun initAdapter(){ + followerAdapter = FollowerAdapter() + + binding.rvFollower.adapter = followerAdapter + followerAdapter.userList.addAll( + listOf( + FollowerData("권용민", "안드로이드 YB"), + FollowerData("김용민", "서버 YB"), + FollowerData("박용민", "IOS YB"), + FollowerData("최용민", "웹 YB"), + FollowerData("이용민", "기획 YB"), + FollowerData("나용민", "디자인 YB") + ) + ) + followerAdapter.notifyDataSetChanged() + } +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeActivity.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeActivity.kt new file mode 100644 index 0000000..59a1327 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeActivity.kt @@ -0,0 +1,109 @@ +package org.sopt.androidassignment + + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import androidx.viewpager2.widget.ViewPager2 +import org.sopt.androidassignment.databinding.ActivityHomeBinding +import org.sopt.androidassignment.databinding.FragmentProfileBinding + + +class HomeActivity : AppCompatActivity() { + private lateinit var binding : ActivityHomeBinding + private var position = FOLL_FRAGMENT + private lateinit var binding2 : FragmentProfileBinding + private lateinit var sampleViewPagerAdapter: SampleViewPagerAdapter + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + binding = ActivityHomeBinding.inflate(layoutInflater) + + initAdapter() + initBottomNavigation() + //initTransactionEvent() + setContentView(binding.root) + } + + private fun initAdapter(){ + + val fragmentList = listOf(ProfileFragment(), HomeFragment(), CameraFragment()) + + sampleViewPagerAdapter = SampleViewPagerAdapter(this) + sampleViewPagerAdapter.fragments.addAll(fragmentList) + + binding.vpSample.adapter = sampleViewPagerAdapter + } + + private fun initBottomNavigation(){ + binding.vpSample.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() { + override fun onPageSelected(position: Int) { + binding.bnvSample.menu.getItem(position).isChecked=true + } + }) + + binding.bnvSample.setOnItemSelectedListener{ + when(it.itemId){ + R.id.menu_android->{ + binding.vpSample.currentItem=FIRST_FRAGMENT + return@setOnItemSelectedListener true + } + R.id.menu_list->{ + binding.vpSample.currentItem= SECOND_FRAGMENT + return@setOnItemSelectedListener true + } + else->{ + binding.vpSample.currentItem= THIRD_FRAGMENT + return@setOnItemSelectedListener true + } + } + } + } + + companion object{ + const val FIRST_FRAGMENT=0 + const val SECOND_FRAGMENT=1 + const val THIRD_FRAGMENT=2 + + const val FOLL_FRAGMENT = 1 + const val REPO_FRAGMENT = 2 + } + + fun initTransactionEvent(){ + val fragment1 = FollowerList() + val fragment2 = RepositoryListFragment() + supportFragmentManager.beginTransaction().add(R.id.container_fragment, fragment1).commit() + + binding2.btHomeFollower.setOnClickListener{ + val transaction = supportFragmentManager.beginTransaction() + + when(position){ + FOLL_FRAGMENT->{ + transaction.replace(R.id.container_fragment, fragment1) + position = FOLL_FRAGMENT + } + REPO_FRAGMENT->{ + transaction.replace(R.id.container_fragment, fragment1) + position= FOLL_FRAGMENT + } + } + transaction.commit() + } + binding2.btHomeRepository.setOnClickListener{ + val transaction = supportFragmentManager.beginTransaction() + when(position){ + FOLL_FRAGMENT->{ + transaction.replace(R.id.container_fragment, fragment2) + position= REPO_FRAGMENT + } + REPO_FRAGMENT->{ + transaction.replace(R.id.container_fragment, fragment2) + position= REPO_FRAGMENT + } + } + + transaction.commit() + } + } + +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeFragment.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeFragment.kt new file mode 100644 index 0000000..5a9fd79 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/HomeFragment.kt @@ -0,0 +1,59 @@ +package org.sopt.androidassignment + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [HomeFragment.newInstance] factory method to + * create an instance of this fragment. + */ +class HomeFragment : Fragment() { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_home, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment HomeFragment. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + HomeFragment().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/ProfileFragment.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/ProfileFragment.kt new file mode 100644 index 0000000..c40bc66 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/ProfileFragment.kt @@ -0,0 +1,23 @@ +package org.sopt.androidassignment + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import org.sopt.androidassignment.databinding.FragmentProfileBinding + + +class ProfileFragment : Fragment() { + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + + return inflater.inflate(R.layout.fragment_profile, container, false) + } + + + +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryAdapter.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryAdapter.kt new file mode 100644 index 0000000..f8ccd12 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryAdapter.kt @@ -0,0 +1,32 @@ +package org.sopt.androidassignment + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import org.sopt.androidassignment.databinding.GitRepositoryListBinding + +class RepositoryAdapter : RecyclerView.Adapter(){ + val repoList = mutableListOf() + + override fun onCreateViewHolder( + parent: ViewGroup, + viewType: Int + ): RepositoryViewHolder { + val binding = GitRepositoryListBinding.inflate(LayoutInflater.from(parent.context), parent, false) + return RepositoryViewHolder(binding) + } + + override fun onBindViewHolder(holder: RepositoryAdapter.RepositoryViewHolder, position: Int) { + holder.onBind(repoList[position]) + } + + override fun getItemCount(): Int = repoList.size + + class RepositoryViewHolder(private val binding:GitRepositoryListBinding) + :RecyclerView.ViewHolder(binding.root){ + fun onBind(data:RepositoryData){ + binding.tvRepository.text = data.repo + binding.tvIntro.text = data.intro + } + } +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryData.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryData.kt new file mode 100644 index 0000000..07029f3 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryData.kt @@ -0,0 +1,5 @@ +package org.sopt.androidassignment + +data class RepositoryData( + val repo : String, val intro : String +) diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryListFragment.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryListFragment.kt new file mode 100644 index 0000000..7f83818 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/RepositoryListFragment.kt @@ -0,0 +1,47 @@ +package org.sopt.androidassignment + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.recyclerview.widget.GridLayoutManager +import org.sopt.androidassignment.databinding.FragmentRepositoryListBinding + +class RepositoryListFragment : Fragment() { + private var _binding : FragmentRepositoryListBinding? = null + private val binding get() = _binding!! + private lateinit var repositoryAdapter: RepositoryAdapter + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + _binding = FragmentRepositoryListBinding.inflate(layoutInflater, container, false) + initAdapter() + binding.rvRepository.adapter = repositoryAdapter + binding.rvRepository.layoutManager= GridLayoutManager(activity, 2) + return binding.root + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + private fun initAdapter(){ + repositoryAdapter = RepositoryAdapter() + + binding.rvRepository.adapter=repositoryAdapter + repositoryAdapter.repoList.addAll( + listOf( + RepositoryData("안드로이드 과제1\n레포지토리", "1주차 과제"), + RepositoryData("안드로이드 과제2\n레포지토리", "글자수 제한을 체크하겠습니다."), + RepositoryData("왕초보 스터디\n레포지토리", "제못제잘 과제"), + RepositoryData("코틀린 스터디\n레포지토리", "코틀린 가만안드.. 과제"), + RepositoryData("솝탁 스터디\n레포지토리", "알고리즘 과제"), + RepositoryData("풋살 스터디\n레포지토리", "개발스터디란 우리가 개발이라는"), + + ) + ) + } +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SampleViewPagerAdapter.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SampleViewPagerAdapter.kt new file mode 100644 index 0000000..4f6e07c --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SampleViewPagerAdapter.kt @@ -0,0 +1,13 @@ +package org.sopt.androidassignment + +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentActivity +import androidx.viewpager2.adapter.FragmentStateAdapter + +class SampleViewPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) { + val fragments = mutableListOf() + + override fun getItemCount(): Int =fragments.size + + override fun createFragment(position: Int): Fragment = fragments[position] +} \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignInActivity.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignInActivity.kt new file mode 100644 index 0000000..2f82dbb --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignInActivity.kt @@ -0,0 +1,82 @@ +package org.sopt.androidassignment + +import android.app.Activity +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.util.Log +import android.widget.Toast +import org.sopt.androidassignment.databinding.ActivitySignInBinding +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response + +class SignInActivity : AppCompatActivity() { + + private lateinit var binding : ActivitySignInBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + binding = ActivitySignInBinding.inflate(layoutInflater) + + val intent = Intent(this, HomeActivity::class.java) + binding.btLogin.setOnClickListener{ + var str = binding.etId.getText() + var pw = binding.etPw.getText() + if(!str.isEmpty() && !pw.isEmpty()){ + Toast.makeText(this, "${str}님 환영합니다.", Toast.LENGTH_SHORT).show() + startActivity(intent) + //initNetwork() + } + else{ + Toast.makeText(this, "로그인 실패", Toast.LENGTH_SHORT).show() + } + } + + val intent2 = Intent(this, SignUpActivity::class.java) + binding.btSignin.setOnClickListener{ + startActivity(intent2) + } + + val id = getIntent().getStringExtra("id") + val pw = getIntent().getStringExtra("pw") + + binding.etId.setText(id) + binding.etPw.setText(pw) + + + + setContentView(binding.root) + } + +// private fun initNetwork(){ +// val requestLoginData = RequestLoginData( +// //email = binding.etId.text.toString(), +// binding.etId.text.toString(), +// //password = binding.etPw.text.toString() +// binding.etPw.text.toString() +// ) +// +// val call: Call = ServiceCreator.sampleService.postLogin(requestLoginData) +// call.enqueue(object : Callback { +// override fun onResponse( +// call: Call, +// response: Response +// ){ +// if(response.isSuccessful){ +// val data = response.body()?.data +// +// Toast.makeText(this@SignInActivity, "${data?.email}님 반갑습니다!", Toast.LENGTH_SHORT).show() +// startActivity(Intent(this@SignInActivity, HomeActivity::class.java)) +// } else +// Toast.makeText(this@SignInActivity, "로그인에 실패하셨습니다", Toast.LENGTH_LONG).show() +// } +// +// override fun onFailure(call: Call, t: Throwable) { +// TODO("Not yet implemented") +// Log.e("NetworkText", "error:$t") +// } +// }) +// } +} \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignUpActivity.kt b/assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignUpActivity.kt similarity index 100% rename from AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignUpActivity.kt rename to assignment/AndroidAssignment/app/src/main/java/org/sopt/androidassignment/SignUpActivity.kt diff --git a/assignment/AndroidAssignment/app/src/main/res/color/selector_bottom_navi.xml b/assignment/AndroidAssignment/app/src/main/res/color/selector_bottom_navi.xml new file mode 100644 index 0000000..740d35f --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/color/selector_bottom_navi.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/res/color/selector_button.xml b/assignment/AndroidAssignment/app/src/main/res/color/selector_button.xml new file mode 100644 index 0000000..80905a8 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/color/selector_button.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/res/color/selector_button_text.xml b/assignment/AndroidAssignment/app/src/main/res/color/selector_button_text.xml new file mode 100644 index 0000000..d6cce94 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/color/selector_button_text.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/res/color/selector_edittext.xml b/assignment/AndroidAssignment/app/src/main/res/color/selector_edittext.xml new file mode 100644 index 0000000..02f1393 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/color/selector_edittext.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/res/color/selector_edittext_border.xml b/assignment/AndroidAssignment/app/src/main/res/color/selector_edittext_border.xml new file mode 100644 index 0000000..eb476eb --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/color/selector_edittext_border.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/assignment/AndroidAssignment/app/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to assignment/AndroidAssignment/app/src/main/res/drawable-v24/ic_launcher_foreground.xml diff --git a/AndroidAssignment/app/src/main/res/drawable/border.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/border.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/drawable/border.xml rename to assignment/AndroidAssignment/app/src/main/res/drawable/border.xml diff --git a/AndroidAssignment/app/src/main/res/drawable/bt_git.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/bt_git.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/drawable/bt_git.xml rename to assignment/AndroidAssignment/app/src/main/res/drawable/bt_git.xml diff --git a/assignment/AndroidAssignment/app/src/main/res/drawable/button_clicked.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/button_clicked.xml new file mode 100644 index 0000000..2c622a8 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/drawable/button_clicked.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/res/drawable/button_round.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/button_round.xml new file mode 100644 index 0000000..f6ac63d --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/drawable/button_round.xml @@ -0,0 +1,16 @@ + + //10만큼 각모서리에 + + + + //내부 색 설정 + //각 모서리를 12dp만큼 둥글게 만들겠다ㅣ. + + \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_camera_alt_24.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_camera_alt_24.xml new file mode 100644 index 0000000..13186de --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_camera_alt_24.xml @@ -0,0 +1,13 @@ + + + + diff --git a/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_home_24.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_home_24.xml new file mode 100644 index 0000000..3a4c7da --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_home_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_person_24.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_person_24.xml new file mode 100644 index 0000000..6bdced2 --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/drawable/ic_baseline_person_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/AndroidAssignment/app/src/main/res/drawable/ic_launcher_background.xml b/assignment/AndroidAssignment/app/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/drawable/ic_launcher_background.xml rename to assignment/AndroidAssignment/app/src/main/res/drawable/ic_launcher_background.xml diff --git a/AndroidAssignment/app/src/main/res/drawable/imagegit.jpg b/assignment/AndroidAssignment/app/src/main/res/drawable/imagegit.jpg similarity index 100% rename from AndroidAssignment/app/src/main/res/drawable/imagegit.jpg rename to assignment/AndroidAssignment/app/src/main/res/drawable/imagegit.jpg diff --git a/assignment/AndroidAssignment/app/src/main/res/drawable/img_github.png b/assignment/AndroidAssignment/app/src/main/res/drawable/img_github.png new file mode 100644 index 0000000..302cf12 Binary files /dev/null and b/assignment/AndroidAssignment/app/src/main/res/drawable/img_github.png differ diff --git a/AndroidAssignment/app/src/main/res/drawable/my_face2.jpg b/assignment/AndroidAssignment/app/src/main/res/drawable/my_face2.jpg similarity index 100% rename from AndroidAssignment/app/src/main/res/drawable/my_face2.jpg rename to assignment/AndroidAssignment/app/src/main/res/drawable/my_face2.jpg diff --git a/AndroidAssignment/app/src/main/res/drawable/myface.jpg b/assignment/AndroidAssignment/app/src/main/res/drawable/myface.jpg similarity index 100% rename from AndroidAssignment/app/src/main/res/drawable/myface.jpg rename to assignment/AndroidAssignment/app/src/main/res/drawable/myface.jpg diff --git a/AndroidAssignment/app/src/main/res/font/allerta.xml b/assignment/AndroidAssignment/app/src/main/res/font/allerta.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/font/allerta.xml rename to assignment/AndroidAssignment/app/src/main/res/font/allerta.xml diff --git a/AndroidAssignment/app/src/main/res/font/anton.xml b/assignment/AndroidAssignment/app/src/main/res/font/anton.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/font/anton.xml rename to assignment/AndroidAssignment/app/src/main/res/font/anton.xml diff --git a/AndroidAssignment/app/src/main/res/font/archivo_black.xml b/assignment/AndroidAssignment/app/src/main/res/font/archivo_black.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/font/archivo_black.xml rename to assignment/AndroidAssignment/app/src/main/res/font/archivo_black.xml diff --git a/AndroidAssignment/app/src/main/res/font/basic.xml b/assignment/AndroidAssignment/app/src/main/res/font/basic.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/font/basic.xml rename to assignment/AndroidAssignment/app/src/main/res/font/basic.xml diff --git a/AndroidAssignment/app/src/main/res/font/capriola.xml b/assignment/AndroidAssignment/app/src/main/res/font/capriola.xml similarity index 100% rename from AndroidAssignment/app/src/main/res/font/capriola.xml rename to assignment/AndroidAssignment/app/src/main/res/font/capriola.xml diff --git a/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr.xml b/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr.xml new file mode 100644 index 0000000..3953f7d --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr_bold.otf b/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr_bold.otf new file mode 100644 index 0000000..7f4131c Binary files /dev/null and b/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr_bold.otf differ diff --git a/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr_regular.otf b/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr_regular.otf new file mode 100644 index 0000000..e26c1cd Binary files /dev/null and b/assignment/AndroidAssignment/app/src/main/res/font/noto_sans_kr_regular.otf differ diff --git a/assignment/AndroidAssignment/app/src/main/res/layout/activity_home.xml b/assignment/AndroidAssignment/app/src/main/res/layout/activity_home.xml new file mode 100644 index 0000000..fa5246e --- /dev/null +++ b/assignment/AndroidAssignment/app/src/main/res/layout/activity_home.xml @@ -0,0 +1,33 @@ + + + + + + + + + + \ No newline at end of file diff --git a/AndroidAssignment/app/src/main/res/layout/activity_sign_in.xml b/assignment/AndroidAssignment/app/src/main/res/layout/activity_sign_in.xml similarity index 54% rename from AndroidAssignment/app/src/main/res/layout/activity_sign_in.xml rename to assignment/AndroidAssignment/app/src/main/res/layout/activity_sign_in.xml index 8973f89..2c0eff8 100644 --- a/AndroidAssignment/app/src/main/res/layout/activity_sign_in.xml +++ b/assignment/AndroidAssignment/app/src/main/res/layout/activity_sign_in.xml @@ -6,46 +6,38 @@ android:layout_height="match_parent" tools:context=".SignInActivity"> - - + app:layout_constraintTop_toBottomOf="@+id/imageView" /> @@ -54,27 +46,31 @@ android:id="@+id/tv_pw" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="50dp" + android:layout_marginTop="34dp" + android:fontFamily="@font/noto_sans_kr" + android:textFontWeight="700" android:text="비밀번호" android:textColor="#000000" - android:textStyle="bold" - android:fontFamily="@font/allerta" - android:textSize="18dp" + android:textSize="14sp" + android:textStyle="normal" app:layout_constraintStart_toStartOf="@+id/et_id" app:layout_constraintTop_toBottomOf="@+id/et_id" /> @@ -82,43 +78,59 @@