This file contains 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
import android.util.SparseArray; | |
import android.widget.AbsListView; | |
/** | |
* Helper class for calculating relative scroll offsets in a ListView or GridView by tracking the | |
* position of child views. | |
*/ | |
public class ListViewScrollTracker { | |
private AbsListView mListView; | |
private SparseArray<Integer> mPositions; |
This file contains 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
final SupportMenuItem searchMenuItem = (SupportMenuItem) menu.findItem(R.id.menu_search); | |
if (searchMenuItem == null) throw new IllegalArgumentException("menu item is null and that is very suspicious."); | |
this.searchView = (SearchView) searchMenuItem.getActionView(); | |
if (searchView == null) throw new IllegalArgumentException("search view is null and that is very suspicious."); | |
searchView.setQueryHint(getActivity().getString(R.string.search_hint)); | |
// wow. much hack. style search box.. | |
Resources resources = searchView.getContext().getResources(); |
This file contains 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
adb shell setprop log.tag.SQLiteLog V | |
adb shell setprop log.tag.SQLiteStatements V | |
adb shell stop | |
adb shell start |
This file contains 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.sjl.util; | |
import android.app.Activity; | |
import android.app.Application; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.util.Log; | |
import java.util.List; |
This file contains 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
/******This Gist explains how to create instagram like Gradient color transition in android.******/ | |
1. Create some gradient color drawables inside drawable Folder. | |
a) color1.xml | |
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<gradient | |
android:startColor="#c44e4e" | |
android:endColor="#dcb9b9" | |
android:angle="0"/> |
This file contains 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
function solution(K, M, A) { | |
// M is a red herring | |
return minimalLargeSumBinarySearch(K, A); | |
} | |
function minimalLargeSumBinarySearch(maxNumBlocks, arra) { | |
var lowerBoundLargeSum = Math.max.apply(null, arra); | |
var upperBoundLargeSum = arra.reduce((a,c)=>a+c,0); | |
var result = -1; | |