トラッキング コード

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
    }
 
}