正在查看: Adobe Acrobat v15.3 应用的 ARBlueHeronFileTransferActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Adobe Acrobat v15.3 应用的 ARBlueHeronFileTransferActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.adobe.reader.services;
import android.app.Activity;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.ViewCompat;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.adobe.libs.buildingblocks.utils.BBFileUtils;
import com.adobe.libs.services.a.g;
import com.adobe.libs.services.a.i;
import com.adobe.libs.services.auth.SVServicesLoginActivity;
import com.adobe.libs.services.auth.d;
import com.adobe.libs.services.h.a;
import com.adobe.libs.services.h.e;
import com.adobe.reader.R;
import com.adobe.reader.analytics.ARDCMAnalytics;
import com.adobe.reader.misc.ARFileTransferActivity;
import com.adobe.reader.services.ARFileTransferService;
import com.adobe.reader.services.AROutboxTransferManager;
import com.adobe.reader.services.auth.ARServicesAccount;
import com.adobe.reader.utils.ARUtils;
import java.io.File;
public class ARBlueHeronFileTransferActivity extends ARFileTransferActivity {
public static final String BLUE_HERON_TRANSFER_ACTIVITY_RETURN_CLOUD_ID = "com.adobe.reader.services.ARBlueHeronFileTransferActivity.cloudID";
public static final String BLUE_HERON_TRANSFER_ACTIVITY_RETURN_FILE_PATH = "com.adobe.reader.services.ARBlueHeronFileTransferActivity.returnFilePath";
private i mCacheManagerClient;
private boolean mDownLoadComplete;
private Intent mServiceIntent;
private ARFileTransferService.TRANSFER_TYPE mTransferType;
private BroadcastReceiver mBroadcastReceiver_downloadComplete = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
((NotificationManager) ARBlueHeronFileTransferActivity.this.getSystemService("notification")).cancelAll();
((TextView) ARBlueHeronFileTransferActivity.this.findViewById(2131492967)).setTextColor(ViewCompat.MEASURED_STATE_MASK);
Bundle extras = intent.getExtras();
if (e.values()[extras.getInt(ARFileTransferActivity.RESULT_KEY, -1)] != e.SUCCESS) {
ARBlueHeronFileTransferActivity.this.displayErrorDialog(extras.getString(ARFileTransferActivity.FAILURE_ERROR_MESSAGE_KEY, ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_DOWNLOAD_ERROR)));
return;
}
AROutboxFileEntry outboxFileEntryFromJSONStr = AROutboxFileEntry.getOutboxFileEntryFromJSONStr(intent.getExtras().getString(ARFileTransferActivity.FILE_ENTRY_KEY));
String filePath = outboxFileEntryFromJSONStr.getFilePath();
String fileID = outboxFileEntryFromJSONStr.getFileID();
String cloudSource = outboxFileEntryFromJSONStr.getCloudSource();
if (fileID != null) {
ARBlueHeronFileTransferActivity.this.mDownLoadComplete = true;
ARBlueHeronFileTransferActivity.this.openFile(new File(filePath), fileID, cloudSource);
}
}
};
private BroadcastReceiver mBroadcastReceiver_uploadComplete = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
((NotificationManager) ARBlueHeronFileTransferActivity.this.getSystemService("notification")).cancelAll();
((TextView) ARBlueHeronFileTransferActivity.this.findViewById(2131492967)).setTextColor(ViewCompat.MEASURED_STATE_MASK);
Bundle extras = intent.getExtras();
AROutboxFileEntry outboxFileEntryFromJSONStr = AROutboxFileEntry.getOutboxFileEntryFromJSONStr(extras.getString(ARFileTransferActivity.FILE_ENTRY_KEY));
e eVar = e.values()[extras.getInt(ARFileTransferActivity.RESULT_KEY, -1)];
if (eVar != e.SUCCESS) {
String string = ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_UPLOAD_ERROR);
if (eVar == e.OFFLINE) {
string = a.a(ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_OFFLINE), outboxFileEntryFromJSONStr.getCloudSource());
} else if (eVar == e.QUOTA_EXCEEDED) {
ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.UPLOAD_FAILURE, "Document Cloud", (String) null);
string = ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_UPLOAD_QUOTA_ERROR);
} else {
ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.UPLOAD_FAILURE, "Document Cloud", (String) null);
}
ARBlueHeronFileTransferActivity.this.setResult(0);
ARBlueHeronFileTransferActivity.this.displayErrorDialog(string);
return;
}
String fileID = outboxFileEntryFromJSONStr.getFileID();
if (fileID != null) {
if (ARBlueHeronFileTransferActivity.this.mTransferType == ARFileTransferService.TRANSFER_TYPE.UPLOAD) {
ARDCMAnalytics.getInstance().trackAction(ARDCMAnalytics.UPLOAD_SUCCESS, "Document Cloud", (String) null);
}
ARBlueHeronFileTransferActivity.this.setTransferStatusText(a.a(ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_UPLOADING_STR), outboxFileEntryFromJSONStr.getCloudSource()));
String filePath = outboxFileEntryFromJSONStr.getFilePath();
Intent intent2 = new Intent();
intent2.putExtra(ARBlueHeronFileTransferActivity.BLUE_HERON_TRANSFER_ACTIVITY_RETURN_FILE_PATH, filePath);
intent2.putExtra(ARBlueHeronFileTransferActivity.BLUE_HERON_TRANSFER_ACTIVITY_RETURN_CLOUD_ID, fileID);
ARBlueHeronFileTransferActivity.this.setResult(-1, intent2);
ARBlueHeronFileTransferActivity.this.finish();
}
}
};
private BroadcastReceiver mBroadcastReceiver_updateComplete = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
((NotificationManager) ARBlueHeronFileTransferActivity.this.getSystemService("notification")).cancelAll();
Bundle extras = intent.getExtras();
AROutboxFileEntry outboxFileEntryFromJSONStr = AROutboxFileEntry.getOutboxFileEntryFromJSONStr(extras.getString(ARFileTransferActivity.FILE_ENTRY_KEY));
e eVar = e.values()[extras.getInt(ARFileTransferActivity.RESULT_KEY, -1)];
if (eVar != e.SUCCESS) {
String string = ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_UPLOAD_ERROR);
if (eVar == e.OFFLINE) {
string = a.a(ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_OFFLINE), outboxFileEntryFromJSONStr.getCloudSource());
} else if (eVar == e.QUOTA_EXCEEDED) {
string = ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_UPLOAD_QUOTA_ERROR);
}
ARBlueHeronFileTransferActivity.this.setResult(0);
ARBlueHeronFileTransferActivity.this.displayErrorDialog(string);
return;
}
String fileID = outboxFileEntryFromJSONStr.getFileID();
if (fileID != null) {
ARBlueHeronFileTransferActivity.this.setTransferStatusText(ARBlueHeronFileTransferActivity.this.getString(R.string.IDS_CLOUD_UPDATED_STR));
String filePath = outboxFileEntryFromJSONStr.getFilePath();
Intent intent2 = new Intent();
intent2.putExtra(ARBlueHeronFileTransferActivity.BLUE_HERON_TRANSFER_ACTIVITY_RETURN_FILE_PATH, filePath);
intent2.putExtra(ARBlueHeronFileTransferActivity.BLUE_HERON_TRANSFER_ACTIVITY_RETURN_CLOUD_ID, fileID);
ARBlueHeronFileTransferActivity.this.setResult(-1, intent2);
ARBlueHeronFileTransferActivity.this.finish();
}
}
};
public static void performClass3Upload(Activity activity, String str, int i, String str2) {
Intent intent = new Intent(activity, (Class<?>) ARBlueHeronFileTransferActivity.class);
String a2 = BBFileUtils.a(str);
g.a();
intent.putExtra(ARFileTransferActivity.FILE_ENTRY_KEY, AROutboxFileEntry.getJSONStrFromOutboxFileEntry(new AROutboxFileEntry(a2, str, str2, g.d(str2), -1L, AROutboxTransferManager.TRANSFER_STATUS.NOT_STARTED, ARFileTransferService.TRANSFER_TYPE.CLASS3_UPLOAD, d.ACROBAT_DOT_COM_DEFAULT_SOURCE_NAME)));
activity.startActivityForResult(intent, i);
}
public static void performUpload(Activity activity, String str, int i, String str2) {
performUploadInFolder(activity, str, i, null, str2);
}
public static void performUploadInFolder(Activity activity, String str, int i, String str2, String str3) {
String jSONStrFromOutboxFileEntry = AROutboxFileEntry.getJSONStrFromOutboxFileEntry(new AROutboxFileEntry(BBFileUtils.a(str), str, null, -1L, -1L, AROutboxTransferManager.TRANSFER_STATUS.NOT_STARTED, ARFileTransferService.TRANSFER_TYPE.UPLOAD, str3));
Intent intent = new Intent(activity, (Class<?>) ARBlueHeronFileTransferActivity.class);
intent.putExtra(ARFileTransferActivity.FILE_ENTRY_KEY, jSONStrFromOutboxFileEntry);
intent.putExtra(ARFileTransferActivity.FOLDER_ID_KEY, str2);
activity.startActivityForResult(intent, i);
}
private void startTransferForCloudOperations() {
startService(this.mServiceIntent);
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
switch (i) {
case 100:
if (i2 != -1) {
finish();
break;
} else {
((LinearLayout) findViewById(2131492963)).setVisibility(0);
startTransferForCloudOperations();
break;
}
default:
finish();
break;
}
}
@Override
public void onCreate(Bundle bundle) {
String a2;
super.onCreate(bundle);
String stringExtra = getIntent().getStringExtra(ARFileTransferActivity.FILE_ENTRY_KEY);
final AROutboxFileEntry outboxFileEntryFromJSONStr = AROutboxFileEntry.getOutboxFileEntryFromJSONStr(stringExtra);
int intExtra = getIntent().getIntExtra(ARFileTransferActivity.TRANSFER_TYPE_KEY, -1);
if (outboxFileEntryFromJSONStr != null) {
intExtra = outboxFileEntryFromJSONStr.getTransferType().ordinal();
}
if (intExtra == -1) {
finish();
return;
}
this.mTransferType = ARFileTransferService.TRANSFER_TYPE.values()[intExtra];
this.mCacheManagerClient = new i() {
@Override
public boolean isInTransitionalState(String str) {
return TextUtils.equals(str, outboxFileEntryFromJSONStr.getFileID()) && ARBlueHeronFileTransferActivity.this.mTransferType == ARFileTransferService.TRANSFER_TYPE.UPDATE;
}
@Override
public boolean isPurgeable(String str) {
return (TextUtils.equals(outboxFileEntryFromJSONStr.getFileID(), str) && ARBlueHeronFileTransferActivity.this.mTransferType == ARFileTransferService.TRANSFER_TYPE.UPDATE) ? false : true;
}
};
g.a().a(this.mCacheManagerClient);
this.mServiceIntent = new Intent(this, (Class<?>) ARFileTransferService.class);
Bundle bundle2 = new Bundle();
bundle2.putBoolean(ARFileTransferActivity.IS_MODAL_KEY, getIntent().getBooleanExtra(ARFileTransferActivity.IS_MODAL_KEY, false));
if (this.mTransferType != ARFileTransferService.TRANSFER_TYPE.CLASS3_UPLOAD) {
if (!g.a().a(new File(outboxFileEntryFromJSONStr.getFilePath()).length())) {
String string = this.mTransferType == ARFileTransferService.TRANSFER_TYPE.UPLOAD ? getString(R.string.IDS_LOW_INTERNAL_MEMORY_UPLOAD_STR) : null;
if (string != null) {
displayErrorDialog(string);
return;
}
}
}
bundle2.putCharSequence(ARFileTransferActivity.FILE_ENTRY_KEY, stringExtra);
if (this.mTransferType == ARFileTransferService.TRANSFER_TYPE.DOWNLOAD) {
a2 = getString(2131230759);
} else if (this.mTransferType == ARFileTransferService.TRANSFER_TYPE.UPLOAD || this.mTransferType == ARFileTransferService.TRANSFER_TYPE.CLASS3_UPLOAD || this.mTransferType == ARFileTransferService.TRANSFER_TYPE.UPDATE) {
bundle2.putString(ARFileTransferActivity.FOLDER_ID_KEY, getIntent().getStringExtra(ARFileTransferActivity.FOLDER_ID_KEY));
a2 = a.a(getString(R.string.IDS_CLOUD_UPLOADING_STR), outboxFileEntryFromJSONStr.getCloudSource());
} else {
a2 = null;
}
String fileName = outboxFileEntryFromJSONStr.getFileName();
((TextView) findViewById(2131492968)).setText(fileName);
setTransferStatusText(a2);
((ImageView) findViewById(2131492964)).setImageResource(ARUtils.getProgressViewDrawableIconForFile(fileName));
registerBroadcastReceivers();
this.mServiceIntent.putExtras(bundle2);
if (ARServicesAccount.getInstance().isSignedIn()) {
startTransferForCloudOperations();
return;
}
((LinearLayout) findViewById(2131492963)).setVisibility(4);
Intent intent = new Intent(this, (Class<?>) SVServicesLoginActivity.class);
intent.putExtra("service_variant", com.adobe.libs.services.h.g.ADC_SUBSCRIPTION.ordinal());
intent.putExtra("is_entitlement_check_required_bofore_subscription_check", true);
startActivityForResult(intent, 100);
}
@Override
public void onDestroy() {
super.onDestroy();
if (this.mCacheManagerClient != null) {
g.a().b(this.mCacheManagerClient);
}
if (this.mTransferType != null) {
Intent intent = null;
switch (this.mTransferType) {
case DOWNLOAD:
intent = new Intent(ARFileTransferService.BROADCAST_CANCEL_DOWNLOAD);
String filePath = AROutboxFileEntry.getOutboxFileEntryFromJSONStr(getIntent().getStringExtra(ARFileTransferActivity.FILE_ENTRY_KEY)).getFilePath();
if (!this.mDownLoadComplete) {
BBFileUtils.g(filePath);
break;
}
break;
case UPLOAD:
intent = new Intent(ARFileTransferService.BROADCAST_CANCEL_UPLOAD);
break;
case CLASS3_UPLOAD:
intent = new Intent(ARFileTransferService.BROADCAST_CANCEL_PROMOTE);
break;
}
if (intent != null) {
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}
}
}
@Override
public void registerBroadcastReceivers() {
super.registerBroadcastReceivers();
switch (this.mTransferType) {
case DOWNLOAD:
LocalBroadcastManager.getInstance(this).registerReceiver(this.mBroadcastReceiver_downloadComplete, new IntentFilter(ARFileTransferService.BROADCAST_DOWNLOAD_COMPLETE));
break;
case UPLOAD:
LocalBroadcastManager.getInstance(this).registerReceiver(this.mBroadcastReceiver_uploadComplete, new IntentFilter(ARFileTransferService.BROADCAST_UPLOAD_COMPLETE));
break;
case CLASS3_UPLOAD:
LocalBroadcastManager.getInstance(this).registerReceiver(this.mBroadcastReceiver_uploadComplete, new IntentFilter(ARFileTransferService.BROADCAST_UPLOAD_COMPLETE));
break;
case UPDATE:
LocalBroadcastManager.getInstance(this).registerReceiver(this.mBroadcastReceiver_updateComplete, new IntentFilter(ARFileTransferService.BROADCAST_UPDATE_COMPLETE));
break;
}
}
@Override
public void unregisterBroadcastReceivers() {
super.unregisterBroadcastReceivers();
switch (this.mTransferType) {
case DOWNLOAD:
LocalBroadcastManager.getInstance(this).unregisterReceiver(this.mBroadcastReceiver_downloadComplete);
break;
case UPLOAD:
LocalBroadcastManager.getInstance(this).unregisterReceiver(this.mBroadcastReceiver_uploadComplete);
break;
case CLASS3_UPLOAD:
LocalBroadcastManager.getInstance(this).unregisterReceiver(this.mBroadcastReceiver_uploadComplete);
break;
case UPDATE:
LocalBroadcastManager.getInstance(this).unregisterReceiver(this.mBroadcastReceiver_updateComplete);
break;
}
}
}