Skip to content

Instantly share code, notes, and snippets.

View pedromassango's full-sized avatar
🔥

Pedro Massango pedromassango

🔥
View GitHub Profile
@pedromassango
pedromassango / UserJava
Last active January 8, 2018 00:04
A java model class with Parcelable
/**
* Created by pedromassango on 1/8/18.
*/
public class UserJava implements Parcelable {
private String username;
private int age;
protected UserJava(Parcel in, String username, int age) {
@SuppressLint("ParcelCreator")
@Parcelize
class User(var username: String, var age: Int): Parcelable
// ADD this to use Parcelize, etc.
apply plugin: 'kotlin-android-extensions'
android {
...
defaultConfig { ... }
buildTypes { .... }
// ADD this to use Parcelize, etc.
#Fri May 11 01:18:34 WAT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
google()
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:3.1.2'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.pedromassango.materialdesigncomponents"
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<android.support.design.button.MaterialButton
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Press me"
android:layout_height="wrap_content"/>
val alarmMgr = getSystemService(Context.ALARM_SERVICE) as AlarmManager
// Intent to start the Broadcast Receiver
val broadcastIntent = Intent(this, AlarmBroadcastReceiver::class.java)
// The Pending Intent to pass in AlarmManager
val pIntent = PendingIntent.getBroadcast(this,0,broadcastIntent,0)