public void initialize( ReaderMainActivity readerMainActivity, Bundle savedInstanceState, final int messageId) { if (readerMainActivity != null) { activity = readerMainActivity; // getting unique id for device if (deviceId == null) { deviceId = android.provider.Settings.Secure.getString( activity.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); } if (mNewsHandler instanceof QueryNewsHandler) { tempHandler = (QueryNewsHandler) mNewsHandler; } mNewsHandler = new UIHandler(readerMainActivity); I13N.getNew().registerSession(readerMainActivity); DrawerManager.getInstance(readerMainActivity).onCreateDrawer(savedInstanceState); } else { if (mNewsHandler == null) { mNewsHandler = new QueryNewsHandler(); } else if (mNewsHandler instanceof UIHandler) { mNewsHandler = tempHandler; } I13N.getNew().registerSession(mApp); DrawerManager.getInstance(mApp); } ReaderController.getInstance().registerUIHandler(mNewsHandler); ReaderController.getInstance().getDataHandler().registerUiHandler(mNewsHandler); // Select/create the first Fragment if (savedInstanceState == null) { mNewsHandler.post( new Runnable() { @Override public void run() { // implicitly select the first item (which is the default news list) DrawerManager.getInstance().selectItem(DrawerManager.DRAWER_DEFAULT, messageId); } }); } isInitialized = true; }
public void requestPersonalizationTask() { NewsHttpGetTask task = new NewsHttpGetTask(Constants.CONFIG_ID_PERSONALIZATION); HashMap payload = ReaderController.getInstance().createPersonalizationRequest(); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, payload); }