当前位置: 首页>>代码示例>>Java>>正文


Java IDownloaderClient.STATE_FAILED_CANCELED属性代码示例

本文整理汇总了Java中com.google.android.vending.expansion.downloader.IDownloaderClient.STATE_FAILED_CANCELED属性的典型用法代码示例。如果您正苦于以下问题:Java IDownloaderClient.STATE_FAILED_CANCELED属性的具体用法?Java IDownloaderClient.STATE_FAILED_CANCELED怎么用?Java IDownloaderClient.STATE_FAILED_CANCELED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.vending.expansion.downloader.IDownloaderClient的用法示例。


在下文中一共展示了IDownloaderClient.STATE_FAILED_CANCELED属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
    Log.i("APKExpansionDownloader", "DownloadStateChanged: " + newState);
    switch (newState) {
    // Download success
    case IDownloaderClient.STATE_COMPLETED:
        mDownloadProgressDlg.success();
        break;
    // Download failure
    case IDownloaderClient.STATE_FAILED_CANCELED:
    case IDownloaderClient.STATE_FAILED_FETCHING_URL:
    case IDownloaderClient.STATE_FAILED_UNLICENSED:
    case IDownloaderClient.STATE_FAILED:
        mDownloadProgressDlg.failed();
        break;
    // Download paused
    case IDownloaderClient.STATE_PAUSED_NEED_CELLULAR_PERMISSION:
    case IDownloaderClient.STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION:
    case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
    case IDownloaderClient.STATE_PAUSED_ROAMING:
    case IDownloaderClient.STATE_PAUSED_SDCARD_UNAVAILABLE:
        mDownloadProgressDlg.paused();
        break;
    // Download resume (do nothing)
    case IDownloaderClient.STATE_IDLE:
    case IDownloaderClient.STATE_CONNECTING:
    case IDownloaderClient.STATE_FETCHING_URL:
    case IDownloaderClient.STATE_DOWNLOADING:
        break;
    // unknown state (do nothing)
    default:
        break;
    }
}
 
开发者ID:cclink,项目名称:ObbDownloadHelper,代码行数:34,代码来源:ObbDownloadHelper.java

示例2: onDownloadStateChanged

/**
 * The download state should trigger changes in the UI --- it may be useful
 * to show the state as being indeterminate at times. This sample can be
 * considered a guideline.
 */
@Override
public void onDownloadStateChanged(int newState) {
    setState(newState);
    boolean showDashboard = true;
    boolean showCellMessage = false;
    boolean paused;
    boolean indeterminate;
    switch (newState) {
        case IDownloaderClient.STATE_IDLE:
            // STATE_IDLE means the service is listening, so it's
            // safe to start making calls via mRemoteService.
            paused = false;
            indeterminate = true;
            break;
        case IDownloaderClient.STATE_CONNECTING:
        case IDownloaderClient.STATE_FETCHING_URL:
            showDashboard = true;
            paused = false;
            indeterminate = true;
            break;
        case IDownloaderClient.STATE_DOWNLOADING:
            paused = false;
            showDashboard = true;
            indeterminate = false;
            break;

        case IDownloaderClient.STATE_FAILED_CANCELED:
        case IDownloaderClient.STATE_FAILED:
        case IDownloaderClient.STATE_FAILED_FETCHING_URL:
        case IDownloaderClient.STATE_FAILED_UNLICENSED:
            paused = true;
            showDashboard = false;
            indeterminate = false;
            break;
        case IDownloaderClient.STATE_PAUSED_NEED_CELLULAR_PERMISSION:
        case IDownloaderClient.STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION:
            showDashboard = false;
            paused = true;
            indeterminate = false;
            showCellMessage = true;
            break;

        case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
            paused = true;
            indeterminate = false;
            break;
        case IDownloaderClient.STATE_PAUSED_ROAMING:
        case IDownloaderClient.STATE_PAUSED_SDCARD_UNAVAILABLE:
            paused = true;
            indeterminate = false;
            break;
        case IDownloaderClient.STATE_COMPLETED:
            showDashboard = false;
            paused = false;
            indeterminate = false;
            validateXAPKZipFiles();
            return;
        default:
            paused = true;
            indeterminate = true;
            showDashboard = true;
    }
    int newDashboardVisibility = showDashboard ? View.VISIBLE : View.GONE;
    if (mDashboard.getVisibility() != newDashboardVisibility) {
        mDashboard.setVisibility(newDashboardVisibility);
    }
    int cellMessageVisibility = showCellMessage ? View.VISIBLE : View.GONE;
    if (mCellMessage.getVisibility() != cellMessageVisibility) {
        mCellMessage.setVisibility(cellMessageVisibility);
    }

    mPB.setIndeterminate(indeterminate);
    setButtonPausedState(paused);
}
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:79,代码来源:DownloaderActivity.java

示例3: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
    if (null != mClientProxy) {
        mClientProxy.onDownloadStateChanged(newState);
    }
    if (newState != mState) {
        mState = newState;
        if (newState == IDownloaderClient.STATE_IDLE || null == mContentIntent) {
            return;
        }
        int stringDownloadID;
        int iconResource;
        boolean ongoingEvent;

        // get the new title string and paused text
        switch (newState) {
            case 0:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getStringResource(mContext, "state_unknown");
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_DOWNLOADING:
                iconResource = android.R.drawable.stat_sys_download;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_FETCHING_URL:
            case IDownloaderClient.STATE_CONNECTING:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_COMPLETED:
            case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_FAILED:
            case IDownloaderClient.STATE_FAILED_CANCELED:
            case IDownloaderClient.STATE_FAILED_FETCHING_URL:
            case IDownloaderClient.STATE_FAILED_SDCARD_FULL:
            case IDownloaderClient.STATE_FAILED_UNLICENSED:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = false;
                break;

            default:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = true;
                break;
        }

        mCurrentText = mContext.getString(stringDownloadID);
        mCurrentTitle = mLabel;
        mCurrentBuilder.setTicker(mLabel + ": " + mCurrentText);
        mCurrentBuilder.setSmallIcon(iconResource);
        mCurrentBuilder.setContentTitle(mCurrentTitle);
        mCurrentBuilder.setContentText(mCurrentText);
        if (ongoingEvent) {
            mCurrentBuilder.setOngoing(true);
        } else {
            mCurrentBuilder.setOngoing(false);
            mCurrentBuilder.setAutoCancel(true);
        }
        mNotificationManager.notify(NOTIFICATION_ID, mCurrentBuilder.build());
    }
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:74,代码来源:DownloadNotification.java

示例4: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
    if (null != mClientProxy) {
        mClientProxy.onDownloadStateChanged(newState);
    }
    if (newState != mState) {
        mState = newState;
        if (newState == IDownloaderClient.STATE_IDLE || null == mContentIntent) {
            return;
        }
        int stringDownloadID;
        int iconResource;
        boolean ongoingEvent;

        // get the new title string and paused text
        switch (newState) {
            case 0:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = R.string.state_unknown;
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_DOWNLOADING:
                iconResource = android.R.drawable.stat_sys_download;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_FETCHING_URL:
            case IDownloaderClient.STATE_CONNECTING:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_COMPLETED:
            case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_FAILED:
            case IDownloaderClient.STATE_FAILED_CANCELED:
            case IDownloaderClient.STATE_FAILED_FETCHING_URL:
            case IDownloaderClient.STATE_FAILED_SDCARD_FULL:
            case IDownloaderClient.STATE_FAILED_UNLICENSED:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            default:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;
        }
        mCurrentText = mContext.getString(stringDownloadID);
        mCurrentTitle = mLabel.toString();
        mCurrentNotification.tickerText = mLabel + ": " + mCurrentText;
        mCurrentNotification.icon = iconResource;
        mCurrentNotification.setLatestEventInfo(mContext, mCurrentTitle, mCurrentText,
                mContentIntent);
        if (ongoingEvent) {
            mCurrentNotification.flags |= Notification.FLAG_ONGOING_EVENT;
        } else {
            mCurrentNotification.flags &= ~Notification.FLAG_ONGOING_EVENT;
            mCurrentNotification.flags |= Notification.FLAG_AUTO_CANCEL;
        }
        mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
    }
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:73,代码来源:DownloadNotification.java

示例5: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
    if (null != mClientProxy) {
        mClientProxy.onDownloadStateChanged(newState);
    }
    if (newState != mState) {
        mState = newState;
        if (newState == IDownloaderClient.STATE_IDLE || null == mContentIntent) {
            return;
        }
        int stringDownloadID;
        int iconResource;
        boolean ongoingEvent;

        // get the new title string and paused text
        switch (newState) {
            case 0:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = R.string.state_unknown;
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_DOWNLOADING:
                iconResource = android.R.drawable.stat_sys_download;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_FETCHING_URL:
            case IDownloaderClient.STATE_CONNECTING:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_COMPLETED:
            case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_FAILED:
            case IDownloaderClient.STATE_FAILED_CANCELED:
            case IDownloaderClient.STATE_FAILED_FETCHING_URL:
            case IDownloaderClient.STATE_FAILED_SDCARD_FULL:
            case IDownloaderClient.STATE_FAILED_UNLICENSED:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            default:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;
        }

        mCurrentText = mContext.getString(stringDownloadID);
        mCurrentTitle = mLabel;
        mCurrentBuilder.setTicker(mLabel + ": " + mCurrentText);
        mCurrentBuilder.setSmallIcon(iconResource);
        mCurrentBuilder.setContentTitle(mCurrentTitle);
        mCurrentBuilder.setContentText(mCurrentText);
        if (ongoingEvent) {
            mCurrentBuilder.setOngoing(true);
        } else {
            mCurrentBuilder.setOngoing(false);
            mCurrentBuilder.setAutoCancel(true);
        }
        mNotificationManager.notify(NOTIFICATION_ID, mCurrentBuilder.build());
    }
}
 
开发者ID:google,项目名称:play-apk-expansion,代码行数:74,代码来源:DownloadNotification.java

示例6: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
    if (null != mClientProxy) {
        mClientProxy.onDownloadStateChanged(newState);
    }
    if (newState != mState) {
        mState = newState;
        if (newState == IDownloaderClient.STATE_IDLE || null == mContentIntent) {
            return;
        }
        int stringDownloadID;
        int iconResource;
        boolean ongoingEvent;

        // get the new title string and paused text
        switch (newState) {
            case 0:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = R.string.state_unknown;
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_DOWNLOADING:
                iconResource = android.R.drawable.stat_sys_download;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_FETCHING_URL:
            case IDownloaderClient.STATE_CONNECTING:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_COMPLETED:
            case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_FAILED:
            case IDownloaderClient.STATE_FAILED_CANCELED:
            case IDownloaderClient.STATE_FAILED_FETCHING_URL:
            case IDownloaderClient.STATE_FAILED_SDCARD_FULL:
            case IDownloaderClient.STATE_FAILED_UNLICENSED:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            default:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;
        }
        mCurrentText = mContext.getString(stringDownloadID);
        mCurrentTitle = mLabel.toString();
        mCurrentNotification.setTicker(mLabel + ": " + mCurrentText);
        mCurrentNotification.setSmallIcon(iconResource);
        mCurrentNotification.setContentTitle(mCurrentTitle);
        mCurrentNotification.setContentText(mCurrentText);
        mCurrentNotification.setContentIntent(mContentIntent);
        if (ongoingEvent) {
            mCurrentNotification.setOngoing(true);
        } else {
            mCurrentNotification.setOngoing(false);
            mCurrentNotification.setAutoCancel(true);
        }
        mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification.build());
    }
}
 
开发者ID:thomasuster,项目名称:android-expansion,代码行数:74,代码来源:DownloadNotification.java

示例7: onDownloadStateChanged

@SuppressWarnings("deprecation")
@Override
   public void onDownloadStateChanged(int newState) {
       if (null != mClientProxy) {
           mClientProxy.onDownloadStateChanged(newState);
       }
       if (newState != mState) {
           mState = newState;
           if (newState == IDownloaderClient.STATE_IDLE || null == mContentIntent) {
               return;
           }
           int stringDownloadID;
           int iconResource;
           boolean ongoingEvent;

           // get the new title string and paused text
           switch (newState) {
               case 0:
                   iconResource = android.R.drawable.stat_sys_warning;
                   stringDownloadID = R.string.state_unknown;
                   ongoingEvent = false;
                   break;

               case IDownloaderClient.STATE_DOWNLOADING:
                   iconResource = android.R.drawable.stat_sys_download;
                   stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                   ongoingEvent = true;
                   break;

               case IDownloaderClient.STATE_FETCHING_URL:
               case IDownloaderClient.STATE_CONNECTING:
                   iconResource = android.R.drawable.stat_sys_download_done;
                   stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                   ongoingEvent = true;
                   break;

               case IDownloaderClient.STATE_COMPLETED:
               case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
                   iconResource = android.R.drawable.stat_sys_download_done;
                   stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                   ongoingEvent = false;
                   break;

               case IDownloaderClient.STATE_FAILED:
               case IDownloaderClient.STATE_FAILED_CANCELED:
               case IDownloaderClient.STATE_FAILED_FETCHING_URL:
               case IDownloaderClient.STATE_FAILED_SDCARD_FULL:
               case IDownloaderClient.STATE_FAILED_UNLICENSED:
                   iconResource = android.R.drawable.stat_sys_warning;
                   stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                   ongoingEvent = false;
                   break;

               default:
                   iconResource = android.R.drawable.stat_sys_warning;
                   stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                   ongoingEvent = true;
                   break;
           }
           mCurrentText = mContext.getString(stringDownloadID);
           mCurrentTitle = mLabel.toString();
           mCurrentNotification.tickerText = mLabel + ": " + mCurrentText;
           mCurrentNotification.icon = iconResource;
           mCurrentNotification.setLatestEventInfo(mContext, mCurrentTitle, mCurrentText,
                   mContentIntent);
           if (ongoingEvent) {
               mCurrentNotification.flags |= Notification.FLAG_ONGOING_EVENT;
           } else {
               mCurrentNotification.flags &= ~Notification.FLAG_ONGOING_EVENT;
               mCurrentNotification.flags |= Notification.FLAG_AUTO_CANCEL;
           }
           mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
       }
   }
 
开发者ID:CmdrStardust,项目名称:Alite,代码行数:74,代码来源:DownloadNotification.java

示例8: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
    if (null != mClientProxy) {
        mClientProxy.onDownloadStateChanged(newState);
    }
    if (newState != mState) {
        mState = newState;
        if (newState == IDownloaderClient.STATE_IDLE || null == mContentIntent) {
            return;
        }
        int stringDownloadID;
        int iconResource;
        boolean ongoingEvent;

        // get the new title string and paused text
        switch (newState) {
            case 0:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getStringResource(mContext, "state_unknown");
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_DOWNLOADING:
                iconResource = android.R.drawable.stat_sys_download;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_FETCHING_URL:
            case IDownloaderClient.STATE_CONNECTING:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_COMPLETED:
            case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_FAILED:
            case IDownloaderClient.STATE_FAILED_CANCELED:
            case IDownloaderClient.STATE_FAILED_FETCHING_URL:
            case IDownloaderClient.STATE_FAILED_SDCARD_FULL:
            case IDownloaderClient.STATE_FAILED_UNLICENSED:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = false;
                break;

            default:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(mContext, newState);
                ongoingEvent = true;
                break;
        }

        mCurrentText = mContext.getString(stringDownloadID);
        mCurrentTitle = mLabel;
        mCurrentBuilder.setTicker(mLabel + ": " + mCurrentText)
        .setSmallIcon(iconResource)
        .setContentTitle(mCurrentTitle)
        .setContentText(mCurrentText);
        if (ongoingEvent) {
            mCurrentBuilder.setOngoing(true);
        } else {
            mCurrentBuilder.setOngoing(false);
            mCurrentBuilder.setAutoCancel(true);
        }
        Notification notification;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            notification = mCurrentBuilder.build();
        } else {
            notification = mCurrentBuilder.getNotification();
        }
        mNotificationManager.notify(NOTIFICATION_ID, notification);
    }
}
 
开发者ID:Over17,项目名称:UnityOBBDownloader,代码行数:80,代码来源:DownloadNotification.java

示例9: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
    if (null != mClientProxy) {
        mClientProxy.onDownloadStateChanged(newState);
    }
    if (newState != mState) {
        mState = newState;
        if (newState == IDownloaderClient.STATE_IDLE || null == mContentIntent) {
            return;
        }
        int stringDownloadID;
        int iconResource;
        boolean ongoingEvent;

        // get the new title string and paused text
        switch (newState) {
            case 0:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = R.string.state_unknown;
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_DOWNLOADING:
                iconResource = android.R.drawable.stat_sys_download;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_FETCHING_URL:
            case IDownloaderClient.STATE_CONNECTING:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;

            case IDownloaderClient.STATE_COMPLETED:
            case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
                iconResource = android.R.drawable.stat_sys_download_done;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            case IDownloaderClient.STATE_FAILED:
            case IDownloaderClient.STATE_FAILED_CANCELED:
            case IDownloaderClient.STATE_FAILED_FETCHING_URL:
            case IDownloaderClient.STATE_FAILED_SDCARD_FULL:
            case IDownloaderClient.STATE_FAILED_UNLICENSED:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = false;
                break;

            default:
                iconResource = android.R.drawable.stat_sys_warning;
                stringDownloadID = Helpers.getDownloaderStringResourceIDFromState(newState);
                ongoingEvent = true;
                break;
        }
        mCurrentText = mContext.getString(stringDownloadID);
        mCurrentTitle = mLabel.toString();
        mCurrentNotification.tickerText = mLabel + ": " + mCurrentText;
        mCurrentNotification.icon = iconResource;
        
       // mCurrentNotification.setLatestEventInfo(mContext, mCurrentTitle, mCurrentText,
         //       mContentIntent);
        mCurrentNotification.contentIntent = mContentIntent;
        if (ongoingEvent) {
            mCurrentNotification.flags |= Notification.FLAG_ONGOING_EVENT;
        } else {
            mCurrentNotification.flags &= ~Notification.FLAG_ONGOING_EVENT;
            mCurrentNotification.flags |= Notification.FLAG_AUTO_CANCEL;
        }
        mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
    }
}
 
开发者ID:StoryMaker,项目名称:storypath,代码行数:75,代码来源:DownloadNotification.java

示例10: onDownloadStateChanged

@Override
public void onDownloadStateChanged(int newState) {
       setState(newState);
       boolean showDashboard = true;
       boolean showCellMessage = false;
       boolean paused;
       boolean indeterminate;
       switch (newState) {
           case IDownloaderClient.STATE_IDLE:
               // STATE_IDLE means the service is listening, so it's
               // safe to start making calls via mRemoteService.
               paused = false;
               indeterminate = true;
               break;
           case IDownloaderClient.STATE_CONNECTING:
           case IDownloaderClient.STATE_FETCHING_URL:
               showDashboard = true;
               paused = false;
               indeterminate = true;
               break;
           case IDownloaderClient.STATE_DOWNLOADING:
               paused = false;
               showDashboard = true;
               indeterminate = false;
               break;

           case IDownloaderClient.STATE_FAILED_CANCELED:
           case IDownloaderClient.STATE_FAILED:
           case IDownloaderClient.STATE_FAILED_FETCHING_URL:
           case IDownloaderClient.STATE_FAILED_UNLICENSED:
               paused = true;
               showDashboard = false;
               indeterminate = false;
               break;
           case IDownloaderClient.STATE_PAUSED_NEED_CELLULAR_PERMISSION:
           case IDownloaderClient.STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION:
               showDashboard = false;
               paused = true;
               indeterminate = false;
               showCellMessage = true;
               break;

           case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
               paused = true;
               indeterminate = false;
               break;
           case IDownloaderClient.STATE_PAUSED_ROAMING:
           case IDownloaderClient.STATE_PAUSED_SDCARD_UNAVAILABLE:
               paused = true;
               indeterminate = false;
               break;
           case IDownloaderClient.STATE_COMPLETED:
               showDashboard = false;
               paused = false;
               indeterminate = false;
               validateXAPKZipFiles();
               return;
           default:
               paused = true;
               indeterminate = true;
               showDashboard = true;
       }
       int newDashboardVisibility = showDashboard ? View.VISIBLE : View.GONE;
       if (mDashboard.getVisibility() != newDashboardVisibility) {
           mDashboard.setVisibility(newDashboardVisibility);
       }
       int cellMessageVisibility = showCellMessage ? View.VISIBLE : View.GONE;
       if (mCellMessage.getVisibility() != cellMessageVisibility) {
           mCellMessage.setVisibility(cellMessageVisibility);
       }

       mPB.setIndeterminate(indeterminate);
       setButtonPausedState(paused);
}
 
开发者ID:museumsvictoria,项目名称:mv-fieldguide-android,代码行数:74,代码来源:SplashActivity.java


注:本文中的com.google.android.vending.expansion.downloader.IDownloaderClient.STATE_FAILED_CANCELED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。