Skip to content

Instantly share code, notes, and snippets.

View arthtilva's full-sized avatar

Arth Tilva arthtilva

  • Tilva Artsoft
  • Rajkot, Gujarat, India
View GitHub Profile
@arthtilva
arthtilva / RetrofitHelper.java
Last active September 3, 2020 13:42
Retrofit helper class
import android.accounts.NetworkErrorException;
import android.util.Log;
import com.caregiver.BuildConfig;
import java.io.IOException;
import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@arthtilva
arthtilva / build.gradle
Created June 15, 2017 11:23
comman use
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
@arthtilva
arthtilva / digit.log
Created April 11, 2017 17:32
Fabric digit Crash after callback
# Crashlytics - plaintext stacktrace downloaded by tilva.arth at Tue, 11 Apr 2017 15:57:05 GMT
# URL: -----------------------
# Organization: Tilva Artsoft
# Platform: android
# Application: ----------
# Version: N/A
# Bundle Identifier: -------------
# Issue #: 8
# Issue ID: 58d3ae970aeb16625bbdd17f
# Session ID: 58ECF7220177000151875B00241E3A3B_fcc141d1cde3468980e23278b595202f_0_v1
@arthtilva
arthtilva / apk_name
Last active June 15, 2017 11:22
generate APK as per your required name
buildTypes {
debug {
applicationVariants.all { variant ->
variant.outputs.each { output ->
def date = new Date();
def formattedDate = date.format('dd-MM-yyyy')
output.outputFile = new File(output.outputFile.parent,
output.outputFile.name.replace("-release", "-release_" + formattedDate)
//for Debug use output.outputFile = new File(output.outputFile.parent,
@arthtilva
arthtilva / Thumbnail.java
Created January 26, 2017 10:24
Create image/thumbnail from Video.
public static Bitmap retriveVideoFrameFromVideo(String videoPath) throws Throwable {
Bitmap bitmap = null;
MediaMetadataRetriever mediaMetadataRetriever = null;
try {
mediaMetadataRetriever = new MediaMetadataRetriever();
if (Build.VERSION.SDK_INT >= 14)
mediaMetadataRetriever.setDataSource(videoPath, new HashMap<String, String>());
else
mediaMetadataRetriever.setDataSource(videoPath);
bitmap = mediaMetadataRetriever.getFrameAtTime();
@arthtilva
arthtilva / country.json
Created January 12, 2017 12:00
List of Country Code with Name
String countryJson = "[{\"name\":\"Afghanistan\",\"dial_code\":\"+93\",\"code\":\"AF\"},{\"name\":\"Albania\",\"dial_code\":\"+355\",\"code\":\"AL\"},{\"name\":\"Algeria\",\"dial_code\":\"+213\",\"code\":\"DZ\"},{\"name\":\"AmericanSamoa\",\"dial_code\":\"+1 684\",\"code\":\"AS\"},{\"name\":\"Andorra\",\"dial_code\":\"+376\",\"code\":\"AD\"},{\"name\":\"Angola\",\"dial_code\":\"+244\",\"code\":\"AO\"},{\"name\":\"Anguilla\",\"dial_code\":\"+1 264\",\"code\":\"AI\"},{\"name\":\"Antarctica\",\"dial_code\":\"+672\",\"code\":\"AQ\"},{\"name\":\"Antigua and Barbuda\",\"dial_code\":\"+1268\",\"code\":\"AG\"},{\"name\":\"Argentina\",\"dial_code\":\"+54\",\"code\":\"AR\"},{\"name\":\"Armenia\",\"dial_code\":\"+374\",\"code\":\"AM\"},{\"name\":\"Aruba\",\"dial_code\":\"+297\",\"code\":\"AW\"},{\"name\":\"Australia\",\"dial_code\":\"+61\",\"code\":\"AU\"},{\"name\":\"Austria\",\"dial_code\":\"+43\",\"code\":\"AT\"},{\"name\":\"Azerbaijan\",\"dial_code\":\"+994\",\"code\":\"AZ\"},{\"name\":\"Bahamas\",\"dial_code\":\"+1
@arthtilva
arthtilva / underline.java
Last active October 24, 2016 05:20
Underline Text
String data = "Forgot Password?";
SpannableString content = new SpannableString(data);
content.setSpan(new UnderlineSpan(), 0, data.length(), 0);
.setText(content);
//====================//
String data="Underlined Text";
textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
textView.setText(data);
@arthtilva
arthtilva / API.java
Created September 29, 2016 12:31
HttpURLConnection api call
/**
* Created by arthtilva on 29-09-2016.
*/
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
@arthtilva
arthtilva / FUM
Last active April 5, 2021 06:28
Frequently Used Methods and codes
/***************************************************************************************/
/****************************** Full Screen Theme **************************************/
/***************************************************************************************/
<style name="AppThemeFullScreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
@arthtilva
arthtilva / mapRect.java
Created September 8, 2016 06:52
Draw rectangle in google map android
public static double EarthRadius = 6378137.0;
static double TwoPi = Math.PI * 2, DegreesToRadians = 0.0174532925, RadiansToDegrees = 57.2957795;
public static LatLng getLatLng(LatLng source, double range, double bearing) {
range = range * 1000;
double latA = source.latitude * DegreesToRadians;
double lonA = source.longitude * DegreesToRadians;
double angularDistance = range / EarthRadius;
double trueCourse = bearing * DegreesToRadians;