Skip to content

Instantly share code, notes, and snippets.

View pantos27's full-sized avatar
💅
coding makes my nails polish peel

Amir A pantos27

💅
coding makes my nails polish peel
View GitHub Profile
@pantos27
pantos27 / Activity.java
Created November 15, 2016 08:12
CircularArrayAdapter, never ending loop list view adapter
//once created, set the position to the middle
listViewObject.setSelectionFromTop(nameOfAdapterObject.MIDDLE, 0);
@pantos27
pantos27 / loader.java
Created October 6, 2016 06:51
load picture with Picasso with a rotating loading animation plcaeholder
Picasso.with( context )
.load( your_path )
.error( R.drawable.ic_error )
.placeholder( R.drawable.progress_animation )
.into( image_view );
@pantos27
pantos27 / ViewPager.java
Created September 29, 2016 15:29
Custom Android ViewPager for disabling scrolling with navigation buttons (left/right)
viewPager = new ViewPager(this){
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
View nextFocus = findFocus();
if(event.getAction() == KeyEvent.ACTION_DOWN) {
if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT)
Log.d("TestFocus", "" + (nextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus(), FOCUS_RIGHT)));
else if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT)
Log.d("TestFocus", "" + (nextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus(), FOCUS_LEFT)));
@pantos27
pantos27 / MainActivity.java
Created February 15, 2016 08:21
async task home work
package com.pantos27.www.lesson17_asynctask;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import java.net.URL;