Removed ProgressEvent
Database upgrade is done on splash screen
This commit is contained in:
parent
39a9a48c99
commit
97c2b47a4a
|
@ -47,7 +47,6 @@ import de.danoeh.antennapod.adapter.NavListAdapter;
|
|||
import de.danoeh.antennapod.core.asynctask.FeedRemover;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
import de.danoeh.antennapod.core.event.MessageEvent;
|
||||
import de.danoeh.antennapod.core.event.ProgressEvent;
|
||||
import de.danoeh.antennapod.core.event.QueueEvent;
|
||||
import de.danoeh.antennapod.core.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
|
@ -787,25 +786,6 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
loadData();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(ProgressEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
switch(event.action) {
|
||||
case START:
|
||||
pd = new ProgressDialog(this);
|
||||
pd.setMessage(event.message);
|
||||
pd.setIndeterminate(true);
|
||||
pd.setCancelable(false);
|
||||
pd.show();
|
||||
break;
|
||||
case END:
|
||||
if(pd != null) {
|
||||
pd.dismiss();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(MessageEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
package de.danoeh.antennapod.core.event;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
public class ProgressEvent {
|
||||
|
||||
public enum Action {
|
||||
START, END
|
||||
}
|
||||
|
||||
public final Action action;
|
||||
public final String message;
|
||||
|
||||
private ProgressEvent(Action action, String message) {
|
||||
this.action = action;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static ProgressEvent start(String message) {
|
||||
return new ProgressEvent(Action.START, message);
|
||||
}
|
||||
|
||||
public static ProgressEvent end() {
|
||||
return new ProgressEvent(Action.END, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||
.append("action", action)
|
||||
.append("message", message)
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -28,8 +28,6 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.event.ProgressEvent;
|
||||
import de.danoeh.antennapod.core.feed.Chapter;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
|
@ -38,7 +36,6 @@ import de.danoeh.antennapod.core.feed.FeedPreferences;
|
|||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.util.LongIntMap;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
// TODO Remove media column from feeditem table
|
||||
|
||||
|
@ -1478,11 +1475,9 @@ public class PodDBAdapter {
|
|||
@Override
|
||||
public void onUpgrade(final SQLiteDatabase db, final int oldVersion,
|
||||
final int newVersion) {
|
||||
EventBus.getDefault().post(ProgressEvent.start(context.getString(R.string.progress_upgrading_database)));
|
||||
Log.w("DBAdapter", "Upgrading from version " + oldVersion + " to "
|
||||
+ newVersion + ".");
|
||||
DBUpgrader.upgrade(db, oldVersion, newVersion);
|
||||
EventBus.getDefault().post(ProgressEvent.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue