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 Bitmap getScreenshotFromRecyclerView(RecyclerView view) { | |
| RecyclerView.Adapter adapter = view.getAdapter(); | |
| Bitmap bigBitmap = null; | |
| if (adapter != null) { | |
| int size = adapter.getItemCount(); | |
| int height = 0; | |
| Paint paint = new Paint(); | |
| int iHeight = 0; | |
| final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); |
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
| adb pull data/data/your.package/databases/yourDb.sqlite C:\Users\Your.Name\Desktop | |
| adb pull data/data/your.package/shared_prefs/your_preference_file_name.xml C:\Users\Your.Name\Desktop | |
| pause | |
| start "" "C:/Program Files (x86)/SqliteBrowser3/bin/sqlitebrowser" C:\Users\Your.Name\Desktop\yourDb.sqlite |
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 ArrayList<MusicBean> getMusic(){ | |
| ArrayList<MusicBean> alMusic = new ArrayList<>(); | |
| Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; | |
| String[] projection = {MediaStore.Audio.Media._ID, | |
| MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.TITLE, | |
| MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.DISPLAY_NAME, |
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.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.graphics.Rect; | |
| import android.graphics.drawable.Drawable; | |
| import android.support.v4.content.ContextCompat; | |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.AttributeSet; | |
| 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
| 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; |
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
| // 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
| 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
| 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
| 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(); |