mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
confirm before deleting chat history
Conflicts: xwords4/android/XWords4/res/values/strings.xml
This commit is contained in:
parent
255ca56ed7
commit
07e97107ce
2 changed files with 28 additions and 9 deletions
|
@ -2538,4 +2538,7 @@
|
||||||
<item quantity="other">%1$s messages sent</item>
|
<item quantity="other">%1$s messages sent</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
|
<string name="confirm_clear_chat">Are you sure you want to delete
|
||||||
|
all chat history for this game?\n\n(This action cannot be
|
||||||
|
undone.)</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -21,16 +21,18 @@
|
||||||
package org.eehouse.android.xw4;
|
package org.eehouse.android.xw4;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MenuInflater;
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.eehouse.android.xw4.DlgDelegate.Action;
|
||||||
|
|
||||||
public class ChatDelegate extends DelegateBase
|
public class ChatDelegate extends DelegateBase
|
||||||
implements View.OnClickListener {
|
implements View.OnClickListener {
|
||||||
|
@ -82,10 +84,7 @@ public class ChatDelegate extends DelegateBase
|
||||||
{
|
{
|
||||||
boolean handled = R.id.chat_menu_clear == item.getItemId();
|
boolean handled = R.id.chat_menu_clear == item.getItemId();
|
||||||
if ( handled ) {
|
if ( handled ) {
|
||||||
DBUtils.clearChatHistory( m_activity, m_rowid );
|
showConfirmThen( R.string.confirm_clear_chat, Action.CLEAR_ACTION );
|
||||||
LinearLayout layout =
|
|
||||||
(LinearLayout)findViewById( R.id.chat_history );
|
|
||||||
layout.removeAllViews();
|
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
@ -105,4 +104,21 @@ public class ChatDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dlgButtonClicked( Action action, int which, Object[] params )
|
||||||
|
{
|
||||||
|
switch ( action ) {
|
||||||
|
case CLEAR_ACTION:
|
||||||
|
if ( AlertDialog.BUTTON_POSITIVE == which ) {
|
||||||
|
DBUtils.clearChatHistory( m_activity, m_rowid );
|
||||||
|
LinearLayout layout =
|
||||||
|
(LinearLayout)findViewById( R.id.chat_history );
|
||||||
|
layout.removeAllViews();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super.dlgButtonClicked( action, which, params );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue