'기타' 카테고리의 다른 글
junit 단정문 링크 (0) | 2021.07.28 |
---|---|
material develop android site (0) | 2021.07.28 |
쿼리 정리 사이트 (0) | 2018.01.31 |
codebeautify (0) | 2017.12.02 |
맥 터미널 개발환경 구축하기 (0) | 2017.12.02 |
junit 단정문 링크 (0) | 2021.07.28 |
---|---|
material develop android site (0) | 2021.07.28 |
쿼리 정리 사이트 (0) | 2018.01.31 |
codebeautify (0) | 2017.12.02 |
맥 터미널 개발환경 구축하기 (0) | 2017.12.02 |
/**
* GZip를 이용한 스트링 압축
* @author jksong
* @Param
* @since 2019-09-09 오전 8:30
**/
public static byte[] zipStringToBytes(String input) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(gzipOutputStream);
bufferedOutputStream.write(input.getBytes());
bufferedOutputStream.close();
byteArrayOutputStream.close();
return byteArrayOutputStream.toByteArray();
}
/**
* GZIPInputStream을 이용하여 byte배열 압축해제하기
* @author jksong
* @Param
* @since 2019-09-09 오전 8:30
**/
public String unzipStringFromBytes(byte[] bytes) throws IOException {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
GZIPInputStream gzipInputStream = new GZIPInputStream(byteArrayInputStream);
BufferedInputStream bufferedInputStream = new BufferedInputStream(gzipInputStream);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[100];
int length;
while((length = bufferedInputStream.read(buffer)) > 0) {
byteArrayOutputStream.write(buffer, 0, length);
}
bufferedInputStream.close();
gzipInputStream.close();
byteArrayInputStream.close();
byteArrayOutputStream.close();
return byteArrayOutputStream.toString();
}
메소드 참조 표현식(이중 콜론 연산자), 생성자참조 표현식 (0) | 2023.01.18 |
---|---|
한자리 숫자일대 앞에 0을 붙여준다 (0) | 2021.07.29 |
숫자만 입력되었는지 체크하기 (0) | 2019.03.05 |
입력 날짜 및 시간 이후 시간 계산 (2) | 2018.03.07 |
용량 계산 (0) | 2017.12.27 |
public class SwipeViewPager extends ViewPager {
private boolean enabled;
public SwipeViewPager(Context context) {
super(context);
}
public SwipeViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (enabled) {
return super.onInterceptTouchEvent(ev);
} else {
if (MotionEventCompat.getActionMasked(ev) == MotionEvent.ACTION_MOVE) {
// ignore move action
} else {
if (super.onInterceptTouchEvent(ev)) {
super.onTouchEvent(ev);
}
}
return false;
}
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (enabled) {
return super.onTouchEvent(ev);
} else {
return MotionEventCompat.getActionMasked(ev) != MotionEvent.ACTION_MOVE && super.onTouchEvent(ev);
}
}
public void setPagingEnabled(boolean enabled) {
this.enabled = enabled;
}
}
setPagingEnabled(false)를 하면 스와이프해서 페이지 이동을 막을 수 있음
android studio plugin (0) | 2021.07.28 |
---|---|
startActivityForResult @Deprecated 되어 변경된 코드 예시 (0) | 2021.06.25 |
안드로이드 로그 레벨 색상 (0) | 2019.08.12 |
String to byte 계산 (0) | 2019.04.08 |
urlEncode, urlDecode (0) | 2019.04.08 |