commit 0acbffb9dd321bad0b2a1555fba1418bc6fd8967
parent 6310e71debca7c90448e87bc631c502534f194cb
Author: Jan Dankert <devnull@localhost>
Date: Wed, 8 Feb 2012 22:24:16 +0100
Speichern des neuen Topics im asynchronen Prozess.
Diffstat:
1 file changed, 30 insertions(+), 53 deletions(-)
diff --git a/src/de/mtbnews/android/CreateTopicActivity.java b/src/de/mtbnews/android/CreateTopicActivity.java
@@ -3,7 +3,6 @@ package de.mtbnews.android;
import java.io.IOException;
import android.app.Activity;
-import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
@@ -26,67 +25,45 @@ public class CreateTopicActivity extends Activity
forumId = getIntent().getStringExtra("forum_id");
- new ServerAsyncTask(this, R.string.waitingforcontent)
- {
- private TapatalkClient client;
-
- @Override
- protected void callServer() throws IOException
- {
- client = ((IBCApplication) getApplication())
- .getTapatalkClient();
- // try
- // {
- // message = client.getMessage(boxId, messageId);
- // }
- // catch (TapatalkException e)
- // {
- // throw new RuntimeException(e);
- // }
- }
-
- protected void doOnSuccess()
- {
- // MessageActivity.this.setTitle(feed.getTitle());
-
- final TextView recipient = (TextView) findViewById(R.id.recipient);
- recipient.setText("");
- recipient.setVisibility(View.INVISIBLE);
+ final TextView recipient = (TextView) findViewById(R.id.recipient);
+ recipient.setText("");
+ recipient.setVisibility(View.INVISIBLE);
- // TextView name = (TextView) findViewById(R.id.item_title);
- // name.setText(item.getTitle());
+ final TextView subject = (TextView) findViewById(R.id.subject);
+ subject.setText("");
- final TextView subject = (TextView) findViewById(R.id.subject);
- subject.setText("");
+ final TextView text = (TextView) findViewById(R.id.content);
+ text.setText("");
- final TextView text = (TextView) findViewById(R.id.content);
- text.setText("");
-
- Button button = (Button) findViewById(R.id.send);
- button.setOnClickListener(new OnClickListener()
+ Button button = (Button) findViewById(R.id.send);
+ button.setOnClickListener(new OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ new ServerAsyncTask(CreateTopicActivity.this,
+ R.string.send)
{
+
@Override
- public void onClick(View v)
+ protected void callServer() throws IOException,
+ TapatalkException
{
- try
- {
- client.createTopic(forumId, subject.getText()
- .toString(), text.getText().toString());
- Toast.makeText(CreateTopicActivity.this,
- R.string.sent_ok, Toast.LENGTH_LONG);
- CreateTopicActivity.this.finish();
- }
- catch (TapatalkException e)
- {
- new AlertDialog.Builder(CreateTopicActivity.this)
- .setTitle(R.string.sent_fail).setMessage(
- e.getMessage()).show();
- }
+ TapatalkClient client = ((IBCApplication) getApplication())
+ .getTapatalkClient();
+ client.createTopic(forumId, subject.getText()
+ .toString(), text.getText().toString());
}
- });
+ protected void doOnSuccess()
+ {
+ Toast.makeText(CreateTopicActivity.this,
+ R.string.sent_ok, Toast.LENGTH_LONG);
+ CreateTopicActivity.this.finish();
+ }
+ }.execute();
}
- }.execute();
+ });
}