Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Focusing

Lester Lopez iamdeveloper-lopez

👨‍💻
Focusing
Block or report user

Report or block iamdeveloper-lopez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SimpleCollapsingToolbarCallback.java
public abstract class SimpleCollapsingToolbarCallback implements AppBarLayout.OnOffsetChangedListener {
public enum State {
EXPANDED,
COLLAPSED
}
@iamdeveloper-lopez
iamdeveloper-lopez / IPFinderTask.java
Created Mar 19, 2019
Getting IP address in simple way.
View IPFinderTask.java
import android.os.AsyncTask;
import android.util.Log;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class IPFinderTask extends AsyncTask<Void, Void, String> {
@iamdeveloper-lopez
iamdeveloper-lopez / DynamicHeightImageView.java
Created Mar 18, 2019
An ImageView layout that maintains a consistent width to height aspect ratio.
View DynamicHeightImageView.java
public class DynamicHeightImageView extends ImageView {
private double mHeightRatio;
public DynamicHeightImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public DynamicHeightImageView(Context context) {
super(context);
@iamdeveloper-lopez
iamdeveloper-lopez / README.md
Created Oct 26, 2018
UnzipTask is an extension for AsyncTask which focus on Unzipping file and extract it to the one you've provided.
View README.md

UnzipTask

UnzipTask is an extension for AsyncTask which focus on Unzipping file and extract it to the one you've provided.

Implementation

Using Builder

UnzipTask.Builder builder = new UnzipTask.Builder();
builder.setZipFile(zipFile);
@iamdeveloper-lopez
iamdeveloper-lopez / PercentViewPager.java
Created Aug 28, 2018
PercentViewPager is an extension for ViewPager that can control W & H by percentage.
View PercentViewPager.java
public class PercentViewPager extends ViewPager {
private int WIDTH_PERCENT = Integer.MIN_VALUE;
private int HEIGHT_PERCENT = Integer.MIN_VALUE;
public PercentViewPager(@NonNull Context context) {
super(context);
init(context, null);
}
@iamdeveloper-lopez
iamdeveloper-lopez / PercentImageView.java
Last active Aug 28, 2018
PercentImageView is an extension for ImageView that can control W & H by percentage.
View PercentImageView.java
public class PercentImageView extends AppCompatImageView {
private int WIDTH_PERCENT = Integer.MIN_VALUE;
private int HEIGHT_PERCENT = Integer.MIN_VALUE;
public PercentImageView(Context context) {
super(context);
init(context, null);
}
@iamdeveloper-lopez
iamdeveloper-lopez / README.md
Last active Oct 25, 2018
Alternative to Rx request using Retrofit
View README.md

RetrofitTask

To implement it with custom callback just call

Call<GitHubUser> call = githubService.getUser(userId);

RetrofitTask task = new RetrofitTask<GitHubUser>(call, new RetrofitTask.RetrofitTaskCllback<GitHubUser>(){
    @Override
    public void onSuccess(GitHubUser response) {
@iamdeveloper-lopez
iamdeveloper-lopez / PopBackStack
Created Aug 10, 2018
PopBackStack on Nested Child Fragments
View PopBackStack
@Override
public void onBackPressed() {
for (Fragment fragment : fragmentManager.getFragments()) {
if (fragment.isVisible() && hasBackStack(fragment)) {
if (popFragment(fragment))
return;
}
}
super.onBackPressed();
}
View StatusBar.java
public class StatusBar extends View {
private int statusBarColor = Integer.MIN_VALUE;
public StatusBar(Context context) {
super(context);
}
public StatusBar(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
@iamdeveloper-lopez
iamdeveloper-lopez / VetAdapter.java
Created Jun 18, 2018
VetAdapter - sample recyclerView adapter implementation
View VetAdapter.java
public class VetAdapter extends RecyclerView.Adapter<VetAdapter.ViewHolder> {
private List<VetArray> vetArrays = new ArrayList<>();
public VetAdapter() {
}
public VetAdapter(List<VetArray> vetArrays) {
this.vetArrays = vetArrays;
}
You can’t perform that action at this time.