Fix nullpointer with Intent API, fix clearing of encrypt file list, notify when adding a range of input uris

This commit is contained in:
Dominik Schürmann 2015-04-04 19:01:03 +02:00
parent ac3efb8b58
commit 8e5d0d1682
2 changed files with 7 additions and 6 deletions

View File

@ -390,8 +390,6 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
});
deleteFileDialog.show(getActivity().getSupportFragmentManager(), "deleteDialog");
mFilesModels.clear();
} else {
if (mShareAfterEncrypt) {
// Share encrypted message/file
@ -724,6 +722,7 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
public void addAll(ArrayList<Uri> inputUris) {
if (inputUris != null) {
int startIndex = mDataset.size();
for (Uri inputUri : inputUris) {
ViewModel newModel = new ViewModel(mActivity, inputUri);
if (mDataset.contains(newModel)) {
@ -732,8 +731,8 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
mDataset.add(newModel);
}
}
notifyItemRangeInserted(startIndex, mDataset.size() - startIndex);
}
// TODO: notifyItemInserted?
}
public void remove(ViewModel model) {

View File

@ -123,9 +123,6 @@ public class EncryptTextFragment extends CryptoOperationFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.encrypt_text_fragment, container, false);
if (mMessage != null) {
mText.setText(mMessage);
}
mText = (TextView) view.findViewById(R.id.encrypt_text_text);
mText.addTextChangedListener(new TextWatcher() {
@Override
@ -144,6 +141,11 @@ public class EncryptTextFragment extends CryptoOperationFragment {
}
});
// set initial text
if (mMessage != null) {
mText.setText(mMessage);
}
return view;
}