/** Executed on UI thread after task */ @Override protected void onPostExecute(Void v) { log("finished data update"); _updatingData = false; updateView(); if (CPU.isBigCluster()) updateView_big(); }
/** Stuff to do on a seperate thread */ @Override protected Void doInBackground(Void... v) { CpuStateMonitor monitor = _app.getCpuStateMonitor(); try { monitor.updateStates(); if (CPU.isBigCluster()) monitor.updateStates_Big(); } catch (CpuStateMonitor.CpuStateMonitorException e) { Log.e(TAG, "Problem getting CPU states"); } return null; }
@Nullable @Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View scroll_main = inflater.inflate(R.layout.scroll_tmp, container, false); mainView = (LinearLayout) scroll_main.findViewById(R.id.main_vertical_view); View v_default = inflater.inflate(R.layout.cpu_time_table, container, false); default_header_view = Utils.genarateView(getActivity(), R.layout.title_header_view, container); big_header_view = Utils.genarateView(getActivity(), R.layout.title_header_view, container); _app = new CpuSpyApp(); if (CPU.isBigCluster()) { ((TextView) default_header_view.findViewById(R.id.header_title)) .setText(getString(R.string.litter_core_title)); mainView.addView(default_header_view); } findViews(v_default); mainView.addView(v_default); LayoutInflater inf = LayoutInflater.from(getActivity()); LinearLayout v_big = (LinearLayout) inf.inflate(R.layout.cpu_time_table, container, false); if (CPU.isBigCluster()) { ((TextView) big_header_view.findViewById(R.id.header_title)) .setText(getString(R.string.big_core_title)); mainView.addView(big_header_view); // View v_big = inflater.inflate(R.layout.cpu_time_table, container, false); findViews_big(v_big); mainView.addView(v_big); } // see if we're updating data during a config change (rotate screen) if (savedInstanceState != null) { _updatingData = savedInstanceState.getBoolean("updatingData"); } return scroll_main; }