Skip to content

Instantly share code, notes, and snippets.

View YoungjaeKim's full-sized avatar

YoungjaeKim YoungjaeKim

View GitHub Profile
@YoungjaeKim
YoungjaeKim / NullableBooleanToVisibilityConverter.cs
Created June 10, 2013 18:23
More usable Boolean to Visibility converter for XAML converter
public class NullableBooleanToVisibilityConverter : IValueConverter
{
/// <summary>
/// Converts a value.
/// </summary>
/// <returns>
/// A converted value. If the method returns null, the valid null value is used.
/// </returns>
/// <param name="value">The value produced by the binding source.</param>
/// <param name="targetType">The type of the binding target property.</param>
@YoungjaeKim
YoungjaeKim / Text.java
Created May 12, 2013 15:28
기록물 시간 표시에 사용되는 친숙한 시간 표현 변환. 최적화 덜 됨.
/**
* 친숙한 시간 표기법.
* @param date 과거시간데이터.
* @return 한국어로 친숙한 시간 설명 출력.
* @exception 미래값을 넣으면 {@link IllegalArgumentException} 발생.
*/
public static String toFriendlyDateTimeString(DateTime date){
DateTime now = new DateTime();
if (date.isAfterNow())
throw new IllegalArgumentException("Future DateTime cannot be not handled.");
@YoungjaeKim
YoungjaeKim / QuestionViewActivity.java
Created May 12, 2013 15:27
ActionMode on ActionBarSherlock. A kind of context menu.
private final class ActionModeForReply implements ActionMode.Callback {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
//Used to put dark icons on light action bar
menu.add(R.string.send_now)
.setIcon(R.drawable.ic_menu_send_now)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;