dbFileList = new ArrayList<>();
147 | File dir = new File(dirPath);
148 | if (dir.exists()) {
149 | File[] files = dir.listFiles();
150 | if (files != null && files.length > 0) {
151 | dbFileList.addAll(Arrays.asList(files));
152 | }
153 | }
154 | return dbFileList;
155 | }
156 |
157 | private static int getPragmaVersionOfSqliteDb(File dbFile) throws IOException {
158 | RandomAccessFile fp = new RandomAccessFile(dbFile, "r");
159 | fp.seek(60);
160 | byte[] buff = new byte[4];
161 | fp.read(buff, 0, 4);
162 | return ByteBuffer.wrap(buff).getInt();
163 | }
164 |
165 | @NonNull
166 | public static String removePackageFromFileName(String fileName) {
167 | int lastDot = fileName.lastIndexOf('.');
168 | if (lastDot != -1) {
169 | int secondLastDot = fileName.substring(0, lastDot).lastIndexOf('.');
170 | if (secondLastDot != -1)
171 | fileName = fileName.substring(secondLastDot + 1);
172 | }
173 | return fileName;
174 | }
175 |
176 | public static String getMimeType(String path) {
177 | String type = null;
178 | String extension = MimeTypeMap.getFileExtensionFromUrl(path);
179 | if (extension != null) {
180 | type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
181 | }
182 | if (type == null) {
183 | type = "*/*";
184 | }
185 | return type;
186 | }
187 | }
188 |
--------------------------------------------------------------------------------
/debug_tools/src/main/java/com/krishna/debug_tools/utils/FileProvider.java:
--------------------------------------------------------------------------------
1 | package com.krishna.debug_tools.utils;
2 |
3 | import android.content.ContentProvider;
4 | import android.content.ContentValues;
5 | import android.database.Cursor;
6 | import android.net.Uri;
7 | import android.os.ParcelFileDescriptor;
8 |
9 | import java.io.File;
10 | import java.io.FileNotFoundException;
11 |
12 | /**
13 | * Created by krishna on 04/02/18.
14 | */
15 |
16 | public class FileProvider extends ContentProvider {
17 |
18 | @Override
19 | public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
20 | File privateFile = new File(uri.getPath());
21 | return ParcelFileDescriptor.open(privateFile, ParcelFileDescriptor.MODE_READ_ONLY);
22 | }
23 |
24 | @Override
25 | public boolean onCreate() {
26 | return false;
27 | }
28 |
29 | @Override
30 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
31 | return null;
32 | }
33 |
34 | @Override
35 | public String getType(Uri uri) {
36 | return null;
37 | }
38 |
39 | @Override
40 | public Uri insert(Uri uri, ContentValues values) {
41 | return null;
42 | }
43 |
44 | @Override
45 | public int delete(Uri uri, String selection, String[] selectionArgs) {
46 | return 0;
47 | }
48 |
49 | @Override
50 | public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
51 | return 0;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/debug_tools/src/main/java/com/krishna/debug_tools/utils/FixedGridLayoutManager.java:
--------------------------------------------------------------------------------
1 | package com.krishna.debug_tools.utils;
2 |
3 | import android.content.Context;
4 | import android.graphics.PointF;
5 | import android.support.v7.widget.LinearSmoothScroller;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.util.AttributeSet;
8 | import android.util.Log;
9 | import android.util.SparseArray;
10 | import android.util.SparseIntArray;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 |
14 | import java.util.HashSet;
15 | import java.util.List;
16 |
17 | /**
18 | * A {@link android.support.v7.widget.RecyclerView.LayoutManager} implementation
19 | * that places children in a two-dimensional grid, sized to a fixed column count
20 | * value. User scrolling is possible in both horizontal and vertical directions
21 | * to view the data set.
22 | *
23 | *
The column count is controllable via {@link #setTotalColumnCount(int)}. The layout manager
24 | * will generate the number of rows necessary to accommodate the data set based on
25 | * the fixed column count.
26 | *
27 | *
This manager does make some assumptions to simplify the implementation:
28 | *
29 | * - All child views are assumed to be the same size
30 | * - The window of visible views is a constant
31 | *
32 | */
33 | public class FixedGridLayoutManager extends RecyclerView.LayoutManager {
34 |
35 | private static final String TAG = FixedGridLayoutManager.class.getSimpleName();
36 |
37 | private static final int DEFAULT_COUNT = 1;
38 |
39 | /* View Removal Constants */
40 | private static final int REMOVE_VISIBLE = 0;
41 | private static final int REMOVE_INVISIBLE = 1;
42 |
43 | /* Fill Direction Constants */
44 | private static final int DIRECTION_NONE = -1;
45 | private static final int DIRECTION_START = 0;
46 | private static final int DIRECTION_END = 1;
47 | private static final int DIRECTION_UP = 2;
48 | private static final int DIRECTION_DOWN = 3;
49 |
50 | /* First (top-left) position visible at any point */
51 | private int mFirstVisiblePosition;
52 | /* Consistent size applied to all child views */
53 | private int mDecoratedChildWidth;
54 | private int mDecoratedChildHeight;
55 | /* Number of columns that exist in the grid */
56 | private int mTotalColumnCount = DEFAULT_COUNT;
57 | /* Metrics for the visible window of our data */
58 | private int mVisibleColumnCount;
59 | private int mVisibleRowCount;
60 |
61 | /* Used for tracking off-screen change events */
62 | private int mFirstChangedPosition;
63 | private int mChangedPositionCount;
64 |
65 | /**
66 | * Set the number of columns the layout manager will use. This will
67 | * trigger a layout update.
68 | *
69 | * @param count Number of columns.
70 | */
71 | public void setTotalColumnCount(int count) {
72 | mTotalColumnCount = count;
73 | requestLayout();
74 | }
75 |
76 | /*
77 | * You must return true from this method if you want your
78 | * LayoutManager to support anything beyond "simple" item
79 | * animations. Enabling this causes onLayoutChildren() to
80 | * be called twice on each animated change; once for a
81 | * pre-layout, and again for the real layout.
82 | */
83 | @Override
84 | public boolean supportsPredictiveItemAnimations() {
85 | return true;
86 | }
87 |
88 | /*
89 | * Called by RecyclerView when a view removal is triggered. This is called
90 | * before onLayoutChildren() in pre-layout if the views removed are not visible. We
91 | * use it in this case to inform pre-layout that a removal took place.
92 | *
93 | * This method is still called if the views removed were visible, but it will
94 | * happen AFTER pre-layout.
95 | */
96 | @Override
97 | public void onItemsRemoved(RecyclerView recyclerView, int positionStart, int itemCount) {
98 | mFirstChangedPosition = positionStart;
99 | mChangedPositionCount = itemCount;
100 | }
101 |
102 | /*
103 | * This method is your initial call from the framework. You will receive it when you
104 | * need to start laying out the initial set of views. This method will not be called
105 | * repeatedly, so don't rely on it to continually process changes during user
106 | * interaction.
107 | *
108 | * This method will be called when the data set in the adapter changes, so it can be
109 | * used to update a layout based on a new item count.
110 | *
111 | * If predictive animations are enabled, you will see this called twice. First, with
112 | * state.isPreLayout() returning true to lay out children in their initial conditions.
113 | * Then again to lay out children in their final locations.
114 | */
115 | @Override
116 | public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
117 | //We have nothing to show for an empty data set but clear any existing views
118 | if (getItemCount() == 0) {
119 | detachAndScrapAttachedViews(recycler);
120 | return;
121 | }
122 | if (getChildCount() == 0 && state.isPreLayout()) {
123 | //Nothing to do during prelayout when empty
124 | return;
125 | }
126 |
127 | //Clear change tracking state when a real layout occurs
128 | if (!state.isPreLayout()) {
129 | mFirstChangedPosition = mChangedPositionCount = 0;
130 | }
131 |
132 | if (getChildCount() == 0) { //First or empty layout
133 | //Scrap measure one child
134 | View scrap = recycler.getViewForPosition(0);
135 | addView(scrap);
136 | measureChildWithMargins(scrap, 0, 0);
137 |
138 | /*
139 | * We make some assumptions in this code based on every child
140 | * view being the same size (i.e. a uniform grid). This allows
141 | * us to compute the following values up front because they
142 | * won't change.
143 | */
144 | mDecoratedChildWidth = getDecoratedMeasuredWidth(scrap);
145 | mDecoratedChildHeight = getDecoratedMeasuredHeight(scrap);
146 |
147 | detachAndScrapView(scrap, recycler);
148 | }
149 |
150 | //Always update the visible row/column counts
151 | updateWindowSizing();
152 |
153 | SparseIntArray removedCache = null;
154 | /*
155 | * During pre-layout, we need to take note of any views that are
156 | * being removed in order to handle predictive animations
157 | */
158 | if (state.isPreLayout()) {
159 | removedCache = new SparseIntArray(getChildCount());
160 | for (int i = 0; i < getChildCount(); i++) {
161 | final View view = getChildAt(i);
162 | LayoutParams lp = (LayoutParams) view.getLayoutParams();
163 |
164 | if (lp.isItemRemoved()) {
165 | //Track these view removals as visible
166 | removedCache.put(lp.getViewLayoutPosition(), REMOVE_VISIBLE);
167 | }
168 | }
169 |
170 | //Track view removals that happened out of bounds (i.e. off-screen)
171 | if (removedCache.size() == 0 && mChangedPositionCount > 0) {
172 | for (int i = mFirstChangedPosition; i < (mFirstChangedPosition + mChangedPositionCount); i++) {
173 | removedCache.put(i, REMOVE_INVISIBLE);
174 | }
175 | }
176 | }
177 |
178 |
179 | int childLeft;
180 | int childTop;
181 | if (getChildCount() == 0) { //First or empty layout
182 | //Reset the visible and scroll positions
183 | mFirstVisiblePosition = 0;
184 | childLeft = getPaddingLeft();
185 | childTop = getPaddingTop();
186 | } else if (!state.isPreLayout()
187 | && getVisibleChildCount() >= state.getItemCount()) {
188 | //Data set is too small to scroll fully, just reset position
189 | mFirstVisiblePosition = 0;
190 | childLeft = getPaddingLeft();
191 | childTop = getPaddingTop();
192 | } else { //Adapter data set changes
193 | /*
194 | * Keep the existing initial position, and save off
195 | * the current scrolled offset.
196 | */
197 | final View topChild = getChildAt(0);
198 | childLeft = getDecoratedLeft(topChild);
199 | childTop = getDecoratedTop(topChild);
200 |
201 | /*
202 | * When data set is too small to scroll vertically, adjust vertical offset
203 | * and shift position to the first row, preserving current column
204 | */
205 | if (!state.isPreLayout() && getVerticalSpace() > (getTotalRowCount() * mDecoratedChildHeight)) {
206 | mFirstVisiblePosition = mFirstVisiblePosition % getTotalColumnCount();
207 | childTop = getPaddingTop();
208 |
209 | //If the shift overscrolls the column max, back it off
210 | if ((mFirstVisiblePosition + mVisibleColumnCount) > state.getItemCount()) {
211 | mFirstVisiblePosition = Math.max(state.getItemCount() - mVisibleColumnCount, 0);
212 | childLeft = getPaddingLeft();
213 | }
214 | }
215 |
216 | /*
217 | * Adjust the visible position if out of bounds in the
218 | * new layout. This occurs when the new item count in an adapter
219 | * is much smaller than it was before, and you are scrolled to
220 | * a location where no items would exist.
221 | */
222 | int maxFirstRow = getTotalRowCount() - (mVisibleRowCount - 1);
223 | int maxFirstCol = getTotalColumnCount() - (mVisibleColumnCount - 1);
224 | boolean isOutOfRowBounds = getFirstVisibleRow() > maxFirstRow;
225 | boolean isOutOfColBounds = getFirstVisibleColumn() > maxFirstCol;
226 | if (isOutOfRowBounds || isOutOfColBounds) {
227 | int firstRow;
228 | if (isOutOfRowBounds) {
229 | firstRow = maxFirstRow;
230 | } else {
231 | firstRow = getFirstVisibleRow();
232 | }
233 | int firstCol;
234 | if (isOutOfColBounds) {
235 | firstCol = maxFirstCol;
236 | } else {
237 | firstCol = getFirstVisibleColumn();
238 | }
239 | mFirstVisiblePosition = firstRow * getTotalColumnCount() + firstCol;
240 |
241 | childLeft = getHorizontalSpace() - (mDecoratedChildWidth * mVisibleColumnCount);
242 | childTop = getVerticalSpace() - (mDecoratedChildHeight * mVisibleRowCount);
243 |
244 | //Correct cases where shifting to the bottom-right overscrolls the top-left
245 | // This happens on data sets too small to scroll in a direction.
246 | if (getFirstVisibleRow() == 0) {
247 | childTop = Math.min(childTop, getPaddingTop());
248 | }
249 | if (getFirstVisibleColumn() == 0) {
250 | childLeft = Math.min(childLeft, getPaddingLeft());
251 | }
252 | }
253 | }
254 |
255 | //Clear all attached views into the recycle bin
256 | detachAndScrapAttachedViews(recycler);
257 |
258 | //Fill the grid for the initial layout of views
259 | fillGrid(DIRECTION_NONE, childLeft, childTop, recycler, state, removedCache);
260 |
261 | //Evaluate any disappearing views that may exist
262 | if (!state.isPreLayout() && !recycler.getScrapList().isEmpty()) {
263 | final List scrapList = recycler.getScrapList();
264 | final HashSet disappearingViews = new HashSet(scrapList.size());
265 |
266 | for (RecyclerView.ViewHolder holder : scrapList) {
267 | final View child = holder.itemView;
268 | final LayoutParams lp = (LayoutParams) child.getLayoutParams();
269 | if (!lp.isItemRemoved()) {
270 | disappearingViews.add(child);
271 | }
272 | }
273 |
274 | for (View child : disappearingViews) {
275 | layoutDisappearingView(child);
276 | }
277 | }
278 | }
279 |
280 | @Override
281 | public void onAdapterChanged(RecyclerView.Adapter oldAdapter, RecyclerView.Adapter newAdapter) {
282 | //Completely scrap the existing layout
283 | removeAllViews();
284 | }
285 |
286 | /*
287 | * Rather than continuously checking how many views we can fit
288 | * based on scroll offsets, we simplify the math by computing the
289 | * visible grid as what will initially fit on screen, plus one.
290 | */
291 | private void updateWindowSizing() {
292 | mVisibleColumnCount = (getHorizontalSpace() / mDecoratedChildWidth) + 1;
293 | if (getHorizontalSpace() % mDecoratedChildWidth > 0) {
294 | mVisibleColumnCount++;
295 | }
296 |
297 | //Allow minimum value for small data sets
298 | if (mVisibleColumnCount > getTotalColumnCount()) {
299 | mVisibleColumnCount = getTotalColumnCount();
300 | }
301 |
302 |
303 | mVisibleRowCount = (getVerticalSpace() / mDecoratedChildHeight) + 1;
304 | if (getVerticalSpace() % mDecoratedChildHeight > 0) {
305 | mVisibleRowCount++;
306 | }
307 |
308 | if (mVisibleRowCount > getTotalRowCount()) {
309 | mVisibleRowCount = getTotalRowCount();
310 | }
311 | }
312 |
313 | private void fillGrid(int direction, RecyclerView.Recycler recycler, RecyclerView.State state) {
314 | fillGrid(direction, 0, 0, recycler, state, null);
315 | }
316 |
317 | private void fillGrid(int direction, int emptyLeft, int emptyTop,
318 | RecyclerView.Recycler recycler,
319 | RecyclerView.State state,
320 | SparseIntArray removedPositions) {
321 | if (mFirstVisiblePosition < 0) mFirstVisiblePosition = 0;
322 | if (mFirstVisiblePosition >= getItemCount()) mFirstVisiblePosition = (getItemCount() - 1);
323 |
324 | /*
325 | * First, we will detach all existing views from the layout.
326 | * detachView() is a lightweight operation that we can use to
327 | * quickly reorder views without a full add/remove.
328 | */
329 | SparseArray viewCache = new SparseArray(getChildCount());
330 | int startLeftOffset = emptyLeft;
331 | int startTopOffset = emptyTop;
332 | if (getChildCount() != 0) {
333 | final View topView = getChildAt(0);
334 | startLeftOffset = getDecoratedLeft(topView);
335 | startTopOffset = getDecoratedTop(topView);
336 | switch (direction) {
337 | case DIRECTION_START:
338 | startLeftOffset -= mDecoratedChildWidth;
339 | break;
340 | case DIRECTION_END:
341 | startLeftOffset += mDecoratedChildWidth;
342 | break;
343 | case DIRECTION_UP:
344 | startTopOffset -= mDecoratedChildHeight;
345 | break;
346 | case DIRECTION_DOWN:
347 | startTopOffset += mDecoratedChildHeight;
348 | break;
349 | }
350 |
351 | //Cache all views by their existing position, before updating counts
352 | for (int i = 0; i < getChildCount(); i++) {
353 | int position = positionOfIndex(i);
354 | final View child = getChildAt(i);
355 | viewCache.put(position, child);
356 | }
357 |
358 | //Temporarily detach all views.
359 | // Views we still need will be added back at the proper index.
360 | for (int i = 0; i < viewCache.size(); i++) {
361 | detachView(viewCache.valueAt(i));
362 | }
363 | }
364 |
365 | /*
366 | * Next, we advance the visible position based on the fill direction.
367 | * DIRECTION_NONE doesn't advance the position in any direction.
368 | */
369 | switch (direction) {
370 | case DIRECTION_START:
371 | mFirstVisiblePosition--;
372 | break;
373 | case DIRECTION_END:
374 | mFirstVisiblePosition++;
375 | break;
376 | case DIRECTION_UP:
377 | mFirstVisiblePosition -= getTotalColumnCount();
378 | break;
379 | case DIRECTION_DOWN:
380 | mFirstVisiblePosition += getTotalColumnCount();
381 | break;
382 | }
383 |
384 | /*
385 | * Next, we supply the grid of items that are deemed visible.
386 | * If these items were previously there, they will simply be
387 | * re-attached. New views that must be created are obtained
388 | * from the Recycler and added.
389 | */
390 | int leftOffset = startLeftOffset;
391 | int topOffset = startTopOffset;
392 |
393 | for (int i = 0; i < getVisibleChildCount(); i++) {
394 | int nextPosition = positionOfIndex(i);
395 |
396 | /*
397 | * When a removal happens out of bounds, the pre-layout positions of items
398 | * after the removal are shifted to their final positions ahead of schedule.
399 | * We have to track off-screen removals and shift those positions back
400 | * so we can properly lay out all current (and appearing) views in their
401 | * initial locations.
402 | */
403 | int offsetPositionDelta = 0;
404 | if (state.isPreLayout()) {
405 | int offsetPosition = nextPosition;
406 |
407 | for (int offset = 0; offset < removedPositions.size(); offset++) {
408 | //Look for off-screen removals that are less-than this
409 | if (removedPositions.valueAt(offset) == REMOVE_INVISIBLE
410 | && removedPositions.keyAt(offset) < nextPosition) {
411 | //Offset position to match
412 | offsetPosition--;
413 | }
414 | }
415 | offsetPositionDelta = nextPosition - offsetPosition;
416 | nextPosition = offsetPosition;
417 | }
418 |
419 | if (nextPosition < 0 || nextPosition >= state.getItemCount()) {
420 | //Item space beyond the data set, don't attempt to add a view
421 | continue;
422 | }
423 |
424 | //Layout this position
425 | View view = viewCache.get(nextPosition);
426 | if (view == null) {
427 | /*
428 | * The Recycler will give us either a newly constructed view,
429 | * or a recycled view it has on-hand. In either case, the
430 | * view will already be fully bound to the data by the
431 | * adapter for us.
432 | */
433 | view = recycler.getViewForPosition(nextPosition);
434 | addView(view);
435 |
436 | /*
437 | * Update the new view's metadata, but only when this is a real
438 | * layout pass.
439 | */
440 | if (!state.isPreLayout()) {
441 | LayoutParams lp = (LayoutParams) view.getLayoutParams();
442 | lp.row = getGlobalRowOfPosition(nextPosition);
443 | lp.column = getGlobalColumnOfPosition(nextPosition);
444 | }
445 |
446 | /*
447 | * It is prudent to measure/layout each new view we
448 | * receive from the Recycler. We don't have to do
449 | * this for views we are just re-arranging.
450 | */
451 | measureChildWithMargins(view, 0, 0);
452 | layoutDecorated(view, leftOffset, topOffset,
453 | leftOffset + mDecoratedChildWidth,
454 | topOffset + mDecoratedChildHeight);
455 |
456 | } else {
457 | //Re-attach the cached view at its new index
458 | attachView(view);
459 | viewCache.remove(nextPosition);
460 | }
461 |
462 | if (i % mVisibleColumnCount == (mVisibleColumnCount - 1)) {
463 | leftOffset = startLeftOffset;
464 | topOffset += mDecoratedChildHeight;
465 |
466 | //During pre-layout, on each column end, apply any additional appearing views
467 | if (state.isPreLayout()) {
468 | layoutAppearingViews(recycler, view, nextPosition, removedPositions.size(), offsetPositionDelta);
469 | }
470 | } else {
471 | leftOffset += mDecoratedChildWidth;
472 | }
473 | }
474 |
475 | /*
476 | * Finally, we ask the Recycler to scrap and store any views
477 | * that we did not re-attach. These are views that are not currently
478 | * necessary because they are no longer visible.
479 | */
480 | for (int i = 0; i < viewCache.size(); i++) {
481 | final View removingView = viewCache.valueAt(i);
482 | recycler.recycleView(removingView);
483 | }
484 | }
485 |
486 | /*
487 | * You must override this method if you would like to support external calls
488 | * to shift the view to a given adapter position. In our implementation, this
489 | * is the same as doing a fresh layout with the given position as the top-left
490 | * (or first visible), so we simply set that value and trigger onLayoutChildren()
491 | */
492 | @Override
493 | public void scrollToPosition(int position) {
494 | if (position >= getItemCount()) {
495 | Log.e(TAG, "Cannot scroll to " + position + ", item count is " + getItemCount());
496 | return;
497 | }
498 |
499 | //Set requested position as first visible
500 | mFirstVisiblePosition = position;
501 | //Toss all existing views away
502 | removeAllViews();
503 | //Trigger a new view layout
504 | requestLayout();
505 | }
506 |
507 | /*
508 | * You must override this method if you would like to support external calls
509 | * to animate a change to a new adapter position. The framework provides a
510 | * helper scroller implementation (LinearSmoothScroller), which we leverage
511 | * to do the animation calculations.
512 | */
513 | @Override
514 | public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, final int position) {
515 | if (position >= getItemCount()) {
516 | Log.e(TAG, "Cannot scroll to " + position + ", item count is " + getItemCount());
517 | return;
518 | }
519 |
520 | /*
521 | * LinearSmoothScroller's default behavior is to scroll the contents until
522 | * the child is fully visible. It will snap to the top-left or bottom-right
523 | * of the parent depending on whether the direction of travel was positive
524 | * or negative.
525 | */
526 | LinearSmoothScroller scroller = new LinearSmoothScroller(recyclerView.getContext()) {
527 | /*
528 | * LinearSmoothScroller, at a minimum, just need to know the vector
529 | * (x/y distance) to travel in order to get from the current positioning
530 | * to the target.
531 | */
532 | @Override
533 | public PointF computeScrollVectorForPosition(int targetPosition) {
534 | final int rowOffset = getGlobalRowOfPosition(targetPosition)
535 | - getGlobalRowOfPosition(mFirstVisiblePosition);
536 | final int columnOffset = getGlobalColumnOfPosition(targetPosition)
537 | - getGlobalColumnOfPosition(mFirstVisiblePosition);
538 |
539 | return new PointF(columnOffset * mDecoratedChildWidth, rowOffset * mDecoratedChildHeight);
540 | }
541 | };
542 | scroller.setTargetPosition(position);
543 | startSmoothScroll(scroller);
544 | }
545 |
546 | /*
547 | * Use this method to tell the RecyclerView if scrolling is even possible
548 | * in the horizontal direction.
549 | */
550 | @Override
551 | public boolean canScrollHorizontally() {
552 | //We do allow scrolling
553 | return true;
554 | }
555 |
556 | /*
557 | * This method describes how far RecyclerView thinks the contents should scroll horizontally.
558 | * You are responsible for verifying edge boundaries, and determining if this scroll
559 | * event somehow requires that new views be added or old views get recycled.
560 | */
561 | @Override
562 | public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) {
563 | if (getChildCount() == 0) {
564 | return 0;
565 | }
566 |
567 | //Take leftmost measurements from the top-left child
568 | final View topView = getChildAt(0);
569 | //Take rightmost measurements from the top-right child
570 | final View bottomView = getChildAt(mVisibleColumnCount - 1);
571 |
572 | //Optimize the case where the entire data set is too small to scroll
573 | int viewSpan = getDecoratedRight(bottomView) - getDecoratedLeft(topView);
574 | if (viewSpan < getHorizontalSpace()) {
575 | //We cannot scroll in either direction
576 | return 0;
577 | }
578 |
579 | int delta;
580 | boolean leftBoundReached = getFirstVisibleColumn() == 0;
581 | boolean rightBoundReached = getLastVisibleColumn() >= getTotalColumnCount();
582 | if (dx > 0) { // Contents are scrolling left
583 | //Check right bound
584 | if (rightBoundReached) {
585 | //If we've reached the last column, enforce limits
586 | int rightOffset = getHorizontalSpace() - getDecoratedRight(bottomView) + getPaddingRight();
587 | delta = Math.max(-dx, rightOffset);
588 | } else {
589 | //No limits while the last column isn't visible
590 | delta = -dx;
591 | }
592 | } else { // Contents are scrolling right
593 | //Check left bound
594 | if (leftBoundReached) {
595 | int leftOffset = -getDecoratedLeft(topView) + getPaddingLeft();
596 | delta = Math.min(-dx, leftOffset);
597 | } else {
598 | delta = -dx;
599 | }
600 | }
601 |
602 | offsetChildrenHorizontal(delta);
603 |
604 | if (dx > 0) {
605 | if (getDecoratedRight(topView) < 0 && !rightBoundReached) {
606 | fillGrid(DIRECTION_END, recycler, state);
607 | } else if (!rightBoundReached) {
608 | fillGrid(DIRECTION_NONE, recycler, state);
609 | }
610 | } else {
611 | if (getDecoratedLeft(topView) > 0 && !leftBoundReached) {
612 | fillGrid(DIRECTION_START, recycler, state);
613 | } else if (!leftBoundReached) {
614 | fillGrid(DIRECTION_NONE, recycler, state);
615 | }
616 | }
617 |
618 | /*
619 | * Return value determines if a boundary has been reached
620 | * (for edge effects and flings). If returned value does not
621 | * match original delta (passed in), RecyclerView will draw
622 | * an edge effect.
623 | */
624 | return -delta;
625 | }
626 |
627 | /*
628 | * Use this method to tell the RecyclerView if scrolling is even possible
629 | * in the vertical direction.
630 | */
631 | @Override
632 | public boolean canScrollVertically() {
633 | //We do allow scrolling
634 | return true;
635 | }
636 |
637 | /*
638 | * This method describes how far RecyclerView thinks the contents should scroll vertically.
639 | * You are responsible for verifying edge boundaries, and determining if this scroll
640 | * event somehow requires that new views be added or old views get recycled.
641 | */
642 | @Override
643 | public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
644 | if (getChildCount() == 0) {
645 | return 0;
646 | }
647 |
648 | //Take top measurements from the top-left child
649 | final View topView = getChildAt(0);
650 | //Take bottom measurements from the bottom-right child.
651 | final View bottomView = getChildAt(getChildCount() - 1);
652 |
653 | //Optimize the case where the entire data set is too small to scroll
654 | int viewSpan = getDecoratedBottom(bottomView) - getDecoratedTop(topView);
655 | if (viewSpan < getVerticalSpace()) {
656 | //We cannot scroll in either direction
657 | return 0;
658 | }
659 |
660 | int delta;
661 | int maxRowCount = getTotalRowCount();
662 | boolean topBoundReached = getFirstVisibleRow() == 0;
663 | boolean bottomBoundReached = getLastVisibleRow() >= maxRowCount;
664 | if (dy > 0) { // Contents are scrolling up
665 | //Check against bottom bound
666 | if (bottomBoundReached) {
667 | //If we've reached the last row, enforce limits
668 | int bottomOffset;
669 | if (rowOfIndex(getChildCount() - 1) >= (maxRowCount - 1)) {
670 | //We are truly at the bottom, determine how far
671 | bottomOffset = getVerticalSpace() - getDecoratedBottom(bottomView)
672 | + getPaddingBottom();
673 | } else {
674 | /*
675 | * Extra space added to account for allowing bottom space in the grid.
676 | * This occurs when the overlap in the last row is not large enough to
677 | * ensure that at least one element in that row isn't fully recycled.
678 | */
679 | bottomOffset = getVerticalSpace() - (getDecoratedBottom(bottomView)
680 | + mDecoratedChildHeight) + getPaddingBottom();
681 | }
682 |
683 | delta = Math.max(-dy, bottomOffset);
684 | } else {
685 | //No limits while the last row isn't visible
686 | delta = -dy;
687 | }
688 | } else { // Contents are scrolling down
689 | //Check against top bound
690 | if (topBoundReached) {
691 | int topOffset = -getDecoratedTop(topView) + getPaddingTop();
692 |
693 | delta = Math.min(-dy, topOffset);
694 | } else {
695 | delta = -dy;
696 | }
697 | }
698 |
699 | offsetChildrenVertical(delta);
700 |
701 | if (dy > 0) {
702 | if (getDecoratedBottom(topView) < 0 && !bottomBoundReached) {
703 | fillGrid(DIRECTION_DOWN, recycler, state);
704 | } else if (!bottomBoundReached) {
705 | fillGrid(DIRECTION_NONE, recycler, state);
706 | }
707 | } else {
708 | if (getDecoratedTop(topView) > 0 && !topBoundReached) {
709 | fillGrid(DIRECTION_UP, recycler, state);
710 | } else if (!topBoundReached) {
711 | fillGrid(DIRECTION_NONE, recycler, state);
712 | }
713 | }
714 |
715 | /*
716 | * Return value determines if a boundary has been reached
717 | * (for edge effects and flings). If returned value does not
718 | * match original delta (passed in), RecyclerView will draw
719 | * an edge effect.
720 | */
721 | return -delta;
722 | }
723 |
724 | /*
725 | * This is a helper method used by RecyclerView to determine
726 | * if a specific child view can be returned.
727 | */
728 | @Override
729 | public View findViewByPosition(int position) {
730 | for (int i = 0; i < getChildCount(); i++) {
731 | if (positionOfIndex(i) == position) {
732 | return getChildAt(i);
733 | }
734 | }
735 |
736 | return null;
737 | }
738 |
739 | /**
740 | * Boilerplate to extend LayoutParams for tracking row/column of attached views
741 | */
742 |
743 | /*
744 | * Even without extending LayoutParams, we must override this method
745 | * to provide the default layout parameters that each child view
746 | * will receive when added.
747 | */
748 | @Override
749 | public RecyclerView.LayoutParams generateDefaultLayoutParams() {
750 | return new LayoutParams(
751 | ViewGroup.LayoutParams.WRAP_CONTENT,
752 | ViewGroup.LayoutParams.WRAP_CONTENT);
753 | }
754 |
755 | @Override
756 | public RecyclerView.LayoutParams generateLayoutParams(Context c, AttributeSet attrs) {
757 | return new LayoutParams(c, attrs);
758 | }
759 |
760 | @Override
761 | public RecyclerView.LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
762 | if (lp instanceof ViewGroup.MarginLayoutParams) {
763 | return new LayoutParams((ViewGroup.MarginLayoutParams) lp);
764 | } else {
765 | return new LayoutParams(lp);
766 | }
767 | }
768 |
769 | @Override
770 | public boolean checkLayoutParams(RecyclerView.LayoutParams lp) {
771 | return lp instanceof LayoutParams;
772 | }
773 |
774 | public static class LayoutParams extends RecyclerView.LayoutParams {
775 |
776 | //Current row in the grid
777 | public int row;
778 | //Current column in the grid
779 | public int column;
780 |
781 | public LayoutParams(Context c, AttributeSet attrs) {
782 | super(c, attrs);
783 | }
784 |
785 | public LayoutParams(int width, int height) {
786 | super(width, height);
787 | }
788 |
789 | public LayoutParams(ViewGroup.MarginLayoutParams source) {
790 | super(source);
791 | }
792 |
793 | public LayoutParams(ViewGroup.LayoutParams source) {
794 | super(source);
795 | }
796 |
797 | public LayoutParams(RecyclerView.LayoutParams source) {
798 | super(source);
799 | }
800 | }
801 |
802 | /**
803 | * Animation Layout Helpers
804 | */
805 |
806 | /* Helper to obtain and place extra appearing views */
807 | private void layoutAppearingViews(RecyclerView.Recycler recycler, View referenceView, int referencePosition, int extraCount, int offset) {
808 | //Nothing to do...
809 | if (extraCount < 1) return;
810 |
811 | //FIXME: This code currently causes double layout of views that are still visible…
812 | for (int extra = 1; extra <= extraCount; extra++) {
813 | //Grab the next position after the reference
814 | final int extraPosition = referencePosition + extra;
815 | if (extraPosition < 0 || extraPosition >= getItemCount()) {
816 | //Can't do anything with this
817 | continue;
818 | }
819 |
820 | /*
821 | * Obtain additional position views that we expect to appear
822 | * as part of the animation.
823 | */
824 | View appearing = recycler.getViewForPosition(extraPosition);
825 | addView(appearing);
826 |
827 | //Find layout delta from reference position
828 | final int newRow = getGlobalRowOfPosition(extraPosition + offset);
829 | final int rowDelta = newRow - getGlobalRowOfPosition(referencePosition + offset);
830 | final int newCol = getGlobalColumnOfPosition(extraPosition + offset);
831 | final int colDelta = newCol - getGlobalColumnOfPosition(referencePosition + offset);
832 |
833 | layoutTempChildView(appearing, rowDelta, colDelta, referenceView);
834 | }
835 | }
836 |
837 | /* Helper to place a disappearing view */
838 | private void layoutDisappearingView(View disappearingChild) {
839 | /*
840 | * LayoutManager has a special method for attaching views that
841 | * will only be around long enough to animate.
842 | */
843 | addDisappearingView(disappearingChild);
844 |
845 | //Adjust each disappearing view to its proper place
846 | final LayoutParams lp = (LayoutParams) disappearingChild.getLayoutParams();
847 |
848 | final int newRow = getGlobalRowOfPosition(lp.getViewAdapterPosition());
849 | final int rowDelta = newRow - lp.row;
850 | final int newCol = getGlobalColumnOfPosition(lp.getViewAdapterPosition());
851 | final int colDelta = newCol - lp.column;
852 |
853 | layoutTempChildView(disappearingChild, rowDelta, colDelta, disappearingChild);
854 | }
855 |
856 |
857 | /* Helper to lay out appearing/disappearing children */
858 | private void layoutTempChildView(View child, int rowDelta, int colDelta, View referenceView) {
859 | //Set the layout position to the global row/column difference from the reference view
860 | int layoutTop = getDecoratedTop(referenceView) + rowDelta * mDecoratedChildHeight;
861 | int layoutLeft = getDecoratedLeft(referenceView) + colDelta * mDecoratedChildWidth;
862 |
863 | measureChildWithMargins(child, 0, 0);
864 | layoutDecorated(child, layoutLeft, layoutTop,
865 | layoutLeft + mDecoratedChildWidth,
866 | layoutTop + mDecoratedChildHeight);
867 | }
868 |
869 | /**
870 | * Private Helpers and Metrics Accessors
871 | */
872 |
873 | /* Return the overall column index of this position in the global layout */
874 | private int getGlobalColumnOfPosition(int position) {
875 | return position % mTotalColumnCount;
876 | }
877 |
878 | /* Return the overall row index of this position in the global layout */
879 | private int getGlobalRowOfPosition(int position) {
880 | return position / mTotalColumnCount;
881 | }
882 |
883 | /*
884 | * Mapping between child view indices and adapter data
885 | * positions helps fill the proper views during scrolling.
886 | */
887 | private int positionOfIndex(int childIndex) {
888 | int row = childIndex / mVisibleColumnCount;
889 | int column = childIndex % mVisibleColumnCount;
890 |
891 | return mFirstVisiblePosition + (row * getTotalColumnCount()) + column;
892 | }
893 |
894 | private int rowOfIndex(int childIndex) {
895 | int position = positionOfIndex(childIndex);
896 |
897 | return position / getTotalColumnCount();
898 | }
899 |
900 | private int getFirstVisibleColumn() {
901 | return (mFirstVisiblePosition % getTotalColumnCount());
902 | }
903 |
904 | private int getLastVisibleColumn() {
905 | return getFirstVisibleColumn() + mVisibleColumnCount;
906 | }
907 |
908 | private int getFirstVisibleRow() {
909 | return (mFirstVisiblePosition / getTotalColumnCount());
910 | }
911 |
912 | private int getLastVisibleRow() {
913 | return getFirstVisibleRow() + mVisibleRowCount;
914 | }
915 |
916 | private int getVisibleChildCount() {
917 | return mVisibleColumnCount * mVisibleRowCount;
918 | }
919 |
920 | private int getTotalColumnCount() {
921 | if (getItemCount() < mTotalColumnCount) {
922 | return getItemCount();
923 | }
924 |
925 | return mTotalColumnCount;
926 | }
927 |
928 | private int getTotalRowCount() {
929 | if (getItemCount() == 0 || mTotalColumnCount == 0) {
930 | return 0;
931 | }
932 | int maxRow = getItemCount() / mTotalColumnCount;
933 | //Bump the row count if it's not exactly even
934 | if (getItemCount() % mTotalColumnCount != 0) {
935 | maxRow++;
936 | }
937 |
938 | return maxRow;
939 | }
940 |
941 | private int getHorizontalSpace() {
942 | return getWidth() - getPaddingRight() - getPaddingLeft();
943 | }
944 |
945 | private int getVerticalSpace() {
946 | return getHeight() - getPaddingBottom() - getPaddingTop();
947 | }
948 | }
949 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-hdpi/ic_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-hdpi/ic_file.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-hdpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-hdpi/ic_folder.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-mdpi/ic_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-mdpi/ic_file.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-mdpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-mdpi/ic_folder.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-xhdpi/ic_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-xhdpi/ic_file.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-xhdpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-xhdpi/ic_folder.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-xxhdpi/ic_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-xxhdpi/ic_file.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-xxhdpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-xxhdpi/ic_folder.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-xxxhdpi/ic_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-xxxhdpi/ic_file.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable-xxxhdpi/ic_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/drawable-xxxhdpi/ic_folder.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable/edittext_drawable.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
7 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/activity_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/activity_shared_preference.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
29 |
30 |
39 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/app_bar_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/content_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/fragment_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
23 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/item_database_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
25 |
26 |
34 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/item_shared_preference.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
24 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/item_simple_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
24 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/item_table_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/main_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/nav_header_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
21 |
22 |
28 |
29 |
34 |
35 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/layout/table_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
26 |
27 |
31 |
32 |
38 |
39 |
43 |
44 |
45 |
46 |
55 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/menu/drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/menu/menu_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/mipmap-hdpi/ic_android_robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/mipmap-hdpi/ic_android_robot.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/mipmap-mdpi/ic_android_robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/mipmap-mdpi/ic_android_robot.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/mipmap-xhdpi/ic_android_robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/mipmap-xhdpi/ic_android_robot.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/mipmap-xxhdpi/ic_android_robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/mipmap-xxhdpi/ic_android_robot.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/mipmap-xxxhdpi/ic_android_robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/debug_tools/src/main/res/mipmap-xxxhdpi/ic_android_robot.png
--------------------------------------------------------------------------------
/debug_tools/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #E1F5FE
8 | #FFFFFF
9 | #F5F5F5
10 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 176dp
7 | 16dp
8 | 4dp
9 |
10 | 250dp
11 | 86dp
12 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Dev Tools
3 | DrawerActivity
4 |
5 | Open navigation drawer
6 | Close navigation drawer
7 |
8 | Settings
9 |
10 |
11 |
--------------------------------------------------------------------------------
/debug_tools/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/debug_tools/src/test/java/com/krishna/debug_tools/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.krishna.debug_tools;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Feb 05 18:38:54 IST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/screenshots/database list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/screenshots/database list.png
--------------------------------------------------------------------------------
/screenshots/drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/screenshots/drawer.png
--------------------------------------------------------------------------------
/screenshots/sharedPreference.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/screenshots/sharedPreference.png
--------------------------------------------------------------------------------
/screenshots/table content.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/screenshots/table content.png
--------------------------------------------------------------------------------
/screenshots/table list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kk121/Android-Debug-Tools/1493e76b178ed882d89dacd5bac173faf3907efb/screenshots/table list.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | include ':debug_tools'
3 |
--------------------------------------------------------------------------------