Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O_notifications #5

Merged
merged 22 commits into from Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@
/build
/captures
.externalNativeBuild
/.idea/
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions .travis.yml
Expand Up @@ -8,14 +8,19 @@ android:
components:
- tools
- platform-tools
- build-tools-25.0.3
- android-25
- build-tools-26.0.0-preview
- tools
- 'android-O'
- extra-android-support
- extra-google-google_play_services
- extra-android-m2repository
- extra-google-m2repository
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- '.+'
install: [
"echo yes | ${ANDROID_HOME}tools/bin/sdkmanager \"platforms;android-O\" --channel=3"]
script:
- ./gradlew build
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -9,6 +9,7 @@ The project contains the following apps:
#### 4. sqlitedatabase: A simple sqlite database app with mock server which handles user(friend) search and logs the queries into local database. A good app to understand RxAndroid in kotlin.
#### 5. videostreaming: A live RTSP video streaming app with custom media controls.(Better run this app on physical device)
#### 6. customcamera: This is a MVP pattern, custom camera app with flash support. The home screen is a gridview which shows clicked photos. Dagger 2 implementation added.
#### 7. o_notifications: This is a MVP pattern, android-O notifications. The home screen provides simple way to create notification channels and notifications. By default there are 2 notification groups “Personal” and “Business”.

More to come in future :octocat: :star2:

Expand All @@ -35,3 +36,4 @@ Location (If using emulator then send the location from Extended Controls of Emu
Sqlite | <img src="/gifs/database.gif" width="59%">
Video Streaming (Always use device to run this App since emulator has rendering issues) | <img src="/gifs/videostreaming.gif" width="59%">
Custom Camera | <img src="/gifs/customcamera.gif" width="59%">
Android-O Notifications | <img src="/gifs/o_notification_003.gif" width="59%">
24 changes: 7 additions & 17 deletions app/build.gradle
Expand Up @@ -3,12 +3,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0-rc2"
defaultConfig {
applicationId "com.talentica.androidkotlin"
minSdkVersion 21
targetSdkVersion 25
minSdkVersion 16
targetSdkVersion 'O'
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -30,21 +30,11 @@ android {
}
}

//ext {
// buildToolsVersion = "25.0.2"
// supportLibVersion = "25.3.1"
// runnerVersion = "0.5"
// rulesVersion = "0.5"
// espressoVersion = "2.2.2"
// archLifecycleVersion = "1.0.0-alpha1"
// archRoomVersion = "1.0.0-alpha1"
//}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
compile 'com.android.support:cardview-v7:26.0.0-beta1'
compile 'com.android.support:recyclerview-v7:26.0.0-beta1'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha1'
compile 'android.arch.persistence.room:runtime:1.0.0-alpha1'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"
Expand Down
8 changes: 4 additions & 4 deletions audioplayer/build.gradle
Expand Up @@ -3,14 +3,14 @@ apply plugin: 'kotlin-android'


android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0 rc2"


defaultConfig {
applicationId "com.talentica.androidkotlin.audioplayer"
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 'O'
versionCode 1
versionName "1.0"

Expand All @@ -31,7 +31,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
Expand Down
Expand Up @@ -30,13 +30,13 @@ class MainActivity : AppCompatActivity(), SeekBar.OnSeekBarChangeListener, Media
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

mSeekbar = findViewById(R.id.progressbar) as SeekBar
mSeekbar = findViewById<SeekBar>(R.id.progressbar)
mSeekbar?.setOnSeekBarChangeListener(this)

mPlayPauseButton = findViewById(R.id.play_pause_btn) as ImageButton
mPlayPauseButton = findViewById<ImageButton>(R.id.play_pause_btn)
mPlayPauseButton?.setOnClickListener(this)

mTimer = findViewById(R.id.tv_progress) as TextView
mTimer = findViewById<TextView>(R.id.tv_progress)
}

override fun onClick(v: View?) {
Expand Down
10 changes: 5 additions & 5 deletions customcamera/build.gradle
Expand Up @@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0 rc2"


defaultConfig {
applicationId "com.talentica.androidkotlin.customcamera"
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 'O'
versionCode 1
versionName "1.0"

Expand All @@ -30,7 +30,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

Expand All @@ -46,7 +46,7 @@ dependencies {
compile 'io.reactivex:rxjava:1.0.15'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava-async-util:0.21.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:design:26.0.0-beta1'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.jakewharton.timber:timber:2.7.1'
}
Expand Up @@ -39,7 +39,7 @@ class LandingGalleryAdapter(private val mContext: Context) : BaseAdapter() {
}

val bm = decodeSampledBitmapFromUri(itemList[position], 220, 220)
val imv:ImageView = viewItem?.findViewById(R.id.pic) as ImageView
val imv:ImageView = viewItem?.findViewById<ImageView>(R.id.pic)!!
imv.setImageBitmap(bm)
return viewItem!!
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ class LandingActivity : SlowkaActivity<LandingActivityView>(), LandingActivityVi
super.onCreate(savedInstanceState)
setContentViewWithToolbar(R.layout.activity_landing, true)

val fab = findViewById(R.id.fab) as FloatingActionButton
val fab = findViewById<FloatingActionButton>(R.id.fab)
fab.setOnClickListener {
startActivity(CameraActivity.createIntent(this))
}
Expand Down
Binary file added gifs/o_notification_003.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions locationmanager/build.gradle
Expand Up @@ -3,14 +3,14 @@ apply plugin: 'kotlin-android'


android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0 rc2"


defaultConfig {
applicationId "com.talentica.androidkotlin.locationmanager"
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 'O'
versionCode 1
versionName "1.0"

Expand All @@ -31,7 +31,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-location:10.2.6'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
Expand Down
Expand Up @@ -148,14 +148,14 @@ class MainActivity : AppCompatActivity(), GoogleApiClient.ConnectionCallbacks,
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main);

btn_location = findViewById(R.id.btn_detect_fused_location) as Button
btn_location = findViewById<Button>(R.id.btn_detect_fused_location)
//total six textviews
txt_location = findViewById(R.id.txt_location) as TextView
mLatitudeTextView = findViewById(R.id.mLatitudeTextView) as TextView
mLongitudeTextView = findViewById(R.id.mLongitudeTextView) as TextView
mLastUpdateTimeTextView = findViewById(R.id.mLastUpdateTimeTextView) as TextView
tv_city = findViewById(R.id.tv_city) as TextView
tv_pincode = findViewById(R.id.tv_pincode) as TextView
txt_location = findViewById<TextView>(R.id.txt_location)
mLatitudeTextView = findViewById<TextView>(R.id.mLatitudeTextView)
mLongitudeTextView = findViewById<TextView>(R.id.mLongitudeTextView)
mLastUpdateTimeTextView = findViewById<TextView>(R.id.mLastUpdateTimeTextView)
tv_city = findViewById<TextView>(R.id.tv_city)
tv_pincode = findViewById<TextView>(R.id.tv_pincode)

// Set labels.
mLatitudeLabel = "lat"//getResources().getString(R.string.latitude_label);
Expand Down Expand Up @@ -289,7 +289,9 @@ class MainActivity : AppCompatActivity(), GoogleApiClient.ConnectionCallbacks,
} else {
mCurrentLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
mLastUpdateTime = DateFormat.getTimeInstance().format(Date());
updateLocationUI();
runOnUiThread {
updateLocationUI();
}
}
}
}
Expand All @@ -302,12 +304,13 @@ class MainActivity : AppCompatActivity(), GoogleApiClient.ConnectionCallbacks,
override fun onLocationChanged(location: Location?) {
mCurrentLocation = location;
mLastUpdateTime = DateFormat.getTimeInstance().format(Date());
updateLocationUI();
Toast.makeText(this, "Location updated", Toast.LENGTH_SHORT).show();
runOnUiThread {
updateLocationUI();
Toast.makeText(this, "Location updated", Toast.LENGTH_SHORT).show();
}
}

override fun onConnectionFailed(connectionResult: ConnectionResult) {

// Refer to the javadoc for ConnectionResult to see what error codes might be returned in
// onConnectionFailed.
Log.i(TAG, "Connection failed: ConnectionResult.getErrorCode() = " + connectionResult.getErrorCode());
Expand All @@ -329,12 +332,14 @@ class MainActivity : AppCompatActivity(), GoogleApiClient.ConnectionCallbacks,
Log.i(TAG, "Location settings are not satisfied. Show the user a dialog to" +
"upgrade location settings ");
try {
// Show the dialog by calling startResolutionForResult(), and check the result
// in onActivityResult().
Toast.makeText(this, "Location dialog will be open", Toast.LENGTH_SHORT).show();
runOnUiThread {
// Show the dialog by calling startResolutionForResult(), and check the result
// in onActivityResult().
Toast.makeText(this, "Location dialog will be open", Toast.LENGTH_SHORT).show();

//move to step 6 in onActivityResult to check what action user has taken on settings dialog
status.startResolutionForResult(this, REQUEST_CHECK_SETTINGS);
//move to step 6 in onActivityResult to check what action user has taken on settings dialog
status.startResolutionForResult(this, REQUEST_CHECK_SETTINGS);
}
} catch (e: IntentSender.SendIntentException) {
Log.i(TAG, "PendingIntent unable to execute request.");
}
Expand Down
1 change: 1 addition & 0 deletions o_notifications/.gitignore
@@ -0,0 +1 @@
/build
21 changes: 21 additions & 0 deletions o_notifications/README.md
@@ -0,0 +1,21 @@
# Android-O Notifications With Kotlin

This project is written in kotlin to display usage new notification manager features to support android-O.

MVP has been used in this app, usage of dependency injection framework like dagger2 is highly recommended:

This creates 2 notification channel groups when presenter (NotificationPresenter) starts: “Personal” and “Business”


## Minimum Requirements

* Android Studio 3.0 Canery 3
* Kotlin compiler and runtime version 1.1.2-4
* Android O
* Android sdk tools 26.0.2
* Android sdk build-tools 26 rc2
* Android sdk plateform-toools 26.0.0 rc2

Android-O Notifications

<img src="../gifs/o_notification_003.gif" width="59%">
42 changes: 42 additions & 0 deletions o_notifications/build.gradle
@@ -0,0 +1,42 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'


android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0 rc2"


defaultConfig {
applicationId "com.talentica.androidkotlin.onotifications"
minSdkVersion 'O'
targetSdkVersion 'O'
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:26.0.0-beta1'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.github.enricocid:cpl:1.0.2'
}
repositories {
mavenCentral()
}
25 changes: 25 additions & 0 deletions o_notifications/proguard-rules.pro
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/kaushald/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# 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