예제 #1
0
 private void invalidateAllViews() {
   myThisBookView.invalidateViews();
   myThisBookView.requestLayout();
   myAllBooksView.invalidateViews();
   myAllBooksView.requestLayout();
   if (mySearchResultsView != null) {
     mySearchResultsView.invalidateViews();
     mySearchResultsView.requestLayout();
   }
 }
예제 #2
0
  @Override
  protected void onStart() {
    super.onStart();
    setActionBarInfo(getString(R.string.scenes_title));
    this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    opzioni.initializePrefs();
    if (!opzioni.isDbConfigured()) {
      AlertDialogHelper.dbNotInitedDialog(this);
    }
    SoulissDBHelper.open();

    // prendo comandi dal DB, setto adapter
    LinkedList<SoulissScene> goer = datasource.getScenes(SoulissClient.getAppContext());
    scenesArray = new SoulissScene[goer.size()];
    scenesArray = goer.toArray(scenesArray);
    progsAdapter = new SceneListAdapter(this, scenesArray, opzioni);
    // Adapter della lista
    listaScenesView.setAdapter(progsAdapter);
    listaScenesView.invalidateViews();
    // ImageView nodeic = (ImageView) findViewById(R.id.scene_icon);
    // nodeic.setAlpha(150);
    mAdapter =
        new NavDrawerAdapter(
            SceneListActivity.this,
            R.layout.drawer_list_item,
            dmh.getStuff(),
            DrawerMenuHelper.SCENES);
    mDrawerList.setAdapter(mAdapter);
  }
  private void updateList(List<ListQuadRowItem> aList) {
    final LayoutInflater inflater = this.getLayoutInflater();

    listView.setAdapter(
        new ArrayAdapter<ListQuadRowItem>(this, R.layout.list_row_table, aList) {
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
            View row;
            if (null == convertView) {
              row = inflater.inflate(R.layout.list_row_table, null);
            } else {
              row = convertView;
            }
            ListQuadRowItem item = getItem(position);

            ((TextView) row.findViewById(R.id.rowTopRight)).setText(item.getTopRight());
            ((TextView) row.findViewById(R.id.rowBottomLeft)).setText(item.getBottomLeft());
            ((TextView) row.findViewById(R.id.rowBottomRight)).setText(item.getBottomRight());

            TextView tv = (TextView) row.findViewById(R.id.rowTopLeft);
            if (item.getReference() == -1) {
              tv.setText("Add piece ...");
              tv.setTextColor(Color.BLUE);
            } else {
              tv.setText(item.getTopLeft());
              tv.setTextColor(Color.GRAY);
            }

            return row;
          }
        });
    listView.invalidateViews();
  }
예제 #4
0
 public void run() {
   // reload content
   arrayFinalTasks.clear();
   adapter1.notifyDataSetChanged();
   listaIzvjestaj.invalidateViews();
   listaIzvjestaj.refreshDrawableState();
 }
예제 #5
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.select_btn:
        Intent intent = new Intent();
        intent.setType("*/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        try {
          startActivityForResult(Intent.createChooser(intent, "Select a File to Upload"), 1);
        } catch (android.content.ActivityNotFoundException ex) {
          Toast.makeText(
                  getApplicationContext(), "Please install a File Manager ", Toast.LENGTH_SHORT)
              .show();
        }
        break;
      case R.id.upload_btn:
        String[] str = new String[3 + imgList.size()];
        str[0] = fileId;
        str[1] = uploadFlag;
        for (int i = 0; i < imgList.size(); i++) {

          str[2 + i] = imgList.get(i);
        }

        UploadFileTask uploadFileTask = new UploadFileTask(FileUploadActivity.this);
        uploadFileTask.execute(str);
        imgListName.clear();
        imgList.clear();
        imgPathListView.invalidateViews();
        break;
    }
  }
 @Override
 public void run() {
   ListView v = getListView();
   if (v != null) {
     v.invalidateViews();
   }
   mHandler.postDelayed(this, REFRESH_INTERVAL_MILLIS);
 }
  public static void listViewRefresh(ListView listView, ArrayAdapter<GenericListItem> listAdapter) {
    AppState.logX(TAG, String.format("listViewRefresh 2: listAdapter = %s", listAdapter));

    listView.invalidateViews();
    listView.invalidate();

    if (listAdapter != null) listAdapter.notifyDataSetChanged();
  }
예제 #8
0
  private void addMessage(MessageBox message) {
    mMessageList.add(message);
    if (turn == 0) {
      mMessageFeed.invalidateViews();

      mFeedAdapter.notifyDataSetChanged();
      mMessageFeed.setSelection(mFeedAdapter.getCount() - 1);
    }
  }
예제 #9
0
  public void clearChoices() {
    listView.clearChoices();

    listView.setChoiceMode(ListView.CHOICE_MODE_NONE);
    listView.setOnItemClickListener(listener);
    listener = null;

    listView.invalidateViews();
  }
 private void clearSelect() {
   mMsgListView.clearChoices();
   final int checkedCount = mMsgListView.getCheckedItemCount();
   mSelectionMenu.setTitle(getString(R.string.selected_count, checkedCount));
   if (checkedCount == 0) {
     mActionButton.setEnabled(false);
   }
   mMsgListView.invalidateViews();
 }
 private void allSelect() {
   int count = mMsgListAdapter.getCount();
   for (int i = 0; i < count; i++) {
     mMsgListView.setItemChecked(i, true);
   }
   final int checkedCount = mMsgListView.getCheckedItemCount();
   mSelectionMenu.setTitle(getString(R.string.selected_count, checkedCount));
   if (checkedCount > 0) {
     mActionButton.setEnabled(true);
   }
   mMsgListView.invalidateViews();
 }
예제 #12
0
 void showSearchResultsTab(LinkedList<Bookmark> results) {
   if (mySearchResultsView == null) {
     mySearchResultsView = createTab("searchResults", R.id.search_results);
     new BookmarksAdapter(mySearchResultsView, mySearchResults, false);
   } else {
     mySearchResults.clear();
   }
   mySearchResults.addAll(results);
   mySearchResultsView.invalidateViews();
   mySearchResultsView.requestLayout();
   getTabHost().setCurrentTabByTag("searchResults");
 }
예제 #13
0
 public void didReceivedNotification(int id, Object... args) {
   if (id == MessagesController.updateInterfaces) {
     int mask = (Integer) args[0];
     if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0
         || (mask & MessagesController.UPDATE_MASK_NAME) != 0) {
       if (listView != null) {
         listView.invalidateViews();
       }
     }
   } else if (id == MessagesController.contactsDidLoaded) {
     createActionBarMenu();
   } else if (id == MessagesController.mediaCountDidLoaded) {
     long uid = (Long) args[0];
     if (uid > 0 && user_id == uid && dialog_id == 0 || dialog_id != 0 && dialog_id == uid) {
       totalMediaCount = (Integer) args[1];
       if (listView != null) {
         listView.invalidateViews();
       }
     }
   } else if (id == MessagesController.encryptedChatCreated) {
     if (creatingChat) {
       NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats);
       TLRPC.EncryptedChat encryptedChat = (TLRPC.EncryptedChat) args[0];
       Bundle args2 = new Bundle();
       args2.putInt("enc_id", encryptedChat.id);
       presentFragment(new ChatActivity(args2), true);
     }
   } else if (id == MessagesController.encryptedChatUpdated) {
     TLRPC.EncryptedChat chat = (TLRPC.EncryptedChat) args[0];
     if (currentEncryptedChat != null && chat.id == currentEncryptedChat.id) {
       currentEncryptedChat = chat;
       updateRowsIds();
       if (listAdapter != null) {
         listAdapter.notifyDataSetChanged();
       }
     }
   }
 }
 @Override
 public void onReceive(Context context, Intent intent) {
   if (ExtensionManager.RCS_CONTACT_PRESENCE_CHANGED.equals(intent.getAction())) {
     long receiveTime = System.currentTimeMillis();
     Log.i(TAG, "mPreReceiveTime : " + mPreReceiveTime + " | receiveTime : " + receiveTime);
     if (mAdapter != null && ((receiveTime - mPreReceiveTime) > WAIT_TIME)) {
       mPreReceiveTime = receiveTime;
       mAdapter.notifyDataSetChanged();
     }
   } else if (ExtensionManager.RCS_CONTACT_UNREAD_NUMBER_CHANGED.equals(
       intent.getAction())) {
     mAdapter.notifyDataSetChanged();
     mListView.invalidateViews();
   }
 }
  /** @param which */
  private void removePlaylistItem(int which) {

    mCursor.moveToPosition(which);
    long id = mCursor.getLong(mMediaIdIndex);
    if (mPlaylistId >= 0) {
      Uri uri = Playlists.Members.getContentUri(EXTERNAL, mPlaylistId);
      getActivity().getContentResolver().delete(uri, Playlists.Members.AUDIO_ID + "=" + id, null);
    } else if (mPlaylistId == PLAYLIST_QUEUE) {
      MusicUtils.removeTrack(id);
      reloadQueueCursor();
    } else if (mPlaylistId == PLAYLIST_FAVORITES) {
      MusicUtils.removeFromFavorites(getActivity(), id);
    }
    mListView.invalidateViews();
  }
예제 #16
0
        @Override
        public void onReceive(Context context, Intent intent) {
          List<SoulissScene> goer = datasource.getScenes(SceneListActivity.this);
          scenesArray = new SoulissScene[goer.size()];
          int q = 0;
          for (SoulissScene object : goer) {
            scenesArray[q++] = object;
          }

          progsAdapter =
              new SceneListAdapter(
                  SceneListActivity.this.getApplicationContext(), scenesArray, opzioni);
          // Adapter della lista
          listaScenesView.setAdapter(progsAdapter);
          listaScenesView.invalidateViews();
        }
예제 #17
0
  @Override
  protected void onStart() {
    super.onStart();
    setActionBarInfo(getString(R.string.programs_title));
    this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    SoulissDBHelper.open();
    opzioni.initializePrefs();
    if (!opzioni.isDbConfigured()) {
      AlertDialogHelper.dbNotInitedDialog(this);
    }
    if (!opzioni.isDataServiceEnabled()) {
      AlertDialogHelper.serviceNotActiveDialog(this);
    }
    // prendo comandi dal DB, setto adapter
    LinkedList<SoulissCommand> goer = datasource.getUnexecutedCommands(this);
    if (goer.size() == 0) tt.setText(getString(R.string.programs_no));
    programsArray = new SoulissCommand[goer.size()];
    programsArray = goer.toArray(programsArray);
    progsAdapter =
        new ProgramListAdapter(
            this.getApplicationContext(), programsArray, datasource.getTriggerMap(this), opzioni);
    // Adapter della lista
    listaProgrammiView.setAdapter(progsAdapter);
    listaProgrammiView.invalidateViews();
    // forza refresh drawer
    mDrawermAdapter =
        new NavDrawerAdapter(
            ProgramListActivity.this,
            R.layout.drawer_list_item,
            dmh.getStuff(),
            DrawerMenuHelper.PROGRAMS);
    mDrawerList.setAdapter(mDrawermAdapter);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.attachToListView(listaProgrammiView);
    // ADD NEW PROGRAM Listener
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent myIntentt = new Intent(ProgramListActivity.this, AddProgramActivity.class);
            ProgramListActivity.this.startActivityForResult(myIntentt, 12);
          }
        });
  }
  protected void setIntents(ArrayList<String> intents) {

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < intents.size(); i++) {
      sb.append(intents.get(i));
      if (i < (intents.size() - 1)) {
        sb.append("<>");
      }
    }
    Settings.System.putString(mResolver, Settings.System.QUICK_LAUNCH_TARGETS, sb.toString());

    // tell our adapter/listview to reload
    mIntentAdapter.reloadIntents();
    mIntentAdapter.notifyDataSetChanged();
    mIntentList.invalidateViews();

    mClearButton.setEnabled(!intents.isEmpty());
  }
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    // Check for database errors
    if (data == null) {
      return;
    }

    if (getArguments() != null
        && Playlists.CONTENT_TYPE.equals(getArguments().getString(MIME_TYPE))
        && (getArguments().getLong(BaseColumns._ID) >= 0
            || getArguments().getLong(BaseColumns._ID) == PLAYLIST_FAVORITES)) {
      mMediaIdIndex = data.getColumnIndexOrThrow(Playlists.Members.AUDIO_ID);
      mTitleIndex = data.getColumnIndexOrThrow(MediaColumns.TITLE);
      mAlbumIndex = data.getColumnIndexOrThrow(AudioColumns.ALBUM);
      // FIXME
      // mArtistIndex =
      // data.getColumnIndexOrThrow(Playlists.Members.ARTIST);
    } else if (getArguments() != null
        && Genres.CONTENT_TYPE.equals(getArguments().getString(MIME_TYPE))) {
      mMediaIdIndex = data.getColumnIndexOrThrow(BaseColumns._ID);
      mTitleIndex = data.getColumnIndexOrThrow(MediaColumns.TITLE);
      mArtistIndex = data.getColumnIndexOrThrow(AudioColumns.ARTIST);
      mAlbumIndex = data.getColumnIndexOrThrow(AudioColumns.ALBUM);
    } else if (getArguments() != null
        && Artists.CONTENT_TYPE.equals(getArguments().getString(MIME_TYPE))) {
      mTitleIndex = data.getColumnIndexOrThrow(MediaColumns.TITLE);
      // mArtistIndex is "line2" of the ListView
      mArtistIndex = data.getColumnIndexOrThrow(AudioColumns.ALBUM);
    } else if (getArguments() != null
        && Albums.CONTENT_TYPE.equals(getArguments().getString(MIME_TYPE))) {
      mMediaIdIndex = data.getColumnIndexOrThrow(BaseColumns._ID);
      mTitleIndex = data.getColumnIndexOrThrow(MediaColumns.TITLE);
      mArtistIndex = data.getColumnIndexOrThrow(AudioColumns.ARTIST);
    } else {
      mMediaIdIndex = data.getColumnIndexOrThrow(BaseColumns._ID);
      mTitleIndex = data.getColumnIndexOrThrow(MediaColumns.TITLE);
      mArtistIndex = data.getColumnIndexOrThrow(AudioColumns.ARTIST);
      mAlbumIndex = data.getColumnIndexOrThrow(AudioColumns.ALBUM);
    }
    mTrackAdapter.changeCursor(data);
    mListView.invalidateViews();
    mCursor = data;
  }
예제 #20
0
        @Override
        public void onReceive(Context context, Intent intent) {
          List<SoulissCommand> goer = datasource.getUnexecutedCommands(ProgramListActivity.this);
          programsArray = new SoulissCommand[goer.size()];
          int q = 0;
          for (SoulissCommand object : goer) {
            programsArray[q++] = object;
          }

          progsAdapter =
              new ProgramListAdapter(
                  ProgramListActivity.this.getApplicationContext(),
                  programsArray,
                  datasource.getTriggerMap(ProgramListActivity.this),
                  opzioni);
          // Adapter della lista
          listaProgrammiView.setAdapter(progsAdapter);
          listaProgrammiView.invalidateViews();
        }
예제 #21
0
  /** 回调执行的方法 */
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {

      Uri uri = data.getData();
      filePath = FileUtils.getPath(this, uri);
      Log.i("filePath", filePath);
      if (VerifyUtil.isNullOREmpty(filePath)) {
        Toast.makeText(FileUploadActivity.this, "选择文件错误,请重新选择文件", Toast.LENGTH_SHORT).show();
        return;
      }
      imgList.add(filePath);
      imgListName.add(FileUtils.getFileName(filePath));
      imgPathListView.invalidateViews();

      Log.i("path:", filePath);
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
 @Override
 public void onClick(DialogInterface dialog, int which) {
   int id = listaList.get(idok).get_idGast();
   switch (which) {
     case 0:
       Intent intent = new Intent(this, GastosFormActivity.class);
       intent.putExtra("GASTO_ID", id);
       startActivity(intent);
       break;
     case 1:
       alertconfirm.show();
       break;
     case DialogInterface.BUTTON_POSITIVE:
       listaList.remove(idok);
       gastosDAO.eliminarGastos(id);
       lista1.invalidateViews();
       break;
     case DialogInterface.BUTTON_NEGATIVE:
       alertconfirm.dismiss();
       break;
   }
 }
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == Activity.RESULT_OK) {
            Uri ringtone = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
            String name = null;
            if (ringtone != null && parentActivity != null) {
                Ringtone rng = RingtoneManager.getRingtone(parentActivity, ringtone);
                if (rng != null) {
                    name = rng.getTitle(parentActivity);
                    rng.stop();
                }
            }

            SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
            SharedPreferences.Editor editor = preferences.edit();

            if (requestCode == 4) {
                if (name != null && ringtone != null) {
                    editor.putString("GlobalSound", name);
                    editor.putString("GlobalSoundPath", ringtone.toString());
                } else {
                    editor.putString("GlobalSound", "NoSound");
                    editor.putString("GlobalSoundPath", "NoSound");
                }
            } else if (requestCode == 9) {
                if (name != null && ringtone != null) {
                    editor.putString("GroupSound", name);
                    editor.putString("GroupSoundPath", ringtone.toString());
                } else {
                    editor.putString("GroupSound", "NoSound");
                    editor.putString("GroupSoundPath", "NoSound");
                }
            }
            editor.commit();
            listView.invalidateViews();
        }
    }
  @Override
  public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
      if (data == null) {
        return;
      }
      Uri ringtone = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
      String name = null;
      if (ringtone != null) {
        Ringtone rng = RingtoneManager.getRingtone(ApplicationLoader.applicationContext, ringtone);
        if (rng != null) {
          if (ringtone.equals(Settings.System.DEFAULT_NOTIFICATION_URI)) {
            name = LocaleController.getString("Default", R.string.Default);
          } else {
            name = rng.getTitle(getParentActivity());
          }
          rng.stop();
        }
      }

      SharedPreferences preferences =
          ApplicationLoader.applicationContext.getSharedPreferences(
              "Notifications", Activity.MODE_PRIVATE);
      SharedPreferences.Editor editor = preferences.edit();

      if (requestCode == 12) {
        if (name != null && ringtone != null) {
          editor.putString("sound_" + dialog_id, name);
          editor.putString("sound_path_" + dialog_id, ringtone.toString());
        } else {
          editor.putString("sound_" + dialog_id, "NoSound");
          editor.putString("sound_path_" + dialog_id, "NoSound");
        }
      }
      editor.commit();
      listView.invalidateViews();
    }
  }
 @Override
 public void didReceivedNotification(int id, Object... args) {
   if (id == MessagesController.notificationsSettingsUpdated) {
     listView.invalidateViews();
   }
 }