use of android.content.Context in project VirtualApp by asLody.
the class ServiceManagerNative method getServiceFetcher.
private static IServiceFetcher getServiceFetcher() {
if (sFetcher == null) {
synchronized (ServiceManagerNative.class) {
if (sFetcher == null) {
Context context = VirtualCore.get().getContext();
Bundle response = new ProviderCall.Builder(context, SERVICE_CP_AUTH).methodName("@").call();
if (response != null) {
IBinder binder = BundleCompat.getBinder(response, "_VA_|_binder_");
linkBinderDied(binder);
sFetcher = IServiceFetcher.Stub.asInterface(binder);
}
}
}
}
return sFetcher;
}
use of android.content.Context in project FileDownloaderManager by arlyxiao.
the class FileDownloader method register_done_receiver.
private void register_done_receiver() {
download_done_receiver = new DownloadDoneNotification() {
@Override
public void onReceive(Context ctxt, Intent intent) {
fd = intent.getParcelableExtra("download_manager");
if (fd.get_obj_id() == FileDownloader.this.get_obj_id()) {
// if (fd.download_url == FileDownloader.this.download_url) {
Log.i("调试 接收正在下载的 downloaded_size 值 ", Integer.toString(fd.downloaded_size));
FileDownloader.this.downloaded_size = 0;
FileDownloader.this.file_size = 0;
Log.i("调试 接收正在下载的 file_size 值 ", Integer.toString(fd.file_size));
} else {
Log.i("调试 广播接收到不同的 obj_id 2 ", Integer.toString(fd.get_obj_id()));
}
}
};
context.registerReceiver(download_done_receiver, new IntentFilter("app.action.download_done_notification"));
}
use of android.content.Context in project FileDownloaderManager by arlyxiao.
the class FileDownloader method register_pause_receiver.
private void register_pause_receiver() {
download_pause_receiver = new DownloadPauseReceiver() {
@Override
public void onReceive(Context ctxt, Intent intent) {
fd = intent.getParcelableExtra("download_manager");
if (fd.get_obj_id() == FileDownloader.this.get_obj_id()) {
// if (fd.download_url == FileDownloader.this.download_url) {
Log.i("调试 pause 接收正在下载的 downloaded_size 值 ", Integer.toString(fd.downloaded_size));
FileDownloader.this.downloaded_size = 0;
FileDownloader.this.file_size = 0;
Log.i("调试 pause 接收正在下载的 file_size 值 ", Integer.toString(fd.file_size));
} else {
Log.i("调试 广播接收到不同的 obj_id 3 ", Integer.toString(fd.get_obj_id()));
}
}
};
context.registerReceiver(download_pause_receiver, new IntentFilter("app.action.download_pause_receiver"));
}
use of android.content.Context in project FileDownloaderManager by arlyxiao.
the class FileDownloader method register_stop_receiver.
private void register_stop_receiver() {
download_stop_receiver = new DownloadStopReceiver() {
@Override
public void onReceive(Context ctxt, Intent intent) {
fd = intent.getParcelableExtra("download_manager");
if (fd.get_obj_id() == FileDownloader.this.get_obj_id()) {
// if (fd.download_url == FileDownloader.this.download_url) {
Log.i("调试 stop 接收正在下载的 downloaded_size 值 ", Integer.toString(fd.downloaded_size));
FileDownloader.this.downloaded_size = 0;
FileDownloader.this.file_size = 0;
Log.i("调试 stop 接收正在下载的 file_size 值 ", Integer.toString(fd.file_size));
} else {
Log.i("调试 stop 广播接收到不同的 obj_id 4 ", Integer.toString(fd.get_obj_id()));
}
}
};
context.registerReceiver(download_stop_receiver, new IntentFilter("app.action.download_stop_receiver"));
}
use of android.content.Context in project enroscar by stanfy.
the class ImageConsumerTest method consumerShouldReturnRequiredSizeRespectingScreenDimensions.
@Test
public void consumerShouldReturnRequiredSizeRespectingScreenDimensions() {
ImageConsumer consumer = new Consumer(0, 0);
Context context = Robolectric.application;
assertThat(consumer.getRequiredWidth()).isEqualTo(context.getResources().getDisplayMetrics().widthPixels);
assertThat(consumer.getRequiredHeight()).isEqualTo(context.getResources().getDisplayMetrics().heightPixels);
}
Aggregations