Android Open Source - android-festival-timetable Sample Activity






From Project

Back to project page android-festival-timetable.

License

The source code is released under:

MIT License

If you think the Android project android-festival-timetable 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.mymusictaste.festival;
/*w w w .j  av  a2  s .  c  om*/
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.mymusictaste.festival.type.Schedule;
import com.mymusictaste.festival.type.Stage;

import java.util.ArrayList;

/**
 * Created by JKtheUnique on 14. 3. 12.
 */
public class SampleActivity extends Activity {

  private long startTime = (long)1375398000;
//  private long endTime = (long)1375722000*(long)1000;
    private int festivalDays = 3;
  private ArrayList<Schedule> schedules;
  private ArrayList<Stage> stages;
  private MmtTimetable timetable;

  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sample);
    initLayout();
    generateTimetable();
    populateLayout();
  }

  private void initLayout(){
    timetable = (MmtTimetable)findViewById(R.id.timetable);
  }

  private void generateTimetable(){
    schedules = new ArrayList<Schedule>();
    stages = new ArrayList<Stage>();
    for (int stageId = 0; stageId<3;stageId++){
      Stage stage = new Stage();
      stage.setStageId(stageId);
      stage.setStageName("STAGE  " + stageId);
            stages.add(stage);
    }

    for(int scheduleId = 0; scheduleId<10; scheduleId++){
      Schedule schedule = new Schedule();
      schedule.setScheduleTitle("SCHEDULE  "+scheduleId);
            schedule.setScheduleId(scheduleId);
      schedule.setScheduleStageId(scheduleId%3);
      schedule.setScheduleStartTime(startTime +(60L*60L*7L*(long)scheduleId*1000L));
      schedule.setScheduleEndTime(schedule.getScheduleStartTime()+(60L*60L*3L*1000L));
      schedules.add(schedule);
    }
  }
  private void populateLayout(){
        timetable.setData(stages,schedules);
  }

}




Java Source Code List

com.mymusictaste.festival.MmtTimetable.java
com.mymusictaste.festival.SampleActivity.java
com.mymusictaste.festival.type.Schedule.java
com.mymusictaste.festival.type.Stage.java