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.Yahya.Utils; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.PorterDuff; | |
import android.graphics.PorterDuffXfermode; | |
import android.graphics.Rect; |
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
// To animate view slide out from left to right | |
public void slideToRight(View view){ | |
TranslateAnimation animate = new TranslateAnimation(0,view.getWidth(),0,0); | |
animate.setDuration(500); | |
animate.setFillAfter(true); | |
view.startAnimation(animate); | |
view.setVisibility(View.GONE); | |
} | |
// To animate view slide out from right to left | |
public void slideToLeft(View view){ |
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
android:contentInsetStart="0dp" | |
android:contentInsetLeft="0dp" | |
app:contentInsetLeft="0dp" | |
app:contentInsetStart="0dp" |
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
private void addCalendar() { | |
Uri eventsUri; | |
if (android.os.Build.VERSION.SDK_INT <= 7) { | |
eventsUri = Uri.parse("content://calendar/events"); | |
} | |
else { |
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
private String getDistanceBetweenTwoLocations(double latA, double lngA, double latB, double lngB, String suffix) { | |
Location locationA = new Location("point A"); | |
locationA.setLatitude(latA); | |
locationA.setLongitude(lngA); | |
Location locationB = new Location("point B"); | |
locationB.setLatitude(latB); | |
locationB.setLongitude(lngB); |
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
http://maps.google.com/?q=latitude,longitude |
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
Date now = new Date(); | |
SimpleDateFormat sdf = new SimpleDateFormat("K:mm a"); | |
String formattedTime = sdf.format(now); |
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
// Using an AsyncTask to load the slow images in a background thread | |
new AsyncTask<ViewHolder, Void, Bitmap>() { | |
private ViewHolder v; | |
@Override | |
protected Bitmap doInBackground(ViewHolder... params) { | |
v = params[0]; | |
return mFakeImageLoader.getImage(); | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
Copyright (C) 2015 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 |
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
private void sendSMS() { | |
String text = getSMSContent(); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) // At least KitKat | |
{ | |
String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(this); // Need to change the build to API 19 | |
Intent sendIntent = new Intent(Intent.ACTION_SEND); | |
sendIntent.setType("text/plain"); | |
sendIntent.putExtra(Intent.EXTRA_TEXT, text); |
OlderNewer