Skip to content

Instantly share code, notes, and snippets.

View SidoPillai's full-sized avatar
:electron:
What's next?

SidoPillai SidoPillai

:electron:
What's next?
View GitHub Profile
@SidoPillai
SidoPillai / ApiService.kt
Last active December 30, 2024 18:04
Implementing Rate Limiters for Android apps.
class ApiService(
private val rateLimiter: RateLimiter,
private val analyticsService: AnalyticsService
) {
suspend fun logEvent(event: AnalyticsEvent): Response<Data>? {
return withContext(Dispatchers.IO) {
if (rateLimiter.execute()) {
try {
analyticsService.postEvent(event)
@SidoPillai
SidoPillai / tensorflowlogs.txt
Created October 9, 2019 23:34
tensorflowlogs.txt
/home/sid/Downloads/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -D__ANDROID_API__=21 -target armv7-none-linux-androideabi -gcc-toolchain /home/sid/Downloads/android-ndk-r18b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ -Wl,--exclude-libs,libunwind.a --sysroot=/home/sid/Downloads/android-ndk-r18b/platforms/android-21/arch-arm/ -Wl,-soname,libAppStudioApp.so -Wl,-rpath=/home/sid/Qt5.13.1/5.13.1/android_armv7/lib -Wl,-rpath-link=/home/sid/Qt5.13.1/5.13.1/android_armv7/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o ../Output/android/libAppStudioApp.so ../Intermediate/android/qrc/qrc_qml_qml_qmlcache.o ../Intermediate/android/qrc/qrc_Resources.o ../Intermediate/android/obj/QmlApplication.o ../Intermediate/android/obj/NetworkAccessManagerAuth.o ../Intermediate/android/obj/NetworkAccessManagerFactory.o ../Intermediate/android/obj/NetworkAccessManagers.o ../Intermediate/android/obj/T
class MainActivity : AppCompatActivity() {
private lateinit var fusedLocationProviderClient: FusedLocationProviderClient
private lateinit var locationCallback: LocationCallback
private lateinit var locationRequest: LocationRequest
override fun onCreate(savedInstanceState: Bundle?) {
// ...
class GooglePlayServicesUtil {
companion object {
private const val GOOGLE_PLAY_SERVICES_AVAILABLE_REQUEST = 9000
fun isGooglePlayServicesWithError(activity: Activity, showDialog: Boolean): Boolean {
val status = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity)
return if (status != ConnectionResult.SUCCESS) {
if (showDialog) {
class GooglePlayServicesUtil {
companion object {
private const val GOOGLE_PLAY_SERVICES_AVAILABLE_REQUEST = 9000
fun isGooglePlayServicesWithError(activity: Activity, showDialog: Boolean): Boolean {
val status = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity)
return if (status != ConnectionResult.SUCCESS) {
if (showDialog) {
@SidoPillai
SidoPillai / Camera.cpp
Created June 6, 2019 17:48
Invoke native camera on android and take picture
// Take Picture
void Camera::takePciture()
{
const QString CameraAndroid::IMAGE_CAPTURE_ACTION = QString("android.media.action.IMAGE_CAPTURE");
QAndroidJniObject MediaStore__EXTRA_OUTPUT = QAndroidJniObject::getStaticObjectField(
"android/provider/MediaStore", "EXTRA_OUTPUT", "Ljava/lang/String;");

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@SidoPillai
SidoPillai / UIDocumentViewController.mm
Last active June 6, 2019 17:42
UIDocumentViewController for QT
static QPointer<DocumentPicker> m_Instance;
@interface DocumentPickerDelegate: NSObject <UINavigationControllerDelegate, UIDocumentPickerDelegate>
{
DocumentPicker *m_DocumentPicker;
}
@end
@implementation DocumentPickerDelegate
@SidoPillai
SidoPillai / material text sizes.md
Created August 10, 2018 18:48 — forked from passsy/material text sizes.md
Material font sizes
@SidoPillai
SidoPillai / Android Design for UI Developers.md
Created March 24, 2016 23:18 — forked from mfurtak/Android Design for UI Developers.md
Notes from the talk "Android Design for UI Developers" at Google I/O 2013# Android Design for UI Developers

App Navigation

Lateral Navigation

  • Switching between sibling elements
  • Action bar can do this through tabs, or spinners
    • "Implementing Effective Navigation"
    • Action Bar compatibility for 2.1+ * No need to rush off ABS, but for new apps, go for ActionBarCompat
  • View Pager