Skip to content

Instantly share code, notes, and snippets.

View ParkSangGwon's full-sized avatar

Ted Park ParkSangGwon

View GitHub Profile
@ParkSangGwon
ParkSangGwon / AvoidSmartManagerActivity.java
Last active July 22, 2016 05:55
SmartManager Issue TransActivity
public class AvoidSmartManagerActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(0, 0);
finish();
}
}
@ParkSangGwon
ParkSangGwon / MainActivity.java
Created August 10, 2016 14:52
Linkify로 TextView의 특정단어 클릭시 URL이동시키기
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tvLinkify = (TextView) findViewById(R.id.tvLinkify);
@ParkSangGwon
ParkSangGwon / PaletteSample.java
Created October 27, 2016 09:29
PaletteSample
Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
if(palette==null)
return;
Palette.Swatch vibrantSwatch = palette.getVibrantSwatch();
if(vibrantSwatch!=null){
Glide.with(this)
.load("http://...")
.asBitmap()
.into(new BitmapImageViewTarget(ivImage) {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
super.onResourceReady(bitmap, anim);
Palette palette=Palette.from(bitmap).generate();
@ParkSangGwon
ParkSangGwon / KoreanUtil.java
Created August 4, 2016 09:09
안드로이드,JAVA에서 단어에 따라서 '을/를', '이/가','은/는' 구분하기
public class KoreanUtil {
public static final String getComleteWordByJongsung(String name, String firstValue, String secondValue) {
char lastName = name.charAt(name.length() - 1);
// 한글의 제일 처음과 끝의 범위밖일 경우는 오류
if (lastName < 0xAC00 || lastName > 0xD7A3) {
return name;
}
public class ObjectUtils {
public static boolean isEmpty(Object s) {
if (s == null) {
return true;
}
if ((s instanceof String) && (((String)s).trim().length() == 0)) {
return true;
}
if (s instanceof Map) {
android.app.NotificationManager notificationManager = (android.app.NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel channelMessage = new NotificationChannel("channel_id", "channel_name", android.app.NotificationManager.IMPORTANCE_DEFAULT);
channelMessage.setDescription("channel description");
channelMessage.enableLights(true);
channelMessage.setLightColor(Color.GREEN);
channelMessage.enableVibration(true);
channelMessage.setVibrationPattern(new long[]{100, 200, 100, 200});
channelMessage.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
notificationManager.createNotificationChannel(channelMessage);
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/tv_marker"
/**
* Created by TedPark on 16. 4. 11..
*/
public class ClearEditText extends AppCompatEditText implements TextWatcher, View.OnTouchListener, View.OnFocusChangeListener {
private Drawable clearDrawable;
private OnFocusChangeListener onFocusChangeListener;
private OnTouchListener onTouchListener;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel notificationChannel = new NotificationChannel("channel_id", "channel_name", NotificationManager.IMPORTANCE_DEFAULT);
notificationChannel.setDescription("channel description");
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.GREEN);
notificationChannel.enableVibration(true);
notificationChannel.setVibrationPattern(new long[]{100, 200, 100, 200});
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
notificationManager.createNotificationChannel(notificationChannel);