Skip to content

Commit

Permalink
#27 내비게이션 바: 코드 작성 및 액티비티 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
otcroz committed Jun 23, 2022
1 parent 093c24f commit 1cba278
Show file tree
Hide file tree
Showing 16 changed files with 484 additions and 76 deletions.
17 changes: 17 additions & 0 deletions SHAPEUP2022/.idea/deploymentTargetDropDown.xml

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

5 changes: 5 additions & 0 deletions SHAPEUP2022/.idea/misc.xml

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

14 changes: 8 additions & 6 deletions SHAPEUP2022/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
android:exported="false" />
<activity
android:name=".TempMainActivity"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
android:exported="true">

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SettingActivity"
Expand All @@ -44,7 +40,13 @@
android:exported="true" />
<activity
android:name=".MainActivity"
android:exported="true"></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=".ToDoActivity"
android:exported="false" /> <!-- 정보 -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.shape_up_2022

import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -9,7 +10,7 @@ import androidx.fragment.app.FragmentTransaction
import com.example.shape_up_2022.databinding.MainPageBinding

class MainActivity : AppCompatActivity() {
private val binding by lazy { MainPageBinding.inflate(layoutInflater)}
private val binding by lazy {MainPageBinding.inflate(layoutInflater)}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -20,9 +21,42 @@ class MainActivity : AppCompatActivity() {

// 프래그먼트 연결 - 캘린더 프래그먼트
viewFragment(MainCalenderFragment() , R.id.fragment_calender)


// 탭바 연결
binding.navHome.setOnClickListener {
val intent_home = Intent(this, MainActivity::class.java)
startActivity(intent_home)
overridePendingTransition(0, 0)
finish()
}

binding.navTodo.setOnClickListener {
val intent_todo = Intent(this, ToDoActivity::class.java)
startActivity(intent_todo)
overridePendingTransition(0, 0)
finish()
}

binding.navSimulation.setOnClickListener {
val intent_simul = Intent(this, SimulationActivity::class.java)
startActivity(intent_simul)
overridePendingTransition(0, 0)
finish()
}

binding.navMap.setOnClickListener {

}

binding.navMypage.setOnClickListener {
val intent_mypage = Intent(this, MyPageActivity::class.java)
startActivity(intent_mypage)
overridePendingTransition(0, 0)
finish()
}


// 프래그먼트 연결 - 여러가지 메뉴
viewFragment(MainRecyclerViewFragment(), R.id.fragmentView_recycler)
}

// 프래그먼트 연결
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,38 @@ class MyPageActivity : AppCompatActivity() {

binding.gotosetting.setOnClickListener{


val intent = Intent(this, SettingActivity::class.java)
startActivity(intent)
}

// 탭바 연결
binding.navHome.setOnClickListener {
val intent_home = Intent(this, MainActivity::class.java)
startActivity(intent_home)
overridePendingTransition(0, 0);
}

binding.navTodo.setOnClickListener {
val intent_todo = Intent(this, ToDoActivity::class.java)
startActivity(intent_todo)
overridePendingTransition(0, 0);
}

binding.navSimulation.setOnClickListener {
val intent_simul = Intent(this, SimulationActivity::class.java)
startActivity(intent_simul)
overridePendingTransition(0, 0);
}

binding.navMap.setOnClickListener {

}

binding.navMypage.setOnClickListener {
val intent_mypage = Intent(this, MyPageActivity::class.java)
startActivity(intent_mypage)
overridePendingTransition(0, 0);
}
}

private fun calculateInSampleSize(fileUri: Uri, reqWidth: Int, reqHeight: Int): Int {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.shape_up_2022

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
Expand Down Expand Up @@ -40,5 +41,35 @@ class SimulationActivity : AppCompatActivity() {
binding.indoor.visibility = View.VISIBLE
}


// 탭바 연결
binding.navHome.setOnClickListener {
val intent_home = Intent(this, MainActivity::class.java)
startActivity(intent_home)
overridePendingTransition(0, 0);
}

binding.navTodo.setOnClickListener {
val intent_todo = Intent(this, ToDoActivity::class.java)
startActivity(intent_todo)
overridePendingTransition(0, 0);
}

binding.navSimulation.setOnClickListener {
val intent_simul = Intent(this, SimulationActivity::class.java)
startActivity(intent_simul)
overridePendingTransition(0, 0);
}

binding.navMap.setOnClickListener {

}

binding.navMypage.setOnClickListener {
val intent_mypage = Intent(this, MyPageActivity::class.java)
startActivity(intent_mypage)
overridePendingTransition(0, 0);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.example.shape_up_2022

import android.app.AlertDialog
import android.content.DialogInterface
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
Expand Down Expand Up @@ -77,5 +78,34 @@ class ToDoActivity : AppCompatActivity() {
binding.todoAdd.setOnClickListener {
alert.show()
}

// 탭바 연결
binding.navHome.setOnClickListener {
val intent_home = Intent(this, MainActivity::class.java)
startActivity(intent_home)
overridePendingTransition(0, 0);
}

binding.navTodo.setOnClickListener {
val intent_todo = Intent(this, ToDoActivity::class.java)
startActivity(intent_todo)
overridePendingTransition(0, 0);
}

binding.navSimulation.setOnClickListener {
val intent_simul = Intent(this, SimulationActivity::class.java)
startActivity(intent_simul)
overridePendingTransition(0, 0);
}

binding.navMap.setOnClickListener {

}

binding.navMypage.setOnClickListener {
val intent_mypage = Intent(this, MyPageActivity::class.java)
startActivity(intent_mypage)
overridePendingTransition(0, 0);
}
}
}
4 changes: 4 additions & 0 deletions SHAPEUP2022/app/src/main/res/drawable/ic_icon_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="35dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="35dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF9966" android:pathData="M19,9.3V5C19,4.45 18.55,4 18,4H17C16.45,4 16,4.45 16,5V6.6L12.67,3.6C12.29,3.26 11.71,3.26 11.33,3.6L2.97,11.13C2.63,11.43 2.84,12 3.3,12H5V19C5,19.55 5.45,20 6,20H9C9.55,20 10,19.55 10,19V14H14V19C14,19.55 14.45,20 15,20H18C18.55,20 19,19.55 19,19V12H20.7C21.16,12 21.38,11.43 21.03,11.13L19,9.3ZM10,10C10,8.9 10.9,8 12,8C13.1,8 14,8.9 14,10H10Z"/>
</vector>
4 changes: 4 additions & 0 deletions SHAPEUP2022/app/src/main/res/drawable/ic_icon_map.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="29dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="29dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF9966" android:pathData="M12,2C7.589,2 4,5.589 4,9.995C3.971,16.44 11.696,21.784 12,22C12,22 20.029,16.44 20,10C20,5.589 16.411,2 12,2ZM12,14C9.79,14 8,12.21 8,10C8,7.79 9.79,6 12,6C14.21,6 16,7.79 16,10C16,12.21 14.21,14 12,14Z"/>
</vector>
4 changes: 4 additions & 0 deletions SHAPEUP2022/app/src/main/res/drawable/ic_icon_mypage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="29dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="29dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF9966" android:pathData="M7.5,6.5C7.5,8.981 9.519,11 12,11C14.481,11 16.5,8.981 16.5,6.5C16.5,4.019 14.481,2 12,2C9.519,2 7.5,4.019 7.5,6.5ZM20,21H21V20C21,16.141 17.859,13 14,13H10C6.14,13 3,16.141 3,20V21H20Z"/>
</vector>
5 changes: 5 additions & 0 deletions SHAPEUP2022/app/src/main/res/drawable/ic_icon_simulation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="29dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="29dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF9966" android:pathData="M21,6H19L17.73,4.73C17.2707,4.2702 16.6498,4.0083 16,4H13.5C13.3599,3.4388 13.0394,2.9391 12.5878,2.5778C12.1361,2.2165 11.5783,2.0135 11,2V8.36C11.0514,9.3699 11.4506,10.331 12.13,11.08C13.2486,12.1553 14.7116,12.8 16.26,12.9L19.71,11.52C20.1148,11.3575 20.4793,11.1087 20.7781,10.7909C21.0768,10.4731 21.3027,10.094 21.44,9.68L22,8.15C22.0152,8.0472 22.0152,7.9428 22,7.84V7C22,6.7348 21.8946,6.4804 21.7071,6.2929C21.5196,6.1054 21.2652,6 21,6ZM16,8C15.8022,8 15.6089,7.9413 15.4444,7.8315C15.28,7.7216 15.1518,7.5654 15.0761,7.3827C15.0004,7.2 14.9806,6.9989 15.0192,6.8049C15.0578,6.6109 15.153,6.4328 15.2929,6.2929C15.4327,6.153 15.6109,6.0578 15.8049,6.0192C15.9989,5.9806 16.2,6.0004 16.3827,6.0761C16.5654,6.1518 16.7216,6.28 16.8315,6.4444C16.9414,6.6089 17,6.8022 17,7C17,7.2652 16.8946,7.5196 16.7071,7.7071C16.5196,7.8946 16.2652,8 16,8Z"/>
<path android:fillColor="#FF9966" android:pathData="M11.38,11.74C10.6824,10.976 10.2266,10.0226 10.07,9H6C5.7328,9.0177 5.4649,8.9781 5.2142,8.8838C4.9635,8.7895 4.7359,8.6428 4.5465,8.4535C4.3572,8.2641 4.2105,8.0365 4.1162,7.7858C4.0219,7.5351 3.9823,7.2672 4,7C4,6.7348 3.8946,6.4804 3.7071,6.2929C3.5196,6.1054 3.2652,6 3,6C2.7348,6 2.4804,6.1054 2.2929,6.2929C2.1054,6.4804 2,6.7348 2,7C2.0101,7.694 2.174,8.3771 2.48,9C2.8173,9.6541 3.3481,10.1884 4,10.53V22H7V17H13V22H16V13.87C14.2555,13.7326 12.6174,12.9773 11.38,11.74V11.74Z"/>
</vector>
7 changes: 7 additions & 0 deletions SHAPEUP2022/app/src/main/res/drawable/ic_icon_todo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector android:height="25dp" android:viewportHeight="20"
android:viewportWidth="20" android:width="25dp" xmlns:android="http://schemas.android.com/apk/res/android">
<group>
<clip-path android:pathData="M0,0h20v20h-20z"/>
<path android:fillColor="#FF9966" android:pathData="M2.5,19.375C2.4999,19.4835 2.5281,19.5902 2.5818,19.6845C2.6355,19.7789 2.7128,19.8576 2.8061,19.913C2.8995,19.9684 3.0056,19.9985 3.1141,20.0004C3.2227,20.0022 3.3298,19.9758 3.425,19.9238L10,16.3363L16.575,19.9238C16.6702,19.9758 16.7774,20.0022 16.8859,20.0004C16.9944,19.9985 17.1005,19.9684 17.1939,19.913C17.2872,19.8576 17.3645,19.7789 17.4182,19.6845C17.4719,19.5902 17.5001,19.4835 17.5,19.375V2.5C17.5,1.837 17.2366,1.2011 16.7678,0.7322C16.2989,0.2634 15.663,0 15,0L5,0C4.337,0 3.7011,0.2634 3.2322,0.7322C2.7634,1.2011 2.5,1.837 2.5,2.5V19.375ZM10,5.5125C11.7337,3.7313 16.0675,6.85 10,10.8588C3.9325,6.85 8.2662,3.7325 10,5.515V5.5125Z"/>
</group>
</vector>
51 changes: 51 additions & 0 deletions SHAPEUP2022/app/src/main/res/layout/activity_my_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,56 @@


</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<!--Tab bar-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<ImageButton
android:id="@+id/nav_home"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_icon_home"/>

<ImageButton
android:id="@+id/nav_todo"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_todo"/>

<ImageButton
android:id="@+id/nav_simulation"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_simulation"/>

<ImageButton
android:id="@+id/nav_map"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_map"/>

<ImageButton
android:id="@+id/nav_mypage"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_mypage"/>
</LinearLayout>


</LinearLayout>
46 changes: 46 additions & 0 deletions SHAPEUP2022/app/src/main/res/layout/activity_to_do.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,50 @@
android:gravity="center"
android:text="여백..."
android:layout_weight="1" />
<!--Tab bar-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<ImageButton
android:id="@+id/nav_home"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_icon_home"/>

<ImageButton
android:id="@+id/nav_todo"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_todo"/>

<ImageButton
android:id="@+id/nav_simulation"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_simulation"/>

<ImageButton
android:id="@+id/nav_map"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_map"/>

<ImageButton
android:id="@+id/nav_mypage"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="60dp"
android:backgroundTint="#00001111"
android:src="@drawable/ic_icon_mypage"/>
</LinearLayout>
</LinearLayout>
Loading

0 comments on commit 1cba278

Please sign in to comment.