导航菜单

页面标题

页面副标题

Adobe Acrobat v15.3 - ARFileURLDownloadActivity.java 源代码

正在查看: Adobe Acrobat v15.3 应用的 ARFileURLDownloadActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.adobe.reader.misc;

import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.adobe.libs.services.h.e;
import com.adobe.reader.R;
import com.adobe.reader.utils.ARUtils;
import java.io.File;

public class ARFileURLDownloadActivity extends ARFileTransferActivity {
    private String mFileID;
    private Intent mServiceIntent;
    private BroadcastReceiver mBroadcastReceiver_urlDownloadComplete = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            ((NotificationManager) ARFileURLDownloadActivity.this.getSystemService("notification")).cancel(1);
            e eVar = e.values()[intent.getExtras().getInt(ARFileTransferActivity.RESULT_KEY, -1)];
            if (eVar == e.SUCCESS) {
                ARFileURLDownloadActivity.this.openFile(new File(intent.getExtras().getString(ARFileTransferActivity.FILE_PATH_KEY)));
                return;
            }
            String string = ARFileURLDownloadActivity.this.getString(R.string.IDS_CLOUD_DOWNLOAD_ERROR);
            if (eVar == e.OFFLINE) {
                string = ARFileURLDownloadActivity.this.getString(R.string.IDS_OFFLINE);
            } else if (eVar == e.LOW_MEMORY) {
                string = ARFileURLDownloadActivity.this.getString(R.string.IDS_LOW_INTERNAL_MEMORY_DOWNLOAD_STR);
            }
            ARFileURLDownloadActivity.this.displayErrorDialog(string);
        }
    };
    private BroadcastReceiver mBroadcastReceiver_urlDismissDownload = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (ARFileURLDownloadActivity.this.mFileID.equals((String) intent.getExtras().getCharSequence(ARFileTransferActivity.FILE_ID_KEY))) {
                ARFileURLDownloadActivity.this.finish();
            }
        }
    };

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.mServiceIntent = new Intent(this, (Class<?>) ARFileURLDownloadService.class);
        Bundle bundle2 = new Bundle();
        Uri uri = (Uri) getIntent().getExtras().getParcelable(ARFileTransferActivity.FILE_PATH_KEY);
        String lastPathSegment = uri.getLastPathSegment();
        String string = getString(2131230759);
        bundle2.putParcelable(ARFileTransferActivity.FILE_PATH_KEY, uri);
        this.mFileID = String.valueOf(System.currentTimeMillis());
        bundle2.putCharSequence(ARFileTransferActivity.FILE_ID_KEY, this.mFileID);
        ((TextView) findViewById(2131492968)).setText(lastPathSegment);
        setTransferStatusText(string);
        ((ImageView) findViewById(2131492964)).setImageResource(ARUtils.getProgressViewDrawableIconForFile(lastPathSegment));
        registerBroadcastReceivers();
        LocalBroadcastManager.getInstance(this).registerReceiver(this.mBroadcastReceiver_urlDismissDownload, new IntentFilter(ARFileURLDownloadService.BROADCAST_URL_DISMISS_DOWNLOAD));
        this.mServiceIntent.putExtras(bundle2);
        startService(this.mServiceIntent);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        LocalBroadcastManager.getInstance(this).unregisterReceiver(this.mBroadcastReceiver_urlDismissDownload);
        Intent intent = new Intent(ARFileURLDownloadService.BROADCAST_URL_CANCEL_DOWNLOAD);
        Bundle bundle = new Bundle();
        bundle.putCharSequence(ARFileTransferActivity.FILE_ID_KEY, this.mFileID);
        intent.putExtras(bundle);
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
    }

    @Override
    public void registerBroadcastReceivers() {
        super.registerBroadcastReceivers();
        LocalBroadcastManager.getInstance(this).registerReceiver(this.mBroadcastReceiver_urlDownloadComplete, new IntentFilter(ARFileURLDownloadService.BROADCAST_URL_DOWNLOAD_COMPLETE));
    }

    @Override
    public void unregisterBroadcastReceivers() {
        super.unregisterBroadcastReceivers();
        LocalBroadcastManager.getInstance(this).unregisterReceiver(this.mBroadcastReceiver_urlDownloadComplete);
    }
}