@Override
 public void onFragmentDestroy() {
   super.onFragmentDestroy();
   NotificationCenter.getInstance().removeObserver(this, MessagesController.updateInterfaces);
   NotificationCenter.getInstance().removeObserver(this, MessagesController.chatDidCreated);
   NotificationCenter.getInstance().removeObserver(this, MessagesController.chatDidFailCreate);
   avatarUpdater.clear();
 }
示例#2
0
 @Override
 public void onFragmentDestroy() {
     super.onFragmentDestroy();
     NotificationCenter.Instance.removeObserver(this, MessagesController.mediaDidLoaded);
     NotificationCenter.Instance.removeObserver(this, MessagesController.didReceivedNewMessages);
     NotificationCenter.Instance.removeObserver(this, MessagesController.messagesDeleted);
     NotificationCenter.Instance.removeObserver(this, MessagesController.messageReceivedByServer);
 }
 @Override
 public void onResume() {
     super.onResume();
     if (isFinish) {
         return;
     }
     if (getActivity() == null) {
         return;
     }
 @Override
 public void onResume() {
   super.onResume();
   if (getActivity() == null) {
     return;
   }
   ((LaunchActivity) parentActivity).showActionBar();
   ((LaunchActivity) parentActivity).updateActionBar();
 }
示例#5
0
 @Override
 public void onResume() {
     super.onResume();
     if (getActivity() == null) {
         return;
     }
     if (!firstStart && listAdapter != null) {
         listAdapter.notifyDataSetChanged();
     }
     firstStart = false;
示例#6
0
 @Override
 public boolean onFragmentCreate() {
     super.onFragmentCreate();
     NotificationCenter.Instance.addObserver(this, MessagesController.mediaDidLoaded);
     NotificationCenter.Instance.addObserver(this, MessagesController.messagesDeleted);
     NotificationCenter.Instance.addObserver(this, MessagesController.didReceivedNewMessages);
     NotificationCenter.Instance.addObserver(this, MessagesController.messageReceivedByServer);
     dialog_id = getArguments().getLong("dialog_id", 0);
     loading = true;
     MessagesController.Instance.loadMedia(dialog_id, 0, 50, 0, true, classGuid);
     return true;
 }
 @SuppressWarnings("unchecked")
 @Override
 public boolean onFragmentCreate() {
   super.onFragmentCreate();
   NotificationCenter.getInstance().addObserver(this, MessagesController.updateInterfaces);
   NotificationCenter.getInstance().addObserver(this, MessagesController.chatDidCreated);
   NotificationCenter.getInstance().addObserver(this, MessagesController.chatDidFailCreate);
   avatarUpdater.parentFragment = this;
   avatarUpdater.delegate = this;
   selectedContacts = getArguments().getIntegerArrayList("result");
   final ArrayList<Integer> usersToLoad = new ArrayList<Integer>();
   for (Integer uid : selectedContacts) {
     if (MessagesController.getInstance().users.get(uid) == null) {
       usersToLoad.add(uid);
     }
   }
   if (!usersToLoad.isEmpty()) {
     final Semaphore semaphore = new Semaphore(0);
     final ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
     final boolean[] error = new boolean[1];
     MessagesStorage.getInstance()
         .storageQueue
         .postRunnable(
             new Runnable() {
               @Override
               public void run() {
                 users.addAll(MessagesStorage.getInstance().getUsers(usersToLoad, error));
                 semaphore.release();
               }
             });
     try {
       semaphore.acquire();
     } catch (Exception e) {
       FileLog.e("tmessages", e);
     }
     if (error[0]) {
       return false;
     }
     if (!users.isEmpty()) {
       for (TLRPC.User user : users) {
         MessagesController.getInstance().users.putIfAbsent(user.id, user);
       }
     } else {
       return false;
     }
   }
   return true;
 }
  @Override
  public void onResume() {
    super.onResume();
    if (getActivity() == null) {
      return;
    }
    ((ApplicationActivity) parentActivity).updateActionBar();

    SharedPreferences preferences =
        ApplicationLoader.applicationContext.getSharedPreferences(
            "mainconfig", Activity.MODE_PRIVATE);
    boolean animations = preferences.getBoolean("view_animations", true);
    if (!animations) {
      firstNameField.requestFocus();
      Utilities.showKeyboard(firstNameField);
    }
  }
    @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 onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setHasOptionsMenu(true);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
 }
 @Override
 public void onFragmentDestroy() {
   super.onFragmentDestroy();
 }
 @Override
 public boolean onFragmentCreate() {
   super.onFragmentCreate();
   chat_id = getArguments().getInt("chat_id", 0);
   return true;
 }