lab2
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
6
.idea/compiler.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\ankav\.android\avd\Pixel_6_API_31.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-10-03T08:08:19.409182700Z" />
|
||||
</component>
|
||||
</project>
|
20
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="jbr-17" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
41
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,41 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
6
.idea/kotlinc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.8.10" />
|
||||
</component>
|
||||
</project>
|
9
.idea/misc.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
75
app/build.gradle.kts
Normal file
@ -0,0 +1,75 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.pmulabs"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.example.pmulabs"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.4.3"
|
||||
}
|
||||
packaging {
|
||||
resources {
|
||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation("androidx.core:core-ktx:1.9.0")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
|
||||
implementation("androidx.activity:activity-compose:1.7.2")
|
||||
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.ui:ui-graphics")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
implementation("androidx.compose.material3:material3:1.2.0-alpha08")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview-android:1.5.2")
|
||||
implementation("androidx.leanback:leanback:1.0.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||
implementation("androidx.compose.material:material-icons-extended")
|
||||
implementation("androidx.navigation:navigation-compose:2.6.0")
|
||||
implementation("androidx.navigation:navigation-compose:2.4.0-alpha10")
|
||||
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,24 @@
|
||||
package com.example.pmulabs
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.pmulabs", appContext.packageName)
|
||||
}
|
||||
}
|
28
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.PMULabs"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.PMULabs">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
24
app/src/main/java/com/example/pmulabs/MainActivity.kt
Normal file
@ -0,0 +1,24 @@
|
||||
package com.example.pmulabs
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.viewModels
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.example.pmulabs.designElem.SearchViewModel
|
||||
import com.example.pmulabs.designElem.SharedViewModel
|
||||
import com.example.pmulabs.graphs.RootNavigationGraph
|
||||
import com.example.pmulabs.ui.theme.PMULabsTheme
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private val searchViewModel: SearchViewModel by viewModels()
|
||||
private val sharedViewModel: SharedViewModel by viewModels()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
PMULabsTheme {
|
||||
RootNavigationGraph(navController = rememberNavController(),searchViewModel, sharedViewModel = sharedViewModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.example.pmulabs.basecomponents.navigate
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
@Composable
|
||||
fun BackButton(modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 80.dp)
|
||||
.requiredHeight(height = 30.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 80.dp)
|
||||
.requiredHeight(height = 30.dp)
|
||||
.clip(shape = RoundedCornerShape(6.dp))
|
||||
.background(color = Color(0xff423a99)))
|
||||
Text(
|
||||
text = "Back",
|
||||
color = Color.White,
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 17.dp,
|
||||
y = 3.dp))
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,87 @@
|
||||
package com.example.pmulabs.basecomponents.navigate
|
||||
|
||||
import com.example.pmulabs.R
|
||||
|
||||
const val SEARCH_ARGUMENT_TEXT="text"
|
||||
const val CALENDAR_ARGUMENT_DATE="date"
|
||||
const val SEARCHBYTAG_ARGUMENT_KEY="id"
|
||||
const val ARTICLE_ARGUMENT_KEY="id"
|
||||
|
||||
sealed class BottomBarScreen(
|
||||
val route: String,
|
||||
val title: String,
|
||||
val icon: Int,
|
||||
val iconFocused: Int
|
||||
|
||||
){
|
||||
object Profile: BottomBarScreen(
|
||||
route = "PROFILE",
|
||||
title="Me",
|
||||
icon= R.drawable.ic_bottom_profile,
|
||||
iconFocused=R.drawable.ic_bottom_profile_focused
|
||||
)
|
||||
object Categories: BottomBarScreen(
|
||||
route = "CATEGORIES",
|
||||
title="Tags",
|
||||
icon= R.drawable.ic_bottom_categories,
|
||||
iconFocused=R.drawable.ic_bottom_categories_focused
|
||||
)
|
||||
object Main: BottomBarScreen(
|
||||
route = "MAIN",
|
||||
title="Main",
|
||||
icon= R.drawable.ic_bottom_main,
|
||||
iconFocused=R.drawable.ic_bottom_main_focused
|
||||
)
|
||||
object ArticlePage: BottomBarScreen(
|
||||
route = "ARTICLEPAGE/{$ARTICLE_ARGUMENT_KEY}",
|
||||
title="Article",
|
||||
icon= R.drawable.ic_bottom_main,
|
||||
iconFocused=R.drawable.ic_bottom_main_focused
|
||||
){
|
||||
fun passId(id: String): String{
|
||||
return "ARTICLEPAGE/$id"
|
||||
}
|
||||
}
|
||||
object Search: BottomBarScreen(
|
||||
route = "SEARCH/{$SEARCH_ARGUMENT_TEXT}",
|
||||
title="Search",
|
||||
icon= R.drawable.ic_bottom_main,
|
||||
iconFocused=R.drawable.ic_bottom_main_focused
|
||||
){
|
||||
fun passText(text: String): String{
|
||||
return "SEARCH/$text"
|
||||
}
|
||||
}
|
||||
object Calendar: BottomBarScreen(
|
||||
route = "CALENDAR/{$CALENDAR_ARGUMENT_DATE}",
|
||||
title="Calendar",
|
||||
icon= R.drawable.ic_bottom_main,
|
||||
iconFocused=R.drawable.ic_bottom_main_focused
|
||||
){
|
||||
fun passDate(date: String): String{
|
||||
return "CALENDAR/$date"
|
||||
}
|
||||
}
|
||||
object SearchByTag: BottomBarScreen(
|
||||
route = "SEARCHBYTAG/{$SEARCHBYTAG_ARGUMENT_KEY}",
|
||||
title="SEARCHBYTAG",
|
||||
icon= R.drawable.ic_bottom_main,
|
||||
iconFocused=R.drawable.ic_bottom_main_focused
|
||||
){
|
||||
fun passId(id: String): String{
|
||||
return "SEARCHBYTAG/$id"
|
||||
}
|
||||
}
|
||||
object Cooperation: BottomBarScreen(
|
||||
route = "COOPERATION",
|
||||
title="Coop",
|
||||
icon= R.drawable.ic_bottom_cooperation,
|
||||
iconFocused=R.drawable.ic_bottom_cooperation_focused
|
||||
)
|
||||
object Info: BottomBarScreen(
|
||||
route = "INFO",
|
||||
title="Info",
|
||||
icon= R.drawable.ic_bottom_info,
|
||||
iconFocused=R.drawable.ic_bottom_info_focused
|
||||
)
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.example.pmulabs.basecomponents.navigate
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun EmailTextField(email: String, onEmailChange: (String) -> Unit) {
|
||||
TextField(
|
||||
value = email,
|
||||
onValueChange = {
|
||||
onEmailChange(it)
|
||||
},
|
||||
colors = TextFieldDefaults.textFieldColors(
|
||||
containerColor = Color.White
|
||||
),
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 269.dp)
|
||||
.requiredHeight(height = 53.dp)
|
||||
.shadow(shape = RoundedCornerShape(40.dp), elevation = 5.dp)
|
||||
.clip(shape = RoundedCornerShape(40.dp)),
|
||||
label = { Text("Email") },
|
||||
placeholder = { Text("Email") },
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),
|
||||
singleLine = true,
|
||||
)
|
||||
}
|
||||
|
||||
fun isValidEmail(email: String): Boolean {
|
||||
val emailRegex = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+".toRegex()
|
||||
return email.matches(emailRegex)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ValidateEmail(email: String, onEmailChange: (String) -> Unit) {
|
||||
|
||||
Column (modifier = Modifier.padding(16.dp)) {
|
||||
EmailTextField(email = email, onEmailChange = { onEmailChange(it)})
|
||||
|
||||
if (email.isNotEmpty()) {
|
||||
if (isValidEmail(email)) {
|
||||
Text(text = "Email is valid", color = Color(0xFF5D925E))
|
||||
} else {
|
||||
Text(text = "Email is not valid", color = Color(0xFF94474D))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
191
app/src/main/java/com/example/pmulabs/designElem/ArticleItem.kt
Normal file
@ -0,0 +1,191 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.example.pmulabs.R
|
||||
import com.example.pmulabs.models.Article
|
||||
import com.example.pmulabs.repository.CommentRepository
|
||||
import com.example.pmulabs.repository.TegRepository
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
@Composable
|
||||
fun ArticleItem(article: Article,modifier: Modifier = Modifier,onArticleClick: () -> Unit) {
|
||||
|
||||
val tagRepository= TegRepository()
|
||||
val getAllData= tagRepository.getAllData()
|
||||
val commRepository= CommentRepository()
|
||||
val countComm= commRepository.getCountComment(article.id)
|
||||
val formatter = SimpleDateFormat("dd.MM.YY")
|
||||
val publishDate=formatter.format(article.publishDate)
|
||||
var tagName=""
|
||||
getAllData.forEach{teg ->
|
||||
if(article.tagId == teg.id){
|
||||
tagName=teg.title
|
||||
}
|
||||
}
|
||||
|
||||
Card(
|
||||
colors = CardDefaults.outlinedCardColors(
|
||||
containerColor = Color.White,
|
||||
contentColor = Color(0xff423a99)
|
||||
),
|
||||
border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
modifier = modifier
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.clickable{onArticleClick()}
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 199.dp)
|
||||
) {
|
||||
Card(
|
||||
colors = CardDefaults.outlinedCardColors(
|
||||
containerColor = Color.White
|
||||
),
|
||||
border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
content = {},
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 199.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.background(color = Color.White)
|
||||
.border(border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)))
|
||||
LazyRow(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 387.dp)
|
||||
.requiredHeight(height = 199.dp)
|
||||
) {
|
||||
item {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.image2),
|
||||
contentDescription = "image 2",
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 180.dp)
|
||||
.requiredHeight(height = 199.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.border(border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)))
|
||||
}
|
||||
item {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 5.dp,
|
||||
y = 8.dp)
|
||||
.requiredWidth(width = 201.dp)
|
||||
.requiredHeight(height = 177.dp)
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 201.dp)
|
||||
.requiredHeight(height = 150.dp)
|
||||
) {
|
||||
item {
|
||||
LazyRow(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 150.dp)
|
||||
.requiredHeight(height = 20.dp)
|
||||
) {
|
||||
item {
|
||||
Text(
|
||||
text = "${publishDate}",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp))
|
||||
}
|
||||
item {
|
||||
Text(
|
||||
text = "#${tagName}",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp),
|
||||
modifier = Modifier
|
||||
//.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 12.dp,
|
||||
y = 0.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
item {
|
||||
Text(
|
||||
text = "${article.title}",
|
||||
maxLines=4,
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
//.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.dp,
|
||||
y = 15.dp)
|
||||
.requiredWidth(width = 201.dp)
|
||||
.requiredHeight(height = 100.dp))
|
||||
}
|
||||
}
|
||||
LazyRow(
|
||||
modifier = Modifier
|
||||
//.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 3.dp,
|
||||
y = 5.dp)
|
||||
.requiredWidth(width = 80.dp)
|
||||
.requiredHeight(height = 25.dp)
|
||||
) {
|
||||
item {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 58.dp)
|
||||
.requiredHeight(height = 22.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ic_comment),
|
||||
contentDescription = "icon \"heart\"",
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 25.dp)
|
||||
.requiredHeight(height = 22.dp))
|
||||
Text(
|
||||
text = "${countComm}",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp),
|
||||
modifier = Modifier
|
||||
//.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 5.dp,
|
||||
y = 1.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
132
app/src/main/java/com/example/pmulabs/designElem/BottomBar.kt
Normal file
@ -0,0 +1,132 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.NavDestination.Companion.hierarchy
|
||||
import androidx.navigation.NavGraph.Companion.findStartDestination
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import com.example.pmulabs.basecomponents.navigate.BottomBarScreen
|
||||
|
||||
@Composable
|
||||
fun BottomBar(navController: NavHostController){
|
||||
val screens = listOf(
|
||||
BottomBarScreen.Profile,
|
||||
BottomBarScreen.Categories,
|
||||
BottomBarScreen.Main,
|
||||
BottomBarScreen.Cooperation,
|
||||
BottomBarScreen.Info
|
||||
)
|
||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||
val currentDestination=navBackStackEntry?.destination
|
||||
val bottomBarDestination=screens.any{ it.route==currentDestination?.route }
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(start = 17.dp, end = 17.dp, top = 8.dp, bottom = 8.dp)
|
||||
.background(Color.Transparent),
|
||||
horizontalArrangement = Arrangement.SpaceEvenly,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (bottomBarDestination) {
|
||||
NavigationBar(
|
||||
containerColor = Color(0xFFDBDBF1),
|
||||
modifier = Modifier
|
||||
.height(40.dp)
|
||||
.clip(shape = RoundedCornerShape(20.dp))
|
||||
) {
|
||||
screens.forEach { screen ->
|
||||
AddItem(
|
||||
screen = screen,
|
||||
currentDestination = currentDestination,
|
||||
navController = navController
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun RowScope.AddItem(
|
||||
screen: BottomBarScreen,
|
||||
currentDestination: NavDestination?,
|
||||
navController: NavController
|
||||
){
|
||||
val selected = currentDestination?.hierarchy?.any { it.route == screen.route } == true
|
||||
|
||||
val background = if (selected) Color(0xff423a99) else Color.Transparent
|
||||
|
||||
val contentColor =
|
||||
if (selected) Color.White else Color(0xff423a99)
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(background)
|
||||
.clickable(onClick = {
|
||||
navController.navigate(screen.route) {
|
||||
popUpTo(navController.graph.findStartDestination().id)
|
||||
launchSingleTop = true
|
||||
}
|
||||
})
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(start = 17.dp, end = 17.dp, top = 8.dp, bottom = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp)
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = if (selected) screen.iconFocused else screen.icon),
|
||||
contentDescription = "icon",
|
||||
tint = Color.Unspecified
|
||||
)
|
||||
AnimatedVisibility(visible = selected) {
|
||||
Text(
|
||||
text = screen.title,
|
||||
color = contentColor
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*NavigationBarItem(
|
||||
label = {
|
||||
Text(text=screen.title, color = Color(0xff423a99))
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(id = screen.icon),
|
||||
tint = Color.Unspecified,
|
||||
contentDescription = "navigation icon")
|
||||
},
|
||||
selected = selected,
|
||||
onClick = {
|
||||
navController.navigate(screen.route)
|
||||
}
|
||||
|
||||
)*/
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.example.pmulabs.models.Comment
|
||||
import com.example.pmulabs.repository.UserRepository
|
||||
|
||||
@Composable
|
||||
fun CommentItem(modifier: Modifier = Modifier,comm : Comment) {
|
||||
|
||||
val userRep= UserRepository()
|
||||
val user=userRep.getUserById(comm.userId.toString())
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 376.dp)
|
||||
.requiredHeight(height = 105.dp)
|
||||
.offset(
|
||||
y=10.dp
|
||||
)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 376.dp)
|
||||
.requiredHeight(height = 87.dp)
|
||||
.clip(shape = RoundedCornerShape(10.dp))
|
||||
.background(color = Color.White)
|
||||
.border(border = BorderStroke(3.dp, Color(0xff423a99)),
|
||||
shape = RoundedCornerShape(10.dp)))
|
||||
HorizontalDivider(
|
||||
thickness=3.dp,
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 1.dp,
|
||||
y = 31.dp)
|
||||
.requiredWidth(width = 374.dp), color = Color(0xff423a99)
|
||||
)
|
||||
Text(
|
||||
text = "${user.nickname}",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 13.dp,
|
||||
y = 7.dp))
|
||||
Text(
|
||||
text = "${comm.text}",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 13.dp,
|
||||
y = 36.dp))
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
|
||||
@Composable
|
||||
fun LeftCircles(modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 250.dp)
|
||||
.requiredHeight(height = 290.dp)
|
||||
.rotate(degrees = -13.96f)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 166.4320068359375.dp,
|
||||
y = 30.8746337890625.dp)
|
||||
.requiredWidth(width = 122.dp)
|
||||
.requiredHeight(height = 115.dp)
|
||||
.clip(shape = CircleShape)
|
||||
.background(color = Color(0xff423a99).copy(alpha = 0.7f)))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = (-0.000030517578125).dp,
|
||||
y = 145.57101440429688.dp)
|
||||
.requiredWidth(width = 144.dp)
|
||||
.requiredHeight(height = 140.dp)
|
||||
.clip(shape = CircleShape)
|
||||
.background(color = Color(0xff423a99).copy(alpha = 0.7f)))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 74.10296630859375.dp,
|
||||
y = 48.450347900390625.dp)
|
||||
.requiredSize(size = 155.dp)
|
||||
.clip(shape = CircleShape)
|
||||
.background(color = Color(0xffb7b7e3).copy(alpha = 0.5f)))
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 250, heightDp = 290)
|
||||
@Composable
|
||||
private fun LeftCirclesPreview() {
|
||||
LeftCircles(Modifier)
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.example.pmulabs.R
|
||||
|
||||
@Composable
|
||||
fun LogoMobile(modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 250.dp)
|
||||
.requiredHeight(height = 138.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ellipse7),
|
||||
contentDescription = "Ellipse 7",
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.requiredHeight(height = 115.dp)
|
||||
)
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ixbtcom_colored_logo1),
|
||||
contentDescription = "IXBT.com_colored_logo 1",
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.dp,
|
||||
y = 0.dp)
|
||||
.fillMaxWidth()
|
||||
.requiredHeight(height = 113.dp))
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 250, heightDp = 138)
|
||||
@Composable
|
||||
private fun LogoMobilePreview() {
|
||||
LogoMobile(Modifier)
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun RightCircles(modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 355.dp)
|
||||
.requiredHeight(height = 267.dp)
|
||||
.rotate(degrees = -6.33f)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 171.71197509765625.dp,
|
||||
y = 17.979248046875.dp)
|
||||
.requiredWidth(width = 192.dp)
|
||||
.requiredHeight(height = 179.dp)
|
||||
.clip(shape = CircleShape)
|
||||
.background(color = Color(0xff423a99).copy(alpha = 0.7f)))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 86.4691162109375.dp,
|
||||
y = 75.193603515625.dp)
|
||||
.requiredSize(size = 201.dp)
|
||||
.clip(shape = CircleShape)
|
||||
.background(color = Color(0xff423a99).copy(alpha = 0.7f)))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.7720947265625.dp,
|
||||
y = 122.24951171875.dp)
|
||||
.requiredSize(size = 137.dp)
|
||||
.clip(shape = CircleShape)
|
||||
.background(color = Color(0xffb7b7e3).copy(alpha = 0.5f)))
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 355, heightDp = 267)
|
||||
@Composable
|
||||
private fun RightCirclesPreview() {
|
||||
RightCircles(Modifier)
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.example.pmulabs.screensMobile.MainScreen
|
||||
|
||||
class SearchViewModel : ViewModel() {
|
||||
|
||||
private val _searchWidgetState: MutableState<SearchWidget> =
|
||||
mutableStateOf(value = SearchWidget.CLOSED)
|
||||
|
||||
val searchWidgetState: State<SearchWidget> = _searchWidgetState
|
||||
|
||||
private val _searchTextState: MutableState<String> =
|
||||
mutableStateOf(value = "")
|
||||
|
||||
val searchTextState: State<String> = _searchTextState
|
||||
|
||||
fun updateSearchWidgetState(newValue: SearchWidget) {
|
||||
_searchWidgetState.value = newValue
|
||||
}
|
||||
|
||||
fun updateSearchTextState(newValue: String) {
|
||||
_searchTextState.value = newValue
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
enum class SearchWidget {
|
||||
OPENED,
|
||||
CLOSED
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class SharedViewModel : ViewModel() {
|
||||
val argument = mutableStateOf<String?>(null)
|
||||
|
||||
fun setArgument(arg: String) {
|
||||
argument.value = arg
|
||||
}
|
||||
}
|
63
app/src/main/java/com/example/pmulabs/designElem/TagItem.kt
Normal file
@ -0,0 +1,63 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.example.pmulabs.R
|
||||
import com.example.pmulabs.models.Teg
|
||||
|
||||
@Composable
|
||||
fun TagItem(teg: Teg, modifier: Modifier = Modifier,onTagClick: () -> Unit) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 365.dp)
|
||||
.requiredHeight(height = 58.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 365.dp)
|
||||
.requiredHeight(height = 58.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xFFDBDBF1))
|
||||
.clickable { onTagClick() }
|
||||
)
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.iconhashtag1),
|
||||
tint= Color(0xff423a99),
|
||||
contentDescription = "icon \"hashtag 1\"",
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 20.dp,
|
||||
y = 14.dp)
|
||||
.requiredWidth(width = 31.dp)
|
||||
.requiredHeight(height = 29.dp))
|
||||
Text(
|
||||
text = "${teg.title}",
|
||||
color = Color(0xff423a99),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 64.dp,
|
||||
y = 14.dp))
|
||||
}
|
||||
}
|
155
app/src/main/java/com/example/pmulabs/designElem/TopBar.kt
Normal file
@ -0,0 +1,155 @@
|
||||
package com.example.pmulabs.designElem
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.CalendarToday
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.example.pmulabs.R
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun TopBar(onSearchClicked:() -> Unit, onCalendarClicked: () -> Unit) {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.smallTopAppBarColors(containerColor = Color(0xff423a99) ),
|
||||
title = {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ellipse7),
|
||||
contentDescription = "Ellipse 7",
|
||||
modifier = Modifier
|
||||
.requiredHeight(height = 62.dp)
|
||||
)
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ixbtcom_colored_logo1),
|
||||
contentDescription = "IXBT.com_colored_logo 1",
|
||||
modifier = Modifier
|
||||
.offset(
|
||||
x = 4.dp,
|
||||
y = 0.dp
|
||||
)
|
||||
.requiredHeight(height = 60.dp)
|
||||
)
|
||||
},
|
||||
actions = {
|
||||
IconButton(onClick = { onSearchClicked() }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Search,
|
||||
contentDescription = "Search Icon",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
IconButton(onClick = { onCalendarClicked() }) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.CalendarToday,
|
||||
contentDescription = "Calendar Icon",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun SearchAppBar(
|
||||
text: String,
|
||||
onTextChange: (String) -> Unit,
|
||||
onCloseClicked: () -> Unit,
|
||||
onSearchClicked: (String) -> Unit
|
||||
){
|
||||
Surface(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(62.dp),
|
||||
color = Color(0xff423a99)
|
||||
) {
|
||||
TextField(
|
||||
colors=TextFieldDefaults.textFieldColors(
|
||||
Color.White, containerColor = Color(0xff423a99)
|
||||
),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
value=text,
|
||||
onValueChange={
|
||||
onTextChange(it)
|
||||
},
|
||||
placeholder = {
|
||||
Text(
|
||||
text ="Search...",
|
||||
color = Color.White
|
||||
)
|
||||
},
|
||||
textStyle = TextStyle(
|
||||
fontSize = MaterialTheme.typography.titleMedium.fontSize
|
||||
),
|
||||
singleLine = true,
|
||||
leadingIcon = {
|
||||
IconButton(
|
||||
onClick = { }
|
||||
) {
|
||||
Icon(imageVector = Icons.Default.Search,
|
||||
contentDescription = "Search Icon",
|
||||
tint = Color.White)
|
||||
}
|
||||
},
|
||||
trailingIcon = {
|
||||
IconButton(
|
||||
onClick = {
|
||||
if(text.isNotEmpty()){
|
||||
onTextChange("")
|
||||
}else{
|
||||
onCloseClicked()
|
||||
}
|
||||
}
|
||||
) {
|
||||
Icon(imageVector = Icons.Default.Close,
|
||||
contentDescription = "Close Icon",
|
||||
tint = Color.White)
|
||||
}
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(
|
||||
imeAction = ImeAction.Search,
|
||||
),
|
||||
keyboardActions = KeyboardActions(
|
||||
onSearch = {
|
||||
onSearchClicked(text)
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun TopBarPreview(){
|
||||
TopBar(onSearchClicked = {},onCalendarClicked = {})
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun SearchBarPreview(){
|
||||
SearchAppBar(text = "вапвапв", onSearchClicked = {}, onCloseClicked = {}, onTextChange = {})
|
||||
}
|
34
app/src/main/java/com/example/pmulabs/graphs/AuthNavGraph.kt
Normal file
@ -0,0 +1,34 @@
|
||||
package com.example.pmulabs.graphs
|
||||
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navigation
|
||||
import com.example.pmulabs.designElem.SharedViewModel
|
||||
import com.example.pmulabs.screensMobile.EntryScreen
|
||||
import com.example.pmulabs.screensMobile.RegisterScreen
|
||||
import com.example.pmulabs.screensMobile.SplashScreen
|
||||
|
||||
fun NavGraphBuilder.authNavGraph(navController: NavHostController,sharedViewModel: SharedViewModel){
|
||||
navigation(
|
||||
route=Graph.AUTHENTICATION,
|
||||
startDestination = AuthScreen.Splash.route
|
||||
){
|
||||
composable(route=AuthScreen.Splash.route){
|
||||
SplashScreen(navController = navController, Modifier)
|
||||
}
|
||||
composable(route=AuthScreen.Entry.route){
|
||||
EntryScreen(navController = navController, Modifier,sharedViewModel)
|
||||
}
|
||||
composable(route=AuthScreen.Register.route){
|
||||
RegisterScreen(navController = navController, Modifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed class AuthScreen(val route: String){
|
||||
object Splash : AuthScreen(route = "SPLASH")
|
||||
object Entry : AuthScreen(route = "ENTRY")
|
||||
object Register : AuthScreen(route="REGISTER")
|
||||
}
|
83
app/src/main/java/com/example/pmulabs/graphs/HomeNavGraph.kt
Normal file
@ -0,0 +1,83 @@
|
||||
package com.example.pmulabs.graphs
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navArgument
|
||||
import com.example.pmulabs.basecomponents.navigate.ARTICLE_ARGUMENT_KEY
|
||||
import com.example.pmulabs.basecomponents.navigate.BottomBarScreen
|
||||
import com.example.pmulabs.basecomponents.navigate.CALENDAR_ARGUMENT_DATE
|
||||
import com.example.pmulabs.basecomponents.navigate.SEARCHBYTAG_ARGUMENT_KEY
|
||||
import com.example.pmulabs.basecomponents.navigate.SEARCH_ARGUMENT_TEXT
|
||||
import com.example.pmulabs.designElem.SharedViewModel
|
||||
import com.example.pmulabs.screensMobile.ArticlePageScreen
|
||||
import com.example.pmulabs.screensMobile.CalendarScreen
|
||||
import com.example.pmulabs.screensMobile.CoopScreen
|
||||
import com.example.pmulabs.screensMobile.InfoScreen
|
||||
import com.example.pmulabs.screensMobile.MainScreen
|
||||
import com.example.pmulabs.screensMobile.ProfileScreen
|
||||
import com.example.pmulabs.screensMobile.SearchByTagScreen
|
||||
import com.example.pmulabs.screensMobile.SearchScreen
|
||||
import com.example.pmulabs.screensMobile.TagsScreen
|
||||
|
||||
@Composable
|
||||
fun HomeNavGraph(navController: NavHostController,sharedViewModel: SharedViewModel){
|
||||
NavHost(
|
||||
navController = navController,
|
||||
route = Graph.MAIN,
|
||||
startDestination = BottomBarScreen.Main.route
|
||||
){
|
||||
composable(
|
||||
route=BottomBarScreen.Main.route
|
||||
){
|
||||
MainScreen(navController,Modifier)
|
||||
}
|
||||
composable(
|
||||
route=BottomBarScreen.SearchByTag.route,
|
||||
arguments = listOf(navArgument(SEARCHBYTAG_ARGUMENT_KEY){
|
||||
type= NavType.StringType
|
||||
})
|
||||
){
|
||||
SearchByTagScreen(navController,Modifier)
|
||||
}
|
||||
composable(
|
||||
route=BottomBarScreen.ArticlePage.route,
|
||||
arguments = listOf(navArgument(ARTICLE_ARGUMENT_KEY){
|
||||
type= NavType.StringType
|
||||
})
|
||||
){
|
||||
ArticlePageScreen(navController,Modifier)
|
||||
}
|
||||
composable(
|
||||
route=BottomBarScreen.Search.route,
|
||||
arguments = listOf(navArgument(SEARCH_ARGUMENT_TEXT){
|
||||
type= NavType.StringType
|
||||
})
|
||||
){
|
||||
SearchScreen(navController,Modifier)
|
||||
}
|
||||
composable(
|
||||
route=BottomBarScreen.Calendar.route,
|
||||
arguments = listOf(navArgument(CALENDAR_ARGUMENT_DATE){
|
||||
type= NavType.StringType
|
||||
})
|
||||
){
|
||||
CalendarScreen(navController,Modifier)
|
||||
}
|
||||
composable(route=BottomBarScreen.Profile.route){
|
||||
ProfileScreen(navController,Modifier,sharedViewModel)
|
||||
}
|
||||
composable(route=BottomBarScreen.Info.route){
|
||||
InfoScreen(navController,Modifier)
|
||||
}
|
||||
composable(route=BottomBarScreen.Cooperation.route){
|
||||
CoopScreen(navController,Modifier)
|
||||
}
|
||||
composable(route=BottomBarScreen.Categories.route){
|
||||
TagsScreen(navController,Modifier)
|
||||
}
|
||||
}
|
||||
}
|
39
app/src/main/java/com/example/pmulabs/graphs/RootNavGraph.kt
Normal file
@ -0,0 +1,39 @@
|
||||
package com.example.pmulabs.graphs
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navArgument
|
||||
import com.example.pmulabs.designElem.SearchViewModel
|
||||
import com.example.pmulabs.designElem.SharedViewModel
|
||||
import com.example.pmulabs.screensMobile.LoadScreen
|
||||
|
||||
const val USERID_ARGUMENT="userId"
|
||||
|
||||
@Composable
|
||||
fun RootNavigationGraph(navController: NavHostController,searchViewModel: SearchViewModel, sharedViewModel: SharedViewModel){
|
||||
NavHost(
|
||||
navController=navController,
|
||||
route = Graph.ROOT,
|
||||
startDestination = Graph.AUTHENTICATION
|
||||
){
|
||||
authNavGraph(navController=navController,sharedViewModel)
|
||||
composable(route=Graph.MAIN,
|
||||
arguments = listOf(navArgument(USERID_ARGUMENT){
|
||||
type= NavType.StringType
|
||||
})){
|
||||
LoadScreen(searchViewModel = searchViewModel, sharedViewModel = sharedViewModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Graph{
|
||||
const val ROOT="root_graph"
|
||||
const val AUTHENTICATION="auth_graph"
|
||||
const val MAIN="main_graph/{$USERID_ARGUMENT}"
|
||||
fun passUserId(userId: String): String{
|
||||
return "main_graph/$userId"
|
||||
}
|
||||
}
|
11
app/src/main/java/com/example/pmulabs/models/Article.kt
Normal file
@ -0,0 +1,11 @@
|
||||
package com.example.pmulabs.models
|
||||
|
||||
import java.util.Date
|
||||
|
||||
data class Article(
|
||||
val id: Int,
|
||||
val title: String,
|
||||
val text: String,
|
||||
val publishDate: Date,
|
||||
val tagId: Int
|
||||
)
|
8
app/src/main/java/com/example/pmulabs/models/Comment.kt
Normal file
@ -0,0 +1,8 @@
|
||||
package com.example.pmulabs.models
|
||||
|
||||
data class Comment(
|
||||
val id: Int,
|
||||
val userId: Int,
|
||||
val text: String,
|
||||
val articleId: Int
|
||||
)
|
6
app/src/main/java/com/example/pmulabs/models/Teg.kt
Normal file
@ -0,0 +1,6 @@
|
||||
package com.example.pmulabs.models
|
||||
|
||||
data class Teg(
|
||||
val id: Int,
|
||||
val title: String,
|
||||
)
|
9
app/src/main/java/com/example/pmulabs/models/User.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package com.example.pmulabs.models
|
||||
|
||||
data class User(
|
||||
val id: Int,
|
||||
val nickname: String,
|
||||
val email: String,
|
||||
val password: String,
|
||||
val role: String
|
||||
)
|
@ -0,0 +1,70 @@
|
||||
package com.example.pmulabs.repository
|
||||
|
||||
import com.example.pmulabs.models.Article
|
||||
import java.util.Date
|
||||
|
||||
class ArticleRepository {
|
||||
fun getArticleById(articleId : String): Article {
|
||||
return getAllData()[articleId.toInt()]
|
||||
}
|
||||
fun getAllData(): List<Article>{
|
||||
return listOf(
|
||||
Article(
|
||||
id=0,
|
||||
title = "Заголовок 1",
|
||||
text = "Текст статьи с заголовком 1",
|
||||
publishDate = Date(2023,5,22),
|
||||
tagId=5
|
||||
),
|
||||
Article(
|
||||
id=1,
|
||||
title = "Заголовок 2",
|
||||
text = "Текст статьи с заголовком 2",
|
||||
publishDate = Date(2022,11,13),
|
||||
tagId=1
|
||||
),
|
||||
Article(
|
||||
id=2,
|
||||
title = "Заголовок 3",
|
||||
text = "Текст статьи с заголовком 3",
|
||||
publishDate = Date(2023,5,4),
|
||||
tagId=0
|
||||
),
|
||||
Article(
|
||||
id=3,
|
||||
title = "Заголовок 4",
|
||||
text = "Текст статьи с заголовком 4",
|
||||
publishDate = Date(2023,2,14),
|
||||
tagId=2
|
||||
),
|
||||
Article(
|
||||
id=4,
|
||||
title = "Заголовок 5",
|
||||
text = "Текст статьи с заголовком 5",
|
||||
publishDate = Date(2023,0,19),
|
||||
tagId=3
|
||||
),
|
||||
Article(
|
||||
id=5,
|
||||
title = "Заголовок 6",
|
||||
text = "Текст статьи с заголовком 6",
|
||||
publishDate = Date(2023,5,22),
|
||||
tagId=3
|
||||
),
|
||||
Article(
|
||||
id=6,
|
||||
title = "Заголовок 7",
|
||||
text = "Текст статьи с заголовком 7",
|
||||
publishDate = Date(2023,0,19),
|
||||
tagId=4
|
||||
),
|
||||
Article(
|
||||
id=7,
|
||||
title = "Заголовок 8",
|
||||
text = "Текст статьи с заголовком 8",
|
||||
publishDate = Date(2022,11,13),
|
||||
tagId=5
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.example.pmulabs.repository
|
||||
|
||||
import com.example.pmulabs.models.Comment
|
||||
|
||||
class CommentRepository {
|
||||
fun getCountComment(articleId: Int): Int {
|
||||
var count=0;
|
||||
getAllData().forEach{
|
||||
comm ->
|
||||
if(comm.articleId==articleId){
|
||||
count++
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
fun getAllData(): List<Comment>{
|
||||
return listOf(
|
||||
Comment(
|
||||
id=0,
|
||||
text = "Текст комментария 1",
|
||||
userId = 0,
|
||||
articleId = 7
|
||||
),
|
||||
Comment(
|
||||
id=1,
|
||||
text = "Текст комментария 2",
|
||||
userId = 1,
|
||||
articleId = 1
|
||||
),
|
||||
Comment(
|
||||
id=2,
|
||||
text = "Текст комментария 3",
|
||||
userId = 2,
|
||||
articleId = 2
|
||||
),
|
||||
Comment(
|
||||
id=3,
|
||||
text = "Текст комментария 4",
|
||||
userId = 0,
|
||||
articleId = 3
|
||||
),
|
||||
Comment(
|
||||
id=4,
|
||||
text = "Текст комментария 5",
|
||||
userId = 1,
|
||||
articleId = 0
|
||||
),
|
||||
Comment(
|
||||
id=5,
|
||||
text = "Текст комментария 6",
|
||||
userId = 2,
|
||||
articleId = 4
|
||||
),
|
||||
Comment(
|
||||
id=6,
|
||||
text = "Текст комментария 7",
|
||||
userId = 0,
|
||||
articleId = 5
|
||||
),
|
||||
Comment(
|
||||
id=7,
|
||||
text = "Текст комментария 8",
|
||||
userId = 1,
|
||||
articleId = 6
|
||||
),
|
||||
Comment(
|
||||
id=8,
|
||||
text = "Текст комментария 9",
|
||||
userId = 2,
|
||||
articleId = 0
|
||||
),
|
||||
Comment(
|
||||
id=9,
|
||||
text = "Текст комментария 10",
|
||||
userId = 0,
|
||||
articleId = 1
|
||||
),
|
||||
Comment(
|
||||
id=10,
|
||||
text = "Текст комментария 11",
|
||||
userId = 1,
|
||||
articleId = 2
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.example.pmulabs.repository
|
||||
|
||||
import com.example.pmulabs.models.Teg
|
||||
|
||||
class TegRepository {
|
||||
fun getTagById(tagId : String): Teg {
|
||||
return getAllData()[tagId.toInt()]
|
||||
}
|
||||
fun getAllData(): List<Teg>{
|
||||
return listOf(
|
||||
Teg(
|
||||
id=0,
|
||||
title = "Тег_1"
|
||||
),
|
||||
Teg(
|
||||
id=1,
|
||||
title = "Тег_2"
|
||||
),
|
||||
Teg(
|
||||
id=2,
|
||||
title = "Тег_3"
|
||||
),
|
||||
Teg(
|
||||
id=3,
|
||||
title = "Тег_4"
|
||||
),
|
||||
Teg(
|
||||
id=4,
|
||||
title = "Тег_5"
|
||||
),
|
||||
Teg(
|
||||
id=5,
|
||||
title = "Тег_6"
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.example.pmulabs.repository
|
||||
|
||||
import com.example.pmulabs.models.Comment
|
||||
import com.example.pmulabs.models.User
|
||||
|
||||
class UserRepository {
|
||||
val commRepository=CommentRepository()
|
||||
val getAlDataComm=commRepository.getAllData()
|
||||
fun getAllData(): List<User>{
|
||||
return listOf(
|
||||
User(
|
||||
id=0,
|
||||
nickname = "LatinMisha",
|
||||
email = "llmisha@gmail.com",
|
||||
password = "user1",
|
||||
role = "user"
|
||||
),
|
||||
User(
|
||||
id=1,
|
||||
nickname = "Kasablanka",
|
||||
email = "kasyul@gmail.com",
|
||||
password = "user2",
|
||||
role = "user"
|
||||
),
|
||||
User(
|
||||
id=2,
|
||||
nickname = "Ilonherber",
|
||||
email = "ihlon82@gmail.com",
|
||||
password = "user3",
|
||||
role = "user"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun getUserById(userId : String): User {
|
||||
return getAllData()[userId.toInt()]
|
||||
}
|
||||
|
||||
fun getUserComm(userId : String): List<Comment> {
|
||||
val list = mutableListOf<Comment>()
|
||||
for (comm in getAlDataComm) {
|
||||
if (comm.userId == userId.toInt()) {
|
||||
list.add(comm)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.R
|
||||
import com.example.pmulabs.basecomponents.navigate.ARTICLE_ARGUMENT_KEY
|
||||
import com.example.pmulabs.basecomponents.navigate.BackButton
|
||||
import com.example.pmulabs.designElem.CommentItem
|
||||
import com.example.pmulabs.repository.ArticleRepository
|
||||
import com.example.pmulabs.repository.CommentRepository
|
||||
import com.example.pmulabs.repository.TegRepository
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
@Composable
|
||||
fun ArticlePageScreen(navController: NavController,modifier: Modifier = Modifier) {
|
||||
|
||||
var id=navController.currentBackStackEntry?.arguments?.getString(ARTICLE_ARGUMENT_KEY).toString()
|
||||
val articleRep=ArticleRepository()
|
||||
var article= articleRep.getArticleById("0")
|
||||
if (id.toString() != "null") {
|
||||
article = articleRep.getArticleById(id)
|
||||
}
|
||||
val tegRep=TegRepository()
|
||||
val teg= tegRep.getTagById(article?.tagId.toString())
|
||||
val formatter = SimpleDateFormat("dd.MM.YY")
|
||||
val publishDate=formatter.format(article?.publishDate)
|
||||
|
||||
val commRep=CommentRepository()
|
||||
val allComm=commRep.getAllData()
|
||||
|
||||
LazyColumn(
|
||||
contentPadding= PaddingValues(top=105.dp, bottom = 20.dp,start=15.dp,end=15.dp),
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 915.dp)
|
||||
.background(color = Color.White)
|
||||
.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
item{
|
||||
BackButton(modifier=Modifier
|
||||
.clickable { navController.popBackStack()}
|
||||
.offset(
|
||||
y=0.dp
|
||||
))
|
||||
}
|
||||
item {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 245.dp)
|
||||
.requiredHeight(height = 33.dp)
|
||||
.offset(
|
||||
y=0.dp
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = "${publishDate}",
|
||||
color = Color(0xff423a99),
|
||||
style = MaterialTheme.typography.headlineMedium)
|
||||
Text(
|
||||
text = "#${teg.title}",
|
||||
color = Color(0xff423a99),
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
modifier = Modifier
|
||||
.offset(x = 60.dp,
|
||||
y = 0.dp))
|
||||
}
|
||||
}
|
||||
item {
|
||||
Text(
|
||||
text = "${article?.title}",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 32.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.offset(x = 10.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 395.dp))
|
||||
|
||||
}
|
||||
item {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.image3),
|
||||
contentDescription = "image 3",
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 242.dp)
|
||||
.offset(
|
||||
y=0.dp
|
||||
))
|
||||
}
|
||||
item {
|
||||
Text(
|
||||
text = "${article?.text}",
|
||||
color = Color(0xff423a99),
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
modifier = Modifier
|
||||
.offset(x = 5.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 375.dp))
|
||||
}
|
||||
item {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 53.dp)
|
||||
.offset(
|
||||
y=0.dp
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = "Комментарии:",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 32.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 15.dp,
|
||||
y = 6.dp)
|
||||
.requiredWidth(width = 395.dp)
|
||||
.requiredHeight(height = 43.dp))
|
||||
HorizontalDivider(
|
||||
thickness=5.dp,
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 270.dp)
|
||||
.border(BorderStroke(3.dp, Color(0xff423a99))), color = Color(0xff423a99)
|
||||
)
|
||||
HorizontalDivider(
|
||||
thickness=5.dp,
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.border(BorderStroke(3.dp, Color(0xff423a99)))
|
||||
.offset(x = 142.dp,
|
||||
y = 53.dp)
|
||||
.requiredWidth(width = 270.dp), color = Color(0xff423a99)
|
||||
)
|
||||
}
|
||||
}
|
||||
item{
|
||||
allComm.forEach{ comm ->
|
||||
if(comm.articleId==article.id) {
|
||||
CommentItem(comm = comm, modifier = Modifier.offset( y = 10.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.basecomponents.navigate.BackButton
|
||||
import com.example.pmulabs.basecomponents.navigate.BottomBarScreen
|
||||
import com.example.pmulabs.basecomponents.navigate.CALENDAR_ARGUMENT_DATE
|
||||
import com.example.pmulabs.designElem.ArticleItem
|
||||
import com.example.pmulabs.repository.ArticleRepository
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
@Composable
|
||||
fun CalendarScreen(navController: NavController, modifier: Modifier = Modifier){
|
||||
|
||||
val articleRepository= ArticleRepository()
|
||||
val getAllData= articleRepository.getAllData()
|
||||
var date=navController.currentBackStackEntry?.arguments?.getString(CALENDAR_ARGUMENT_DATE).toString()
|
||||
Log.d("date: ",date)
|
||||
val formatter = SimpleDateFormat("dd-MMMM-YY")
|
||||
|
||||
LazyColumn(
|
||||
modifier= Modifier
|
||||
.background(Color.White)
|
||||
.fillMaxSize(),
|
||||
contentPadding = PaddingValues(top =75.dp, bottom = 10.dp, start = 10.dp,end=10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp)){
|
||||
item{
|
||||
BackButton(modifier=Modifier
|
||||
.clickable { navController.popBackStack()})
|
||||
}
|
||||
items(items = getAllData){ article ->
|
||||
val publishDate=formatter.format(article.publishDate)
|
||||
if(publishDate==date) {
|
||||
ArticleItem(
|
||||
article = article,
|
||||
onArticleClick = {navController.navigate(BottomBarScreen.ArticlePage.passId(article.id.toString()))}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,200 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
|
||||
@Composable
|
||||
fun CoopScreen(navController: NavController,modifier: Modifier = Modifier) {
|
||||
LazyColumn(
|
||||
modifier = modifier
|
||||
.background(Color.White),
|
||||
contentPadding = PaddingValues(top =70.dp, bottom = 105.dp, start = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(15.dp)
|
||||
) {
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 275.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.dp,
|
||||
y = 21.810302734375.dp)
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 253.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 253.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.background(color = Color.White)
|
||||
.border(border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)))
|
||||
Text(
|
||||
text = " Мы предлагаем рекламные размещения под любой бюджет и аудиторию. \n\n На ресурсе самые лучшие посетители. У нас нет \"школьников\", \"мимо проходящих\", ботов, \"просто интересующихся\". Нас читают те, кто глубоко погружен в технику.\n\n У нас много трафика и нормальные цены за нормальную отдачу,а также рекламные возможности на любой бюджет. ",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 14.dp,
|
||||
y = 34.189697265625.dp)
|
||||
.requiredWidth(width = 368.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xff423a99)))
|
||||
Text(
|
||||
text = "О рекламе",
|
||||
color = Color.White,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 24.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 210.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
}
|
||||
}
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.offset(x = 0.dp,
|
||||
y = 11.dp)
|
||||
.requiredWidth(width = 404.dp)
|
||||
.requiredHeight(height = 420.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.dp,
|
||||
y = 21.dp)
|
||||
.requiredWidth(width = 404.dp)
|
||||
.requiredHeight(height = 420.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 420.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.background(color = Color.White)
|
||||
.border(border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)))
|
||||
Text(
|
||||
text = buildAnnotatedString {
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff423a99),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("КОММЕРЧЕСКИЙ ДИРЕКТОР:\n")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff847fbe),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("Александр Воробьёв\nvorobiev@ixbt.com\n+7 (499) 519-00-95\n")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff423a99),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("ДИРЕКТОР ПО РЕКЛАМЕ:\n")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff847fbe),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("Владимир Сливко\nvslivko@ixbt.com\n+7 (916) 134-14-72\n")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff423a99),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("ПРОДАКТ-МЕНЕДЖЕР:")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff423a99),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append(" \n")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff847fbe),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("Дарья Галиева\ndgalieva@ixbt.games\n+7 (499) 519-00-95\n")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff423a99),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("ГЛАВНЫЙ РЕДАКТОР:\n")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff847fbe),
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("Виталий Казунов\nlock@ixbt.com\n+7 (499) 519-00-95")}},
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 11.dp,
|
||||
y = 10.dp)
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 420.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xff423a99)))
|
||||
Text(
|
||||
text = "Контакты",
|
||||
color = Color.White,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 24.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 210.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,234 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Visibility
|
||||
import androidx.compose.material.icons.filled.VisibilityOff
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonColors
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.basecomponents.navigate.ValidateEmail
|
||||
import com.example.pmulabs.basecomponents.navigate.isValidEmail
|
||||
import com.example.pmulabs.designElem.LeftCircles
|
||||
import com.example.pmulabs.designElem.LogoMobile
|
||||
import com.example.pmulabs.designElem.RightCircles
|
||||
import com.example.pmulabs.designElem.SharedViewModel
|
||||
import com.example.pmulabs.graphs.AuthScreen
|
||||
import com.example.pmulabs.graphs.Graph
|
||||
import com.example.pmulabs.repository.UserRepository
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun EntryScreen(navController: NavController,modifier: Modifier = Modifier, sharedViewModel: SharedViewModel) {
|
||||
|
||||
var emailValue by rememberSaveable { mutableStateOf("") }
|
||||
var passwordValue by rememberSaveable { mutableStateOf("") }
|
||||
val userRepository= UserRepository()
|
||||
val getAllData= userRepository.getAllData()
|
||||
val argument = sharedViewModel.argument.value
|
||||
|
||||
var passwordVisibility by rememberSaveable { mutableStateOf(false) }
|
||||
val emailRegex = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+".toRegex()
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 915.dp)
|
||||
.background(color = Color.White)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 128.dp,
|
||||
y = 730.dp
|
||||
)
|
||||
.requiredWidth(width = 381.dp)
|
||||
.requiredHeight(height = 268.dp)
|
||||
.rotate(degrees = 8.33f)
|
||||
) {
|
||||
RightCircles()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = (-111.28436279296875).dp,
|
||||
y = (-96.86965942382812).dp
|
||||
)
|
||||
.requiredWidth(width = 250.dp)
|
||||
.requiredHeight(height = 290.dp)
|
||||
.rotate(degrees = 12.96f)
|
||||
) {
|
||||
LeftCircles()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.BottomCenter) {
|
||||
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.fillMaxHeight(0.8f)
|
||||
.clip(RoundedCornerShape(15.dp))
|
||||
.background(Color.Transparent)
|
||||
.padding(10.dp)
|
||||
) {
|
||||
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.Transparent), contentAlignment = Alignment.TopCenter
|
||||
) {
|
||||
|
||||
LogoMobile(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.fillMaxWidth()
|
||||
.requiredHeight(height = 131.dp)
|
||||
)
|
||||
|
||||
}
|
||||
Text(
|
||||
text = "Please, Sign In to your account",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp
|
||||
),
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 436.dp)
|
||||
.requiredHeight(height = 27.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(10.dp))
|
||||
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
ValidateEmail(emailValue, {emailValue=it} )
|
||||
Spacer(modifier = Modifier.padding(3.dp))
|
||||
TextField(
|
||||
value = passwordValue,
|
||||
onValueChange = { passwordValue = it },
|
||||
colors = TextFieldDefaults.textFieldColors(
|
||||
containerColor = Color.White
|
||||
),
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 269.dp)
|
||||
.requiredHeight(height = 53.dp)
|
||||
.shadow(shape = RoundedCornerShape(40.dp), elevation = 5.dp)
|
||||
.clip(shape = RoundedCornerShape(40.dp)),
|
||||
label = { Text("Password") },
|
||||
singleLine = true,
|
||||
placeholder = { Text("Password") },
|
||||
visualTransformation = if (passwordVisibility) VisualTransformation.None else PasswordVisualTransformation(),
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
|
||||
trailingIcon = {
|
||||
val image = if (passwordVisibility)
|
||||
Icons.Filled.Visibility
|
||||
else Icons.Filled.VisibilityOff
|
||||
|
||||
val description =
|
||||
if (passwordVisibility) "Hide password" else "Show password"
|
||||
|
||||
IconButton(onClick = { passwordVisibility = !passwordVisibility }) {
|
||||
Icon(imageVector = image, description)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.padding(10.dp))
|
||||
Button(
|
||||
colors = ButtonColors(
|
||||
containerColor = Color(0xff423a99),
|
||||
disabledContainerColor = Color(0xff423a99),
|
||||
contentColor = Color.White,
|
||||
disabledContentColor = Color.White
|
||||
),
|
||||
onClick = {
|
||||
if (passwordValue.isNotEmpty() && isValidEmail(emailValue)) {
|
||||
getAllData.forEach { user ->
|
||||
if (user.password == passwordValue && user.email == emailValue) {
|
||||
sharedViewModel.setArgument(user.id.toString())
|
||||
navController.navigate(route = Graph.passUserId(user.id.toString())) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(0.5f)
|
||||
.height(50.dp)
|
||||
) {
|
||||
Text(text = "Sign In", fontSize = 20.sp)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.padding(3.dp))
|
||||
|
||||
Text(
|
||||
text = "Don't have an account yet? Sign Up",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp
|
||||
),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 75.dp
|
||||
)
|
||||
.clickable {
|
||||
navController.navigate(route = AuthScreen.Register.route)
|
||||
{
|
||||
popUpTo(AuthScreen.Splash.route)
|
||||
}
|
||||
}
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(20.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,230 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
|
||||
@Composable
|
||||
fun InfoScreen(navController: NavController,modifier: Modifier = Modifier) {
|
||||
LazyColumn(
|
||||
modifier = modifier
|
||||
.background(Color.White),
|
||||
contentPadding = PaddingValues(top =75.dp, bottom = 85.dp, start = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(15.dp)
|
||||
) {
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 400.dp)
|
||||
.requiredHeight(height = 309.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.dp,
|
||||
y = 22.dp)
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 287.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 287.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.background(color = Color.White)
|
||||
.border(border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)))
|
||||
Text(
|
||||
text=" iXBT.com — специализированный российский информационно-аналитический сайт с самыми актуальными новостями из сферы компьютерных и мобильных игр, развлекательной и интернет-индустрии, детальными обзорами персональных компьютеров, компьютерных комплектующих, периферийных устройств и техники для гейминга. Мы работаем для вас с 2007 года.\n\n Наш адрес: \"115201, Москва, Каширское шоссе, д. 22 кор. 3 стр. 2; тел. +7(499)519-00-95\"",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 12.dp,
|
||||
y = 27.dp)
|
||||
.requiredWidth(width = 364.dp)
|
||||
.requiredHeight(height = 250.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xff423a99)))
|
||||
Text(
|
||||
text = "О сайте iXBT.com",
|
||||
color = Color.White,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 24.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 210.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
}
|
||||
}
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.offset(x = 0.dp,
|
||||
y = 15.dp)
|
||||
.requiredWidth(width = 400.dp)
|
||||
.requiredHeight(height = 200.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.dp,
|
||||
y = 23.dp)
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 177.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 177.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.background(color = Color.White)
|
||||
.border(border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)))
|
||||
Text(
|
||||
text = " Информация, размещенная на сайте iXBT.games, может быть изменена без предварительного уведомления. Все названия компаний, их логотипы и названия продуктов являются зарегистрированными торговыми марками соответствующих компаний.",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 12.dp,
|
||||
y = 20.dp)
|
||||
.requiredWidth(width = 364.dp)
|
||||
.requiredHeight(height = 144.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xff423a99)))
|
||||
Text(
|
||||
text = "Прежде всего",
|
||||
color = Color.White,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 24.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 210.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
}
|
||||
}
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.offset(x = 0.dp,
|
||||
y = 25.dp)
|
||||
.requiredWidth(width = 400.dp)
|
||||
.requiredHeight(height = 782.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 0.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 759.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 759.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.background(color = Color.White)
|
||||
.border(border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)))
|
||||
Text(
|
||||
text = " Проект iXBT.games (Ай-Экс-Би-Ти Дот Геймс) является частью проекта iXBT.com (Ай-Экс-Би-Ти Дот Ком) - интернет-портала, освещающего новости ИТ-индустрии, технологий, техники, ПО и сети Интернет.\n\n Компания «Аспект Исследования и Публикации» (Aspect Research and Publishing, Ltd) имеет свидетельство о регистрации средства массовой информации iXBT.com (Ай-Экс-Би-Ти Дот Ком) за номером: ЭЛ № ФС 77 - 56280 от 28 ноября 2013 года. Свидетельство выдано Федеральной службой по надзору в сфере связи, информационных технологий и массовых коммуникаций в соответствии с Законом Российской Федерации от 27 декабря 1991 года.\n\n Ранее электронное периодическое издание iXBT.com (Ай-Экс-Би-Ти Дот Ком) было зарегистрировано за номером: ЭЛ № ФС77-22565 от 20 декабря 2005. СМИ перерегистрировано в связи со сменой учредителя 28 ноября 2013 года.\n\n Ранее электронное периодическое издание «Ай-Экс-Би-Ти дот ком / iXBT.com» («iXBT.com / Ай-Экс-Би-Ти дот ком») зарегистрировано Министерством Российской Федерации по делам печати, телерадиовещания и средств массовых коммуникаций — свидетельство ЭЛ № 77-6328 от 10 июня 2002 года. СМИ перерегистрировано в связи со сменой учредителя и изменением названия 20 декабря 2005 года.\n\n На все материалы, опубликованные на сайте iXBT.games, распространяются нормы законодательства о СМИ РФ.",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 12.dp,
|
||||
y = 30.dp)
|
||||
.requiredWidth(width = 368.dp)
|
||||
.requiredHeight(height = 727.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xff423a99)))
|
||||
Text(
|
||||
text = "Правовые основы деятельности сайта",
|
||||
color = Color.White,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(x = 24.dp,
|
||||
y = 0.dp)
|
||||
.requiredWidth(width = 354.dp)
|
||||
.requiredHeight(height = 42.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.ButtonColors
|
||||
import androidx.compose.material3.DatePicker
|
||||
import androidx.compose.material3.DatePickerColors
|
||||
import androidx.compose.material3.DatePickerDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.material3.rememberDatePickerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableLongStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.example.pmulabs.basecomponents.navigate.BottomBarScreen
|
||||
import com.example.pmulabs.designElem.ArticleItem
|
||||
import com.example.pmulabs.designElem.BottomBar
|
||||
import com.example.pmulabs.designElem.SearchAppBar
|
||||
import com.example.pmulabs.designElem.SearchViewModel
|
||||
import com.example.pmulabs.designElem.SearchWidget
|
||||
import com.example.pmulabs.designElem.SharedViewModel
|
||||
import com.example.pmulabs.designElem.TopBar
|
||||
import com.example.pmulabs.graphs.HomeNavGraph
|
||||
import com.example.pmulabs.repository.ArticleRepository
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Date
|
||||
|
||||
@Composable
|
||||
fun MainScreen(navController: NavController, modifier: Modifier = Modifier){
|
||||
|
||||
val articleRepository=ArticleRepository()
|
||||
val getAllData= articleRepository.getAllData()
|
||||
|
||||
LazyColumn(
|
||||
modifier=Modifier
|
||||
.background(Color.White)
|
||||
.fillMaxSize(),
|
||||
contentPadding = PaddingValues(top=75.dp, bottom = 70.dp, start = 10.dp,end=10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(15.dp)){
|
||||
items(items = getAllData){ article ->
|
||||
ArticleItem(article = article,onArticleClick = {navController.navigate(BottomBarScreen.ArticlePage.passId(article.id.toString()))})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun LoadScreen(navController: NavHostController=rememberNavController(), searchViewModel: SearchViewModel,sharedViewModel: SharedViewModel){
|
||||
|
||||
val searchWidgetState by searchViewModel.searchWidgetState
|
||||
val searchTextState by searchViewModel.searchTextState
|
||||
val formatter = SimpleDateFormat("dd-MMMM-YY")
|
||||
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.set(2023, 0, 1) // add year, month (Jan), date
|
||||
|
||||
// set the initial date
|
||||
val datePickerState = rememberDatePickerState(initialSelectedDateMillis = calendar.timeInMillis)
|
||||
|
||||
var showDatePicker by remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
|
||||
var selectedDate by remember {
|
||||
mutableLongStateOf(calendar.timeInMillis) // or use mutableStateOf(calendar.timeInMillis)
|
||||
}
|
||||
|
||||
if (showDatePicker) {
|
||||
DatePickerDialog(
|
||||
colors= DatePickerColors(
|
||||
containerColor = Color.White,
|
||||
currentYearContentColor=Color(0xff423a99),
|
||||
dateTextFieldColors = TextFieldDefaults.textFieldColors(
|
||||
Color(0xff423a99),
|
||||
containerColor = Color.White,
|
||||
focusedLabelColor = Color(0xff423a99),
|
||||
focusedPlaceholderColor = Color(0xff423a99),
|
||||
focusedTrailingIconColor = Color(0xff423a99)
|
||||
),
|
||||
dayContentColor=Color(0xff423a99),
|
||||
dayInSelectionRangeContainerColor=Color(0xff423a99),
|
||||
dayInSelectionRangeContentColor=Color(0xff423a99),
|
||||
disabledDayContentColor=Color(0xff423a99),
|
||||
disabledSelectedDayContainerColor=Color(0xff423a99),
|
||||
disabledSelectedDayContentColor=Color(0xff423a99),
|
||||
disabledSelectedYearContainerColor=Color(0xff423a99),
|
||||
disabledSelectedYearContentColor=Color(0xff423a99),
|
||||
disabledYearContentColor=Color(0xff423a99),
|
||||
dividerColor=Color(0xff423a99),
|
||||
headlineContentColor=Color(0xff423a99),
|
||||
navigationContentColor=Color(0xff423a99),
|
||||
selectedDayContainerColor=Color(0xff423a99),
|
||||
selectedDayContentColor=Color.White,
|
||||
selectedYearContainerColor=Color(0xff423a99),
|
||||
selectedYearContentColor=Color.White,
|
||||
subheadContentColor=Color(0xff423a99),
|
||||
titleContentColor=Color(0xff423a99),
|
||||
todayContentColor=Color.White,
|
||||
todayDateBorderColor=Color(0xff423a99),
|
||||
weekdayContentColor=Color(0xff423a99),
|
||||
yearContentColor=Color(0xff423a99)
|
||||
),
|
||||
onDismissRequest = {
|
||||
showDatePicker = false
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
modifier=Modifier
|
||||
.background(Color.White),
|
||||
colors = ButtonColors(
|
||||
contentColor = Color(0xff423a99),
|
||||
containerColor=Color.Transparent,
|
||||
disabledContainerColor=Color.Transparent,
|
||||
disabledContentColor= Color.Transparent
|
||||
),
|
||||
onClick = {
|
||||
showDatePicker = false
|
||||
selectedDate = datePickerState.selectedDateMillis!!
|
||||
Log.d("Selected date: ", formatter.format(Date(selectedDate)))
|
||||
navController.navigate(BottomBarScreen.Calendar.passDate(formatter.format(Date(selectedDate)))){
|
||||
popUpTo(BottomBarScreen.Main.route)
|
||||
}
|
||||
}) {
|
||||
Text(text = "Confirm")
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(
|
||||
modifier=Modifier
|
||||
.background(Color.White),
|
||||
colors = ButtonColors(
|
||||
contentColor = Color(0xff423a99),
|
||||
containerColor=Color.Transparent,
|
||||
disabledContainerColor=Color.Transparent,
|
||||
disabledContentColor= Color.Transparent
|
||||
),
|
||||
onClick = {
|
||||
showDatePicker = false
|
||||
navController.navigate(BottomBarScreen.Main.route)
|
||||
}) {
|
||||
Text(text = "Cancel")
|
||||
}
|
||||
}
|
||||
) {
|
||||
DatePicker(
|
||||
modifier= Modifier
|
||||
.background(Color.White)
|
||||
.clip(RoundedCornerShape(15.dp)),
|
||||
colors = DatePickerColors(
|
||||
containerColor = Color.White,
|
||||
currentYearContentColor=Color(0xff423a99),
|
||||
dateTextFieldColors = TextFieldDefaults.textFieldColors(
|
||||
Color(0xff423a99),
|
||||
containerColor = Color.White,
|
||||
focusedLabelColor = Color(0xff423a99),
|
||||
focusedPlaceholderColor = Color(0xff423a99),
|
||||
focusedTrailingIconColor = Color(0xff423a99)
|
||||
),
|
||||
dayContentColor=Color(0xff423a99),
|
||||
dayInSelectionRangeContainerColor=Color(0xff423a99),
|
||||
dayInSelectionRangeContentColor=Color(0xff423a99),
|
||||
disabledDayContentColor=Color(0xff423a99),
|
||||
disabledSelectedDayContainerColor=Color(0xff423a99),
|
||||
disabledSelectedDayContentColor=Color(0xff423a99),
|
||||
disabledSelectedYearContainerColor=Color(0xff423a99),
|
||||
disabledSelectedYearContentColor=Color(0xff423a99),
|
||||
disabledYearContentColor=Color(0xff423a99),
|
||||
dividerColor=Color(0xff423a99),
|
||||
headlineContentColor=Color(0xff423a99),
|
||||
navigationContentColor=Color(0xff423a99),
|
||||
selectedDayContainerColor=Color(0xff423a99),
|
||||
selectedDayContentColor=Color.White,
|
||||
selectedYearContainerColor=Color(0xff423a99),
|
||||
selectedYearContentColor=Color.White,
|
||||
subheadContentColor=Color(0xff423a99),
|
||||
titleContentColor=Color(0xff423a99),
|
||||
todayContentColor=Color.White,
|
||||
todayDateBorderColor=Color(0xff423a99),
|
||||
weekdayContentColor=Color(0xff423a99),
|
||||
yearContentColor=Color(0xff423a99)
|
||||
),
|
||||
state = datePickerState
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
bottomBar = { BottomBar(navController = navController) },
|
||||
topBar = { MainAppBar(searchWidgetState= searchWidgetState,
|
||||
searchTextState= searchTextState,
|
||||
onTextChange= { searchViewModel.updateSearchTextState(newValue = it)
|
||||
if(it!="") {
|
||||
navController.navigate(BottomBarScreen.Search.passText(it))
|
||||
}},
|
||||
onCloseClicked= {
|
||||
searchViewModel.updateSearchWidgetState(newValue = SearchWidget.CLOSED)
|
||||
navController.navigate(BottomBarScreen.Main.route)
|
||||
},
|
||||
onSearchClicked= {
|
||||
navController.navigate(BottomBarScreen.Search.passText(it))
|
||||
},
|
||||
onSearchTriggered= {
|
||||
searchViewModel.updateSearchWidgetState(newValue = SearchWidget.OPENED)
|
||||
},
|
||||
onCalendarTriggered = {
|
||||
showDatePicker = true
|
||||
})}
|
||||
) {
|
||||
Modifier
|
||||
.padding(it)
|
||||
HomeNavGraph(navController = navController,sharedViewModel)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MainAppBar(
|
||||
searchWidgetState: SearchWidget,
|
||||
searchTextState: String,
|
||||
onTextChange: (String) -> Unit,
|
||||
onCloseClicked: () -> Unit,
|
||||
onSearchClicked: (String) -> Unit,
|
||||
onSearchTriggered: () -> Unit,
|
||||
onCalendarTriggered: () -> Unit
|
||||
) {
|
||||
when (searchWidgetState) {
|
||||
SearchWidget.CLOSED -> {
|
||||
TopBar(
|
||||
onSearchClicked = onSearchTriggered,
|
||||
onCalendarClicked = onCalendarTriggered
|
||||
)
|
||||
}
|
||||
SearchWidget.OPENED -> {
|
||||
SearchAppBar(
|
||||
text = searchTextState,
|
||||
onTextChange = onTextChange,
|
||||
onCloseClicked = onCloseClicked,
|
||||
onSearchClicked = onSearchClicked
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,213 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.R
|
||||
import com.example.pmulabs.designElem.SharedViewModel
|
||||
import com.example.pmulabs.repository.UserRepository
|
||||
|
||||
@Composable
|
||||
fun ProfileScreen(navController: NavController, modifier: Modifier = Modifier,sharedViewModel: SharedViewModel) {
|
||||
val argument = sharedViewModel.argument.value
|
||||
val userRepository =UserRepository()
|
||||
var getUser=userRepository.getUserById(argument.toString())
|
||||
var getComms=userRepository.getUserComm(argument.toString())
|
||||
Log.d("UserId", argument.toString())
|
||||
LazyColumn(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 915.dp)
|
||||
.background(color = Color.White)
|
||||
) {
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.offset(
|
||||
x = 106.dp,
|
||||
y = 95.dp
|
||||
)
|
||||
.requiredWidth(width = 200.dp)
|
||||
.requiredHeight(height = 310.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ixbtcom_colored_logo1),
|
||||
contentDescription = "Ellipse 8",
|
||||
modifier = Modifier
|
||||
.requiredSize(size = 200.dp)
|
||||
.clip(shape = CircleShape))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 215.dp
|
||||
)
|
||||
.requiredWidth(width = 200.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 200.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xffdbdbf1)))
|
||||
Text(
|
||||
text = "${getUser.nickname}",
|
||||
color = Color(0xff423a99),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 200.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 266.dp
|
||||
)
|
||||
.requiredWidth(width = 200.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 200.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xffdbdbf1)))
|
||||
Text(
|
||||
text = "${getUser.email}",
|
||||
color = Color(0xff423a99),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 200.dp)
|
||||
.requiredHeight(height = 44.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
}
|
||||
}
|
||||
item {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.offset(
|
||||
x = 9.dp,
|
||||
y = 120.dp
|
||||
)
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 342.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 27.1240234375.dp
|
||||
)
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 315.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 315.dp)
|
||||
.clip(shape = RoundedCornerShape(5.dp))
|
||||
.background(color = Color.White)
|
||||
.border(
|
||||
border = BorderStroke(3.dp, Color(0xffdbdbf1)),
|
||||
shape = RoundedCornerShape(5.dp)
|
||||
)
|
||||
)
|
||||
|
||||
LazyColumn(
|
||||
|
||||
contentPadding = PaddingValues(
|
||||
top = 38.dp,
|
||||
bottom = 50.dp,
|
||||
start = 30.dp,
|
||||
end = 30.dp
|
||||
),
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp)
|
||||
) {
|
||||
items(items = getComms) { comment ->
|
||||
Text(
|
||||
text = "${comment.text}",
|
||||
color = Color(0xff423a99),
|
||||
style = TextStyle(
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 54.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 393.dp)
|
||||
.requiredHeight(height = 54.dp)
|
||||
.clip(shape = RoundedCornerShape(15.dp))
|
||||
.background(color = Color(0xff423a99)))
|
||||
Text(
|
||||
text = "Комментарии:",
|
||||
color = Color.White,
|
||||
style = TextStyle(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 24.dp,
|
||||
y = 0.dp
|
||||
)
|
||||
.requiredWidth(width = 210.dp)
|
||||
.requiredHeight(height = 54.dp)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,454 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Visibility
|
||||
import androidx.compose.material.icons.filled.VisibilityOff
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonColors
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.basecomponents.navigate.ValidateEmail
|
||||
import com.example.pmulabs.basecomponents.navigate.isValidEmail
|
||||
import com.example.pmulabs.designElem.LeftCircles
|
||||
import com.example.pmulabs.designElem.LogoMobile
|
||||
import com.example.pmulabs.designElem.RightCircles
|
||||
import com.example.pmulabs.graphs.AuthScreen
|
||||
import com.example.pmulabs.graphs.Graph
|
||||
import com.example.pmulabs.repository.UserRepository
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun RegisterScreen(navController: NavController,modifier: Modifier = Modifier) {
|
||||
|
||||
var emailValue by rememberSaveable { mutableStateOf("") }
|
||||
var passwordValue by rememberSaveable { mutableStateOf("") }
|
||||
var nicknameValue by rememberSaveable { mutableStateOf("") }
|
||||
val userRepository= UserRepository()
|
||||
val getAllData= userRepository.getAllData()
|
||||
|
||||
var passwordVisibility by rememberSaveable { mutableStateOf(false) }
|
||||
val emailRegex = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+".toRegex()
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 915.dp)
|
||||
.background(color = Color.White)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 128.dp,
|
||||
y = 730.dp
|
||||
)
|
||||
.requiredWidth(width = 381.dp)
|
||||
.requiredHeight(height = 268.dp)
|
||||
.rotate(degrees = 8.33f)
|
||||
) {
|
||||
RightCircles()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = (-111.28436279296875).dp,
|
||||
y = (-96.86965942382812).dp
|
||||
)
|
||||
.requiredWidth(width = 250.dp)
|
||||
.requiredHeight(height = 290.dp)
|
||||
.rotate(degrees = 12.96f)
|
||||
) {
|
||||
LeftCircles()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.BottomCenter) {
|
||||
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.fillMaxHeight(0.8f)
|
||||
.clip(RoundedCornerShape(15.dp))
|
||||
.background(Color.Transparent)
|
||||
.padding(10.dp)
|
||||
) {
|
||||
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.Transparent), contentAlignment = Alignment.TopCenter
|
||||
) {
|
||||
|
||||
LogoMobile(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.fillMaxWidth()
|
||||
.requiredHeight(height = 131.dp)
|
||||
)
|
||||
|
||||
}
|
||||
Text(
|
||||
text = "Please, Sign In to your account",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp
|
||||
),
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 436.dp)
|
||||
.requiredHeight(height = 27.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(10.dp))
|
||||
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
TextField(
|
||||
value = nicknameValue,
|
||||
onValueChange = {
|
||||
nicknameValue=it
|
||||
},
|
||||
colors = TextFieldDefaults.textFieldColors(
|
||||
containerColor = Color.White
|
||||
),
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 269.dp)
|
||||
.requiredHeight(height = 53.dp)
|
||||
.shadow(shape = RoundedCornerShape(40.dp), elevation = 5.dp)
|
||||
.clip(shape = RoundedCornerShape(40.dp)),
|
||||
label = { Text("Nickname") },
|
||||
placeholder = { Text("Nickname") },
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),
|
||||
singleLine = true,
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(3.dp))
|
||||
ValidateEmail(emailValue, {emailValue=it} )
|
||||
Spacer(modifier = Modifier.padding(3.dp))
|
||||
TextField(
|
||||
value = passwordValue,
|
||||
onValueChange = { passwordValue = it },
|
||||
colors = TextFieldDefaults.textFieldColors(
|
||||
containerColor = Color.White
|
||||
),
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 269.dp)
|
||||
.requiredHeight(height = 53.dp)
|
||||
.shadow(shape = RoundedCornerShape(40.dp), elevation = 5.dp)
|
||||
.clip(shape = RoundedCornerShape(40.dp)),
|
||||
label = { Text("Password") },
|
||||
singleLine = true,
|
||||
placeholder = { Text("Password") },
|
||||
visualTransformation = if (passwordVisibility) VisualTransformation.None else PasswordVisualTransformation(),
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
|
||||
trailingIcon = {
|
||||
val image = if (passwordVisibility)
|
||||
Icons.Filled.Visibility
|
||||
else Icons.Filled.VisibilityOff
|
||||
|
||||
val description =
|
||||
if (passwordVisibility) "Hide password" else "Show password"
|
||||
|
||||
IconButton(onClick = { passwordVisibility = !passwordVisibility }) {
|
||||
Icon(imageVector = image, description)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.padding(10.dp))
|
||||
Button(
|
||||
colors = ButtonColors(
|
||||
containerColor = Color(0xff423a99),
|
||||
disabledContainerColor = Color(0xff423a99),
|
||||
contentColor = Color.White,
|
||||
disabledContentColor = Color.White
|
||||
),
|
||||
onClick = {
|
||||
if (passwordValue.isNotEmpty() && isValidEmail(emailValue) && nicknameValue.isNotEmpty()) {
|
||||
if(!isUserExist(passwordValue,emailValue,nicknameValue)){
|
||||
navController.navigate(route = Graph.MAIN){
|
||||
popUpTo(Graph.MAIN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(0.5f)
|
||||
.height(50.dp)
|
||||
) {
|
||||
Text(text = "Sign Up", fontSize = 20.sp)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.padding(0.dp))
|
||||
|
||||
Text(
|
||||
text = "Do you have an account? Sign In",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp
|
||||
),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 75.dp
|
||||
)
|
||||
.clickable {
|
||||
navController.navigate(route = AuthScreen.Entry.route)
|
||||
{
|
||||
popUpTo(AuthScreen.Splash.route)
|
||||
}
|
||||
}
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(20.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun isUserExist(passwordValue: String, emailValue: String, nicknameValue: String): Boolean {
|
||||
val userRepository = UserRepository()
|
||||
val getAllData = userRepository.getAllData()
|
||||
|
||||
if (passwordValue.isNotEmpty() && isValidEmail(emailValue) && nicknameValue.isNotEmpty()) {
|
||||
getAllData.forEach { user ->
|
||||
if (user.email == emailValue || user.nickname == nicknameValue) {
|
||||
Log.d("User already exist. User id: ", user.id.toString())
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/*
|
||||
@Composable
|
||||
fun RegisterScreen(navController: NavController,modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 915.dp)
|
||||
.background(color = Color.White)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = (-17).dp,
|
||||
y = 329.dp
|
||||
)
|
||||
.requiredWidth(width = 436.dp)
|
||||
.requiredHeight(height = 325.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 69.1444091796875.dp,
|
||||
y = 122.9124755859375.dp
|
||||
)
|
||||
.requiredWidth(width = 308.dp)
|
||||
.requiredHeight(height = 61.dp)
|
||||
) {
|
||||
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 69.1444091796875.dp,
|
||||
y = 193.824951171875.dp
|
||||
)
|
||||
.requiredWidth(width = 308.dp)
|
||||
.requiredHeight(height = 61.dp)
|
||||
) {
|
||||
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 68.dp,
|
||||
y = 52.dp
|
||||
)
|
||||
.requiredWidth(width = 308.dp)
|
||||
.requiredHeight(height = 61.dp)
|
||||
) {
|
||||
|
||||
}
|
||||
Text(
|
||||
textAlign = TextAlign.Center,
|
||||
text = buildAnnotatedString {
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff7d7dbd),
|
||||
fontSize = 20.sp)) {append("Please, ")}
|
||||
withStyle(style = SpanStyle(
|
||||
color = Color(0xff7d7dbd),
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold)) {append("Sign Up")}},
|
||||
modifier = Modifier
|
||||
.fillMaxSize())
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 128.dp,
|
||||
y = 730.dp
|
||||
)
|
||||
.requiredWidth(width = 381.dp)
|
||||
.requiredHeight(height = 268.dp)
|
||||
.rotate(degrees = 8.33f)
|
||||
) {
|
||||
RightCircles()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = (-111.28436279296875).dp,
|
||||
y = (-96.86965942382812).dp
|
||||
)
|
||||
.requiredWidth(width = 250.dp)
|
||||
.requiredHeight(height = 290.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.rotate(degrees = 12.96f)
|
||||
) {
|
||||
LeftCircles()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 140.35101318359375.dp,
|
||||
y = 152.06341552734375.dp
|
||||
)
|
||||
.requiredWidth(width = 66.dp)
|
||||
.requiredHeight(height = 27.dp)
|
||||
) {
|
||||
BackButton(modifier=Modifier
|
||||
.clickable { navController.navigate(route = AuthScreen.Entry.route){
|
||||
popUpTo(AuthScreen.Splash.route)
|
||||
} })}
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 50.dp,
|
||||
y = 681.dp
|
||||
)
|
||||
.requiredWidth(width = 308.dp)
|
||||
.requiredHeight(height = 127.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Do you have an account? ",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 75.dp
|
||||
))
|
||||
Text(
|
||||
text = "Sign In",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 95.dp
|
||||
)
|
||||
.clickable { navController.navigate(route = AuthScreen.Entry.route)
|
||||
{
|
||||
popUpTo(AuthScreen.Splash.route)
|
||||
}})
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidth(width = 308.dp)
|
||||
.requiredHeight(height = 82.dp)
|
||||
) {
|
||||
ButtonCustom(name = "Sign Up",modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.clickable { navController.navigate(route = Graph.MAIN){
|
||||
popUpTo(Graph.MAIN)
|
||||
} }
|
||||
)
|
||||
}
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 57.dp,
|
||||
y = 165.dp
|
||||
)
|
||||
.requiredWidth(width = 302.dp)
|
||||
.requiredHeight(height = 140.dp)
|
||||
) {
|
||||
LogoMobile(modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 9.dp
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.requiredHeight(height = 131.dp))
|
||||
}
|
||||
}
|
||||
}*/
|
@ -0,0 +1,45 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.basecomponents.navigate.BackButton
|
||||
import com.example.pmulabs.basecomponents.navigate.BottomBarScreen
|
||||
import com.example.pmulabs.basecomponents.navigate.SEARCHBYTAG_ARGUMENT_KEY
|
||||
import com.example.pmulabs.designElem.ArticleItem
|
||||
import com.example.pmulabs.repository.ArticleRepository
|
||||
|
||||
@Composable
|
||||
fun SearchByTagScreen(navController: NavController, modifier: Modifier = Modifier){
|
||||
|
||||
val articleRepository= ArticleRepository()
|
||||
val getAllData= articleRepository.getAllData()
|
||||
var id=navController.currentBackStackEntry?.arguments?.getString(SEARCHBYTAG_ARGUMENT_KEY).toString()
|
||||
Log.d("id: ",id)
|
||||
|
||||
LazyColumn(modifier= Modifier
|
||||
.background(Color.White)
|
||||
.fillMaxSize(),
|
||||
contentPadding = PaddingValues(top =75.dp, bottom = 10.dp, start = 10.dp,end=10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp)){
|
||||
item{
|
||||
BackButton(modifier=Modifier
|
||||
.clickable { navController.popBackStack()})
|
||||
}
|
||||
items(items = getAllData){ article ->
|
||||
if(article.tagId.toString()==id) {
|
||||
ArticleItem(article = article, onArticleClick = {navController.navigate(BottomBarScreen.ArticlePage.passId(article.id.toString()))})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.basecomponents.navigate.BackButton
|
||||
import com.example.pmulabs.basecomponents.navigate.BottomBarScreen
|
||||
import com.example.pmulabs.basecomponents.navigate.SEARCH_ARGUMENT_TEXT
|
||||
import com.example.pmulabs.designElem.ArticleItem
|
||||
import com.example.pmulabs.repository.ArticleRepository
|
||||
|
||||
@Composable
|
||||
fun SearchScreen(navController: NavController, modifier: Modifier = Modifier){
|
||||
|
||||
val articleRepository= ArticleRepository()
|
||||
val getAllData= articleRepository.getAllData()
|
||||
var text=navController.currentBackStackEntry?.arguments?.getString(SEARCH_ARGUMENT_TEXT).toString()
|
||||
Log.d("text: ",text)
|
||||
|
||||
LazyColumn(
|
||||
modifier= Modifier
|
||||
.background(Color.White)
|
||||
.fillMaxSize(),
|
||||
contentPadding = PaddingValues(top =75.dp, bottom = 10.dp, start = 10.dp,end=10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(1.dp)){
|
||||
item{
|
||||
BackButton(modifier=Modifier
|
||||
.clickable { navController.popBackStack()})
|
||||
}
|
||||
items(items = getAllData){ article ->
|
||||
if(article.title.contains(text)) {
|
||||
ArticleItem(article = article,onArticleClick = {navController.navigate(BottomBarScreen.ArticlePage.passId(article.id.toString()))})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.requiredWidth
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonColors
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.designElem.LeftCircles
|
||||
import com.example.pmulabs.designElem.LogoMobile
|
||||
import com.example.pmulabs.designElem.RightCircles
|
||||
import com.example.pmulabs.graphs.AuthScreen
|
||||
|
||||
@Composable
|
||||
fun SplashScreen(navController: NavController,modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 915.dp)
|
||||
.background(color = Color.White)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 128.dp,
|
||||
y = 730.dp
|
||||
)
|
||||
.requiredWidth(width = 381.dp)
|
||||
.requiredHeight(height = 268.dp)
|
||||
.rotate(degrees = 8.33f)
|
||||
) {
|
||||
RightCircles()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = (-111.28436279296875).dp,
|
||||
y = (-96.86965942382812).dp
|
||||
)
|
||||
.requiredWidth(width = 250.dp)
|
||||
.requiredHeight(height = 290.dp)
|
||||
.rotate(degrees = 12.96f)
|
||||
) {
|
||||
LeftCircles()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 200.dp
|
||||
)
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 190.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 62.00006103515625.dp,
|
||||
y = 50.dp
|
||||
)
|
||||
.requiredWidth(width = 302.dp)
|
||||
.requiredHeight(height = 140.dp)
|
||||
) {
|
||||
LogoMobile(modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 9.dp
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.requiredHeight(height = 131.dp))
|
||||
}
|
||||
Text(
|
||||
text = "Welcome to",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 48.sp,
|
||||
fontWeight = FontWeight.Bold),
|
||||
modifier = Modifier
|
||||
.fillMaxSize())
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 0.dp,
|
||||
y = 649.2312622070312.dp
|
||||
)
|
||||
.requiredWidth(width = 412.dp)
|
||||
.requiredHeight(height = 92.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Best app with game news!",
|
||||
color = Color(0xff7d7dbd),
|
||||
textAlign = TextAlign.Center,
|
||||
style = TextStyle(
|
||||
fontSize = 20.sp),
|
||||
modifier = Modifier
|
||||
.fillMaxSize())
|
||||
Button(
|
||||
colors = ButtonColors(
|
||||
containerColor = Color(0xff423a99),
|
||||
disabledContainerColor = Color(0xff423a99),
|
||||
contentColor = Color.White,
|
||||
disabledContentColor = Color.White
|
||||
),
|
||||
onClick = {navController.navigate(route = AuthScreen.Entry.route)},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(0.5f)
|
||||
.height(50.dp)
|
||||
.align(alignment = Alignment.TopStart)
|
||||
.offset(
|
||||
x = 106.5.dp,
|
||||
y = 31.31878662109375.dp
|
||||
)
|
||||
) {
|
||||
Text(text = "Get Started", fontSize = 20.sp)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.example.pmulabs.screensMobile
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import com.example.pmulabs.basecomponents.navigate.BottomBarScreen
|
||||
import com.example.pmulabs.designElem.TagItem
|
||||
import com.example.pmulabs.repository.TegRepository
|
||||
|
||||
@Composable
|
||||
fun TagsScreen(navController: NavController, modifier: Modifier = Modifier){
|
||||
|
||||
val tegRepository= TegRepository()
|
||||
val getAllData= tegRepository.getAllData()
|
||||
|
||||
LazyColumn(
|
||||
modifier= Modifier
|
||||
.background(Color.White)
|
||||
.fillMaxSize(),
|
||||
contentPadding = PaddingValues(top =75.dp, bottom = 10.dp, start = 25.dp,end=25.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(15.dp)){
|
||||
items(items = getAllData){ tag ->
|
||||
TagItem(
|
||||
teg = tag,
|
||||
onTagClick = {navController.navigate(BottomBarScreen.SearchByTag.passId(tag.id.toString()))}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
11
app/src/main/java/com/example/pmulabs/ui/theme/Color.kt
Normal file
@ -0,0 +1,11 @@
|
||||
package com.example.pmulabs.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val Purple80 = Color(0xFFD0BCFF)
|
||||
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||
val Pink80 = Color(0xFFEFB8C8)
|
||||
|
||||
val Purple40 = Color(0xFF6650a4)
|
||||
val PurpleGrey40 = Color(0xFF625b71)
|
||||
val Pink40 = Color(0xFF7D5260)
|
70
app/src/main/java/com/example/pmulabs/ui/theme/Theme.kt
Normal file
@ -0,0 +1,70 @@
|
||||
package com.example.pmulabs.ui.theme
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.core.view.WindowCompat
|
||||
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Purple80,
|
||||
secondary = PurpleGrey80,
|
||||
tertiary = Pink80
|
||||
)
|
||||
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
primary = Purple40,
|
||||
secondary = PurpleGrey40,
|
||||
tertiary = Pink40
|
||||
|
||||
/* Other default colors to override
|
||||
background = Color(0xFFFFFBFE),
|
||||
surface = Color(0xFFFFFBFE),
|
||||
onPrimary = Color.White,
|
||||
onSecondary = Color.White,
|
||||
onTertiary = Color.White,
|
||||
onBackground = Color(0xFF1C1B1F),
|
||||
onSurface = Color(0xFF1C1B1F),
|
||||
*/
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun PMULabsTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
// Dynamic color is available on Android 12+
|
||||
dynamicColor: Boolean = true,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val colorScheme = when {
|
||||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
val context = LocalContext.current
|
||||
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||
}
|
||||
|
||||
darkTheme -> DarkColorScheme
|
||||
else -> LightColorScheme
|
||||
}
|
||||
val view = LocalView.current
|
||||
if (!view.isInEditMode) {
|
||||
SideEffect {
|
||||
val window = (view.context as Activity).window
|
||||
window.statusBarColor = colorScheme.primary.toArgb()
|
||||
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
|
||||
}
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = Typography,
|
||||
content = content
|
||||
)
|
||||
}
|
34
app/src/main/java/com/example/pmulabs/ui/theme/Type.kt
Normal file
@ -0,0 +1,34 @@
|
||||
package com.example.pmulabs.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
// Set of Material typography styles to start with
|
||||
val Typography = Typography(
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
/* Other default text styles to override
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
*/
|
||||
)
|
BIN
app/src/main/res/drawable/ellipse7.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
5
app/src/main/res/drawable/ic_bottom_categories.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:tint="#423A99" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19L3,19L3,5h18v14zM5,10h9v2L5,12zM5,7h9v2L5,9z"/>
|
||||
</vector>
|
@ -0,0 +1,5 @@
|
||||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:tint="#FFFFFF" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM12,11L3,11L3,9h9v2zM12,7L3,7L3,5h9v2z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_bottom_cooperation.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#423A99"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM12.31,11.14c-1.77,-0.45 -2.34,-0.94 -2.34,-1.67 0,-0.84 0.79,-1.43 2.1,-1.43 1.38,0 1.9,0.66 1.94,1.64h1.71c-0.05,-1.34 -0.87,-2.57 -2.49,-2.97L13.23,5L10.9,5v1.69c-1.51,0.32 -2.72,1.3 -2.72,2.81 0,1.79 1.49,2.69 3.66,3.21 1.95,0.46 2.34,1.15 2.34,1.87 0,0.53 -0.39,1.39 -2.1,1.39 -1.6,0 -2.23,-0.72 -2.32,-1.64L8.04,14.33c0.1,1.7 1.36,2.66 2.86,2.97L10.9,19h2.34v-1.67c1.52,-0.29 2.72,-1.16 2.73,-2.77 -0.01,-2.2 -1.9,-2.96 -3.66,-3.42z"/>
|
||||
</vector>
|
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13.41,18.09L13.41,20h-2.67v-1.93c-1.71,-0.36 -3.16,-1.46 -3.27,-3.4h1.96c0.1,1.05 0.82,1.87 2.65,1.87 1.96,0 2.4,-0.98 2.4,-1.59 0,-0.83 -0.44,-1.61 -2.67,-2.14 -2.48,-0.6 -4.18,-1.62 -4.18,-3.67 0,-1.72 1.39,-2.84 3.11,-3.21L10.74,4h2.67v1.95c1.86,0.45 2.79,1.86 2.85,3.39L14.3,9.34c-0.05,-1.11 -0.64,-1.87 -2.22,-1.87 -1.5,0 -2.4,0.68 -2.4,1.64 0,0.84 0.65,1.39 2.67,1.91s4.18,1.39 4.18,3.91c-0.01,1.83 -1.38,2.83 -3.12,3.16z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_bottom_info.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#423A99"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M11,7h2v2h-2zM11,11h2v6h-2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_bottom_info_focused.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_bottom_main.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#423A99"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<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>
|
5
app/src/main/res/drawable/ic_bottom_main_focused.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
||||
</vector>
|
6
app/src/main/res/drawable/ic_bottom_profile.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<vector android:height="24dp" android:tint="#423A99"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM7.35,18.5C8.66,17.56 10.26,17 12,17s3.34,0.56 4.65,1.5C15.34,19.44 13.74,20 12,20S8.66,19.44 7.35,18.5zM18.14,17.12L18.14,17.12C16.45,15.8 14.32,15 12,15s-4.45,0.8 -6.14,2.12l0,0C4.7,15.73 4,13.95 4,12c0,-4.42 3.58,-8 8,-8s8,3.58 8,8C20,13.95 19.3,15.73 18.14,17.12z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,6c-1.93,0 -3.5,1.57 -3.5,3.5S10.07,13 12,13s3.5,-1.57 3.5,-3.5S13.93,6 12,6zM12,11c-0.83,0 -1.5,-0.67 -1.5,-1.5S11.17,8 12,8s1.5,0.67 1.5,1.5S12.83,11 12,11z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_bottom_profile_focused.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM12,6c1.93,0 3.5,1.57 3.5,3.5S13.93,13 12,13s-3.5,-1.57 -3.5,-3.5S10.07,6 12,6zM12,20c-2.03,0 -4.43,-0.82 -6.14,-2.88C7.55,15.8 9.68,15 12,15s4.45,0.8 6.14,2.12C16.43,19.18 14.03,20 12,20z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_comment.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:autoMirrored="true" android:height="25dp"
|
||||
android:tint="#423A99" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="25dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2L4,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
|
||||
</vector>
|
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
BIN
app/src/main/res/drawable/iconhashtag1.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
app/src/main/res/drawable/image2.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
app/src/main/res/drawable/image3.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
app/src/main/res/drawable/ixbtcom_colored_logo1.png
Normal file
After Width: | Height: | Size: 12 KiB |
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 7.6 KiB |
10
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
3
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">PMULabs</string>
|
||||
</resources>
|
5
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.PMULabs" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
</resources>
|
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
17
app/src/test/java/com/example/pmulabs/ExampleUnitTest.kt
Normal file
@ -0,0 +1,17 @@
|
||||
package com.example.pmulabs
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
5
build.gradle.kts
Normal file
@ -0,0 +1,5 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
|
||||
}
|
23
gradle.properties
Normal file
@ -0,0 +1,23 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Fri Sep 29 21:28:05 GMT+04:00 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
185
gradlew
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
89
gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
18
settings.gradle.kts
Normal file
@ -0,0 +1,18 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "PMULabs"
|
||||
include(":app")
|
||||
|