정리가 아주 잘되어 있어서 링크 공유합니다

https://recipes4dev.tistory.com/95

 

안드로이드 에디트텍스트 속성 5. [inputMethod, inputType] (Android EditText Attributes 5)

1. EditText 속성 (5) EditText 속성 리스트 및 요약 설명을 확인하시려면 [안드로이드 에디트텍스트 속성] 페이지를 참고하시기 바랍니다. EditText 속성에 대한 자세한 설명 및 예제를 확인하시려면, 아

recipes4dev.tistory.com

 

codeGlance2 소스 사이드바 네비게이션
Awesome Console 터미널 출력에서 파일 이름으로 인식된 부분이 자동으로 연결되고, 그 링크를 클릭하면 해당 파일을 편집기에서 자동으로 열어줌
Translation 편집기에서 커서에 해당하는 단어나 선택영역의 문장을 번역해줌
Grep Console 콘솔 확장
Key Promoter X 단축키 표시
Rainbow Brackets 괄호 기호에 색깔을 입혀 구분시켜준다
.ignore

startAvtivityForResult가 Deprecated되며 변경된 코드

 

ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
if (result.getResultCode() == Activity.RESULT_OK) {
// There are no request codes
} else {


}
}
});

 

Intent intent = new Intent(this, user.class);
intent.setData(Uri.parse("package:" + mContext.getPackageName()));
someActivityResultLauncher.launch(intent);

'android' 카테고리의 다른 글

editText 속성  (0) 2021.08.24
android studio plugin  (0) 2021.07.28
뷰페이저 스와이프해서 프래그먼튼 이동 막기  (0) 2019.09.30
안드로이드 로그 레벨 색상  (0) 2019.08.12
String to byte 계산  (0) 2019.04.08

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' 카테고리의 다른 글

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

로그레벨별 추천하는 색상

Debug : 6897BB 

Info : 6A8759 

Warn : BBB529 

Error : FF6B68 

Assert : 9876AA



출처: https://gun0912.tistory.com/31 [박상권의 삽질블로그]

  public static String byteCalculation(String bytes) {
    String retFormat = "0";
    Double size = Double.parseDouble(bytes);
    int unit = 1024;
    DecimalFormat df = null;
    
    String[] s = {"B", "KB", "MB", "GB", "TB", "PB"};
    
    if (!bytes.equals("0")) {
      if (size < unit) {
        df = new DecimalFormat("#,###.###");
        double t = size / unit;
        return String.valueOf(df.format(t)) + " " + s[1];
        
      } else {
        int idx = (int) Math.floor(Math.log(size) / Math.log(unit));
        df = new DecimalFormat("#,###");
        double ret = ((size / Math.pow(unit, Math.floor(idx))));
        retFormat = df.format(ret) + " " + s[idx];
      }
    } else {
      retFormat += " " + s[0];
    }
    
    return retFormat;
  }

'android' 카테고리의 다른 글

뷰페이저 스와이프해서 프래그먼튼 이동 막기  (0) 2019.09.30
안드로이드 로그 레벨 색상  (0) 2019.08.12
urlEncode, urlDecode  (0) 2019.04.08
Base64Encode, Decode  (0) 2019.04.08
SharedPreferences  (0) 2019.04.08

  public static String urlEncode(String content, String lngType) throws UnsupportedEncodingException {
    return URLEncoder.encode(content, lngType);
  }
  
  public static String urlDecode(String content, String lngType) throws UnsupportedEncodingException {
    return URLDecoder.decode(content, lngType);
  }

'android' 카테고리의 다른 글

안드로이드 로그 레벨 색상  (0) 2019.08.12
String to byte 계산  (0) 2019.04.08
Base64Encode, Decode  (0) 2019.04.08
SharedPreferences  (0) 2019.04.08
앱 이름 가져오기  (0) 2019.04.08

  public static String base64Encode(String str) {
    return Base64.encodeToString(str.getBytes(), 0);
  }
  
  public static String base64Decode(String str) {
    return new String(Base64.decode(str, 0));
  }

'android' 카테고리의 다른 글

String to byte 계산  (0) 2019.04.08
urlEncode, urlDecode  (0) 2019.04.08
SharedPreferences  (0) 2019.04.08
앱 이름 가져오기  (0) 2019.04.08
버전 정보 가져오기  (0) 2019.04.08

  public static String getAppName(Context mContext) {
    ApplicationInfo applicationInfo = mContext.getApplicationInfo();
    int stringId = applicationInfo.labelRes;
    return stringId == 0 ? applicationInfo.nonLocalizedLabel.toString() : mContext.getString(stringId);
  }

'android' 카테고리의 다른 글

Base64Encode, Decode  (0) 2019.04.08
SharedPreferences  (0) 2019.04.08
버전 정보 가져오기  (0) 2019.04.08
JSON String 파싱하기  (0) 2019.03.20
안드로이드 UI 라이브러리 모음  (0) 2019.03.05

+ Recent posts