From 09b5f21384c2791cb47f974716517a47752e7668 Mon Sep 17 00:00:00 2001 From: Alireza Saei Date: Sat, 22 Jan 2022 17:27:21 +0330 Subject: [PATCH 1/4] Reading from JSON & classes --- LinkedIn/.gitignore | 15 ++ LinkedIn/.idea/.gitignore | 3 + LinkedIn/.idea/compiler.xml | 6 + LinkedIn/.idea/gradle.xml | 21 ++ LinkedIn/.idea/misc.xml | 18 ++ LinkedIn/.idea/vcs.xml | 6 + LinkedIn/app/.gitignore | 1 + LinkedIn/app/build.gradle | 49 +++++ LinkedIn/app/proguard-rules.pro | 21 ++ .../linkedin/ExampleInstrumentedTest.kt | 24 +++ LinkedIn/app/src/main/AndroidManifest.xml | 37 ++++ LinkedIn/app/src/main/assets/users.json | 7 + .../java/com/example/linkedin/MainActivity.kt | 38 ++++ .../com/example/linkedin/SecondActivity.kt | 41 ++++ .../java/com/example/linkedin/SplashScreen.kt | 60 ++++++ .../main/java/com/example/linkedin/User.kt | 21 ++ .../drawable-v24/ic_launcher_foreground.xml | 30 +++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++ .../app/src/main/res/drawable/splashcover.png | Bin 0 -> 12950 bytes .../app/src/main/res/layout/activity_main.xml | 55 ++++++ LinkedIn/app/src/main/res/layout/splash.xml | 18 ++ .../app/src/main/res/layout/suggestions.xml | 18 ++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes .../src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes .../app/src/main/res/values-night/themes.xml | 16 ++ LinkedIn/app/src/main/res/values/colors.xml | 10 + LinkedIn/app/src/main/res/values/strings.xml | 7 + LinkedIn/app/src/main/res/values/themes.xml | 16 ++ .../com/example/linkedin/ExampleUnitTest.kt | 17 ++ LinkedIn/build.gradle | 18 ++ LinkedIn/gradle.properties | 21 ++ LinkedIn/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + LinkedIn/gradlew | 185 ++++++++++++++++++ LinkedIn/gradlew.bat | 89 +++++++++ LinkedIn/settings.gradle | 10 + 46 files changed, 1064 insertions(+) create mode 100644 LinkedIn/.gitignore create mode 100644 LinkedIn/.idea/.gitignore create mode 100644 LinkedIn/.idea/compiler.xml create mode 100644 LinkedIn/.idea/gradle.xml create mode 100644 LinkedIn/.idea/misc.xml create mode 100644 LinkedIn/.idea/vcs.xml create mode 100644 LinkedIn/app/.gitignore create mode 100644 LinkedIn/app/build.gradle create mode 100644 LinkedIn/app/proguard-rules.pro create mode 100644 LinkedIn/app/src/androidTest/java/com/example/linkedin/ExampleInstrumentedTest.kt create mode 100644 LinkedIn/app/src/main/AndroidManifest.xml create mode 100644 LinkedIn/app/src/main/assets/users.json create mode 100644 LinkedIn/app/src/main/java/com/example/linkedin/MainActivity.kt create mode 100644 LinkedIn/app/src/main/java/com/example/linkedin/SecondActivity.kt create mode 100644 LinkedIn/app/src/main/java/com/example/linkedin/SplashScreen.kt create mode 100644 LinkedIn/app/src/main/java/com/example/linkedin/User.kt create mode 100644 LinkedIn/app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 LinkedIn/app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 LinkedIn/app/src/main/res/drawable/splashcover.png create mode 100644 LinkedIn/app/src/main/res/layout/activity_main.xml create mode 100644 LinkedIn/app/src/main/res/layout/splash.xml create mode 100644 LinkedIn/app/src/main/res/layout/suggestions.xml create mode 100644 LinkedIn/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 LinkedIn/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 LinkedIn/app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 LinkedIn/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 LinkedIn/app/src/main/res/values-night/themes.xml create mode 100644 LinkedIn/app/src/main/res/values/colors.xml create mode 100644 LinkedIn/app/src/main/res/values/strings.xml create mode 100644 LinkedIn/app/src/main/res/values/themes.xml create mode 100644 LinkedIn/app/src/test/java/com/example/linkedin/ExampleUnitTest.kt create mode 100644 LinkedIn/build.gradle create mode 100644 LinkedIn/gradle.properties create mode 100644 LinkedIn/gradle/wrapper/gradle-wrapper.jar create mode 100644 LinkedIn/gradle/wrapper/gradle-wrapper.properties create mode 100644 LinkedIn/gradlew create mode 100644 LinkedIn/gradlew.bat create mode 100644 LinkedIn/settings.gradle diff --git a/LinkedIn/.gitignore b/LinkedIn/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/LinkedIn/.gitignore @@ -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 diff --git a/LinkedIn/.idea/.gitignore b/LinkedIn/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/LinkedIn/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/LinkedIn/.idea/compiler.xml b/LinkedIn/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/LinkedIn/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LinkedIn/.idea/gradle.xml b/LinkedIn/.idea/gradle.xml new file mode 100644 index 0000000..caa6f38 --- /dev/null +++ b/LinkedIn/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/LinkedIn/.idea/misc.xml b/LinkedIn/.idea/misc.xml new file mode 100644 index 0000000..72ab208 --- /dev/null +++ b/LinkedIn/.idea/misc.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/LinkedIn/.idea/vcs.xml b/LinkedIn/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/LinkedIn/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LinkedIn/app/.gitignore b/LinkedIn/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/LinkedIn/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/LinkedIn/app/build.gradle b/LinkedIn/app/build.gradle new file mode 100644 index 0000000..45824cd --- /dev/null +++ b/LinkedIn/app/build.gradle @@ -0,0 +1,49 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' +} + +android { + compileSdk 31 + + defaultConfig { + multiDexEnabled true + applicationId "com.example.linkedin" + minSdk 19 + targetSdk 31 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildFeatures { + viewBinding true + } + + buildTypes { + release { + minifyEnabled 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' + } +} + +dependencies { + implementation 'com.google.code.gson:gson:2.8.6' + implementation 'com.android.support:multidex:1.0.3' + implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.5.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/LinkedIn/app/proguard-rules.pro b/LinkedIn/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/LinkedIn/app/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/LinkedIn/app/src/androidTest/java/com/example/linkedin/ExampleInstrumentedTest.kt b/LinkedIn/app/src/androidTest/java/com/example/linkedin/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..0f31b20 --- /dev/null +++ b/LinkedIn/app/src/androidTest/java/com/example/linkedin/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.linkedin + +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.linkedin", appContext.packageName) + } +} \ No newline at end of file diff --git a/LinkedIn/app/src/main/AndroidManifest.xml b/LinkedIn/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..7fe45e8 --- /dev/null +++ b/LinkedIn/app/src/main/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LinkedIn/app/src/main/assets/users.json b/LinkedIn/app/src/main/assets/users.json new file mode 100644 index 0000000..72cdd40 --- /dev/null +++ b/LinkedIn/app/src/main/assets/users.json @@ -0,0 +1,7 @@ +[{"id":"1","name":"arshia hemat","dateOfBirth":"1380/5/2","universityLocation":"UI","field":"CE","workplace":"morcot","specialties":["Machine learning","Reinforcement learning","Blockchain programming"],"connectionId":["2","3","4"]} +,{"id":"2","name":"amirali goli","dateOfBirth":"1379/5/2","universityLocation":"UI","field":"CE","workplace":"mohaymen","specialties":["Java programming","Django","Back-End"],"connectionId":["1","4","5","6"]} +,{"id":"3","name":"danial tavakoli","dateOfBirth":"1381/5/2","universityLocation":"UI","field":"CE","workplace":"-","specialties":["Java programming","AI"],"connectionId":["1","4","6"]} +,{"id":"4","name":"mohamad eshagh","dateOfBirth":"1381/5/3","universityLocation":"UI","field":"CE","workplace":"msi","specialties":["Kotlin programming","Android"],"connectionId":["1","2","3"]} +,{"id":"5","name":"ali ebrahimi","dateOfBirth":"1381/8/3","universityLocation":"UI","field":"CE","workplace":"-","specialties":["Java programming","AI","Java FX"],"connectionId":["2","6"]} +,{"id":"6","name":"mehrshad farahani","dateOfBirth":"1381/8/13","universityLocation":"UI","field":"CE","workplace":"-","specialties":["QT","C++ programming"],"connectionId":["2","3","5","7"]} +,{"id":"7","name":"naghi mamoli","dateOfBirth":"1340/8/3","universityLocation":"UB","field":"Ar","workplace":"Paytakht","specialties":["Building","Welding","Plastering"],"connectionId":["6"]}] \ No newline at end of file diff --git a/LinkedIn/app/src/main/java/com/example/linkedin/MainActivity.kt b/LinkedIn/app/src/main/java/com/example/linkedin/MainActivity.kt new file mode 100644 index 0000000..5a4806a --- /dev/null +++ b/LinkedIn/app/src/main/java/com/example/linkedin/MainActivity.kt @@ -0,0 +1,38 @@ +package com.example.linkedin + + +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.widget.Button +import android.widget.Toast +import com.google.android.material.textfield.TextInputEditText +import com.google.android.material.textfield.TextInputLayout + + +class MainActivity : AppCompatActivity() { + private val x = SplashScreen.allUsers + companion object { + var str: String = "" + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + val btn1 = findViewById