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 class PathUtils { | |
/** | |
* To get URI from Path | |
* | |
* @param context context | |
* @param file file | |
* @return Uri | |
*/ | |
public static Uri getUriFromPath(Context context, File file) { | |
String filePath = file.getAbsolutePath(); |
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 static byte[] decode(String path, int startMs, int maxMs) | |
throws IOException, com.mindtherobot.libs.mpg.DecoderException { | |
ByteArrayOutputStream outStream = new ByteArrayOutputStream(1024); | |
float totalMs = 0; | |
boolean seeking = true; | |
File file = new File(path); | |
InputStream inputStream = new BufferedInputStream(new FileInputStream(file), 8 * 1024); | |
try { |
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 static byte[] decode(String path, int startMs, int maxMs) | |
throws IOException, com.mindtherobot.libs.mpg.DecoderException { | |
ByteArrayOutputStream outStream = new ByteArrayOutputStream(1024); | |
float totalMs = 0; | |
boolean seeking = true; | |
File file = new File(path); | |
InputStream inputStream = new BufferedInputStream(new FileInputStream(file), 8 * 1024); | |
try { |
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 Bitmap captureScreen() { | |
View v = getWindow().getDecorView().getRootView(); | |
v.setDrawingCacheEnabled(true); | |
Bitmap bmp = Bitmap.createBitmap(v.getDrawingCache()); | |
v.setDrawingCacheEnabled(false); | |
return bmp; | |
} |
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
import android.Manifest; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.pm.PackageManager; | |
import androidx.core.app.ActivityCompat; | |
import androidx.core.content.ContextCompat; |
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
import android.annotation.SuppressLint | |
import android.content.ContentUris | |
import android.content.Context | |
import android.content.CursorLoader | |
import android.database.Cursor | |
import android.net.Uri | |
import android.os.Build | |
import android.os.Environment | |
import android.provider.DocumentsContract | |
import android.provider.MediaStore |
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 class AnimatorHelper { | |
private static final int DURATION_LIST = 700; | |
public static void buttonVanish(View... views){ | |
for(final View view:views){ | |
view.setEnabled(false); | |
view.animate() | |
.scaleX(0) | |
.scaleY(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
try { | |
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), clipData.getItemAt(i).getUri()); | |
binding.imgLogo.setImageBitmap(bitmap); | |
} catch (IOException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} |
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 saveVideo(Uri uri) { | |
String videoFileName = "video_" + System.currentTimeMillis() + ".mp4"; | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { | |
ContentValues valuesvideos = new ContentValues(); | |
valuesvideos.put(MediaStore.Video.Media.RELATIVE_PATH, Environment.DIRECTORY_MOVIES + "VidFolder"); | |
valuesvideos.put(MediaStore.Video.Media.TITLE, videoFileName); | |
valuesvideos.put(MediaStore.Video.Media.DISPLAY_NAME, videoFileName); | |
valuesvideos.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4"); |
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
//time conversion | |
public String timeConversion(long value) { | |
String videoTime; | |
int dur = (int) value; | |
int hrs = (dur / 3600000); | |
int mns = (dur / 60000) % 60000; | |
int scs = dur % 60000 / 1000; | |
if (hrs > 0) { | |
videoTime = String.format("%02d:%02d:%02d", hrs, mns, scs); |
OlderNewer