handle empty filename in decrypt list

This commit is contained in:
Vincent Breitmoser 2015-06-19 20:09:04 +02:00
parent ae56f4f900
commit 36f3887c5f
2 changed files with 6 additions and 1 deletions

View File

@ -34,6 +34,7 @@ import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -476,7 +477,10 @@ public class DecryptListFragment
KeyFormattingUtils.setStatus(mContext, holder, model.mResult); KeyFormattingUtils.setStatus(mContext, holder, model.mResult);
OpenPgpMetadata metadata = model.mResult.getDecryptMetadata(); OpenPgpMetadata metadata = model.mResult.getDecryptMetadata();
holder.vFilename.setText(metadata.getFilename());
String filename = metadata.getFilename();
holder.vFilename.setText(
!TextUtils.isEmpty(filename) ? filename : mContext.getString(R.string.filename_unknown));
long size = metadata.getOriginalSize(); long size = metadata.getOriginalSize();
if (size == -1 || size == 0) { if (size == -1 || size == 0) {

View File

@ -1334,5 +1334,6 @@
<string name="error_loading_keys">"Error loading keys!"</string> <string name="error_loading_keys">"Error loading keys!"</string>
<string name="error_empty_log">"(error, empty log)"</string> <string name="error_empty_log">"(error, empty log)"</string>
<string name="error_reading_text">"Could not read input to decrypt!"</string> <string name="error_reading_text">"Could not read input to decrypt!"</string>
<string name="filename_unknown"><![CDATA[<no filename>]]></string>
</resources> </resources>