From dbaa28de5ecf850c79be9a5505669b7211db749d Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 20 May 2014 07:00:03 -0700 Subject: [PATCH] don't refuse to delete local translation --- .../org/eehouse/android/xw4/loc/LocItemEditDelegate.java | 5 +---- .../XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java | 8 ++++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java index 542ff2a21..3dd821b9c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java @@ -72,10 +72,7 @@ public class LocItemEditDelegate extends DelegateBase { protected void onPause() { // Save any local translation - CharSequence txt = m_edit.getText(); - if ( null != txt && 0 < txt.length() ) { - LocUtils.setXlation( m_activity, m_key, txt.toString() ); - } + LocUtils.setXlation( m_activity, m_key, m_edit.getText() ); super.onPause(); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java index 358286dc2..b1b15512c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java @@ -225,10 +225,14 @@ public class LocUtils { return result; } - public static void setXlation( Context context, String key, String txt ) + public static void setXlation( Context context, String key, CharSequence txt ) { loadXlations( context ); - s_xlationsLocal.put( key, txt ); + if ( null == txt || 0 == txt.length() ) { + s_xlationsLocal.remove( key ); + } else { + s_xlationsLocal.put( key, txt.toString() ); + } } protected static String getLocalXlation( Context context, String key,