-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oleg Smirnov
committed
Dec 21, 2020
1 parent
2e628db
commit 10b750d
Showing
379 changed files
with
8,880 additions
and
971 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/******************************************************************************* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2019 vk.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
|
||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply from: '../../dependencies.gradle' | ||
|
||
android { | ||
compileSdkVersion "$sdkVersions.compileSdk".toInteger() | ||
buildToolsVersion "$sdkVersions.buildTools" | ||
|
||
defaultConfig { | ||
applicationId = "com.vk.sdk.sample" | ||
minSdkVersion "$sdkVersions.minSdk" | ||
targetSdkVersion "$sdkVersions.targetSdk" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
lintOptions { | ||
abortOnError true | ||
checkReleaseBuilds true | ||
} | ||
|
||
dexOptions { | ||
preDexLibraries true | ||
javaMaxHeapSize "5g" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: '*.jar') | ||
implementation sdkLibraries.kotlin | ||
implementation sdkLibrariesSupport.recyclerView | ||
implementation sdkLibrariesSupport.appCompat | ||
implementation (sdkLibraries.picasso) { transitive = false } | ||
implementation sdkLibraries.okHttp | ||
|
||
implementation project(':libapi-sdk-core') | ||
implementation project(':libapi-sdk-api') | ||
//implementation 'com.vk:androidsdk:2.0.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!-- ******************************************************************************* | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2019 vk.com | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
# ****************************************************************************** --> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.vk.sdk.sample"> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | ||
|
||
<application | ||
android:name=".SampleApplication" | ||
android:allowBackup="false" | ||
android:label="@string/app_name" | ||
android:icon="@mipmap/ic_launcher_round" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:networkSecurityConfig="@xml/network_security_config" | ||
android:theme="@style/AppTheme" > | ||
<activity | ||
android:name=".WelcomeActivity" | ||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | ||
android:label="@string/app_name" | ||
android:launchMode="singleInstance" | ||
android:windowSoftInputMode="adjustResize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".UserActivity" | ||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | ||
android:label="@string/app_name" /> | ||
</application> | ||
</manifest> |
43 changes: 43 additions & 0 deletions
43
samples/app/sdk/src/main/java/com/vk/sdk/sample/PathUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2019 vk.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
|
||
package com.vk.sdk.sample | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import android.provider.MediaStore | ||
|
||
object PathUtils { | ||
fun getPath(context: Context, uri: Uri): String { | ||
if (uri.scheme == "file") { | ||
if (uri.path != null) return uri.path!! | ||
return "" | ||
} | ||
val proj = arrayOf(MediaStore.Images.Media.DATA) | ||
val cursor = context.contentResolver.query(uri, proj, null, null, null) | ||
val columnIndex = cursor!!.getColumnIndexOrThrow(MediaStore.Images.Media.DATA) | ||
cursor.moveToFirst() | ||
return "file://" + cursor.getString(columnIndex) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
samples/app/sdk/src/main/java/com/vk/sdk/sample/SampleApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2019 vk.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
|
||
package com.vk.sdk.sample | ||
|
||
import android.app.Application | ||
import com.vk.api.sdk.VK | ||
import com.vk.api.sdk.VKTokenExpiredHandler | ||
|
||
class SampleApplication: Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
VK.addTokenExpiredHandler(tokenTracker) | ||
} | ||
|
||
private val tokenTracker = object: VKTokenExpiredHandler { | ||
override fun onTokenExpired() { | ||
WelcomeActivity.startFrom(this@SampleApplication) | ||
} | ||
} | ||
} |
Oops, something went wrong.