This file contains hidden or 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.app.Dialog; | |
| import android.os.Bundle; | |
| import android.text.TextUtils; | |
| import android.view.View; | |
| import android.view.Window; | |
| import android.widget.Button; | |
| import android.widget.EditText; | |
| import com.routerunner.R; |
This file contains hidden or 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 ThreadSynchronisationDemo implements Runnable { | |
| private Account acct = new Account(); | |
| public static void main(String[] args) { | |
| ThreadSynchronisationDemo r = new ThreadSynchronisationDemo(); | |
| Thread one = new Thread(r); | |
| Thread two = new Thread(r); | |
| one.setName("Fred"); |
This file contains hidden or 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
| /*//Pick image from fragment | |
| PickImage pickImage = new PickImage(activity, this); | |
| pickImage.createImageChooser(); | |
| @Override | |
| public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
| super.onActivityResult(requestCode, resultCode, data); |
This file contains hidden or 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.example.vaibhavjani.geojsonexample; | |
| import android.content.Context; | |
| import android.graphics.Point; | |
| import android.os.Handler; | |
| import android.util.AttributeSet; | |
| import android.view.GestureDetector; | |
| import android.view.MotionEvent; | |
| import android.view.ScaleGestureDetector; |
This file contains hidden or 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
| Intent batteryIntent = getActivity().getApplicationContext().registerReceiver(null, | |
| new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); | |
| try { | |
| int temperature = batteryIntent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0) / 10; | |
| showBetteryTemperature(temperature); | |
| } catch (Exception e) { | |
| e.printStackTrace(); |
This file contains hidden or 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 Bitmap getRecyclerViewScreenshot(RecyclerView view) { | |
| int size = view.getAdapter().getItemCount(); | |
| RecyclerView.ViewHolder holder = view.getAdapter().createViewHolder(view, 0); | |
| view.getAdapter().onBindViewHolder(holder, 0); | |
| holder.itemView.measure(View.MeasureSpec.makeMeasureSpec(view.getWidth(), View.MeasureSpec.EXACTLY), | |
| View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); | |
| holder.itemView.layout(0, 0, holder.itemView.getMeasuredWidth(), holder.itemView.getMeasuredHeight()); | |
| Bitmap bigBitmap = Bitmap.createBitmap(view.getMeasuredWidth(), holder.itemView.getMeasuredHeight() * size, | |
| Bitmap.Config.ARGB_8888); | |
| Canvas bigCanvas = new Canvas(bigBitmap); |
This file contains hidden or 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.routerunner.view; | |
| import android.content.Context; | |
| import android.graphics.Rect; | |
| import android.support.v4.BuildConfig; | |
| import android.support.v4.view.ViewCompat; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.Log; | |
| import android.view.View; |
This file contains hidden or 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
| // amount = 1.2244 with round 0.003 will be 1.23, with round 0.005 will be 1.22, with round 0.03 will be 1.3 | |
| public static String taxFormat(double taxAmount, double round) { | |
| try { | |
| String extensionRemoved = String.valueOf(round).split("\\.")[1]; | |
| int sigCount = extensionRemoved.length() - 1; | |
| double addjust = 1.0; |
This file contains hidden or 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.text.InputFilter; | |
| import android.text.Spanned; | |
| /** | |
| * Created by vaibhav.jani on 17-Dec-15. | |
| */ | |
| public class FilterProvider { | |
| public static InputFilter getFilter(final int maxDigitsBeforeDecimalPoint, final int maxDigitsAfterDecimalPoint) { |
This file contains hidden or 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
| drawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() { | |
| @Override | |
| public void onDrawerSlide(View drawerView, float slideOffset) { | |
| float moveFactor = (drawerView.getWidth() * slideOffset); | |
| float total = drawerView.getMeasuredWidth(); | |
| total = (total == 0) ? 1 : total; |