Skip to content

Homework4 Забыл пул реквест сделать #4

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
viewBinding true
}

buildTypes {
release {
minifyEnabled false
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/itis/androidlabproject/HomeFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.itis.androidlabproject

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment

class HomeFragment : Fragment(R.layout.fragment_home) {

}
6 changes: 6 additions & 0 deletions app/src/main/java/com/itis/androidlabproject/LikeFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.itis.androidlabproject

import androidx.fragment.app.Fragment

class LikeFragment : Fragment(R.layout.fragment_like) {
}
49 changes: 47 additions & 2 deletions app/src/main/java/com/itis/androidlabproject/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,55 @@ package com.itis.androidlabproject

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.provider.ContactsContract
import androidx.fragment.app.Fragment
import com.itis.androidlabproject.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater).also {
setContentView(it.root)
}

supportFragmentManager.beginTransaction().run {
add(R.id.frame_layout, HomeFragment())
addToBackStack("home")
commit()
}

with(binding) {
navbarBtnHome.setOnClickListener {
replaceFragment(HomeFragment())
}
navbarBtnSearch.setOnClickListener {
replaceFragment(SearchFragment())
}
navbarBtnReels.setOnClickListener {
replaceFragment(ReelsFragment())
}
navbarBtnLike.setOnClickListener {
replaceFragment(LikeFragment())
}
navbarBtnProfile.setOnClickListener {
replaceFragment(ProfileFragment())
}
}
}

private fun replaceFragment(fragment: Fragment) {
supportFragmentManager.beginTransaction().run {
addToBackStack(fragment.javaClass.toString())
setCustomAnimations(
R.anim.enter_from_right,
R.anim.exit_to_left,
R.anim.enter_from_left,
R.anim.exit_to_right
)
commit()
replace(R.id.frame_layout, fragment)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.itis.androidlabproject

import androidx.fragment.app.Fragment

class ProfileFragment :Fragment(R.layout.fragment_profile){

}
7 changes: 7 additions & 0 deletions app/src/main/java/com/itis/androidlabproject/ReelsFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.itis.androidlabproject

import androidx.fragment.app.Fragment

class ReelsFragment : Fragment(R.layout.fragment_reels) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.itis.androidlabproject

import androidx.fragment.app.Fragment

class SearchFragment : Fragment(R.layout.fragment_search) {

}
8 changes: 8 additions & 0 deletions app/src/main/res/anim/enter_from_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="-100%p" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
8 changes: 8 additions & 0 deletions app/src/main/res/anim/enter_from_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="100%p" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
8 changes: 8 additions & 0 deletions app/src/main/res/anim/exit_to_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="-100%p"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
8 changes: 8 additions & 0 deletions app/src/main/res/anim/exit_to_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="100%p"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_all_media.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M4,8h4L8,4L4,4v4zM10,20h4v-4h-4v4zM4,20h4v-4L4,16v4zM4,14h4v-4L4,10v4zM10,14h4v-4h-4v4zM16,4v4h4L20,4h-4zM10,8h4L14,4h-4v4zM16,14h4v-4h-4v4zM16,20h4v-4h-4v4z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_avatarka.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2L5,3c-1.11,0 -2,0.9 -2,2zM15,9c0,1.66 -1.34,3 -3,3s-3,-1.34 -3,-3 1.34,-3 3,-3 3,1.34 3,3zM6,17c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v1L6,18v-1z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,5.69l5,4.5V18h-2v-6H9v6H7v-7.81l5,-4.5M12,3L2,12h3v8h6v-6h2v6h6v-8h3L12,3z"/>
</vector>
22 changes: 22 additions & 0 deletions app/src/main/res/drawable/ic_like.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M7.5,14h1v3H10v-3h1v4.5h1.5v-5c0,-0.55 -0.45,-1 -1,-1H7c-0.55,0 -1,0.45 -1,1v5h1.5V14z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M13.5,18.5H15V17h2c0.55,0 1,-0.45 1,-1v-2.5c0,-0.55 -0.45,-1 -1,-1h-3.5V18.5zM15,14h1.5v1.5H15V14z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M19,3H5C3.9,3 3,3.9 3,5v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5C21,3.9 20.1,3 19,3zM19,19H5V5h14V19z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M8.5,11.5l1.5,0l0,-6l-3,0l0,1.5l1.5,0z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M16.5,10h-3V9h2c0.55,0 1,-0.45 1,-1V6.5c0,-0.55 -0.45,-1 -1,-1H12V7h3v1h-2c-0.55,0 -1,0.45 -1,1v2.5h4.5V10z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_more.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_reels.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path
android:fillColor="@android:color/white"
android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>
59 changes: 53 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,60 @@
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/navbar_btn_home"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageButton
android:id="@+id/navbar_btn_home"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Hello World!"
android:src="@drawable/ic_home"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintEnd_toStartOf="@id/navbar_btn_search"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/frame_layout" />

<ImageButton
android:id="@+id/navbar_btn_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@id/navbar_btn_home"
app:layout_constraintEnd_toStartOf="@id/navbar_btn_reels"
app:layout_constraintStart_toEndOf="@id/navbar_btn_home" />

<ImageButton
android:id="@+id/navbar_btn_reels"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_reels"
app:layout_constraintBottom_toBottomOf="@id/navbar_btn_home"
app:layout_constraintEnd_toStartOf="@id/navbar_btn_like"
app:layout_constraintStart_toEndOf="@id/navbar_btn_search" />

<ImageButton
android:id="@+id/navbar_btn_like"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_like"
app:layout_constraintBottom_toBottomOf="@id/navbar_btn_home"
app:layout_constraintEnd_toStartOf="@id/navbar_btn_profile"
app:layout_constraintStart_toEndOf="@id/navbar_btn_reels" />

<ImageButton
android:id="@+id/navbar_btn_profile"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_avatarka"
app:layout_constraintBottom_toBottomOf="@id/navbar_btn_home"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/navbar_btn_like" />

</androidx.constraintlayout.widget.ConstraintLayout>
20 changes: 20 additions & 0 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeFragment">

<TextView
android:id="@+id/tv_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:textAllCaps="true"
android:textSize="50sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
21 changes: 21 additions & 0 deletions app/src/main/res/layout/fragment_like.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LikeFragment">

<TextView
android:id="@+id/tv_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Like"
android:textAllCaps="true"
android:textSize="50sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
21 changes: 21 additions & 0 deletions app/src/main/res/layout/fragment_profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ProfileFragment">

<TextView
android:id="@+id/tv_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Profile"
android:textAllCaps="true"
android:textSize="50sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading