Example #1
0
  public void addToMySchedule(View v) {
    scheduleTitle = (TextView) findViewById(R.id.title);
    String schedule_title = (String) scheduleTitle.getText();
    scheduleTime = (TextView) findViewById(R.id.duration);
    String schedule_time = (String) scheduleTime.getText();
    scheduleLocation = (TextView) findViewById(R.id.artist);
    String schedule_location = (String) scheduleLocation.getText();
    // imageOne = (ImageButton) findViewById(R.id.thumbnail);
    // imageTwo = (ImageButton) findViewById(R.id.thumbnail2);

    /** ***************inserting into my_schedule table******************* */
    // initializing database
    DatabaseHelper dbHelper2 = new DatabaseHelper(this);

    Log.d(HOMESCREEN, "Inserting Schedule Items to MyScheduleTable");
    // TODO: Add Loading Spinner until this process is complete
    //      and/or start a new thread to Handle this
    // initializing Schedule Table and
    // inserting all items into schedule Table

    my_scheduleItem =
        new MyScheduleItem(schedule_time, " ", schedule_title, " ", " ", schedule_location);
    // Inserting ScheduleItems to Database
    Log.d(HOMESCREEN, "Inserting Master Schedule Items");
    // Log.d(HOMESCREEN, ((startTimesArray.length)-1).toString());
    Log.d(HOMESCREEN, "StartTime:" + my_scheduleItem.getStartTime().toString());
    Log.d(HOMESCREEN, "Location:" + my_scheduleItem.getPanelTitle().toString());
    schedItem_id = dbHelper2.createMyScheduleItem(my_scheduleItem, null);

    /** ***************************************************************** */
    Toast.makeText(HomeScreen.this, "Item Added to MySchedule", Toast.LENGTH_SHORT).show();
  }
Example #2
0
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_screen);

    // initialize Parse for backend/cloud support
    Parse.initialize(
        this,
        "PUXTA9zRvdwXpCDMa1U8ErnSCPjQmHSvu2cdvMPG",
        "QIOJXwayIAQ2kfYDe7iw0yGfbFI8KGKejOiXoioM");

    // testing Parse funcionality
    ParseObject testObject = new ParseObject("TestObject");
    testObject.put("foo", "bar");
    testObject.saveInBackground();

    // defining default activity to handle push notifications
    PushService.setDefaultPushCallback(this, HomeScreen.class);
    ParseInstallation.getCurrentInstallation().saveInBackground();

    // initializing database
    DatabaseHelper dbHelper = new DatabaseHelper(this);

    Log.d(HOMESCREEN, "Inserting Schedule Items to Table");
    // TODO: Add Loading Spinner until this process is complete
    //      and/or start a new thread to Handle this
    // initializing Schedule Table and
    // inserting all items into schedule Table
    for (int i = 0; i < ((startTimesArray.length) - 1); i++) {
      scheduleItem =
          new ScheduleItem(
              startTimesArray[i],
              endTimesArray[i],
              panelTitleArray[i],
              panelDescriptionArray[i],
              speakersArray[i],
              locationArray[i]);

      // Inserting ScheduleItems to Database
      Log.d(HOMESCREEN, "Inserting Master Schedule Items");
      // Log.d(HOMESCREEN, ((startTimesArray.length)-1).toString());
      Log.d(HOMESCREEN, scheduleItem.getStartTime().toString());
      Log.d(HOMESCREEN, scheduleItem.getPanelTitle().toString());
      schedItem_id = dbHelper.createScheduleItem(scheduleItem, null);
    }

    /** ***************inserting into my_schedule table******************* */
    /*
    //initializing database
    DatabaseHelper dbHelper2 = new DatabaseHelper(this);

    Log.d(HOMESCREEN,"Inserting Schedule Items to Table");
    //TODO: Add Loading Spinner until this process is complete
    //      and/or start a new thread to Handle this
    //initializing Schedule Table and
    //inserting all items into schedule Table
    for (int i=0; i<3; i++){
    	my_scheduleItem = new MyScheduleItem(startTimesArray[i],
    			endTimesArray[i],
    			panelTitleArray[i],
    			panelDescriptionArray[i],
    			speakersArray[i],
    			locationArray[i]);

    	// Inserting ScheduleItems to Database
        Log.d(HOMESCREEN, "Inserting Master Schedule Items");
        //Log.d(HOMESCREEN, ((startTimesArray.length)-1).toString());
        Log.d(HOMESCREEN, my_scheduleItem.getStartTime().toString());
        Log.d(HOMESCREEN, my_scheduleItem.getPanelTitle().toString());
        schedItem_id = dbHelper2.createMyScheduleItem(my_scheduleItem, null);
    }
    */
    /** ***************************************************************** */

    // Initialization
    viewPager = (ViewPager) findViewById(R.id.pager);
    actionBar = getActionBar();
    mAdapter = new TabsPagerAdapter(getSupportFragmentManager());

    viewPager.setAdapter(mAdapter);
    actionBar.setHomeButtonEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Adding Tabs
    for (String tab_name : tabs) {
      actionBar.addTab(actionBar.newTab().setText(tab_name).setTabListener(this));
    }

    /*select_item = (ImageButton) findViewById(R.id.feedback_thumbnail);
    select_item.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(HomeScreen.this, "Item Added to MySchedule", Toast.LENGTH_SHORT).show();
        }
    });*/

    viewPager.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {

          @Override
          public void onPageSelected(int position) {
            // on changing the page
            // make respected tab selected
            actionBar.setSelectedNavigationItem(position);
          }

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageScrollStateChanged(int arg0) {}
        });
  }