コード例 #1
0
  @Override
  protected void postInitUI() {
    super.postInitUI();
    mAdapter = new AlarmListAdapter(this);
    mAdapter.setCache(controller.getCache());
    controller.addObserver(mAdapter);
    mAdapter.setClockAction(controller);
    lvAlarm.setAdapter(mAdapter);
    lvAlarm.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Log.d(Clock.TAG, "default click");
            TemporaryData.save(Clock.class.getName(), controller.getCache().read().get(position));
            TemporaryData.save(ClockController.class.getName(), controller);
            AlarmEditActivity.callMe(AlarmListActivity.this);
          }
        });
    lvAlarm.setOnItemLongClickListener(
        new OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            showDialog(controller.getCache().read().get(position));
            return true;
          }
        });
    controller.checkDefaultClockPolicy();
  }
コード例 #2
0
 @Override
 protected void onDestroy() {
   // TODO Auto-generated method stub
   super.onDestroy();
   PropertyCenter.getInstance().removePropertyChangeListener(this);
   if (controller != null) {
     if (mAdapter != null) {
       controller.deleteObserver(mAdapter);
       mAdapter = null;
     }
     controller.clearCache();
     controller = null;
   }
 }
コード例 #3
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.actionbar_title:
       updateUI();
       break;
     case R.id.actionbar_left:
       this.finish();
       break;
     case R.id.actionbar_right:
       if (controller.getItemCounts() < CLOCK_MAX_NUMBER) {
         TemporaryData.save(ClockController.class.getName(), controller);
         AlarmEditActivity.callMe(AlarmListActivity.this);
       } else
         ErrorDialogUtil.showErrorDialog(
             AlarmListActivity.this,
             CloudStatusCodeProxy.TYPE_SERVICE,
             LocalCode.CODE_14102,
             true);
       break;
   }
 }
コード例 #4
0
 public void onButton3(View view) {
   Log.d(Clock.TAG, "current store id:" + ClockHelper.getCurrentClockId());
   Clock clock = controller.getItemById(ClockHelper.getCurrentClockId());
   Log.d(Clock.TAG, "current clock:" + (clock == null ? "-1" : clock.toString()));
 }
コード例 #5
0
 public void onButton2(View view) {
   ClockController.launchClockService(getBaseContext(), ClockInfo.ACTION_LAUNCH_ALARM);
 }
コード例 #6
0
 public void onButton1(View view) {
   controller.deleteAll();
   mAdapter.notifyDataSetChanged();
 }