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:
parent
4aca69e765
commit
690e9442f3
@ -30,7 +30,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="Yaaic"
|
android:label="Yaaic"
|
||||||
android:theme="@style/Theme.Yaaic"
|
android:theme="@style/Theme.Yaaic"
|
||||||
android:allowBackup="true">
|
android:allowBackup="true"
|
||||||
|
android:name=".ApplicationController">
|
||||||
<activity android:name=".activity.MainActivity"
|
<activity android:name=".activity.MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="standard" >
|
android:launchMode="standard" >
|
||||||
|
35
app/src/main/java/org/yaaic/ApplicationController.java
Normal file
35
app/src/main/java/org/yaaic/ApplicationController.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -100,16 +100,6 @@ public class Yaaic
|
|||||||
servers.remove(serverId);
|
servers.remove(serverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set servers
|
|
||||||
*
|
|
||||||
* @param servers
|
|
||||||
*/
|
|
||||||
public void setServers(HashMap<Integer, Server> servers)
|
|
||||||
{
|
|
||||||
this.servers = servers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add server to list
|
* Add server to list
|
||||||
*/
|
*/
|
||||||
|
@ -130,11 +130,6 @@ public class IRCService extends Service
|
|||||||
mStartForeground = mStopForeground = null;
|
mStartForeground = mStopForeground = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load servers from Database
|
|
||||||
Database db = new Database(this);
|
|
||||||
Yaaic.getInstance().setServers(db.getServers());
|
|
||||||
db.close();
|
|
||||||
|
|
||||||
// Broadcast changed server list
|
// Broadcast changed server list
|
||||||
sendBroadcast(new Intent(Broadcast.SERVER_UPDATE));
|
sendBroadcast(new Intent(Broadcast.SERVER_UPDATE));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user