トラッキング コード

2/08/2014

About a permission "WRITE_EXTERNAL_STORAGE"

http://developer.android.com/reference/android/Manifest.permission.html#WRITE_EXTERNAL_STORAGE
Starting in API level 19, this permission is not required to read/write files in your application-specific directories returned by getExternalFilesDir(String) and getExternalCacheDir()


If appliction is waking up on Android 4.4 Device, WRITE_EXTERNAL_STORAGE is not required to call getExternalFilesDir(String) and getExternalCacheDir(). Not returned Null.

2/01/2014

Add "disable swipe" to ViewPager.

I want to stop swipe in ViewPager. But ViewPager does not have "disable swipe" API.

Creat a custom ViewPager

I creat a custom ViewPager. Custom ViewPager has a "disable swipe" API.

package jp.baroqueworksdev.myapidemo.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class MyViewPager extends ViewPager {
    private boolean mIsEnabledSwipe = true;

    public MyViewPager(Context context) {
        super(context);
    }

    public MyViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (!mIsEnabledSwipe) {
            return false;
        }
        return super.onTouchEvent(event);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (!mIsEnabledSwipe) {
            return false;
        }
        return super.onInterceptTouchEvent(event);
    }

    public void setEnabledSwipe(boolean enabled) {
        mIsEnabledSwipe = enabled;
    }

}