Skip to content

Commit b4566ea

Browse files
committed
Initial commit
0 parents  commit b4566ea

File tree

87 files changed

+3380
-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.

87 files changed

+3380
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown-navigator-enh.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown-navigator.xml

+62
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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.alphelios.mediapicker"
12+
minSdkVersion 21
13+
targetSdkVersion 30
14+
versionCode 1
15+
versionName "1.0"
16+
17+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
buildTypes {
21+
release {
22+
minifyEnabled false
23+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24+
}
25+
}
26+
compileOptions {
27+
sourceCompatibility JavaVersion.VERSION_1_8
28+
targetCompatibility JavaVersion.VERSION_1_8
29+
}
30+
kotlinOptions {
31+
jvmTarget = '1.8'
32+
}
33+
buildFeatures {
34+
viewBinding true
35+
}
36+
}
37+
38+
dependencies {
39+
40+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
41+
implementation 'androidx.core:core-ktx:1.3.2'
42+
implementation 'androidx.appcompat:appcompat:1.2.0'
43+
implementation 'com.google.android.material:material:1.2.1'
44+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
45+
testImplementation 'junit:junit:4.13.1'
46+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
47+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
48+
49+
implementation 'com.intuit.sdp:sdp-android:1.0.6'
50+
implementation 'com.airbnb.android:lottie:3.6.0'
51+
52+
//Glide
53+
implementation 'com.github.bumptech.glide:glide:4.11.0'
54+
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
55+
56+
implementation project(':dazzle')
57+
}

app/proguard-rules.pro

+21
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.alphelios.mediapicker
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.alphelios.mediapicker", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.alphelios.mediapicker">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.alphelios.mediapicker
2+
3+
import android.app.Activity
4+
import android.content.Intent
5+
import android.net.Uri
6+
import android.os.Bundle
7+
import android.view.LayoutInflater
8+
import android.widget.ImageView
9+
import androidx.appcompat.app.AppCompatActivity
10+
import com.alphelios.dazzle.Dazzle
11+
import com.alphelios.dazzle.Dazzle.Companion.PICKED_MEDIA_LIST
12+
import com.alphelios.dazzle.Dazzle.Companion.REQUEST_CODE_PICKER
13+
import com.alphelios.dazzle.utils.DazzleOptions
14+
import com.alphelios.mediapicker.databinding.ActivityMainBinding
15+
import com.bumptech.glide.Glide
16+
17+
class MainActivity : AppCompatActivity() {
18+
19+
private lateinit var binding: ActivityMainBinding
20+
override fun onCreate(savedInstanceState: Bundle?) {
21+
super.onCreate(savedInstanceState)
22+
binding = ActivityMainBinding.inflate(layoutInflater)
23+
setContentView(binding.root)
24+
25+
binding.toolbar.setOnMenuItemClickListener {
26+
when(it.itemId){
27+
R.id.github -> {
28+
startActivity(Intent(Intent.ACTION_VIEW,
29+
Uri.parse("https://github.com/")))
30+
}
31+
}
32+
false
33+
}
34+
35+
val dazzleOptions =
36+
DazzleOptions.init().apply {
37+
maxCount = 5 //maximum number of images/videos to be picked
38+
maxVideoDuration = 10 //maximum duration for video capture in seconds
39+
allowFrontCamera = true //allow front camera use
40+
excludeVideos = false //exclude or include video functionalities
41+
}
42+
43+
binding.selectMedia.setOnClickListener {
44+
Dazzle.startPicker(this, dazzleOptions) //this -> context of Activity or Fragment
45+
}
46+
}
47+
48+
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
49+
super.onActivityResult(requestCode, resultCode, data)
50+
51+
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_PICKER){
52+
53+
val mImageList = data?.getStringArrayListExtra(PICKED_MEDIA_LIST) as ArrayList //List of selected/captured images/videos
54+
mImageList.map {
55+
val inflate = LayoutInflater.from(this).inflate(R.layout.scrollitem_image, binding.imageContainer,false)
56+
val iv = inflate as ImageView
57+
58+
59+
Glide.with(this).load(it).into(iv)
60+
binding.imageContainer.addView(iv)
61+
}
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)