public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {
private int mItemOffset;
public ItemOffsetDecoration(int itemOffset) {
mItemOffset = itemOffset;
}
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
| <IfModule mod_rewrite.c> | |
| RewriteEngine on | |
| # Redirect /index.php (and /index) to / | |
| RewriteCond %{THE_REQUEST} ^GET\ /(.*/)?index(\.php)?(\?.*)?\ HTTP/ | |
| RewriteRule ^ http://%{HTTP_HOST}/%1 [L,R=301] | |
| # Redirect /foo.php to /foo | |
| RewriteCond %{THE_REQUEST} ^GET\ /(.*)\.php(\?.*)?\ HTTP/ | |
| RewriteRule ^ http://%{HTTP_HOST}/%1 [L,R=301] |
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
| # The following will allow you to use URLs such as the following: | |
| # | |
| # example.com/link | |
| # example.com/link/ | |
| # | |
| # Which will actually serve files such as the following: | |
| # | |
| # example.com/link.html | |
| # example.com/link.php | |
| # |
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.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
| int firstVisibleItem, visibleItemCount, totalItemCount; |
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.quynguyenblog.mymap; | |
| import android.app.AlertDialog; | |
| import android.app.Service; | |
| import android.content.Context; | |
| import android.content.DialogInterface; | |
| import android.content.Intent; | |
| import android.location.Location; | |
| import android.location.LocationListener; | |
| import android.location.LocationManager; |
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.support.v4.view.ViewPager; | |
| import android.util.AttributeSet; | |
| import android.view.Gravity; | |
| import android.view.MotionEvent; | |
| import android.view.View; | |
| /** | |
| * Created by Shyish on 11/10/2015. | |
| */ |
Android Recyclerview GridLayoutManager column spacing Here is the question, the first answer does not work well in my project,and it makes the spacing bigger between item and item. the second answer is quite perfect.But if RecyclerView has headers,it does not work well. Then I fixed it.
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
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
| --- | |
| METHOD 1 | |
| This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
| If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
| --- | |
| SELECT * | |
| FROM table | |
| ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
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.columnspacing | |
| import android.graphics.Paint; | |
| import android.graphics.Rect; | |
| import android.support.v4.content.ContextCompat; | |
| import android.support.v7.widget.GridLayoutManager; | |
| 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
| RewriteEngine On | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule ^([^/]+)/$ $1.php | |
| RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php | |
| RewriteRule ^([^/]+)/$ $1.html | |
| RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ | |
| RewriteRule (.*)$ /$1/ [R=301,L] |
OlderNewer