1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-24 09:52:18 -05:00

Move loading of servers from Service to Application object.

This commit is contained in:
Sebastian Kaspari 2015-03-28 10:50:56 +01:00
parent 4aca69e765
commit 690e9442f3
4 changed files with 37 additions and 16 deletions

View File

@ -30,7 +30,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:icon="@mipmap/ic_launcher"
android:label="Yaaic"
android:theme="@style/Theme.Yaaic"
android:allowBackup="true">
android:allowBackup="true"
android:name=".ApplicationController">
<activity android:name=".activity.MainActivity"
android:label="@string/app_name"
android:launchMode="standard" >

View File

@ -0,0 +1,35 @@
/*
Yaaic - Yet Another Android IRC Client
Copyright 2009-2013 Sebastian Kaspari
This file is part of Yaaic.
Yaaic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Yaaic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic;
import android.app.Application;
/**
* Application implementation for Yaaic.
*/
public class ApplicationController extends Application {
@Override
public void onCreate() {
super.onCreate();
Yaaic.getInstance().loadServers(this);
}
}

View File

@ -100,16 +100,6 @@ public class Yaaic
servers.remove(serverId);
}
/**
* Set servers
*
* @param servers
*/
public void setServers(HashMap<Integer, Server> servers)
{
this.servers = servers;
}
/**
* Add server to list
*/

View File

@ -130,11 +130,6 @@ public class IRCService extends Service
mStartForeground = mStopForeground = null;
}
// Load servers from Database
Database db = new Database(this);
Yaaic.getInstance().setServers(db.getServers());
db.close();
// Broadcast changed server list
sendBroadcast(new Intent(Broadcast.SERVER_UPDATE));
}