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
| private void fixApi21ToolBarBug(Toolbar toolbar){ | |
| if(Build.VERSION.SDK_INT!=21) return; //only on api 21 | |
| final int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); | |
| final int result = (resourceId>0) ? getResources().getDimensionPixelSize(resourceId)*2 : 0; | |
| final CollapsingToolbarLayout.LayoutParams params = | |
| (CollapsingToolbarLayout.LayoutParams)toolbar.getLayoutParams(); | |
| params.topMargin -= result; | |
| toolbar.setLayoutParams(params); | |
| } |
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
| /** | |
| * Getting activities that are available for smsto:phone_number action | |
| * and starting intent chooser to support on API version greater than Lollipop, | |
| * because Lollipop is using default sms action provider as Hangouts | |
| * as result, we couldn't give an option to choose intent provider | |
| * @param context used to get package manager and start intent filter | |
| * @param phoneNumber to send sms | |
| */ | |
| private void startMessengerIntent(Context context, String phoneNumber) { | |
| Uri uri = Uri.parse("sms:" + phoneNumber); |
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
| /* | |
| * Copyright (C) 2013-2015 Juha Kuitunen | |
| * Copyright (C) 2007 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.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
| /** | |
| * Created by John on 05.08.2014. | |
| * Version 1.0 | |
| */ | |
| public class OnSwipeTouchListener implements View.OnTouchListener { | |
| private GestureDetector gestureDetector; | |
| public OnSwipeTouchListener(Context c) { | |
| gestureDetector = new GestureDetector(c, new GestureListener()); |
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 FixedAspectLayout extends FrameLayout { | |
| private float aspect = 1.0f; | |
| // .. alternative constructors omitted | |
| public FixedAspectLayout(Context context, AttributeSet attrs) { | |
| super(context, attrs); | |
| init(context, attrs); | |
| } |
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 ExpandableTextView extends TextView { | |
| private static final int DEFAULT_TRIM_LENGTH = 200; | |
| private static final String ELLIPSIS = "....."; | |
| private CharSequence originalText; | |
| private CharSequence trimmedText; | |
| private BufferType bufferType; | |
| private boolean trim = true; | |
| private int trimLength; |
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
| googleMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() { | |
| @Override | |
| public void onCameraChange(CameraPosition cameraPosition) { | |
| LatLngBounds bounds = googleMap.getProjection().getVisibleRegion().latLngBounds; | |
| new DynamicallyAddMarkerTask().execute(bounds); | |
| } | |
| }); | |
| private class DynamicClusteringTask extends AsyncTask<LatLngBounds, Void, Void> { |
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.widget.AbsListView; | |
| /** | |
| * Created by JohnMars on 7/10/14. | |
| * Version 1.0 | |
| */ | |
| public abstract class EndlessScrollListener implements AbsListView.OnScrollListener { | |
| private int visibleThreshold = 5; | |
| // The current offset index of data you have loaded | |
| private int currentPage = 0; |