1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-26 19:02:17 -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 <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/save" android:id="@+id/ok"
android:text="Save" /> android:text="Ok" />
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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); ((ListView) findViewById(R.id.channels)).setAdapter(adapter);
((Button) findViewById(R.id.add)).setOnClickListener(this); ((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); ((Button) findViewById(R.id.cancel)).setOnClickListener(this);
channels = getIntent().getExtras().getStringArrayList(Extra.CHANNELS); channels = getIntent().getExtras().getStringArrayList(Extra.CHANNELS);
@ -87,7 +87,7 @@ public class AddChannelActivity extends Activity implements OnClickListener
setResult(RESULT_CANCELED); setResult(RESULT_CANCELED);
finish(); finish();
break; break;
case R.id.save: case R.id.ok:
// Get list and return as result // Get list and return as result
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra(Extra.CHANNELS, channels); intent.putExtra(Extra.CHANNELS, channels);

View File

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