Skip to content

Instantly share code, notes, and snippets.

View akbarsha03's full-sized avatar
🎯
I just keep trying

Akbarsha M akbarsha03

🎯
I just keep trying
View GitHub Profile
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
package com.aracem.utils.animations.pagetransformation;
import org.jetbrains.annotations.NotNull;
import android.support.v4.view.ViewPager;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(0);
} else if (position <= 1) { // [-1,1]
@akbarsha03
akbarsha03 / DialogFragment.java
Created November 30, 2014 13:10
Remove Title bar from Dialog Fragment
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
dialog = new Dialog(getActivity());
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
@akbarsha03
akbarsha03 / Animation.java
Created September 16, 2014 05:13
Expand/Collapse animation
public static Animation expand(final View v, final boolean expand) {
try {
Method m = v.getClass().getDeclaredMethod("onMeasure", int.class, int.class);
m.setAccessible(true);
m.invoke(
v,
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(((View)v.getParent()).getMeasuredWidth(), MeasureSpec.AT_MOST)
);
} catch (Exception e) {
@akbarsha03
akbarsha03 / Email.java
Created August 8, 2014 05:34
Send email
Intent intentEmail = new Intent(Intent.ACTION_SEND);
intentEmail.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
intentEmail.putExtra(Intent.EXTRA_SUBJECT, "your subject");
intentEmail.putExtra(Intent.EXTRA_TEXT, "message body");
intentEmail.setType("message/rfc822");
startActivity(Intent.createChooser(intentEmail, "Choose an email provider :"));
@akbarsha03
akbarsha03 / language codes
Created July 15, 2014 11:47
language codes
Afrikaans af
Amharic am
Arabic ar
Belarusian be
Bulgarian bg
Catalan ca
Chinese(Simplified) zh-CN
Chinese(Traditional) zh-TW
Croatian hr
Czech cs-CZ
@akbarsha03
akbarsha03 / languagecode.xml
Created July 15, 2014 11:45
All languages with code
<!-- All language list -->
<string-array name="languages">
<item>Afrikaans</item> af
<item>Amharic</item> am
<item>Arabic</item> ar
<item>Belarusian</item> be
<item>Bulgarian</item> bg
<item>Catalan</item> ca
<item>Chinese(Simplified)</item> zh-CN
<item>Chinese(Traditional)</item> zh-TW
@akbarsha03
akbarsha03 / Languages.xml
Created July 15, 2014 11:35
All language list
<!-- All language list -->
<string-array name="languages">
<item>Afrikaans</item>
<item>Amharic</item>
<item>Arabic</item>
<item>Belarusian</item>
<item>Bulgarian</item>
<item>Catalan</item>
<item>Chinese(Simplified)</item>
<item>Chinese(Traditional)</item>
@akbarsha03
akbarsha03 / DynamicSize.java
Created July 15, 2014 07:03
Get required view size dynamically in percentage depends upon the Screen size
/**
* Get the area of the screen size. following calculation done with the help
* of Ashik :D
*
* @param context
* @param percentage
* @return intRequiredCellSize
* @author Ashik Ali
*/
public static int getCellSizeForScreen(Context context, double percentage) {