Update to JDK 17, Gradle 7.3.3 & Android Gradle Plugin 7.1.0

Signed-off-by: psavarmattas <puranjaysavarmattas@gmail.com>
This commit is contained in:
2022-01-26 17:29:24 +05:30
parent 63f6cbaabf
commit 93a9a75e94
12 changed files with 46 additions and 24 deletions

View File

@@ -7,19 +7,19 @@ android {
compileSdk 32
defaultConfig {
applicationId "com.example.chatcom"
applicationId 'com.psmforums.chatcom'
minSdk 21
targetSdk 32
versionCode 1
versionName '0.0.1'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.debug
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debug {
signingConfig signingConfigs.debug
}
}
compileOptions {
@@ -29,6 +29,8 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
buildToolsVersion '32.0.0'
ndkVersion '23.1.7779620'
}
dependencies {
@@ -38,7 +40,7 @@ dependencies {
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@@ -8,34 +8,41 @@ import androidx.fragment.app.FragmentActivity
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.example.chatcom.mainScreens.Chats
import com.example.chatcom.mainScreens.Contacts
import com.example.chatcom.mainScreens.Settings
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
class MainActivity : AppCompatActivity() {
private lateinit var viewPager2: ViewPager2
private lateinit var tabLayout : TabLayout
private lateinit var toolbar: androidx.appcompat.widget.Toolbar
private lateinit var appPagerAdapter: AppPagerAdapter
private var titles = arrayListOf("Chats","Contacts","Settings")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
toolbar = findViewById(R.id.toolbarMain)
tabLayout = findViewById(R.id.tabLayoutMain)
viewPager2 = findViewById(R.id.viewPager2Main)
toolbar.title = "ChatCom"
setSupportActionBar(toolbar)
appPagerAdapter = AppPagerAdapter( this)
viewPager2.adapter = appPagerAdapter
TabLayoutMediator(tabLayout,viewPager2){
tab,position->
tab.text = titles[position]
}.attach()
}
class AppPagerAdapter(fragmentActivity: FragmentActivity):FragmentStateAdapter(fragmentActivity)
{
class AppPagerAdapter(fragmentActivity: FragmentActivity):FragmentStateAdapter(fragmentActivity) {
override fun getItemCount(): Int {
return 3
}
@@ -43,13 +50,12 @@ class MainActivity : AppCompatActivity() {
override fun createFragment(position: Int): Fragment {
return when(position)
{
0->Chats()
2->Contacts()
3->Settings()
0-> Chats()
2-> Contacts()
3-> Settings()
else -> Chats()
}
}
}
}

View File

@@ -1,10 +1,11 @@
package com.example.chatcom
package com.example.chatcom.mainScreens
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.chatcom.R
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER

View File

@@ -1,10 +1,11 @@
package com.example.chatcom
package com.example.chatcom.mainScreens
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.chatcom.R
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER

View File

@@ -1,10 +1,11 @@
package com.example.chatcom
package com.example.chatcom.mainScreens
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.chatcom.R
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Chats">
tools:context=".mainScreens.Chats">
<!-- TODO: Update blank fragment layout -->
<TextView

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Contacts">
tools:context=".mainScreens.Contacts">
<!-- TODO: Update blank fragment layout -->
<TextView

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Settings">
tools:context=".mainScreens.Settings">
<!-- TODO: Update blank fragment layout -->
<TextView