Skip to content

Commit 923c75e

Browse files
committed
stop multiple threads to load image
1 parent 783a49e commit 923c75e

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

app/src/main/java/com/katcom/androidFileVault/PreviewManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public Bitmap getPreview(ProtectedFile file,int sizeX,int sizeY){
5050
in = vault.getDecryptedInputStream(file);
5151
//in.close();
5252
Bitmap preview = BitmapFactory.decodeStream(in,null,options);
53-
53+
return preview;
5454
// If loading with options succeed, return the image
55-
if(preview != null) return preview;
55+
//if(preview != null) return preview;
5656

5757
// If failed to load the image with options, drop the options and load it again
58-
in = vault.getDecryptedInputStream(file);
59-
return BitmapFactory.decodeStream(in);
58+
//in = vault.getDecryptedInputStream(file);
59+
//return BitmapFactory.decodeStream(in);
6060

6161
} catch (UnrecoverableEntryException | NoSuchAlgorithmException | KeyStoreException | IOException e) {
6262
Log.e(TAG,e.toString());

app/src/main/java/com/katcom/androidFileVault/VaultFragment.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,18 @@ private void saveTempPictureUri(Uri uri) {
305305
*/
306306
private void loadPreviewData(){
307307

308-
Executor executor = getCacheExecutor();
308+
//Executor executor = Executors.newFixedThreadPool(30);
309309

310310
for(ProtectedFile file:mFiles){
311-
/*Log.v(TAG,"LOADING PREVIEW"+file.getFilename());
311+
Log.v(TAG,"LOADING PREVIEW"+file.getFilename());
312312
Bitmap preview = previewManager.getPreview(file,120,120);
313313
file.setPreview(preview);
314314
if(file.getPreview() != null){
315315
Log.v(TAG,"Done Loading preview on background for : "+file.getFilename());
316316
}else{
317317
Log.v(TAG,"Failed Loading preview on background for : "+file.getFilename());
318-
}**/
319-
new FetchSinglePreviewImage().executeOnExecutor(executor,file);
318+
}
319+
//new FetchSinglePreviewImage().executeOnExecutor(executor,file);
320320
};
321321
}
322322

@@ -518,7 +518,7 @@ protected ProtectedFile doInBackground(ProtectedFile... protectedFiles) {
518518
//Bitmap preview = mVault.getPreview(file,120,120);
519519
Log.v(TAG,"Loading preview on background for : "+file.getFilename());
520520
Bitmap preview = previewManager.getPreview(file,120,120);
521-
521+
522522
return file;
523523
}
524524

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">图库与隐私</string>
4+
<string name="vault_1_button">打开文件库</string>
5+
<string name="export_selected_file">导出所选文件</string>
6+
<string name="share_file">分享文件</string>
7+
<string name="export_all_files">打包导出所有文件</string>
8+
<string name="share_all_files">分享所有文件</string>
9+
<string name="latest">最近</string>
10+
<string name="star">喜爱的</string>
11+
<string name="login">登录</string>
12+
<string name="password_hint">请输入密码</string>
13+
<string name="please_set_password">请输入一个登录密码</string>
14+
<string name="next_move_set_password">下一步</string>
15+
<string name="previous_move_set_password">上一步</string>
16+
<string name="two_password_not_match">两次输入的密码不匹配,请重新输入</string>
17+
<string name="two_password_not_match_title">密码不正确</string>
18+
<string name="enter_password_again">再次输入</string>
19+
<string name="search">搜索</string>
20+
<string name="clear_search">清除</string>
21+
<string name="string_export">导出</string>
22+
<string name="string_share">分享</string>
23+
<string name="take_photo">拍照</string>
24+
25+
</resources>

0 commit comments

Comments
 (0)