1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-27 03:12:18 -05:00

ConversationActivity: Added "close" to menu

This commit is contained in:
Sebastian Kaspari 2010-03-30 23:17:23 +02:00
parent 902b1a5b09
commit 456bf0b515
3 changed files with 15 additions and 2 deletions

View File

@ -24,8 +24,12 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:id="@+id/join" android:id="@+id/join"
android:title="@string/join_channel" android:title="@string/join_channel"
android:icon="@android:drawable/ic_menu_add" /> android:icon="@android:drawable/ic_menu_add" />
<item
android:id="@+id/close"
android:title="@string/close"
android:icon="@android:drawable/ic_menu_close_clear_cancel" />
<item <item
android:id="@+id/disconnect" android:id="@+id/disconnect"
android:title="@string/disconnect" android:title="@string/disconnect"
android:icon="@android:drawable/ic_menu_close_clear_cancel" /> android:icon="@android:drawable/ic_menu_revert" />
</menu> </menu>

View File

@ -25,6 +25,7 @@
<string name="channel">Channel</string> <string name="channel">Channel</string>
<string name="join">Join</string> <string name="join">Join</string>
<string name="join_channel">Join Channel</string> <string name="join_channel">Join Channel</string>
<string name="close">Close</string>
<string name="connect">Connect</string> <string name="connect">Connect</string>
<string name="disconnect">Disconnect</string> <string name="disconnect">Disconnect</string>
<string name="edit">Edit</string> <string name="edit">Edit</string>

View File

@ -41,6 +41,7 @@ import android.widget.Gallery;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewSwitcher; import android.widget.ViewSwitcher;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener; import android.widget.AdapterView.OnItemSelectedListener;
@ -233,7 +234,14 @@ public class ConversationActivity extends Activity implements ServiceConnection,
setResult(RESULT_OK); setResult(RESULT_OK);
finish(); finish();
break; break;
case R.id.close:
Conversation conversation = deckAdapter.getItem(deck.getSelectedItemPosition());
if (conversation.getType() != Conversation.TYPE_SERVER) {
onRemoveConversation(conversation.getName());
} else {
Toast.makeText(this, "You can not close the server info window", Toast.LENGTH_SHORT).show();
}
break;
case R.id.join: case R.id.join:
startActivityForResult(new Intent(this, JoinActivity.class), 0); startActivityForResult(new Intent(this, JoinActivity.class), 0);
break; break;