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
<resources> | |
<style name="AppTheme" parent="@style/Theme.AppCompat.Light"> | |
<item name="android:windowNoTitle">true</item> | |
<item name="windowActionBar">false</item> | |
<item name="android:windowFullscreen">true</item> | |
<item name="android:windowContentOverlay">@null</item> | |
</style> | |
</resources> |
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
@Override | |
public Dialog onCreateDialog(final Bundle savedInstanceState) { | |
// the content | |
final RelativeLayout root = new RelativeLayout(getActivity()); | |
root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); | |
// creating the fullscreen dialog | |
final Dialog dialog = new Dialog(getActivity()); | |
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); |
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
public abstract class EndlessScrollListener implements OnScrollListener { | |
// The minimum amount of items to have below your current scroll position | |
// before loading more. | |
private int visibleThreshold = 5; | |
// The current offset index of data you have loaded | |
private int currentPage = 0; | |
// The total number of items in the dataset after the last load | |
private int previousTotalItemCount = 0; | |
// True if we are still waiting for the last set of data to load. | |
private boolean loading = true; |
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); |
OlderNewer