@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_attendence);
    topBar = (TopBar1) findViewById(R.id.topBar);
    topBar.initTopBar();
    topBar.backArrowIV.setOnClickListener(this);
    //  topBar.logoutIV.setOnClickListener(this);
    topBar.titleTV.setText(getString(R.string.attendence_title));
    studentsListview = (ListView) findViewById(R.id.students_listview);
    doneTV = (TextView) findViewById(R.id.done_tv);
    editTV = (TextView) findViewById(R.id.edit);
    doneTV.setOnClickListener(this);
    editTV.setOnClickListener(this);
    presentTV = (TextView) findViewById(R.id.present_tv);
    absetntTV = (TextView) findViewById(R.id.absent_tv);
    resultTV = (TextView) findViewById(R.id.result_tv);
    resultTV.setText("");

    ((TextView) findViewById(R.id.teacher_name_tv))
        .setText(StorageManager.readString(this, getString(R.string.pref_username), ""));
    String teacherName1 = StorageManager.readString(this, getString(R.string.pref_username), "");
    teacherName = "/" + teacherName1;

    viewPager = (InfiniteViewPager) findViewById(R.id.infinite_viewpager);
    viewPager.setAdapter(new MyInfinitePagerAdapter(0));
    viewPager.setOnInfinitePageChangeListener(
        new InfiniteViewPager.OnInfinitePageChangeListener() {
          @Override
          public void onPageScrolled(
              final Object indicator, final float positionOffset, final int positionOffsetPixels) {
            Calendar cal = null;
            cal = Calendar.getInstance();
            cal.add(Calendar.DAY_OF_YEAR, (Integer.parseInt(String.valueOf(indicator)) * 7));
            // ((TextView)findViewById(R.id.todayDate)).setText(getMonth( cal.get(Calendar.MONTH)
            // +1) +" "+cal.get(Calendar.YEAR) );
          }

          @Override
          public void onPageSelected(final Object indicator) {
            Log.d("InfiniteViewPager", "onPageSelected " + indicator.toString());
            currentIndicator = Integer.parseInt("" + indicator.toString());
          }

          @Override
          public void onPageScrollStateChanged(final int state) {
            Log.d("InfiniteViewPager", "state " + String.valueOf(state));
          }
        });

    GridView weekdayGridView = (GridView) findViewById(R.id.weekday_gridview_main);
    weekdayGridView.setVisibility(View.VISIBLE);
    WeekdayArrayAdapter weekdaysAdapter =
        new WeekdayArrayAdapter(this, android.R.layout.simple_list_item_1, getDaysOfWeek());
    weekdayGridView.setAdapter(weekdaysAdapter);
    Calendar cal = Calendar.getInstance();
    ((TextView) findViewById(R.id.todayDate))
        .setText(
            cal.get(Calendar.DAY_OF_MONTH)
                + " "
                + getMonth(cal.get(Calendar.MONTH) + 1).substring(0, 3)
                + " "
                + cal.get(Calendar.YEAR));
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
    if (CommonUtils.isNetworkAvailable(this)) {
      Log.e("------->>>", sdf.format(cal.getTime()));
      getAttendanceWebService(sdf.format(cal.getTime()));
    } else {
      CommonUtils.getToastMessage(this, getString(R.string.network_error));
    }
  }
예제 #2
0
 public void switchChildBar() {
   switchChild = (SwitchChildView) findViewById(R.id.switchchildBar);
   switchChild.initSwitchChildBar();
   StorageManager.readString(this, "username", "");
   switchChild.childNameTV.setText(StorageManager.readString(this, "username", ""));
 }