Android Open Source - UTMShuttleAndroid Notices Task






From Project

Back to project page UTMShuttleAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project UTMShuttleAndroid 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 async;
//  w ww .  ja  v  a2  s  . c  om
import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
import android.support.v7.widget.CardView;
import android.view.View;
import android.widget.TextView;

import global.App;
import me.echeung.utmshuttleandroid.R;
import util.Scraper;

public class NoticesTask extends AsyncTask<Void, Void, String> {

    private Context context;
    private TextView mText;

    public NoticesTask(Context context, TextView view) {
        this.context = context;
        this.mText = view;
    }

    protected String doInBackground(Void... voids) {
        String notices = App.getNotices();

        if (notices == null || notices.isEmpty())
            return Scraper.getNotices();
        else
            return null;
    }

    protected void onPostExecute(String result) {
        String notices = App.getNotices();

        if (notices != null && !notices.isEmpty()) {
            mText.setText(App.getNotices());
        } else if (result != null && !result.isEmpty()) {
            mText.setText(result);
            App.setNotices(result);
        } else {
            CardView mNoticeCard = (CardView) ((Activity) context).findViewById(R.id.card_notice);
            mNoticeCard.setVisibility(View.GONE);
        }
    }
}




Java Source Code List

activities.MainActivity.java
adapters.TimesListAdapter.java
async.NoticesTask.java
async.RoutesTask.java
classes.Route.java
classes.Routes.java
global.App.java
util.NetworkHelper.java
util.Scraper.java