mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 10:52:16 -05:00
AddServerActivity: Read channels from database and write edited channels back to the database
This commit is contained in:
parent
433b8aaa71
commit
56204e1125
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user