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
String.format("%02d", num); |
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
/** | |
* Description of VideoStream | |
* | |
* @author Rana | |
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial | |
*/ | |
class StreamVideo { | |
private $path = ""; |
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
/* | |
* Copyright (C) 2008 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 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/** | |
* copy text to clipboard | |
* @param context | |
* @param copiedText | |
*/ | |
public static void copyToClipBoard(Context context,String copiedText){ | |
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { | |
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); | |
clipboard.setText(copiedText); | |
} 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
/** | |
* get mine type of file | |
* | |
* @param path | |
* @return mine type for upload file | |
*/ | |
public static String getMimeType(String path, String useThisIfNull) { | |
String type = useThisIfNull; | |
String extension = null; | |
int i = path.lastIndexOf('.'); |
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
/** | |
* Checks to see if the device is connected to a network (cell, wifi, etc). | |
* | |
* @param context The current Context or Activity that this method is called from | |
* @return true if a network connection is available, otherwise false. | |
*/ | |
public static boolean isNetworkAvailable(Context context) { | |
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); | |
return activeNetworkInfo != null && activeNetworkInfo.isConnected(); |
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
# install Dependencies | |
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel&&mkdir ~/ffmpeg_sources | |
# Yasm | |
cd ~/ffmpeg_sources&&git clone --depth 1 git://github.com/yasm/yasm.git&&cd yasm&&autoreconf -fiv&&./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"&&make&&make install&&make distclean | |
# libx264 | |
cd ~/ffmpeg_sources&&git clone --depth 1 git://git.videolan.org/x264&&cd x264&&./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static&&make&&make install&&make distclean | |
# libfdk_aac |
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
RotateAnimation anim = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); | |
//Setup anim with desired properties | |
anim.setInterpolator(new LinearInterpolator()); | |
anim.setRepeatCount(Animation.INFINITE); //Repeat animation indefinitely | |
anim.setDuration(300); //Put desired duration per anim cycle here, in milliseconds | |
login_button = (ImageButton) view.findViewById(R.id.login_button); | |
login_button.setAnimation(anim); |
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 setScreenSize() { | |
Display display = ((Activity) context).getWindowManager().getDefaultDisplay(); | |
if (Build.VERSION.SDK_INT >= 17) { | |
//new pleasant way to get real metrics | |
DisplayMetrics realMetrics = new DisplayMetrics(); | |
display.getRealMetrics(realMetrics); | |
width = realMetrics.widthPixels; | |
height = realMetrics.heightPixels; |
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 method converts device specific pixels to density independent pixels. | |
* | |
* @param px A value in px (pixels) unit. Which we need to convert into dp | |
* @return A float value to represent dp equivalent to px value | |
*/ | |
public static float convertPixelsToDp(float px){ | |
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); | |
float dp = px / (metrics.densityDpi / 160f); | |
return dp; |