Android Open Source - LASA-Schedules Resources






From Project

Back to project page LASA-Schedules.

License

The source code is released under:

GNU General Public License

If you think the Android project LASA-Schedules 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 com.asdar.lasaschedules;
/*from w  w w . j av a  2s. c  om*/
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

import com.google.gson.Gson;

import java.util.Calendar;

/**
 * Created by Ehsan on 8/23/2014.
 */
public class Resources {
    public static Schedule getSchedule(Context context){
        Schedule out;
        final Calendar c = Calendar.getInstance();
        String parsedString = "";
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
        parsedString = sp.getString("jsonschedule", null);
        Gson gson = new Gson();
        Schedule json = null;
        Boolean noschool =  null;
        String specialDay = null;
        if (parsedString != null){
            try{
                json = gson.fromJson(parsedString, Schedule.class);
            }
            catch (Exception e){
                e.printStackTrace();
            }
            try{
                noschool = gson.fromJson(parsedString,Boolean.class);
            }
            catch (Exception e){
            }
            try{
                specialDay = gson.fromJson(parsedString,String.class);
            }
            catch (Exception e){
            }
        }
        if (c.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
            //Forum
            out = StaticSchedules.forum();
        } else {
            //Default Schedule
            out = StaticSchedules.normal();
        }
        if (json != null && json.getEvents() != null && json.getTimes() != null && json.getEvents().size() > 0 && json.getTimes().size() > 0){
            out = json;
        }
        if (specialDay != null){
            if (specialDay.equals("latestart")){
                out = StaticSchedules.latestart();
            }
            if (specialDay.equals("peprally")){
                out = StaticSchedules.peprally();
            }
            if (specialDay.equals("normal")){
                out = StaticSchedules.normal();
            }
        }
        if (noschool != null && noschool){
            out = null;
        }
        return out;
    }
}




Java Source Code List

com.asdar.lasaschedules.AboutDialog.java
com.asdar.lasaschedules.AlarmClearIntent.java
com.asdar.lasaschedules.AlarmRespondIntentService.java
com.asdar.lasaschedules.HomeFragment.java
com.asdar.lasaschedules.MainActivity.java
com.asdar.lasaschedules.NotificationServiceReciever.java
com.asdar.lasaschedules.NotificationService.java
com.asdar.lasaschedules.Resources.java
com.asdar.lasaschedules.RobotoTextView.java
com.asdar.lasaschedules.ScheduleAdapter.java
com.asdar.lasaschedules.ScheduleElement.java
com.asdar.lasaschedules.ScheduleFragment.java
com.asdar.lasaschedules.Schedule.java
com.asdar.lasaschedules.SettingsActivity.java
com.asdar.lasaschedules.SettingsFragment.java
com.asdar.lasaschedules.StaticResources.java
com.asdar.lasaschedules.StaticScheduleFragment.java
com.asdar.lasaschedules.StaticSchedules.java
com.asdar.lasaschedules.TodayActivity.java