GVKun编程网logo

DEDECMS新闻模型整合download功能,可判断点数,会员组等download权限(新闻模块html)

17

此处将为大家介绍关于DEDECMS新闻模型整合download功能,可判断点数,会员组等download权限的详细内容,并且为您解答有关新闻模块html的相关问题,此外,我们还将为您介绍关于andro

此处将为大家介绍关于DEDECMS新闻模型整合download功能,可判断点数,会员组等download权限的详细内容,并且为您解答有关新闻模块html的相关问题,此外,我们还将为您介绍关于android – 未知的URL内容:// downloads / my_downloads、com.intellij.util.download.DownloadableFileDescription的实例源码、com.intellij.util.download.FileDownloader的实例源码、com.nostra13.universalimageloader.core.download.BaseImageDownloader的实例源码的有用信息。

本文目录一览:

DEDECMS新闻模型整合download功能,可判断点数,会员组等download权限(新闻模块html)

DEDECMS新闻模型整合download功能,可判断点数,会员组等download权限(新闻模块html)

 

本教程实现DEDECMS功能:新闻模型整合download功能,可判断点数,会员组等download权限,前台可判断是否有附件download,有则显示,没有则不显示。适用类型:有些新闻有download地址,有些新闻没有download地址的网站。想附件收费的网站等等……具体就不啰嗦了。用得上您就拿走。

DEDECMS新闻模型整合download功能,可判断点数,会员组等download权限

后台效果图

本教程为网站管理员似水星辰原创,转载注明出处。

注:本教程中的金币和会员组设置只针对download连接有效。不对新闻内容生效,和新闻本身的阅读权限和消费金币并不冲突,是分开设置的。新闻中所有sql语句中涉及表名的,请把表前缀换成您自己的表前缀。如:js_addonarticle 换成 您的表前缀_addonarticle。

一、首先规划要加入的字段

download链接:softlinks

消费金币:needmoney

会员组权限:daccess

这些字段要加入到新闻附加表中,前缀_addonarticle,也可以根据自己情况加入需要的表中,自己修改就行了。

进入后台系统-SQL命令行工具,执行:

ALTER TABLE `js_addonarticle` ADD `softlinks` TEXT NOT NULL , ADD `needmoney` SMALLINT( 5 ) NOT NULL , ADD `daccess` SMALLINT( 5 ) NOT NULL  

也可以在phpmyadmin中自行添加。

然后在后台打开核心-频道模型-内容模型管理-普通新闻-修改-字段管理,在模型字段配置(文本模式) 里添加

<field:softlinks  itemname="软件地址" type="softlinks" isnull="true" default="" rename="" /> 

<field:daccess islist="1" itemname="download级别" type="int" isnull="true" default="0" rename="" function="" notsend="1"/>   

<field:needmoney islist="1" itemname="需要金币" type="int" isnull="true" default="0" rename="" function="" notsend="1" /> 

如果不添加则会出现无链接信息错误!请务必添加。

二、数据库字段添加完毕就要修改新闻模型的4个文件了。分别是dede管理目录下的article_add.php,article_edit.php和管理源码article_add.htm,article_edit.htm,打开这4个文件依次修改。

1、修改article_add.htm,在头部的<script></script>中加入以下,在</script>之前加入就行

var startNum = 0; function MakeUpload() { var upfield = document.getElementById("uploadfield"); var endNum = parseInt(document.form1.picnum.value) + startNum-1; if(endNum > 30) endNum = 30; for(startNum; startNum<=endNum; startNum++){ upfield.innerHTML += "<div>软件地址"+startNum+":<input type='text' name='softurl"+startNum+"'value='' /> 服务器名称:<input type='text' name='servermsg"+startNum+"'/></div>\r\n"; } } function ShowHideAddr() { document.getElementById('morelink').style.display = (document.getElementById('morelink').style.display=='block' ? 'none' : 'block'); document.getElementById('morelink').style.height = '100%'; document.getElementById('btsh3').value = (document.getElementById('morelink').style.display=='block' ? '隐藏地址' : '显示地址'); }  

这个是可以增加download地址个数的JS代码。

2、找到

<tr> 

     <td colspan="2"><?php PrintAutoFieldsAdd($cInfos['fieldset'],'autofield'); ?></td> 

   </tr> 

再其后边加入

<tr> <td height="24" bgcolor="#F9FCEF""><strong>&nbsp;download限制:</strong></td> </tr> <tr> <td height="24"> <table width="800" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="90" height="30">&nbsp;需会员权限:</td> <td width="179" align="left"> <select name="daccess" id="daccess"> <?php $dsql->SetQuery("Select * from `js_arcrank` where rank>=0 "); $dsql->Execute(); while($row = $dsql->GetArray()) { if($row['rank']==0) $row['membername'] = "不限会员"; if($row['rank'] == $softconfig['dfrank']) echo " <option value='{$row['rank']}' selected>{$row['membername']}</option>\r\n"; else echo " <option value='{$row['rank']}'>{$row['membername']}</option>\r\n"; } ?> </select> </td> <td width="120" align="center">需消费金币:</td> <td width="411"> <input name="needmoney" type="text" id="needmoney" value="<?php echo $softconfig['dfywboy']; ?>" size="8" />个 </td> </tr> <tr> <td height="26" colspan="4">&nbsp; <span>(如果设定了download限制,[<a href=http://www.dede58.com/a/dedejq/"soft_config.php" target="_blank"><u>软件频道设置</u></a>]中“附件download方式:”必须选择“链接到跳转页面”) </span></td> </tr> </table> </td> </tr> <tr> <td height="24" bgcolor="#F9FCEF"><strong>&nbsp;本地软件选择:</strong></td> </tr> <tr> <td height="24"> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90" height="30">&nbsp;本地地址:</td> <td> <input name="softurl1" type="text" id="softurl1" size="35" /> <input name="sel1" type="button" id="sel1" value="选取" onClick="SelectSoft('form1.softurl1')" /> 服务器名称: <input name="servermsg1" type="text" id="servermsg1" value="本地download"/> </td> </tr> </table> </td> </tr> <?php if($softconfig['moresitedo'] == 0 && trim($softconfig['sites']) != '') { ?> <tr> <td height="24" bgcolor="#F9FCEF"><b>&nbsp;预设的镜像服务器:</b></td> </tr> <tr> <td> (服务器地址 + 软件地址 = 软件真实地址 [<a href=http://www.dede58.com/a/dedejq/"soft_config.php" target="_blank"><u>软件频道设置</u></a>])<br /> <?php $sites = explode("\n", $softconfig['sites']); $startNum = 2; foreach($sites as $site) { $site = trim($site); if(empty($site)) continue; list($siteurl, $sitename) = explode('|', $site); $siteurl = trim($siteurl); $sitename = trim($sitename); ?> <?php echo $sitename; ?>: <input type='hidden' name='forconfig<?php echo $startNum; ?>' value='1' /> <input type='text' name='softurlfirst<?php echo $startNum; ?>'value='<?php echo $siteurl; ?>' /> + <input type='text' name='softurl<?php echo $startNum; ?>'value='' /> <input type='text' name='servermsg<?php echo $startNum; ?>'value='<?php echo $sitename; ?>' /> <input type='checkbox' name='need<?php echo $startNum; ?>'value='1' checked />启用 <br /> <?php $startNum++; }//foreach echo "<script language='javascript'>startNum = $startNum;</script>\r\n"; ?> </td> </tr> <?php }//需要预设镜像 ?> <tr> <td height="24" bgcolor="#F9FCEF"><b>&nbsp;手动指定地址:</b></td> </tr> <tr> <td height="24"> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90">其它地址:</td> <td> <input name="picnum" type="text" id="picnum" size="8" value="5" /> <input name='kkkup' type='button' id='kkkup2' value='增加地址' onClick="MakeUpload();" /> &nbsp; <input type="button" name="Submit3" id="btsh3" value="隐藏地址" onClick="ShowHideAddr();" /> (*多为30个链接) </td> </tr> </table> <div id="morelink"> <div id='uploadfield'></div> </div> </td> </tr>  

到这里article_add.htm文件就修改完了。

3、打开article_edit.htm文件,在头部的<script></script>中加入以下代码,在</script>之前加入就行

#p#分页标题#e#

var startNum = <?php echo $newRowStart?>; function MakeUpload() { var upfield = document.getElementById('uploadfield'); var endNum = parseInt(document.form1.picnum.value) + startNum; if(endNum > 30) endNum = 30; for(startNum; startNum < endNum; startNum++) { upfield.innerHTML += "<div>软件地址"+startNum+":<input type='text' name='softurl"+startNum+"'value='' /> 服务器名称:<input type='text' name='servermsg"+startNum+"'/></div>\r\n"; } } function ShowHideAddr() { document.getElementById('morelink').style.display = (document.getElementById('morelink').style.display=='block' ? 'none' : 'block'); document.getElementById('btsh3').value = (document.getElementById('morelink').style.display=='block' ? '隐藏地址' : '显示地址'); }  

4、找到

<tr> 

      <td colspan="2"><?php 

      PrintAutoFieldsEdit($cInfos['fieldset'],$addRow,'autofield'); 

      ?></td> 

    </tr> 

在其下边加入以下代码:

#p#分页标题#e#

<tr> <td height="24"> <table width="800" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="90" height="30">&nbsp;需会员权限:</td> <td width="179" align="center"> <select name="daccess" id="daccess"> <?php $dsql->SetQuery("Select * from `js_arcrank` where rank>=0 "); $dsql->Execute(); while($row = $dsql->GetArray()) { if($row['rank']==0) $row['membername'] = "不限会员"; if($row['rank'] == $daccess) echo " <option value='{$row['rank']}' selected>{$row['membername']}</option>\r\n"; else echo " <option value='{$row['rank']}'>{$row['membername']}</option>\r\n"; } ?> </select> </td> <td width="120" align="center">需消费金币:</td> <td width="411"> <input name="needmoney" type="text" id="needmoney" value="<?php echo $needmoney; ?>" size="8" />个 </td> </tr> <tr> <td height="26" colspan="4">&nbsp; <span>(如果设定了download限制,<a href=http://www.dede58.com/a/dedejq/"soft_config.php" target="_blank"><u>软件频道设置</u></a>中“附件download方式:”必须选择“链接到跳转页面”) </span></td> </tr> </table> </td> </tr> <tr> <td height="24" colspan="4" bgcolor="#F9FCEF"><strong>&nbsp;软件链接列表:</strong></td> </tr> <tr> <td height="24" colspan="4"> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="72">&nbsp;其它地址:</td> <td> <input name="picnum" type="text" id="picnum" size="8" value="5" /> <input name='kkkup' type='button' id='kkkup2' value='增加数量' onClick="MakeUpload();" /> &nbsp; <input type="button" name="Submit3" id="btsh3" value="隐藏地址" onClick="ShowHideAddr();" /> (*多为30个链接) </td> </tr> </table> </td> </tr> <tr> <td height="24" colspan="4"> <?php echo $nForm; ?> <div id='morelink'> <div id='uploadfield'></div> </div> </td> </tr>  

article_edit.html修改完毕,接下来开始修改article_add.php,要认真看哦!

5、打开article_add.php,找到

#p#分页标题#e#

//保存到附加表 $cts = $dsql->GetOne("SELECT addtable FROM `js_channeltype` WHERE id='$channelid' "); 在其上边加入 //软件链接列表 $urls = ''; //本地链接处理 $softurl1 = stripslashes($softurl1); $nsoftsize = ''; if($softurl1 != '') { $urls .= "{dede:link islocal='1' text='{$servermsg1}'} $softurl1 {/dede:link}\r\n"; } //其它链接处理 for($i=2; $i<=30; $i++) { if(!(${'softurl'.$i})) { $forconfig = (${'forconfig'.$i}) ? FALSE : TRUE; if($forconfig) { if(empty(${'need'.$i})) continue; $serverUrl = stripslashes(${'softurlfirst'.$i}); $serverUrl = preg_replace("#\/$#", "", $serverUrl); $softurl = stripslashes(${'softurl'.$i}); if( cn_substr($softurl, 1) != '/' ) $softurl = '/'.$softurl; $softurl = $serverUrl.$softurl; } else { $softurl = stripslashes(${'softurl'.$i}); } $servermsg = str_replace("'", "", stripslashes(${'servermsg'.$i})); if($servermsg=='') $servermsg = 'download地址'.$i; if($softurl != '') { $urls .= "{dede:link text='$servermsg'} $softurl {/dede:link}\r\n"; } } } $urls = addslashes($urls);  

这段大概在203行左右,主要作用是处理download地址。然后再找到

$query = "INSERT INTO `{$addtable}`(aid,typeid,redirecturl,templet,userip,body{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$templet','$useip','$body'{$inadd_v})"; 

替换为

$query = "INSERT INTO `{$addtable}`(aid,typeid,redirecturl,templet,userip,body,softlinks,needmoney,daccess{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$templet','$useip','$body','$urls','$needmoney','$daccess'{$inadd_v})"; 

article_add.php修改完毕,添加一下新闻,把download地址,金币,会员组都写进去,看看数据库是不是有这条记录了^ ^。

6、打开article_edit.php,找到

$channelid = $arcRow['channel']; 

在其上边加入

$newRowStart = 1; $nForm = ''; $daccess = $addRow['daccess']; $needmoney = $addRow['needmoney']; if($addRow['softlinks'] != '') { $dtp = new DedeTagParse(); $dtp->LoadSource($addRow['softlinks']); if(is_array($dtp->CTags)) { foreach($dtp->CTags as $ctag) { if($ctag->GetName()=='link') { $islocal = $ctag->GetAtt('islocal'); if($islocal != 1) $needmsg = "<input type='checkbox' name='del{$newRowStart}' value='1' />删除"; else $needmsg = '<input name="sel1" type="button" id="sel1" value="选取" onClick="SelectSoft(\'form1.softurl'.$newRowStart.'\')" />'; $nForm .= "<div>软件地址{$newRowStart}:<input type='text' name='softurl{$newRowStart}'value='".trim($ctag->GetInnerText())."' /> 服务器名称:<input type='text' name='servermsg{$newRowStart}' value='".$ctag->GetAtt("text")."'/> <input type='hidden' name='islocal{$newRowStart}' value='{$islocal}' /> $needmsg </div>\r\n"; $newRowStart++; } } } $dtp->Clear(); }  

找到

$cts = $dsql->GetOne("SELECT addtable FROM `js_channeltype` WHERE id='$channelid' "); 

在其上边加入以下代码:

//软件链接列表 

    $urls = ''; 

     

    for($i=1; $i<=30; $i++) 

    { 

        if(!empty(${'softurl'.$i})) 

        { 

            $islocal = empty(${'islocal'.$i}) ? '' : 1; 

            $isneed = empty(${'del'.$i}) ? true : false; 

            $servermsg = str_replace("'",'',stripslashes(${'servermsg'.$i})); 

            $softurl = stripslashes(${'softurl'.$i}); 

             

            if($servermsg=='') 

            { 

                $servermsg = 'download地址'.$i; 

            } 

            if($softurl != '') 

            { 

#p#分页标题#e#

                if($islocal==1) $urls .= "{dede:link islocal='$islocal' text='{$servermsg}'} $softurl {/dede:link}\r\n" ; 

                else if($isneed) $urls .= "{dede:link text='$servermsg'} $softurl {/dede:link}\r\n"; 

                else continue; 

            } 

        } 

    } 

    $urls = addslashes($urls); 

找到

$iquery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},redirecturl='$redirecturl',templet='$templet',userip='$useip' WHERE aid='$id'"; 

替换为:

$iquery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},redirecturl='$redirecturl',templet='$templet',userip='$useip',softlinks ='$urls',needmoney = '$needmoney',daccess = '$daccess' WHERE aid='$id'"; 

至此本教程后台修改部分已经完毕,你学会了吗?接下来开始前台部分。

三、前台调用,和软件的前台调用方式一样,看以下代码

{dede:field name='softlinks'/} 

这个就是调用download地址,打开的页面为软件模型的download页,在哪里可以判断到download的权限。这里就不多讲了,改完后就可以看到了。

有一种情况,就是有些网友希望没有download地址的话就不显示,这里可以提供一种办法。把如下代码复制到新闻源码里即可。

{dede:php} 

        $thisid = $refObj->Fields['aid'];  

        $totrow=$dsql->GetOne('select * from js_addonarticle where aid='.$thisid); 

        if($totrow['softlinks']!='') 

        { 

        echo "<a href=\"/plus/下载.php?open=0&aid=".$thisid."&cid=1\" style=\"color:white\" target=\"_blank\">download地址</a>"; 

        } 

{/dede:php} 

DEDECMS文章模型整合下载功能,可判断点数,会员组等下载权限

前台效果图

到这里,本教程全文完毕。

本文章网址:http://www.ppssdd.com/code/13888.html。转载请保留出处,谢谢合作!

android – 未知的URL内容:// downloads / my_downloads

android – 未知的URL内容:// downloads / my_downloads

我正在使用Download manger下载一些多媒体文件并对其进行分类.我也在使用Crashlytics,这是一个错误,我经常在不同的设备和Android版本上得到它.我正在寻找你的解决方案/建议!

java.lang.IllegalArgumentException: UnkNown URL content://downloads/my_downloads
   at android.content.ContentResolver.insert(ContentResolver.java:862)
   at android.app.DownloadManager.enqueue(DownloadManager.java:1252)
   at com.myapp.LessonFragment$DownloadClickListener.onClick(SourceFile:570)
   at android.view.View.performClick(View.java:4262)
   at android.view.View$PerformClick.run(View.java:17351)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4921)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
   at dalvik.system.NativeStart.main(NativeStart.java)

您可以在下面看到我的代码:

private class DownloadClickListener implements View.OnClickListener {
    @Override
    public void onClick(View view) {
        // Check if download manager available before request
        if (!DownloadHelper.isDownloadManagerAvailable(getActivity())) {
            // Build custom alert dialog
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            builder.setMessage(R.string.download_manager_disabled);
            builder.setCancelable(false);
            builder.setPositiveButton(R.string.ok, (dialog, which) -> {
                dialog.dismiss();
            });
            // Create and display alert dialog
            AlertDialog dialog = builder.create();
            dialog.show();
            return;
        }

        // display short toast on download clicked
        Toast.makeText(getActivity(), R.string.lesson_download_start, Toast.LENGTH_SHORT).show();

        // Get attach from view tag
        Attache attache = (Attache) view.getTag();

        // Get lesson using lesson id
        Lesson lesson = new Select().from(Lesson.class)
                .where(Condition.column("id").is(attache.getLessonId()))
                .querySingle();

        // Set file name from url and attache name
        Uri uri = Uri.parse(attache.getFile());
        String fileName = attache.getName() + '.'
                + MimeTypeMap.getFileExtensionFromUrl(attache.getFile());

        // Check if path directory not exist and create it
        String filePath = Environment.getExternalStorageDirectory() + "/myapp/" + lesson.getTitle() + "/";
        File path = new File(filePath);
        if (!path.exists() || !path.isDirectory()) {
            if (!path.mkdirs()) {
                Timber.e("Could not create path directory.");
            }
        }

        // Check if file exist and then delete it
        File file = new File(filePath, fileName);
        if (file.exists() && file.isFile()) {
            if (file.delete()) {
                Timber.v("%s just deleted.", fileName);
            }
        }

        // Create download manager request using url
        DownloadManager.Request request = new DownloadManager.Request(uri);
        request.setTitle(attache.getName());
        request.setDestinationInExternalPublicDir("/myapp/" + lesson.getTitle(), fileName);

        // Using DownloadManager for download attache file
        DownloadManager manager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE);
        manager.enqueue(request);
    }
}

解决方法:

对于那些获得错误未知URI的人:content:// downloads / public_downloads.
我设法通过@Commonsware在this answer中给出一个提示来解决这个问题.我在GitHub上找到了类FileUtils.
这里的InputStream方法用于从Download目录中获取文件.

 // DownloadsProvider
            else if (isDownloadsDocument(uri)) {

                final String id = DocumentsContract.getDocumentId(uri);

                if (id != null && id.startsWith("raw:")) {
                    return id.substring(4);
                }

                String[] contentUriPrefixesToTry = new String[]{
                        "content://downloads/public_downloads",
                        "content://downloads/my_downloads",
                        "content://downloads/all_downloads"
                };

                for (String contentUriPrefix : contentUriPrefixesToTry) {
                    Uri contentUri = ContentUris.withAppendedId(Uri.parse(contentUriPrefix), Long.valueOf(id));
                    try {
                        String path = getDataColumn(context, contentUri, null, null);
                        if (path != null) {
                            return path;
                        }
                    } catch (Exception e) {}
                }

                // path Could not be retrieved using ContentResolver, therefore copy file to accessible cache using streams
                String fileName = getFileName(context, uri);
                File cacheDir = getDocumentCacheDir(context);
                File file = generateFileName(fileName, cacheDir);
                String destinationPath = null;
                if (file != null) {
                    destinationPath = file.getAbsolutePath();
                    saveFileFromUri(context, uri, destinationPath);
                }

                return destinationPath;
            }

com.intellij.util.download.DownloadableFileDescription的实例源码

com.intellij.util.download.DownloadableFileDescription的实例源码

项目:intellij-ce-playground    文件:FindJarFix.java   
private void downloadJar(String jarUrl,String jarName) {
  final Project project = myModule.getProject();
  final String dirPath = PropertiesComponent.getInstance(project).getValue("findjar.last.used.dir");
  VirtualFile toSelect = dirPath == null ? null : LocalFileSystem.getInstance().findFileByIoFile(new File(dirPath));
  final VirtualFile file = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(),project,toSelect);
  if (file != null) {
    PropertiesComponent.getInstance(project).setValue("findjar.last.used.dir",file.getPath());
    final DownloadableFileService downloader = DownloadableFileService.getInstance();
    final DownloadableFileDescription description = downloader.createFileDescription(jarUrl,jarName);
    final List<VirtualFile> jars =
      downloader.createDownloader(Arrays.asList(description),jarName)
                .downloadFilesWithProgress(file.getPath(),myEditorComponent);
    if (jars != null && jars.size() == 1) {
      Accesstoken token = WriteAction.start();
      try {
        OrderEntryFix.addJarToRoots(jars.get(0).getPresentableurl(),myModule,myRef);
      }
      finally {
        token.finish();
      }
    }
  }
}
项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
@Nullable
@Override
public List<Pair<VirtualFile,DownloadableFileDescription>> downloadWithProgress(@Nullable String targetDirectoryPath,@Nullable Project project,@Nullable JComponent parentComponent) {
  File dir;
  if (targetDirectoryPath != null) {
    dir = new File(targetDirectoryPath);
  }
  else {
    VirtualFile virtualDir = chooseDirectoryForFiles(project,parentComponent);
    if (virtualDir != null) {
      dir = VfsutilCore.virtualToIoFile(virtualDir);
    }
    else {
      return null;
    }
  }

  return downloadWithProcess(dir,parentComponent);
}
项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
private static List<Pair<File,DownloadableFileDescription>> movetoDir(List<Pair<File,DownloadableFileDescription>> downloadedFiles,final File targetDir) throws IOException {
  FileUtil.createDirectory(targetDir);
  List<Pair<File,DownloadableFileDescription>> result = new ArrayList<Pair<File,DownloadableFileDescription>>();
  for (Pair<File,DownloadableFileDescription> pair : downloadedFiles) {
    final DownloadableFileDescription description = pair.getSecond();
    final String fileName = description.generateFileName(new Condition<String>() {
      @Override
      public boolean value(String s) {
        return !new File(targetDir,s).exists();
      }
    });
    final File toFile = new File(targetDir,fileName);
    FileUtil.rename(pair.getFirst(),toFile);
    result.add(Pair.create(toFile,description));
  }
  return result;
}
项目:spoofax-intellij    文件:LibraryService.java   
/**
 * Download files from the specified URLs.
 *
 * @param urls The URLs of the files.
 * @param targetPath The path to download the file to.
 * @return The downloaded files.
 */
private Collection<VirtualFile> downloadFiles(final Collection<String> urls,final String targetPath) {

    final DownloadableFileService fileService = DownloadableFileService.getInstance();

    final List<DownloadableFileDescription> fileDescriptions
            = ContainerUtil.map(urls,(u) -> toFileDescription(fileService,u));

    @Nullable final List<VirtualFile> files = fileService
            .createDownloader(fileDescriptions,"")
            .downloadFilesWithProgress(targetPath,null,null);
    if (files == null || files.size() != fileDescriptions.size()) {
        throw LoggerUtils2.exception(this.logger,RuntimeException.class,"Not all files were downloaded!");
    }
    return files;
}
项目:tools-idea    文件:FindJarFix.java   
private void downloadJar(String jarUrl,jarName);
    final VirtualFile[] jars = downloader.createDownloader(Arrays.asList(description),myEditorComponent,jarName)
      .toDirectory(file.getPath()).download();
    if (jars != null && jars.length == 1) {
      Accesstoken token = WriteAction.start();
      try {
        OrderEntryFix.addJarToRoots(jars[0].getPresentableurl(),myRef);
      }
      finally {
        token.finish();
      }
    }
  }
}
项目:tools-idea    文件:FileDownloaderImpl.java   
@Override
public List<Pair<VirtualFile,DownloadableFileDescription>> downloadAndReturnWithDescriptions() {
  VirtualFile dir = null;
  if (myDirectoryForDownloadedFilesPath != null) {
    File ioDir = new File(FileUtil.toSystemDependentName(myDirectoryForDownloadedFilesPath));
    ioDir.mkdirs();
    dir = LocalFileSystem.getInstance().refreshAndFindFileByPath(myDirectoryForDownloadedFilesPath);
  }

  if (dir == null) {
    dir = chooseDirectoryForFiles();
  }

  if (dir != null) {
    return dodownload(dir);
  }
  return null;
}
项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
public FileDownloaderImpl(@NotNull List<? extends DownloadableFileDescription> fileDescriptions,@Nullable JComponent parentComponent,@NotNull String presentableDownloadName) {
  myProject = project;
  myFileDescriptions = fileDescriptions;
  myParentComponent = parentComponent;
  myDialogTitle = IdeBundle.message("progress.download.0.title",StringUtil.capitalize(presentableDownloadName));
}
项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
@Nullable
@Override
public List<VirtualFile> downloadFilesWithProgress(@Nullable String targetDirectoryPath,@Nullable JComponent parentComponent) {
  final List<Pair<VirtualFile,DownloadableFileDescription>> pairs = downloadWithProgress(targetDirectoryPath,parentComponent);
  if (pairs == null) return null;

  List<VirtualFile> files = new ArrayList<VirtualFile>();
  for (Pair<VirtualFile,DownloadableFileDescription> pair : pairs) {
    files.add(pair.getFirst());
  }
  return files;
}
项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
@Nullable
private List<Pair<VirtualFile,DownloadableFileDescription>> downloadWithProcess(final File targetDir,Project project,JComponent parentComponent) {
  final Ref<List<Pair<File,DownloadableFileDescription>>> localFiles = Ref.create(null);
  final Ref<IOException> exceptionRef = Ref.create(null);

  boolean completed = ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    @Override
    public void run() {
      try {
        localFiles.set(download(targetDir));
      }
      catch (IOException e) {
        exceptionRef.set(e);
      }
    }
  },myDialogTitle,true,parentComponent);
  if (!completed) {
    return null;
  }

  @SuppressWarnings("ThrowableResultOfMethodCallIgnored") Exception exception = exceptionRef.get();
  if (exception != null) {
    final boolean tryAgain = IOExceptionDialog.showErrorDialog(myDialogTitle,exception.getMessage());
    if (tryAgain) {
      return downloadWithProcess(targetDir,parentComponent);
    }
    return null;
  }

  return findVirtualFiles(localFiles.get());
}
项目:tools-idea    文件:FileDownloaderImpl.java   
public FileDownloaderImpl(final List<? extends DownloadableFileDescription> fileDescriptions,final @Nullable Project project,JComponent parent,@NotNull String presentableDownloadName) {
  myProject = project;
  myFileDescriptions = fileDescriptions;
  myParent = parent;
  myDialogTitle = IdeBundle.message("progress.download.0.title",StringUtil.capitalize(presentableDownloadName));
}
项目:tools-idea    文件:FileDownloaderImpl.java   
@Override
public VirtualFile[] download() {
  final List<Pair<VirtualFile,DownloadableFileDescription>> pairs = downloadAndReturnWithDescriptions();
  if (pairs == null) return null;

  List<VirtualFile> files = new ArrayList<VirtualFile>();
  for (Pair<VirtualFile,DownloadableFileDescription> pair : pairs) {
    files.add(pair.getFirst());
  }
  return VfsutilCore.toVirtualFileArray(files);
}
项目:tools-idea    文件:FileDownloaderImpl.java   
private static File generateName(DownloadableFileDescription info,final File dir) {
  final String fileName = info.generateFileName(new Condition<String>() {
    @Override
    public boolean value(String s) {
      return !new File(dir,s).exists();
    }
  });
  return new File(dir,fileName);
}
项目:intellij-ce-playground    文件:DownloadableLibraryFileDescription.java   
@Nullable
DownloadableFileDescription getSourcesDescription();
项目:intellij-ce-playground    文件:DownloadableLibraryFileDescription.java   
@Nullable
DownloadableFileDescription getDocumentationDescription();
项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
private static void deleteFiles(final List<Pair<File,DownloadableFileDescription>> pairs) {
  for (Pair<File,DownloadableFileDescription> pair : pairs) {
    FileUtil.delete(pair.getFirst());
  }
}
项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
@Nullable
@Override
public List<Pair<VirtualFile,DownloadableFileDescription>> downloadAndReturnWithDescriptions() {
  return downloadWithProgress(myDirectoryForDownloadedFilesPath,myProject,myParentComponent);
}
项目:tools-idea    文件:DownloadableLibraryFileDescription.java   
@Nullable
DownloadableFileDescription getSourcesDescription();
项目:tools-idea    文件:DownloadableLibraryFileDescription.java   
@Nullable
DownloadableFileDescription getDocumentationDescription();
项目:tools-idea    文件:FileDownloaderImpl.java   
private static void deleteFiles(final List<Pair<File,DownloadableFileDescription> pair : pairs) {
    FileUtil.delete(pair.getFirst());
  }
  pairs.clear();
}
项目:spoofax-intellij    文件:LibraryService.java   
/**
 * Gets the file description of the specified URL.
 *
 * @param fileService The file service.
 * @param url The URL.
 * @return The file description.
 */
private DownloadableFileDescription toFileDescription(final DownloadableFileService fileService,final String url) {
    final String filename = FilenameUtils.getName(url);
    return fileService.createFileDescription(url,filename);
}

com.intellij.util.download.FileDownloader的实例源码

com.intellij.util.download.FileDownloader的实例源码

项目:intellij-ce-playground    文件:FileDownloaderImpl.java   
@NotNull
@Override
public FileDownloader toDirectory(@NotNull String directoryForDownloadedFilesPath) {
  myDirectoryForDownloadedFilesPath = directoryForDownloadedFilesPath;
  return this;
}
项目:tools-idea    文件:FileDownloaderImpl.java   
@NotNull
@Override
public FileDownloader toDirectory(@NotNull String directoryForDownloadedFilesPath) {
  myDirectoryForDownloadedFilesPath = directoryForDownloadedFilesPath;
  return this;
}

com.nostra13.universalimageloader.core.download.BaseImageDownloader的实例源码

com.nostra13.universalimageloader.core.download.BaseImageDownloader的实例源码

项目:GitHub    文件:MainActivity.java   
@SuppressWarnings("deprecation")
private void initimageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            this)
            .memoryCacheExtraOptions(480,800)
            // default = device screen dimensions
            .threadPoolSize(3)
            // default
            .threadPriority(Thread.norM_PRIORITY - 1)
            // default
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(13) // default
            .discCacheSize(50 * 1024 * 1024) // 缓冲大小
            .discCacheFileCount(100) // 缓冲文件数目
            .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(this)) // default
            .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
            .writeDebugLogs().build();

    // 2.单例ImageLoader类的初始化
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);
}
项目:xlight_android_native    文件:ImageLoaderUtils.java   
/**
     * 初始化imageloader,请在application中调用此方法
     */
    public static void initimageLoader(Context context) {
//        File cacheDir = StorageUtils.getownCacheDirectory(context,//                "AppDir/cache/images");
        File cacheDir = new File(context.getCacheDir(),"images/cache/");
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                context).threadPriority(Thread.norM_PRIORITY - 2) //降低线程的优先级保证主UI线程不受太大影响
                .denyCacheImageMultipleSizesInMemory()
                .diskCacheFileNameGenerator(new Md5FileNameGenerator()) //图片名称使用md5加密
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                .diskCacheSize(1024 * 1024 * 50) // 硬盘存储缓存大小
                .memoryCache(new LruMemoryCache(10 * 1024 * 1024)) //内存缓存
                .memoryCacheSize(10 * 1024 * 1024)//内存缓存
                .diskCache(new UnlimiteddiskCache(cacheDir))
                .imageDownloader(new BaseImageDownloader(context,5 * 1000,30 * 1000)) // connectTimeout (5 s),readTimeout (30 s)
                .taskExecutor(taskExecutor)
                .taskExecutorForCachedImages(executorForCachedImages)
                .threadPriority(Thread.norM_PRIORITY - 1)
                .writeDebugLogs()
                .build();
        com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);
    }
项目:MontageCam    文件:BaseActivity.java   
/**
 * 初始化图片载入框架
 */
private void initimageLoader() {
    File cacheDir = StorageUtils.getCacheDirectory(this);
    int MAXMEMONRY = (int) (Runtime.getRuntime().maxMemory());
    // System.out.println("dsa-->"+MAXMEMONRY+"   "+(MAXMEMONRY/5));//.memoryCache(new
    // LruMemoryCache(50 * 1024 * 1024))
    displayImageOptions defaultOptions = new displayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOndisk(true)
            .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            this).memoryCacheExtraOptions(480,800).defaultdisplayImageOptions(defaultOptions)
            .diskCacheExtraOptions(480,800,null).threadPoolSize(3)
            .threadPriority(Thread.norM_PRIORITY - 2)
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(MAXMEMONRY / 5))
            .diskCache(new UnlimiteddiskCache(cacheDir))
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(this)) // default
            .imagedecoder(new Baseimagedecoder(false)) // default
            .defaultdisplayImageOptions(displayImageOptions.createSimple()).build();

    ImageLoader.getInstance().init(config);
}
项目:boohee_v5.6    文件:u.java   
private static boolean b(String str) {
    long currentTimeMillis = System.currentTimeMillis();
    try {
        b.a("ConnectivityTest: begin to connect to " + str);
        Socket socket = new Socket();
        socket.connect(Host.b(str,5222),BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT);
        socket.setTcpNoDelay(true);
        b.a("ConnectivityTest: connect to " + str + " in " + (System.currentTimeMillis() -
                currentTimeMillis));
        socket.close();
        return true;
    } catch (Throwable th) {
        b.d("ConnectivityTest: Could not connect to:" + str + " exception: " + th.getClass()
                .getSimpleName() + " description: " + th.getMessage());
        return false;
    }
}
项目:MyTravelingDiary    文件:ImageLoaderKit.java   
private ImageLoaderConfiguration getDefaultConfig() throws IOException {
    int MAX_CACHE_MEMORY_SIZE = (int) (Runtime.getRuntime().maxMemory() / 8);
    File cacheDir = StorageUtils.getownCacheDirectory(context,context.getPackageName() + "/cache/image/");

    LogUtil.i(TAG,"ImageLoader memory cache size = " + MAX_CACHE_MEMORY_SIZE / M + "M");
    LogUtil.i(TAG,"ImageLoader disk cache directory = " + cacheDir.getAbsolutePath());

    ImageLoaderConfiguration config = new ImageLoaderConfiguration
            .Builder(context)
            .threadPoolSize(3) // 线程池内加载的数量
            .threadPriority(Thread.norM_PRIORITY - 2) // 降低线程的优先级,减小对UI主线程的影响
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(MAX_CACHE_MEMORY_SIZE))
            .discCache(new LrudiskCache(cacheDir,new Md5FileNameGenerator(),0))
            .defaultdisplayImageOptions(displayImageOptions.createSimple())
            .imageDownloader(new BaseImageDownloader(context,readTimeout (30 s)超时时间
            .writeDebugLogs()
            .build();

    return config;
}
项目:talk-android    文件:VideoRow.java   
Bitmap tryLoadBitmap(ImageViewAware imageAware) {
    Bitmap bitmap = null;
    try {
        java.io.File imageFile = diskCache.get(getMessage().get_id());
        if (imageFile != null && imageFile.exists() && imageFile.length() > 0) {
            ViewScaleType viewScaleType = imageAware.getScaleType();
            ImageSize imageSize = ImageSizeUtils.defineTargetSizeforView(imageAware,new ImageSize(MainApp.CONTEXT.getResources().getdisplayMetrics().widthPixels,MainApp.CONTEXT.getResources().getdisplayMetrics().heightPixels));
            ImageDecodingInfo decodingInfo = new ImageDecodingInfo(getMessage().get_id(),ImageDownloader.Scheme.FILE.wrap(imageFile.getAbsolutePath()),getMessage().get_id(),imageSize,viewScaleType,new BaseImageDownloader(MainApp.CONTEXT),options);
            bitmap = decoder.decode(decodingInfo);
            MainApp.memoryCache.put(getMessage().get_id(),bitmap);
        }
    } catch (Exception ignored) {
        ignored.printstacktrace();
    }
    return bitmap;
}
项目:WeCharEnglish    文件:WeCharapplication.java   
/**
     * 初始化ImageLoader
     *
     * @param context 上下文对象
     */
    private void initimageLoader(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480,800) // default = device screen dimensions
                .diskCacheExtraOptions(480,null)
//                .taskExecutor(...)
//        .taskExecutorForCachedImages(...)
                .threadPoolSize(3) // default
                .threadPriority(Thread.norM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimiteddiskCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
//                .imagedecoder(new Baseimagedecoder()) // default
                .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
                .writeDebugLogs()
                .build();
        ImageLoader.getInstance().init(config);
    }
项目:CloudMusic    文件:ToolImage.java   
/**
 * 初始化ImageLoader
 */
public static void initimageLoader(Context context) {
    //缓存文件的目录
    File cacheDir = CacheUtil.getdiskCacheDir(context,"images");
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480,800) // max width,max height,即保存的每个缓存文件的最大长宽
            .threadPoolSize(3) //线程池内加载的数量
            .threadPriority(Thread.norM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .diskCacheFileNameGenerator(new Md5FileNameGenerator()) //将保存的时候的URI名称用MD5 加密
            .memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation/你可以通过自己的内存缓存实现
            .memoryCacheSize(2 * 1024 * 1024) // 内存缓存的最大值
            .diskCacheSize(50 * 1024 * 1024)  // 50 Mb sd卡(本地)缓存的最大值
            .tasksProcessingOrder(QueueProcessingType.LIFO)
                    // 由原先的discCache -> diskCache
            .diskCache(new UnlimiteddiscCache(cacheDir))//自定义缓存路径
            .imageDownloader(new BaseImageDownloader(context,readTimeout (30 s)超时时间
            .writeDebugLogs() // Remove for release app
            .build();
    //全局初始化此配置
    ImageLoader.getInstance().init(config);

}
项目:MyApplication    文件:MyApplication.java   
@Override
    public void onCreate() {
        super.onCreate();
        //初始化ImageLoader
//      ImageLoaderConfiguration configuration=ImageLoaderConfiguration.createDefault(getApplicationContext());
//      ImageLoader.getInstance().init(configuration);
        File cacheDir = StorageUtils.getownCacheDirectory(this,"Hungry and hurry/Cache");
        ImageLoaderConfiguration config = new ImageLoaderConfiguration
                .Builder(this)
                .memoryCacheExtraOptions(480,800) // maxwidth,max height,即保存的每个缓存文件的最大长宽
                .threadPoolSize(3)//线程池内加载的数量
                .threadPriority(Thread.norM_PRIORITY - 2)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation/你可以通过自己的内存缓存实现
                .memoryCacheSize(2 * 1024 * 1024)
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                .diskCache(new UnlimiteddiskCache(cacheDir))//自定义缓存路径
                .diskCacheFileCount(70)
                .diskCacheFileNameGenerator(new Md5FileNameGenerator())//将保存的时候的URI名称用MD5 加密
                .defaultdisplayImageOptions(displayImageOptions.createSimple())
                .imageDownloader(new BaseImageDownloader(this,readTimeout (30 s)超时时间
                .writeDebugLogs() // Remove for releaseapp
                .build();//开始构建
        ImageLoader.getInstance().init(config);
    }
项目:AndroidLearnDemos    文件:MainActivity.java   
public static void initimageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480,800) // default = device screen dimensions
            .diskCacheExtraOptions(480,null)
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(context)) // default
            .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
            .writeDebugLogs()
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
项目:PictureBeautify    文件:BaseActivity.java   
/**
 * 初始化图片载入框架
 */
private void initimageLoader() {
    File cacheDir = StorageUtils.getCacheDirectory(this);
    int MAXMEMONRY = (int) (Runtime.getRuntime().maxMemory());
    // System.out.println("dsa-->"+MAXMEMONRY+"   "+(MAXMEMONRY/5));//.memoryCache(new
    // LruMemoryCache(50 * 1024 * 1024))
    displayImageOptions defaultOptions = new displayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOndisk(true)
            .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            this).memoryCacheExtraOptions(480,null).threadPoolSize(3)
            .threadPriority(Thread.norM_PRIORITY - 2)
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(MAXMEMONRY / 5))
            .diskCache(new UnlimiteddiskCache(cacheDir))
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(this)) // default
            .imagedecoder(new Baseimagedecoder(false)) // default
            .defaultdisplayImageOptions(displayImageOptions.createSimple()).build();

    ImageLoader.getInstance().init(config);
}
项目:WliveTV    文件:MyApplication.java   
public static void initimageLoader(Context context) {
        // This configuration tuning is custom. You can tune every option,you may tune some of them,// or you can create default configuration by
        //  ImageLoaderConfiguration.createDefault(this);
        // method.
        ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
        config.threadPriority(Thread.norM_PRIORITY - 4);
//        config.memoryCache(new WeakMemoryCache());
        config.memoryCacheExtraOptions(480,800);
        config.memoryCacheSize(2 * 1024 * 1024);
        config.denyCacheImageMultipleSizesInMemory();
        config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
        config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
        config.diskCacheExtraOptions(480,null);
        config.tasksProcessingOrder(QueueProcessingType.LIFO);
//        config.writeDebugLogs(); // Remove for release app
        config.imageDownloader(new BaseImageDownloader(context,10 * 1000));
        config.threadPoolSize(1);
        // Initialize ImageLoader with configuration.
        ImageLoader.getInstance().init(config.build());
    }
项目:commonadapter    文件:MultiImageActivity.java   
/**
 * 初始化UniversalImageLoader
 */
private void configUniversalImageLoader() {
    displayImageOptions defaultOptions = new displayImageOptions.Builder()
            .cacheInMemory().cacheOndisc()
            .bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapdisplayer(500))
            .build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).
            diskCacheFileCount(500)
            .diskCacheSize(50 * 1024 * 1024).
                    imageDownloader(new BaseImageDownloader(this,10 * 1000,20 * 1000))
            .memoryCacheSize((int) Runtime.getRuntime().maxMemory() / 8)
            .defaultdisplayImageOptions(defaultOptions).build();
    ImageLoader.getInstance().init(config);
}
项目:Nepenthes-Android    文件:NeApp.java   
private void initConfig() {
    displayImageOptions localdisplayImageOptions = new displayImageOptions.Builder().cacheInMemory(true).cacheOndisk(true).build();
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory());
    //用最大内存的1/8来存储图片
    final int cacheSize = maxMemory / 8;
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .memoryCacheExtraOptions(W,H) // default = device screen dimensions
            .threadPoolSize(2) // default
            .threadPriority(Thread.norM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(cacheSize))
            .memoryCacheSize(cacheSize)
            .memoryCacheSizePercentage(13) // default
            .diskCache(new UnlimiteddiskCache(StorageUtils.getownCacheDirectory(getApplicationContext(),config.PATH.CHACHE_PATH))) // default
            .diskCacheSize(10 * 1024 * 1024)
            .diskCacheFileCount(100)//.writeDebugLogs()
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(getApplicationContext())) // default
            .defaultdisplayImageOptions(localdisplayImageOptions)
            .build();
    ImageLoader.getInstance().init(configuration);
}
项目:sNowdream-books-android    文件:MainApplication.java   
private void initimageLoader(){
        Context context = getApplicationContext();
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480,null)
                .threadPriority(Thread.norM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimiteddiscCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imagedecoder(new Baseimagedecoder(false)) // default
                .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
项目:sNowdream-jokes-android    文件:MainApplication.java   
private void initimageLoader(){
        Context context = getApplicationContext();
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480,null)
                .threadPriority(Thread.norM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimiteddiscCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imagedecoder(new Baseimagedecoder(false)) // default
                .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
项目:UltimateAndroid    文件:UniversalImageLoader.java   
public static ImageLoaderConfiguration.Builder getDefaultimageLoaderConfigurationBuilder(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
//                .memoryCacheExtraOptions(480,800) // default = device screen dimensions
//                .discCacheExtraOptions(480,Bitmap.CompressFormat.JPEG,75,null)
                .threadPoolSize(3) // default
                .threadPriority(Thread.norM_PRIORITY - 1) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
//                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
//                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .discCache(new UnlimiteddiscCache(cacheDir)) // default
//                .discCacheSize(50 * 1024 * 1024)
                .discCacheFileCount(1000)
                .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imagedecoder(new Baseimagedecoder(false)) // default
                        //   .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
                .defaultdisplayImageOptions(getDefaultimageOptions());
        return builder;
    }
项目:UltimateAndroid    文件:UniversalImageLoader.java   
/**
     * Get default ImageLoaderConfiguration.Builder,and you can easily change the builder.
     * @param context
     * @return
     */
    public static ImageLoaderConfiguration.Builder getDefaultimageLoaderConfigurationBuilder(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
//                .memoryCacheExtraOptions(480,null)
                .threadPoolSize(3) // default
                .threadPriority(Thread.norM_PRIORITY - 1) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
//                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
//                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimiteddiskCache(cacheDir)) // default
//                .discCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(1000)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imagedecoder(new Baseimagedecoder(false)) // default
                        //   .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
                .defaultdisplayImageOptions(getDefaultimageOptions());
        return builder;
    }
项目:android-imageviewer    文件:MainApplication.java   
public static void initimageLoader(Context context) {
    File cacheDir = StorageUtils.getCacheDirectory(context);
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480,800) // default = device screen dimensions
            .denyCacheImageMultipleSizesInMemory()
            .discCacheExtraOptions(480,null)
            .threadPriority(Thread.norM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .discCache(new UnlimiteddiscCache(cacheDir)) // default
            .discCacheSize(50 * 1024 * 1024)
            .discCacheFileCount(100)
            .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(context)) // default
            .imagedecoder(new Baseimagedecoder(true)) // default
            .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
            .writeDebugLogs()
            .build();

    ImageLoader.getInstance().init(config);
}
项目:publicProject    文件:JRYGApplaction.java   
/**
     * @return void
     * @Title: initimageLoader
     * @Description: Todo
     */
    private void initimageLoader() {
        displayImageOptions imageOptions = new displayImageOptions.Builder()
                .showImageOnLoading(R.drawable.default_background)
                .showImageOnFail(R.drawable.default_background)
                .cacheInMemory(true).cacheOndisk(true)
                .resetViewBeforeLoading(true).considerExifParams(false)
                .bitmapConfig(Bitmap.Config.RGB_565).build();
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
                .memoryCacheExtraOptions(480,800)
                .diskCacheExtraOptions(480,null)
                .threadPoolSize(5)
                .threadPriority(Thread.norM_PRIORITY)
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(10)
//                .diskCache(
//                        new UnlimiteddiscCache(StorageUtils.getCacheDirectory(
//                                this,true)))
                .diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator())
                .imageDownloader(new BaseImageDownloader(this))
                .imagedecoder(new Baseimagedecoder(false))
                .defaultdisplayImageOptions(displayImageOptions.createSimple())
                .defaultdisplayImageOptions(imageOptions).build();
        ImageLoader.getInstance().init(config);
    }
项目:mobile-store    文件:ImageLoaderForUIL.java   
@Override
public InputStream getStream(String imageUri,Object extra) throws IOException {
    switch (Scheme.ofUri(imageUri)) {
        case ASSETS:
            return context.getAssets().open(Scheme.ASSETS.crop(imageUri));

        case DRAWABLE:
            return new BaseImageDownloader(context).getStream(imageUri,extra);

        default:
            return DownloaderFactory.create(context,imageUri).getInputStream();
    }
}
项目:TYT    文件:MyApplication.java   
/**
 * 初始化ImageLoader
 */
public static void initimageLoader(Context context) {
    // 哪个地方想要清除自定义路径下的缓存,就在那里调用这个方法
    //  ImageLoader.getInstance().cleardiscCache(); // 清除自定义的ImageLoader缓存的图片

    // 自定义的缓存路径ImageLoaderCache:sdcard/picture/ImageLoaderCache ,属于外部缓存
    File cacheDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),"ImageLoaderCache");
    if (!cacheDir.exists()) {
        cacheDir.mkdir();
    }

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480,max height,即保存的每个缓存文件的最大长宽
            .threadPoolSize(3).threadPriority(Thread.norM_PRIORITY - 2)//线程池内加载的数量
            .denyCacheImageMultipleSizesInMemory()
            //.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) //你可以通过自己的内存缓存实现,那么getCache()就能获取到缓存图片,在data/data/xxx.xxx.xxx/cache 文件夹下
            //.memoryCacheSize(2 * 1024 * 1024)  // 内存缓存大小
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .diskCacheFileCount(100) //缓存图片的个数
            .discCache(new UnlimiteddiscCache(cacheDir))// 自定义缓存路径 ,这个注释的话,就没有自定的缓存了,不过还可以设置内部缓存
            .defaultdisplayImageOptions(displayImageOptions.createSimple())
            .imageDownloader(new BaseImageDownloader(context,readTimeout (30 s)超时时间
            .writeDebugLogs() // Remove for releaseapp
            .build();//开始构建
    ImageLoader.getInstance().init(config);

}
项目:boohee_v5.6    文件:TopicActivity.java   
private void initNotice() {
    if (this.mTopicNotice == null || this.mTopicNotice.size() == 0) {
        this.vfNotice.setVisibility(8);
        return;
    }
    int marginTop = 48;
    if (this.mTopic.choice) {
        marginTop = 56;
    } else {
        ((LayoutParams) this.vfNotice.getLayoutParams()).bottomMargin = 0;
    }
    this.mHeaderHeight += ViewUtils.dip2px(this.ctx,(float) marginTop);
    ViewCompat.setTranslationY(this.frameContent,(float) this.mHeaderHeight);
    this.vfNotice.removeAllViews();
    for (final TopicNotice notice : this.mTopicNotice) {
        View itemNotice = LayoutInflater.from(this).inflate(R.layout.jg,null);
        TextView title = (TextView) itemNotice.findViewById(R.id.tv_title);
        this.imageLoader.displayImage(notice.icon_url,(ImageView) itemNotice.findViewById(R
                .id.iv_icon),ImageLoaderOptions.global(new ColorDrawable(866805452)));
        title.setText(notice.title);
        itemNotice.setonClickListener(new OnClickListener() {
            public void onClick(View v) {
                BooheeScheme.handleUrl(TopicActivity.this.ctx,notice.url);
            }
        });
        this.vfNotice.addView(itemNotice);
    }
    this.vfNotice.setFlipInterval(BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT);
    this.vfNotice.startFlipping();
}
项目:boohee_v5.6    文件:DnspodFree.java   
public Record[] resolve(Domain domain,NetworkInfo info) throws IOException {
    HttpURLConnection httpConn = (HttpURLConnection) new URL("http://119.29.29" +
            ".29/d?ttl=1&dn=" + domain.domain).openConnection();
    httpConn.setConnectTimeout(BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT);
    httpConn.setReadTimeout(10000);
    if (httpConn.getResponseCode() != 200) {
        return null;
    }
    int length = httpConn.getContentLength();
    if (length <= 0 || length > 1024) {
        return null;
    }
    InputStream is = httpConn.getInputStream();
    byte[] data = new byte[length];
    int read = is.read(data);
    is.close();
    if (read <= 0) {
        return null;
    }
    String[] r1 = new String(data,read).split(",");
    if (r1.length != 2) {
        return null;
    }
    try {
        int ttl = Integer.parseInt(r1[1]);
        String[] ips = r1[0].split(com.boohee.one.http.DnspodFree.IP_SPLIT);
        if (ips.length == 0) {
            return null;
        }
        Record[] records = new Record[ips.length];
        long time = System.currentTimeMillis() / 1000;
        for (int i = 0; i < ips.length; i++) {
            records[i] = new Record(ips[i],1,ttl,time);
        }
        return records;
    } catch (Exception e) {
        return null;
    }
}
项目:boohee_v5.6    文件:HttpClientStack.java   
public HttpResponse performRequest(Request<?> request,Map<String,String> additionalHeaders) throws IOException,AuthFailureError {
    HttpUriRequest httpRequest = createHttpRequest(request,additionalHeaders);
    addHeaders(httpRequest,request.getHeaders());
    onPrepareRequest(httpRequest);
    HttpParams httpParams = httpRequest.getParams();
    int timeoutMs = request.getTimeoutMs();
    httpconnectionParams.setConnectionTimeout(httpParams,BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT);
    httpconnectionParams.setSoTimeout(httpParams,timeoutMs);
    return this.mClient.execute(httpRequest);
}
项目:com.giants.multiimagespicker    文件:AppContext.java   
public static void initimageLoader(Context context) {
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
    config.threadPriority(Thread.norM_PRIORITY);
    config.denyCacheImageMultipleSizesInMemory();
    config.memoryCacheSize((int) Runtime.getRuntime().maxMemory() / 4);
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(100 * 1024 * 1024); // 100 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    //修改连接超时时间5秒,下载超时时间5秒
    config.imageDownloader(new BaseImageDownloader(appContext,5 * 1000));
    //      config.writeDebugLogs(); // Remove for release app
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());
}
项目:VideoRecord    文件:MyApplication.java   
private void initimageLoader() {
    File cacheDir = FileUtil.getCacheDirectory(this,FilePathConfig.PATH_IMAGEDOWNLOADER);

    displayImageOptions options = new displayImageOptions.Builder()
            .showImageOnLoading(R.drawable.default_imageview_background) // resource or drawable
            .showImageForEmptyUri(R.drawable.default_imageview_background) // resource or drawable
            .showImageOnFail(R.drawable.default_imageview_background) // resource or drawable
            .resetViewBeforeLoading(false)  // default
            .delayBeforeLoading(200)
            .cacheInMemory(true)
            .cacheOndisk(true)
            .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default
            .bitmapConfig(Bitmap.Config.ARGB_8888) // default
            .displayer(new SimpleBitmapdisplayer()) // default
            .build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .memoryCacheExtraOptions(480,null)
            .threadPoolSize(3) // default
            .threadPriority(Thread.norM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(20 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .diskCache(new UnlimiteddiskCache(cacheDir)) // default
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(getApplicationContext())) // default
            .imagedecoder(new Baseimagedecoder(false)) // default
            .defaultdisplayImageOptions(options)
            .build();
    ImageLoader.getInstance().init(config);
}
项目:BigApp_discuz_Android    文件:ImageUtils.java   
/**
     * 初始化 ImageLoader
     *
     * @param context
     */
    public static ImageLoader initimageLoader(Context context) {

        displayImageOptions options = getDefaultdisplayImageOptions();

        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                context.getApplicationContext())
                .threadPoolSize(10)
                .threadPriority(Thread.norM_PRIORITY - 2)
                .tasksProcessingOrder(QueueProcessingType.FIFO)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new UsingFreqLimitedMemoryCache(3 * 1024 * 1024))
                .discCache(new UnlimiteddiskCache(getDefaultCacheDir()))
                .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
                .imageDownloader(
                        new BaseImageDownloader(context.getApplicationContext()))
                .defaultdisplayImageOptions(options)
//                .writeDebugLogs()
                .build();


        ImageLoader imageLoader = ImageLoader.getInstance();
        imageLoader.init(config);

        return imageLoader;

    }
项目:BigApp_discuz_Android    文件:ImageUtils.java   
/**
     * 初始化 ImageLoader
     *
     * @param context
     */
    public static ImageLoader initNoCacheImageLoader(Context context) {



        displayImageOptions options = new displayImageOptions.Builder()
                .resetViewBeforeLoading(false).delayBeforeLoading(100)
                .considerExifParams(false)
                .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
                .bitmapConfig(Bitmap.Config.RGB_565)
                .displayer(new SimpleBitmapdisplayer()).handler(new Handler())
                .cacheInMemory(false).cacheOndisk(false)
//                .showImageForEmptyUri(R.drawable.default_pic)
//                .showImageOnFail(R.drawable.default_pic)
                .build();


        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                context.getApplicationContext())
                .threadPoolSize(10)
                .threadPriority(Thread.norM_PRIORITY - 2)
                .tasksProcessingOrder(QueueProcessingType.FIFO)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new UsingFreqLimitedMemoryCache(3 * 1024 * 1024))
                .imageDownloader(
                        new BaseImageDownloader(context.getApplicationContext()))
                .defaultdisplayImageOptions(options)
//                .writeDebugLogs()
                .build();


        ImageLoader imageLoader = ImageLoader.getInstance();
        imageLoader.init(config);

        return imageLoader;

    }
项目:BigApp_discuz_Android    文件:ImageBaseUtils.java   
/**
     * 初始化 ImageLoader
     *
     * @param context
     */
    public static ImageLoader initimageLoader(Context context) {

        displayImageOptions options = getDefaultdisplayImageOptions();

        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                context.getApplicationContext())
                .threadPoolSize(10)
                .threadPriority(Thread.norM_PRIORITY - 2)
                .tasksProcessingOrder(QueueProcessingType.FIFO)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new UsingFreqLimitedMemoryCache(3 * 1024 * 1024))
                .discCache(new UnlimiteddiskCache(getDefaultimageCacheDir()))
                .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
                .imageDownloader(
                        new BaseImageDownloader(context.getApplicationContext()))
                .defaultdisplayImageOptions(options)
//                .writeDebugLogs()
                .build();


        ImageLoader imageLoader = ImageLoader.getInstance();
        imageLoader.init(config);

        return imageLoader;

    }
项目:BigApp_discuz_Android    文件:ImageLibUitls.java   
/**
     * 初始化 ImageLoader
     *
     * @param context
     */
    public static ImageLoader initimageLoader(Context context,File cacheDir,Drawable drawableEmpty,Drawable drawableFail) {

        displayImageOptions options = getdisplayImageOptions(drawableEmpty,drawableFail);


        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                context.getApplicationContext())
                .threadPoolSize(10)
                .threadPriority(Thread.norM_PRIORITY - 2)
                .tasksProcessingOrder(QueueProcessingType.FIFO)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new UsingFreqLimitedMemoryCache(3 * 1024 * 1024))
                .discCache(new UnlimiteddiskCache(cacheDir))
                .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
                .imageDownloader(
                        new BaseImageDownloader(context.getApplicationContext()))
                .defaultdisplayImageOptions(options)
//                .writeDebugLogs()
                .build();


        ImageLoader imageLoader = ImageLoader.getInstance();
        imageLoader.init(config);

        return imageLoader;

    }
项目:AndroidFFmpegCMDTool    文件:MyApplication.java   
private void initimageLoader() {
    File cacheDir = FileUtil.getCacheDirectory(this,null)
            .threadPoolSize(3) // default
            .threadPriority(Thread.norM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(20 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .diskCache(new UnlimiteddiskCache(cacheDir)) // default
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(getApplicationContext())) // default
            .imagedecoder(new Baseimagedecoder(false)) // default
            .defaultdisplayImageOptions(options)
            .build();
    ImageLoader.getInstance().init(config);
}
项目:android.java    文件:AGApplication.java   
private ImageLoaderConfiguration getLoaderConfig() {
    return new ImageLoaderConfiguration.Builder(this)
            .memoryCacheExtraOptions(320,600)
            .threadPoolSize(4)
            .threadPriority(Thread.norM_PRIORITY - 1)
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(20 * 1024 * 1024))
            .diskCacheSize(20 * 1024 * 1024)
            .diskCacheFileNameGenerator(new Md5FileNameGenerator())
            .imageDownloader(new BaseImageDownloader(this))
            .imagedecoder(new Baseimagedecoder(true))
            .defaultdisplayImageOptions(getoptions())
            .build();
}
项目:meipaiAll    文件:MyApplication.java   
private void initimageLoaderConfig() {
    /**
     * universal image loader 配置文件
     */
    @SuppressWarnings("deprecation")
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(180,320)
            // max width,max height,即保存的每个缓存文件的最大长宽
            // .discCacheExtraOptions(180,320,null)
            // 设置缓存的详细信息,最好不要设置这个
            .threadPoolSize(3)
                    // 线程池内加载的数量 推荐1-5
            .threadPriority(Thread.norM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
            .memoryCache(new WeakMemoryCache())
                    // implementation/你可以通过自己的内存缓存实现
            .memoryCacheSize(2 * 1024 * 1024).discCacheSize(50 * 1024 * 1024)
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
                    // 将保存的时候的URI名称用MD5 加密
            .tasksProcessingOrder(QueueProcessingType.LIFO).discCacheFileCount(100)
                    // 缓存的文件数量
            .discCache(
                    new UnlimiteddiscCache(new File(Environment.getExternalStorageDirectory() + "/myApp/imgCache")))
                    // 自定义缓存路径
            .defaultdisplayImageOptions(getdisplayOptions())
            .imageDownloader(new BaseImageDownloader(this,30 * 1000)).writeDebugLogs() // Remove
                    // for
                    // release
                    // app
            .build();// 开始构建
    com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);

}
项目:AndroidImagebrowser    文件:UILImagePagerAdapter.java   
/**
 * 初始化ImageLoader
 * 
 * @param context
 */
private static void initimageLoader(Context context) {
    if (sConfig != null) {
        return;
    }

    File cacheDir = StorageUtils.getCacheDirectory(context);
    sConfig = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480,800)
            // default = device screen dimensions
            .denyCacheImageMultipleSizesInMemory()
            .threadPriority(Thread.norM_PRIORITY - 2)
            // default
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(10 * 1024 * 1024))
            .memoryCacheSize(10 * 1024 * 1024)
            .memoryCacheSizePercentage(13)
            .diskCache(new UnlimiteddiskCache(cacheDir))
            // default
            .diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(context)) // default
            .imagedecoder(new Baseimagedecoder(true)) // default
            .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
            .writeDebugLogs().build();

    ImageLoader.getInstance().init(sConfig);
}
项目:android-kit-old    文件:AppUtils.java   
/**
 * initial Universal ImageLoader
 *
 * @param applicationContext
 */
public static void initimageLoader(Context applicationContext) {
    File cacheDir = null;
    if (FileSystem.available())
        cacheDir = StorageUtils.getownCacheDirectory(applicationContext,FileSystem.getDirectoryPath(DefaultFileDirectoryContext.FILE_DIRECTORY_TYPE_PICTURE));
    else
        cacheDir = StorageUtils.getCacheDirectory(applicationContext);
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(applicationContext)
            .memoryCacheExtraOptions(480,null)
            .threadPoolSize(3) // default
            .threadPriority(Thread.norM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .diskCache(new UnlimiteddiscCache(cacheDir)) // default
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(applicationContext)) // default
            .imagedecoder(new Baseimagedecoder(true)) // default
            .defaultdisplayImageOptions(displayImageOptions.createSimple()) // default
            .writeDebugLogs()
            .build();
    ImageLoader.getInstance().init(config);
}
项目:Beautygallery    文件:BeautygalleryApp.java   
private void initimageLoader() {
    File cacheDir = new File(CACHE_DIR);
    if (!cacheDir.exists()) {
        cacheDir.mkdirs();
    }
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(
            getApplicationContext())
            .memoryCacheExtraOptions(480,800)
            // max width,max height,即保存的每个缓存文件的最大长宽
            .threadPoolSize(3)
            // 线程池内加载的数量
            .threadPriority(Thread.norM_PRIORITY - 2)
            // .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(8 * 1024 * 1024))
            // You can pass your own memory cache
            // implementation/你可以通过自己的内存缓存实现
            .memoryCacheSize(8 * 1024 * 1024)
            .discCacheSize(50 * 1024 * 1024)
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            // 将保存的时候的URI名称用MD5 加密
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .discCacheFileCount(500)
            // 缓存的文件数量
            .discCache(new UnlimiteddiskCache(cacheDir))
            // 自定义缓存路径
            .defaultdisplayImageOptions(displayImageOptions.createSimple())
            .imageDownloader(
                    new BaseImageDownloader(getApplicationContext(),30 * 1000))// .writeDebugLogs()
            .build();// 开始构建
    ImageLoaderUtil.setConfiguration(configuration);
    ImageLoaderUtil.getInstance().init(getApplicationContext());
}
项目:Jiemian    文件:JMApplication.java   
private void initimageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .threadPriority(Thread.norM_PRIORITY - 1)
            .denyCacheImageMultipleSizesInMemory()
            .defaultdisplayImageOptions(getoptions())
            .threadPoolSize(3)
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .imageDownloader(new BaseImageDownloader(getApplicationContext()))
            .memoryCache(new LruMemoryCache(5 * 1024 * 1024))
            .memoryCacheSize(5 * 1024 * 1024)
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .build();
    ImageLoader.getInstance().init(config);
}
项目:fdroidclient    文件:ImageLoaderForUIL.java   
@Override
public InputStream getStream(String imageUri,imageUri).getInputStream();
    }
}

关于DEDECMS新闻模型整合download功能,可判断点数,会员组等download权限新闻模块html的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于android – 未知的URL内容:// downloads / my_downloads、com.intellij.util.download.DownloadableFileDescription的实例源码、com.intellij.util.download.FileDownloader的实例源码、com.nostra13.universalimageloader.core.download.BaseImageDownloader的实例源码的相关信息,请在本站寻找。

本文标签: