コード例 #1
0
        @Override
        public void onLoaderReset(final Loader<Set<Transaction>> loader) {
          BlockListFragment.this.transactions.clear(); // be nice
          BlockListFragment.this.transactions = null;

          adapter.notifyDataSetChanged();
        }
コード例 #2
0
        @Override
        public void onLoadFinished(
            final Loader<Set<Transaction>> loader, final Set<Transaction> transactions) {
          BlockListFragment.this.transactions = transactions;

          adapter.notifyDataSetChanged();
        }
コード例 #3
0
  @Override
  public void onResume() {
    super.onResume();

    activity.registerReceiver(tickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));

    loaderManager.initLoader(ID_TRANSACTION_LOADER, null, transactionLoaderCallbacks);

    adapter.notifyDataSetChanged();
  }
コード例 #4
0
 private void renderBlockList() {
   ListAdapter listAdapter = mListView.getAdapter();
   if (listAdapter instanceof BlockListAdapter) {
     ((BlockListAdapter) listAdapter).notifyDataSetChanged();
   } else {
     BlockListAdapter adapter = new BlockListAdapter();
     mListView.setAdapter(adapter);
     mListView.setOnItemClickListener(
         new AdapterView.OnItemClickListener() {
           @Override
           public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
             mBlockStartTime = mBlockEntries.get(position).timeStart;
             updateUi();
           }
         });
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
       invalidateOptionsMenu();
       ActionBar actionBar = getActionBar();
       if (actionBar != null) {
         actionBar.setDisplayHomeAsUpEnabled(false);
       }
     }
     setTitle(getString(R.string.block_canary_block_list_title, getPackageName()));
     mActionButton.setText(R.string.block_canary_delete_all);
     mActionButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             LogWriter.deleteLogFiles();
             mBlockEntries = Collections.emptyList();
             updateUi();
           }
         });
   }
   mActionButton.setVisibility(mBlockEntries.size() == 0 ? GONE : VISIBLE);
 }
コード例 #5
0
 @Override
 public void onReceive(final Context context, final Intent intent) {
   adapter.notifyDataSetChanged();
 }