1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-29 20:32:22 -05:00

AddServerActivity: Read channels from database and write edited channels back to the database

This commit is contained in:
Sebastian Kaspari 2010-04-25 11:05:12 +02:00
parent 433b8aaa71
commit 56204e1125
3 changed files with 9 additions and 4 deletions

View File

@ -52,8 +52,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/save"
android:text="Save" />
android:id="@+id/ok"
android:text="Ok" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -62,7 +62,7 @@ public class AddChannelActivity extends Activity implements OnClickListener
((ListView) findViewById(R.id.channels)).setAdapter(adapter);
((Button) findViewById(R.id.add)).setOnClickListener(this);
((Button) findViewById(R.id.save)).setOnClickListener(this);
((Button) findViewById(R.id.ok)).setOnClickListener(this);
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
channels = getIntent().getExtras().getStringArrayList(Extra.CHANNELS);
@ -87,7 +87,7 @@ public class AddChannelActivity extends Activity implements OnClickListener
setResult(RESULT_CANCELED);
finish();
break;
case R.id.save:
case R.id.ok:
// Get list and return as result
Intent intent = new Intent();
intent.putExtra(Extra.CHANNELS, channels);

View File

@ -83,6 +83,7 @@ public class AddServerActivity extends Activity implements OnClickListener
// Request to edit an existing server
Database db = new Database(this);
this.server = db.getServerById(extras.getInt(Extra.SERVER));
this.channels = db.getChannelsByServerId(server.getId());
db.close();
// Set server values
@ -190,6 +191,8 @@ public class AddServerActivity extends Activity implements OnClickListener
server.getCharset()
);
db.setChannels(server.getId(), channels);
db.close();
server.setId((int) serverId);
@ -229,6 +232,8 @@ public class AddServerActivity extends Activity implements OnClickListener
identity.getNickname()
);
db.setChannels(server.getId(), channels);
db.close();
server.setId(this.server.getId());