Skip to content

Commit 5fe2a83

Browse files
committed
First Commit
0 parents  commit 5fe2a83

File tree

77 files changed

+4401
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+4401
-0
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
}
5+
6+
android {
7+
compileSdkVersion 30
8+
buildToolsVersion "30.0.3"
9+
10+
defaultConfig {
11+
applicationId "com.uniandes.tsdl.andrecn_kotlin"
12+
minSdkVersion 21
13+
targetSdkVersion 30
14+
versionCode 1
15+
versionName "1.0"
16+
17+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
kotlinOptions {
30+
jvmTarget = '1.8'
31+
}
32+
lintOptions {
33+
// textReport true
34+
checkOnly 'NoUsingWorkManager',
35+
'NoOnFailureBodyImplementation',
36+
'NoNetworkStatePermission',
37+
'NoManageNetworkUsage',
38+
'NoInternetPermission',
39+
'NoCheckNetworkTypeInProject',
40+
'NoCheckNetworkTypeInMethod',
41+
'NoCheckNetworkConnectionInProject',
42+
'NoCheckNetworkConnectionInMethod',
43+
'AvoidSync',
44+
'NoMoreThanOneOkhttpConstructor',
45+
'NoCheckInternetConnectionInProject',
46+
'NoCheckInternetConnectionInMethod',
47+
'NoResponseCodeValidation',
48+
'NoResponseContentValidation',
49+
'NoOnResponseBodyImplementation'
50+
51+
// Produce report for CI:
52+
// https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning
53+
// sarifOutput file("../lint-results.sarif")
54+
}
55+
}
56+
57+
dependencies {
58+
implementation project(':library')
59+
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
60+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
61+
implementation 'androidx.core:core-ktx:1.5.0'
62+
implementation 'androidx.appcompat:appcompat:1.3.0'
63+
implementation 'com.google.android.material:material:1.3.0'
64+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
65+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
66+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
67+
implementation 'com.github.bumptech.glide:glide:4.12.0'
68+
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
69+
implementation "androidx.recyclerview:recyclerview:1.2.0-alpha06"
70+
testImplementation 'junit:junit:4.+'
71+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
72+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
73+
implementation "com.android.volley:volley:1.2.0"
74+
}

app/lint.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- <lint lintJars="..." checkDependencies="true" ignoreTestSources="true"> -->
3+
<lint checkDependencies="true" ignoreTestSources="true">
4+
5+
<issue id="all" severity="ignore"/>
6+
7+
<!-- SETTINGS -->
8+
<issue id="NoInternetPermission" severity="warning"/>
9+
<issue id="NoNetworkStatePermission" severity="warning"/>
10+
11+
<!-- CONNECTION STATUS -->
12+
<issue id="NoCheckInternetConnectionInProject" severity="warning"/>
13+
<issue id="NoCheckInternetConnectionInMethod" severity="warning"/>
14+
15+
<issue id="NoCheckNetworkConnectionInProject" severity="warning"/>
16+
<issue id="NoCheckNetworkConnectionInMethod" severity="warning"/>
17+
18+
<issue id="NoCheckNetworkTypeInProject" severity="warning"/>
19+
<issue id="NoCheckNetworkTypeInMethod" severity="warning"/>
20+
21+
<!-- DATA PROCESSING -->
22+
<issue id="NoResponseContentValidation" severity="warning"/>
23+
<issue id="NoResponseCodeValidation" severity="warning"/>
24+
<issue id="NoOnResponseBodyImplementation" severity="warning"/>
25+
<issue id="NoOnFailureBodyImplementation" severity="warning"/>
26+
27+
<!-- MANAGEMENT -->
28+
<issue id="NoManageNetworkUsage" severity="warning"/>
29+
30+
<!-- LIBRARY SPECIFIC -->
31+
<issue id="NoMoreThanOneOkhttpConstructor" severity="warning"/>
32+
33+
<!-- BEST PRACTICES & GUIDELINES -->
34+
<issue id="AvoidSync" severity="warning"/>
35+
<issue id="NoUsingWorkManager" severity="warning"/>
36+
37+
</lint>
38+

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.uniandes.tsdl.andrecn_kotlin
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.uniandes.tsdl.andrecn_kotlin", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.uniandes.tsdl.andrecn_kotlin">
4+
5+
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" ></uses-permission>-->
6+
<!-- <uses-permission android:name="android.permission.INTERNET"/>-->
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.AndrECnkotlin">
14+
<activity android:name=".MainActivity">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
22+
<!-- <activity android:label="SettingsActivity" android:name=".SettingsActivity">-->
23+
<!-- <intent-filter>-->
24+
<!-- <action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />-->
25+
<!-- <category android:name="android.intent.category.DEFAULT" />-->
26+
<!-- </intent-filter>-->
27+
<!-- </activity>-->
28+
29+
</application>
30+
31+
</manifest>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.uniandes.tsdl.andrecn_kotlin
2+
3+
import retrofit2.Call
4+
import retrofit2.Retrofit
5+
import retrofit2.converter.gson.GsonConverterFactory
6+
import retrofit2.http.*
7+
8+
interface APIInterface {
9+
@GET("movies/")
10+
fun getMovies() : Call<List<Movie>>
11+
12+
@POST("movies/")
13+
fun postMovies() : Call<List<Movie>>
14+
15+
@HTTP(method = "GET", path = "movies/")
16+
fun getMoovies() : Call<List<Movie>>
17+
18+
@PUT("movies/")
19+
fun putMovies() : Call<List<Movie>>
20+
21+
@PATCH("movies/")
22+
fun patchMovies() : Call<List<Movie>>
23+
24+
@DELETE("movies/")
25+
fun deleteMovies() : Call<List<Movie>>
26+
27+
@OPTIONS("movies/")
28+
fun optionsMovies() : Call<List<Movie>>
29+
30+
@HEAD("movies/")
31+
fun headMovies() : Call<List<Movie>>
32+
33+
companion object {
34+
35+
var BASE_URL = "https://android-eventual-connectivity.herokuapp.com/"
36+
37+
fun create() : APIInterface {
38+
39+
val retrofit = Retrofit.Builder()
40+
.addConverterFactory(GsonConverterFactory.create())
41+
.baseUrl(BASE_URL)
42+
.build()
43+
return retrofit.create(APIInterface::class.java)
44+
45+
}
46+
}
47+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.uniandes.tsdl.andrecn_kotlin
2+
3+
4+
import android.content.Context
5+
import android.net.ConnectivityManager
6+
import android.net.NetworkCapabilities
7+
import okhttp3.OkHttpClient
8+
9+
class CheckNetworConnected {
10+
11+
private val TAG: String = CheckNetworConnected::class.java.getSimpleName()
12+
13+
fun toMyString(): String {
14+
15+
val client = OkHttpClient()
16+
17+
val client_2 = OkHttpClient()
18+
19+
return "exito"
20+
}
21+
22+
fun isCheckConnectivity(context:Context):Boolean
23+
{
24+
// val connMgr = (context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager)
25+
// var isWifiConn: Boolean = false
26+
// var isMobileConn: Boolean = false
27+
// connMgr.allNetworks.forEach { network ->
28+
// connMgr.getNetworkInfo(network)?.apply {
29+
// if (type == ConnectivityManager.TYPE_WIFI) {
30+
// isWifiConn = isWifiConn or isConnected
31+
// }
32+
// if (type == ConnectivityManager.TYPE_MOBILE) {
33+
// isMobileConn = isMobileConn or isConnected
34+
// }
35+
// }
36+
// val netwCap = connMgr.getNetworkCapabilities(network)
37+
// if (netwCap != null) {
38+
// netwCap.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)
39+
// }
40+
// }
41+
return true
42+
}
43+
44+
45+
46+
47+
48+
}

0 commit comments

Comments
 (0)