Ejemplo n.º 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();
  }
Ejemplo n.º 2
0
 @Override
 public void propertyChange(PropertyChangeEvent event) {
   if (event.getPropertyName().equals(PropertyCenter.PROPERTY_CLOCK)) {
     Log.d(Clock.TAG, "AlarmListAdapter闹钟启动后重新设置闹钟,刷新列表");
     if (mAdapter != null) {
       mAdapter.notifyDataSetChanged();
     }
   }
 }
Ejemplo n.º 3
0
 public void onButton1(View view) {
   controller.deleteAll();
   mAdapter.notifyDataSetChanged();
 }