Skip to content

Instantly share code, notes, and snippets.

View rahulpandey's full-sized avatar

Rahul rahulpandey

  • Reward360 Global Services
  • Bengaluru
View GitHub Profile

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@rahulpandey
rahulpandey / class.responseHandler.php
Created May 24, 2015 06:19
simple class which helpful writing webservices
<?php
class ResponseHandler {
private static $_instance;
private $_api_response_code;
private $_api_response;
// create new instance of class
public static function singleInstance() {
if (! self::$_instance) {
self::$_instance = new self ();
@rahulpandey
rahulpandey / ffmpeg_android_build.sh
Created May 28, 2015 13:06
This build use to compile ffmpeg on windows
#!/bin/bash
######################################################
# Usage:
# put this script in top of FFmpeg source tree
# ./build_android
#
# It generates binary for following architectures:
# ARMv6
# ARMv6+VFP
# ARMv7+VFPv3-d16 (Tegra2)
// generic php function to send GCM push notification
public function sendPushNotificationToGCM($registatoin_ids, $message) {
// Google cloud messaging GCM-API url
$url = 'https://android.googleapis.com/gcm/send';
$fields = array (
'registration_ids' => $registatoin_ids,
'data' => $message
);
// Google Cloud Messaging GCM API Key
define ( "GOOGLE_API_KEY", " GCM_KEY" );
hex values. E.g. for 50% white
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
//TabLayout text color selector when using cutom view
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Active tab -->
<item android:color="@android:color/holo_red_dark" android:state_focused="false" android:state_pressed="false" android:state_selected="true" />
<!-- Inactive tab -->
<item android:color="#000" android:state_focused="false" android:state_pressed="false" android:state_selected="false" />
<!-- Pressed tab -->
<item android:color="#000" android:state_pressed="true" />
mdpi @ 1.00dp = 1.00px
hdpi @ 1.00dp = 1.50px
xhdpi @ 1.00dp = 2.00px
xxhdpi @ 1.00dp = 3.00px
xxxhdpi @ 1.00dp = 4.00px
1.Copy postgresql jar glassfish4/glassfish/domains/domain1/lib/ext
2.start glassfish
asadmin start-domain
3.Create Connection Pool (DataSource)
asadmin create-jdbc-connection-pool
--datasourceclassname org.postgresql.ds.PGSimpleDataSource
--restype javax.sql.DataSource
--property user=USER_NAME:password=PASSWORD:DatabaseName=DB_NAME:ServerName=HOST_NAME:port=PORT_NAME
postgresql-pool(DataSource Name)
ColorDrawable drawable=new ColorDrawable();
drawable.setColor(getResources().getColor(R.color.colorPrimary));
drawable.setAlpha(-verticalOffset * 255 / appBarLayout.getTotalScrollRange());
toolbar.setBackground(drawable);