This file contains hidden or 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
package com.datasync | |
import android.accounts.Account | |
import android.content.* | |
import android.os.Bundle | |
import android.util.Log | |
import timber.log.Timber | |
class SyncAdapter @JvmOverloads constructor( | |
context: Context, |
This file contains hidden or 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
package com.activity | |
import android.os.Bundle | |
import kotlinx.android.synthetic.main.activity_statistiques.* | |
class StatsActivity : BaseActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
This file contains hidden or 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
package com.activity | |
import android.graphics.Color | |
import android.graphics.DashPathEffect | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import com.github.mikephil.charting.charts.LineChart | |
import com.github.mikephil.charting.components.Legend | |
import com.github.mikephil.charting.components.LimitLine | |
import com.github.mikephil.charting.components.LimitLine.LimitLabelPosition |
This file contains hidden or 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
/* | |
https://ntic974.blogspot.com | |
*/ | |
// Définir la date de début de stats par défaut au 1er janvier de l'année en cours | |
val cal = Calendar.getInstance() | |
cal.set(Calendar.MONTH, 0) | |
cal.set(Calendar.DAY_OF_MONTH, 1) | |
val year_start = cal.get(Calendar.YEAR) | |
val month_start = cal.get(Calendar.MONTH) // Mois de 0 à 11 |
This file contains hidden or 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
// first day of year | |
val cal = Calendar.getInstance() | |
cal.set(Calendar.MONTH, 0) | |
cal.set(Calendar.DAY_OF_MONTH, 1) | |
val year_start = cal.get(Calendar.YEAR) | |
val month_start = cal.get(Calendar.MONTH) // Mois de 0 à 11 | |
val day_start = cal.get(Calendar.DAY_OF_MONTH) | |
textViewStartDate.setText("${String.format("%02d", day_start)}/${String.format("%02d", month_start+1)}/${String.format("%04d", year_start)}") | |
// last day of year |
This file contains hidden or 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
//https://medium.com/@manuaravindpta/fetching-contacts-from-device-using-kotlin-6c6d3e76574f | |
package com.dev2qa.example.datasharing.contacts; | |
import android.Manifest; | |
import android.content.ContentResolver; | |
import android.content.ContentUris; | |
import android.content.ContentValues; | |
import android.content.pm.PackageManager; |
This file contains hidden or 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
if (!hasPhoneContactsPermission(Manifest.permission.READ_CONTACTS)) { | |
requestReadContactsPermission(Manifest.permission.READ_CONTACTS) | |
} else { | |
val cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null) | |
if (cursor != null) { | |
if (cursor.count > 0) { | |
while (cursor.moveToNext()) { | |
val id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)) | |
val name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)) | |
val phoneNumber = (cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))).toInt() |
This file contains hidden or 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
phoneContact.addObserver(MyObserver(recyclerViewPhoneContacts)) | |
class PhoneContact: Observable() { | |
var id = "" | |
var name = "" | |
var phoneNumbers = arrayListOf<String>() | |
var emailAddresses = arrayListOf<String>() | |
var addresses = arrayListOf<String>() | |
var selected = false |
This file contains hidden or 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
fun getPhoneContacts() : List<PhoneContact> { | |
phoneContactsList = ArrayList<PhoneContact>() | |
if (!hasPhoneContactsPermission(Manifest.permission.READ_CONTACTS)) { | |
requestReadContactsPermission(Manifest.permission.READ_CONTACTS) | |
} else { | |
//showOkDialog("permissions contacts", "permissions accordées", this as AppCompatActivity, false) | |
val cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null) | |
if (cursor != null) { | |
if (cursor.count > 0) { | |
while (cursor.moveToNext()) { |
This file contains hidden or 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
android.support.v7.widget.util.SortedListAdapterCallback | androidx.recyclerview.widget.SortedListAdapterCallback | |
---|---|---|
android.support.v7.widget.helper.ItemTouchUIUtilImpl | androidx.recyclerview.widget.ItemTouchUIUtilImpl | |
android.support.v7.widget.helper.ItemTouchUIUtil | androidx.recyclerview.widget.ItemTouchUIUtil | |
android.support.v7.widget.helper.ItemTouchHelper | androidx.recyclerview.widget.ItemTouchHelper | |
android.support.v7.widget.WithHint | androidx.appcompat.widget.WithHint | |
android.support.v7.widget.ViewUtils | androidx.appcompat.widget.ViewUtils | |
android.support.v7.widget.ViewStubCompat | androidx.appcompat.widget.ViewStubCompat | |
android.support.v7.widget.ViewInfoStore | androidx.recyclerview.widget.ViewInfoStore | |
android.support.v7.widget.ViewBoundsCheck | androidx.recyclerview.widget.ViewBoundsCheck | |
android.support.v7.widget.VectorEnabledTintResources | androidx.appcompat.widget.VectorEnabledTintResources |