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:
parent
433b8aaa71
commit
56204e1125
@ -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"
|
||||||
|
@ -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);
|
||||||
|
@ -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());
|
||||||
|
Loading…
Reference in New Issue
Block a user