/** Set views data from app item */ public void setViews() { if (appItem != null) { /** **** TITLE ****** */ textViewTitle.setText(appItem.getAppname()); /** **** STRORAGE ****** */ try { appDetails = MainActivity.service .getSystemControl() .getApplicationControl() .getApplicationDeatails(appItem.getAppPackage()); } catch (Exception e) { e.printStackTrace(); } if (appDetails != null) { try { appDetails.getAppSizeInfo(); } catch (Exception e) { e.printStackTrace(); } } } }
private void setViewsFromCallBack() { Log.d(TAG, "ApplicationsAppControlDialog, SET VIEWS FROM CALLBACK"); if (appSizeInfo != null) { try { appDetails = MainActivity.service .getSystemControl() .getApplicationControl() .getApplicationDeatails(appItem.getAppPackage()); } catch (Exception e) { e.printStackTrace(); } if (appDetails != null) { /** ****** DEFAULTS ************** */ boolean isDef = true; try { isDef = appDetails.isDefault(); } catch (Exception e) { e.printStackTrace(); } Log.d(TAG, "APPLICATION IS DEFAULT" + isDef + ""); btnClearDefaults.setEnabled(isDef); /** ***** FORCE STOP *** */ boolean isStopped = true; try { isStopped = appDetails.isStopped(); } catch (RemoteException e) { e.printStackTrace(); } catch (RuntimeException e) { e.printStackTrace(); } btnForceStop.setEnabled(!isStopped); /** ***** UNINSTALL ******* */ boolean isSystemApp = true; try { isSystemApp = appDetails.isSystem(); } catch (RemoteException e) { e.printStackTrace(); } catch (RuntimeException e) { e.printStackTrace(); } if (isSystemApp) { boolean isEnabled = false; try { isEnabled = appDetails.isEnabled(); } catch (RemoteException e) { e.printStackTrace(); } catch (RuntimeException e) { e.printStackTrace(); } if (isEnabled) { btnUninstall.setText( R.string.tv_menu_applications_settings_manage_applications_disable); } else { btnUninstall.setText(R.string.tv_menu_applications_settings_manage_applications_enable); } } else { btnUninstall.setText( R.string.tv_menu_applications_settings_manage_applications_uninstall_btn); } /** ****** PERMMISIONS ******** */ fillPermisions(); } /** **** STRORAGE TOTAL ****** */ btnStorageTotal.setText(appSizeInfo.getTotalSize()); /** **** STRORAGE APP ****** */ btnStorageApp.setText(appSizeInfo.getCodeSize()); /** **** STRORAGE DATA ****** */ btnStorageData.setText(appSizeInfo.getDataSize()); Log.d(TAG, "DATA SIZE: " + appSizeInfo.getDataSize()); /** **** STRORAGE SD CARD ****** */ btnStorageExternal.setText(appSizeInfo.getExternalCacheSize()); /** **** CACHE ****** */ btnCache.setText(appSizeInfo.getCacheSize()); /** ****** CLEAR CACHE ******** */ btnClearCache.setEnabled(!appSizeInfo.isCacheEmpty()); /** ****** CLEAR DATA ******** */ btnClearData.setEnabled(!appSizeInfo.isDataEmpty()); } }