Some minor fixes for working with extended encoding
This commit is contained in:
parent
a8dada6c89
commit
572ecf1577
@ -87,8 +87,8 @@ public class ComposeMessageActivity extends AppCompatActivity {
|
|||||||
// so features like threading can be supported
|
// so features like threading can be supported
|
||||||
if (item.getEncoding() == EXTENDED) {
|
if (item.getEncoding() == EXTENDED) {
|
||||||
replyIntent.putExtra(EXTRA_ENCODING, EXTENDED);
|
replyIntent.putExtra(EXTRA_ENCODING, EXTENDED);
|
||||||
replyIntent.putExtra(EXTRA_PARENT, item);
|
|
||||||
}
|
}
|
||||||
|
replyIntent.putExtra(EXTRA_PARENT, item);
|
||||||
String prefix;
|
String prefix;
|
||||||
if (item.getSubject().length() >= 3 && item.getSubject().substring(0, 3)
|
if (item.getSubject().length() >= 3 && item.getSubject().substring(0, 3)
|
||||||
.equalsIgnoreCase("RE:")) {
|
.equalsIgnoreCase("RE:")) {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package ch.dissem.apps.abit;
|
package ch.dissem.apps.abit;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
@ -79,6 +80,11 @@ public class ComposeMessageFragment extends Fragment {
|
|||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
if (getArguments().containsKey(EXTRA_IDENTITY)) {
|
if (getArguments().containsKey(EXTRA_IDENTITY)) {
|
||||||
identity = (BitmessageAddress) getArguments().getSerializable(EXTRA_IDENTITY);
|
identity = (BitmessageAddress) getArguments().getSerializable(EXTRA_IDENTITY);
|
||||||
|
if (getActivity() != null) {
|
||||||
|
if (identity == null || identity.getPrivateKey() == null) {
|
||||||
|
identity = Singleton.getIdentity(getActivity());
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("No identity set for ComposeMessageFragment");
|
throw new RuntimeException("No identity set for ComposeMessageFragment");
|
||||||
}
|
}
|
||||||
@ -156,6 +162,14 @@ public class ComposeMessageFragment extends Fragment {
|
|||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
if (identity == null || identity.getPrivateKey() == null) {
|
||||||
|
identity = Singleton.getIdentity(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.compose, menu);
|
inflater.inflate(R.menu.compose, menu);
|
||||||
@ -170,6 +184,9 @@ public class ComposeMessageFragment extends Fragment {
|
|||||||
return true;
|
return true;
|
||||||
case R.id.select_encoding:
|
case R.id.select_encoding:
|
||||||
SelectEncodingDialogFragment encodingDialog = new SelectEncodingDialogFragment();
|
SelectEncodingDialogFragment encodingDialog = new SelectEncodingDialogFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putSerializable(EXTRA_ENCODING, encoding);
|
||||||
|
encodingDialog.setArguments(args);
|
||||||
encodingDialog.setTargetFragment(this, 0);
|
encodingDialog.setTargetFragment(this, 0);
|
||||||
encodingDialog.show(getFragmentManager(), "select encoding dialog");
|
encodingDialog.show(getFragmentManager(), "select encoding dialog");
|
||||||
return true;
|
return true;
|
||||||
|
@ -156,7 +156,10 @@ public class MessageDetailFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
List<Plaintext> parents = new ArrayList<>(item.getParents().size());
|
List<Plaintext> parents = new ArrayList<>(item.getParents().size());
|
||||||
for (InventoryVector parentIV : item.getParents()) {
|
for (InventoryVector parentIV : item.getParents()) {
|
||||||
parents.add(messageRepo.getMessage(parentIV));
|
Plaintext parent = messageRepo.getMessage(parentIV);
|
||||||
|
if (parent != null) {
|
||||||
|
parents.add(parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
showRelatedMessages(rootView, R.id.parents, parents);
|
showRelatedMessages(rootView, R.id.parents, parents);
|
||||||
showRelatedMessages(rootView, R.id.responses, messageRepo.findResponses(item));
|
showRelatedMessages(rootView, R.id.responses, messageRepo.findResponses(item));
|
||||||
@ -165,7 +168,7 @@ public class MessageDetailFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showRelatedMessages(View rootView, @IdRes int id, List<Plaintext> messages) {
|
private void showRelatedMessages(View rootView, @IdRes int id, List<Plaintext> messages) {
|
||||||
RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.parents);
|
RecyclerView recyclerView = (RecyclerView) rootView.findViewById(id);
|
||||||
RelatedMessageAdapter adapter = new RelatedMessageAdapter(getActivity(), messages);
|
RelatedMessageAdapter adapter = new RelatedMessageAdapter(getActivity(), messages);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
@ -201,9 +201,9 @@ public class AndroidMessageRepository extends AbstractMessageRepository {
|
|||||||
// There are no parents to save yet (they are saved in the extended data, that's enough for now)
|
// There are no parents to save yet (they are saved in the extended data, that's enough for now)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
db.delete(PARENTS_TABLE_NAME, "child=?", new String[]{hex(message.getInitialHash()).toString()});
|
|
||||||
|
|
||||||
byte[] childIV = message.getInventoryVector().getHash();
|
byte[] childIV = message.getInventoryVector().getHash();
|
||||||
|
db.delete(PARENTS_TABLE_NAME, "child=?", new String[]{hex(childIV).toString()});
|
||||||
|
|
||||||
// save new parents
|
// save new parents
|
||||||
int order = 0;
|
int order = 0;
|
||||||
for (InventoryVector parentIV : message.getParents()) {
|
for (InventoryVector parentIV : message.getParents()) {
|
||||||
|
@ -105,13 +105,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/text"
|
android:layout_below="@+id/text"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp" />
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_marginBottom="16dp"/>
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/responses"
|
android:id="@+id/responses"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/text"
|
android:layout_below="@+id/labels"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp" />
|
android:layout_marginRight="16dp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user