Skip to content

Instantly share code, notes, and snippets.

View jdsingh's full-sized avatar
🎯
Focusing

Jagdeep Singh jdsingh

🎯
Focusing
View GitHub Profile
@jdsingh
jdsingh / build.gradle
Created February 18, 2021 20:40 — forked from tristanlins/build.gradle
Gradle Jacoco Plugin and Gitlab Coverage
plugins {
id 'jacoco'
}
jacocoTestReport {
reports {
xml.enabled true
}
}
@jdsingh
jdsingh / AdbCommands
Created May 22, 2019 10:45 — forked from Pulimet/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jdsingh
jdsingh / height.java
Created April 16, 2019 08:56 — forked from hamakn/height.java
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(
@jdsingh
jdsingh / SightFragment.java
Created December 6, 2018 14:17 — forked from joinAero/SightFragment.java
Android - Fragment for handling view after it has been created and visible to user for the first time.
package cc.cubone.turbo.core.app;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
/**
* Fragment for handling view after it has been created and visible to user for the first time.
*
* <p>Specially in {@link android.support.v4.view.ViewPager}, the page will be created beforehand
@jdsingh
jdsingh / default.xml
Created July 12, 2017 12:29 — forked from Judas/default.xml
Repo configuration file
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="origin" fetch="https://github.com/yourorg" />
<default remote="origin" revision="develop" />
<project remote="origin" name="mobile-android-authentication-ui" path="modules/authentication-ui" />
<project remote="origin" name="mobile-android-conversation-ui" path="modules/conversation-ui" />
<project remote="origin" name="mobile-android-livefeed-ui" path="modules/livefeed-ui" />
<project remote="origin" name="mobile-android-stats-ui" path="modules/stats-ui" />
<project remote="origin" name="mobile-android-user-profile-ui" path="modules/user-profile-ui" />
@jdsingh
jdsingh / RealmBackupRestore.java
Created July 3, 2017 12:57 — forked from paolorotolo/RealmBackupRestore.java
Class to easily backup/restore data from Realm.
package org.glucosio.android.tools;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.widget.Toast;
@jdsingh
jdsingh / PhonecallReceiver.java
Created May 30, 2017 17:37 — forked from ftvs/PhonecallReceiver.java
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@jdsingh
jdsingh / ItemClickSupport.java
Created May 19, 2017 19:01 — forked from nesquena/ItemClickSupport.java
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});
@jdsingh
jdsingh / RxFirebase.java
Created May 3, 2017 08:58 — forked from TinasheMzondiwa/RxFirebase.java
RxFirebase implementation. Fork from https://gist.github.com/gsoltis/86210e3259dcc6998801 with my improvements.
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import rx.Observable;
import rx.Subscriber;