Skip to content

Commit

Permalink
Move loading of servers from Service to Application object.
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo committed Mar 28, 2015
1 parent 4aca69e commit 690e944
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" >
Expand Down
35 changes: 35 additions & 0 deletions app/src/main/java/org/yaaic/ApplicationController.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
10 changes: 0 additions & 10 deletions app/src/main/java/org/yaaic/Yaaic.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,6 @@ public void removeServerById(int serverId)
servers.remove(serverId);
}

/**
* Set servers
*
* @param servers
*/
public void setServers(HashMap<Integer, Server> servers)
{
this.servers = servers;
}

/**
* Add server to list
*/
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/org/yaaic/irc/IRCService.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ public void onCreate()
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));
}
Expand Down

0 comments on commit 690e944

Please sign in to comment.