Android Open Source - Gcal_Importer Show Event List Async






From Project

Back to project page Gcal_Importer.

License

The source code is released under:

Apache License

If you think the Android project Gcal_Importer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.crappo.android.androics;
/* w w w  .j  a v a 2 s.c om*/
import java.util.TimeZone;

import net.fortuna.ical4j.model.Component;
import net.fortuna.ical4j.model.Property;
import android.os.AsyncTask;

public class ShowEventListAsync extends AsyncTask<String, Void, Void>{
    Model4EventList model;
    String[] pathList;
    ShowEventListActivity activityObj;
    public ShowEventListAsync(ShowEventListActivity actObj) {
        this.activityObj = actObj;
        model = new Model4EventList();
    }

    @Override
    protected void onPreExecute() { // ???????????progressBar???????
        super.onPreExecute();
        activityObj.showProgressBar();
    }

    @Override
    protected Void doInBackground(String... pathList) {
        this.pathList = pathList;
        for(String pathStr : pathList) { model.readIcs(pathStr); } // Model?????????ICS????????????????
        model.mapSort(); // ??????????Event????DtStart??????????
        // ICS???????????????????TimeZone?????
        if(model.calendar.getComponent("VTIMEZONE") != null) { // TimeZone???VTIMEZONE????????????????????
            Object obj = model.calendar.getComponents("VTIMEZONE").get(0);
            if(obj instanceof Component) {
                model.timezone = TimeZone.getTimeZone(((Component)obj).getProperty(Property.TZID).getValue());
            }
        } else { // TimeZone???VCALENDAR???Property???????(?)??????????????????????????
            for(Object tmpObj: model.calendar.getProperties()) {
                Object obj = ((Property)tmpObj).getValue();
                if(obj instanceof TimeZone) {
                    model.timezone = (TimeZone)obj;
                } else if ( ((Property)tmpObj).getName().equals("X-WR-TIMEZONE") ){
                    model.timezone = TimeZone.getTimeZone(((Property)tmpObj).getValue());
                }
            }
        }
        activityObj.model = model;
        return null;
    }

    @Override
    protected void onPostExecute(Void result) { // ??????????progressBar???????ListView???????????
        super.onPostExecute(result);
        activityObj.progressBar.dismiss();
        activityObj.refreshLayout();
    }
}




Java Source Code List

net.crappo.android.androics.AccountAuthService.java
net.crappo.android.androics.AndroIcsAuthenticator.java
net.crappo.android.androics.BrowserForDownLoadActivity.java
net.crappo.android.androics.Model4EventList.java
net.crappo.android.androics.Model4Top.java
net.crappo.android.androics.ShowEventListActivity.java
net.crappo.android.androics.ShowEventListAsync.java
net.crappo.android.androics.SimpleFileDialog.java
net.crappo.android.androics.TopActivity.java
net.crappo.android.androics.TopIcsListAsync.java
net.crappo.android.androics.ZipInOutMethods.java