private void setupFloatingImage(boolean update) { if (AppHelper.getImage(context) != null && new File(AppHelper.getImage(context)).exists()) { floatingImage.setImageBitmap(BitmapFactory.decodeFile(AppHelper.getImage(context))); } else { floatingImage.setImageResource(R.mipmap.ic_launcher); } if (adapter != null) adapter.notifyDataSetChanged(); if (update) { if (windowManager != null) try { windowManager.updateViewLayout(FloatingHorizontalLayout.this.floatingImage, mParams); windowManager.updateViewLayout(FloatingHorizontalLayout.this.view, rParams); } catch (Exception e) { e.printStackTrace(); } } }
@Override public void onLoadComplete(Loader<List<AppsModel>> loader, List<AppsModel> data) { if (data == null || data.size() == 0) { context.stopService(new Intent(context, FloatingService.class)); Notifier.cancelNotification( context); // in case if the service is stopped previously and its in the // notification bar return; } if (adapter != null) { adapter.insert(data); } EventTrackerHelper.sendEvent( "FloatingHorizontalLayout", "onLoadCompleteListener", "onLoadCompleteListener", "new Data: " + data.size()); }
@Override public void onItemClickListener(View view, int position) { onAppClick(adapter.getModelList().get(position)); }
@Override public void onReset() { adapter.clear(); EventTrackerHelper.sendEvent("FloatingHorizontalLayout", "onReset", "onReset"); }
@Override public void onLongClick() { Notifier.createNotification(context, adapter.getItemCount()); EventTrackerHelper.sendEvent("FloatingHorizontalLayout", "onLongClick", "onLongClick"); }