Java Code Examples for android.support.v7.widget.RecyclerView.setLayoutManager()

The following are Jave code examples for showing how to use setLayoutManager() of the android.support.v7.widget.RecyclerView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: TopsalesSellControlTableDemo   File: MainActivity.java   View Source Code Vote up 10 votes
private void initView() {
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    mRvLayer = (RecyclerView) findViewById(R.id.rv_layer);
    mRvRoom = (RecyclerView) findViewById(R.id.rv_room);
    mSvRoom = (ObservableHorizontalScrollView) findViewById(R.id.sv_room);
    mRvLayer.setLayoutManager(new LinearLayoutManager(this));
    mRvLayer.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this)
            .color(Color.parseColor("#f5f5f5"))
            .size(1)
            .build()
    );
    mRvRoom.setLayoutManager(new LinearLayoutManager(this));
    mRvRoom.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this)
            .color(Color.parseColor("#f5f5f5"))
            .size(1)
            .build()
    );
}
 
Example 2
Project: PaletteGetter   File: MainActivity.java   View Source Code Vote up 7 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler);
    recyclerView.setLayoutManager(new GridLayoutManager(this, 1));

    adapter = new AppDataAdapter(this, getPackageManager(), new ArrayList<AppData>());
    recyclerView.setAdapter(adapter);

    new Thread() {
        @Override
        public void run() {
            PackageManager manager = getPackageManager();
            if (manager == null) return;

            final List<AppData> apps = new ArrayList<>();
            List<ResolveInfo> infos = manager.queryIntentActivities(new Intent(Intent.ACTION_MAIN, null).addCategory(Intent.CATEGORY_LAUNCHER), 0);
            for (ResolveInfo info : infos) {
                apps.add(new AppData(info.loadLabel(manager).toString(), info.activityInfo.packageName));
            }

            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    adapter.setList(apps);
                }
            });
        }
    }.start();
}
 
Example 3
Project: Musicoco   File: RecentMostPlayActivity.java   View Source Code Vote up 7 votes
private void initViews() {

        list = (RecyclerView) findViewById(R.id.rmp_a_list);

        adapter = new RMPAdapter(this, data);
        list.setLayoutManager(new LinearLayoutManager(this));

        line = findViewById(R.id.rmp_a_line);
        title = (TextView) findViewById(R.id.rmp_a_title);
        toolbar = (Toolbar) findViewById(R.id.rmp_a_toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        first = new FirstThreeViewHolder(this, FirstThreeViewHolder.FIRST);
        second = new FirstThreeViewHolder(this, FirstThreeViewHolder.SECOND);
        third = new FirstThreeViewHolder(this, FirstThreeViewHolder.THIRD);
        first.setVisible(View.INVISIBLE);
        second.setVisible(View.INVISIBLE);
        third.setVisible(View.INVISIBLE);

    }
 
Example 4
Project: LoadingLayout   File: EmptyActivity.java   View Source Code Vote up 6 votes
private void initView() {
    mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
    mRefreshLayout.setEnabled(false);
    mLoadingLayout = (LoadingLayout) findViewById(R.id.loading_layout);
    mRecyclerView = (RecyclerView) findViewById(R.id.list);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new RecyclerAdapter();
    mRecyclerView.setAdapter(mAdapter);

    mRetryBtn = (Button) findViewById(R.id.retry_btn);
    mEmptyBtn = (Button) findViewById(R.id.empty_btn);
    mCustomBtn1 = (Button) findViewById(R.id.custom1);
    mCustomBtn2 = (Button) findViewById(R.id.custom2);
    mRetryBtn.setOnClickListener(this);
    mEmptyBtn.setVisibility(View.GONE);
    mCustomBtn1.setVisibility(View.GONE);
    mCustomBtn2.setVisibility(View.GONE);
}
 
Example 5
Project: RealmTasks   File: TouchHelper.java   View Source Code Vote up 6 votes
public void attachToRecyclerView(RecyclerView recyclerView)
{
    if (this.recyclerView == recyclerView)
    {
        return;
    }
    if (this.recyclerView != null)
    {
        destroyCallbacks();
    }
    this.recyclerView = recyclerView;
    if (recyclerView == null)
    {
        return;
    }
    onItemTouchListener = new TasksOnItemTouchListener(recyclerView.getContext());
    itemDecoration = new TasksItemDecoration();
    recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
    recyclerView.addOnItemTouchListener(onItemTouchListener);
    recyclerView.addItemDecoration(itemDecoration);
    recyclerView.setAdapter(adapter);
    final Context context = this.recyclerView.getContext();
    final ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
    scaledTouchSlop = viewConfiguration.getScaledTouchSlop();
    DisplayMetrics metrics = new DisplayMetrics();
    final WindowManager systemService = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    systemService.getDefaultDisplay().getMetrics(metrics);
    logicalDensity = metrics.density;
    adapter.setOnFirstItemUpdateListener(new OnFirstItemUpdateListener());
}
 
Example 6
Project: EsperantoRadio   File: MestSeteFrag.java   View Source Code Vote up 5 votes
private void initRecyclerView(RecyclerView recyclerView, int position) {
  recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext(), LinearLayoutManager.HORIZONTAL, false));
  mRecyclerViewAdapter = new RecyclerViewAdapter(getKanalSlugFraPosition(position));
  recyclerView.setAdapter(mRecyclerViewAdapter);

  //Remove focus from the RecyclerView so we can intercept the vertical scrolling events
  //recyclerView.setNestedScrollingEnabled(false);
}
 
Example 7
Project: GitHub   File: MainActivity.java   View Source Code Vote up 5 votes
protected void setUpViews() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerViewNotes);
    //noinspection ConstantConditions
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));

    notesAdapter = new NotesAdapter(noteClickListener);
    recyclerView.setAdapter(notesAdapter);

    addNoteButton = findViewById(R.id.buttonAdd);

    editText = (EditText) findViewById(R.id.editTextNote);
    //noinspection ConstantConditions
    RxTextView.editorActions(editText).observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Action1<Integer>() {
                @Override
                public void call(Integer actionId) {
                    if (actionId == EditorInfo.IME_ACTION_DONE) {
                        addNote();
                    }
                }
            });
    RxTextView.afterTextChangeEvents(editText).observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Action1<TextViewAfterTextChangeEvent>() {
                @Override
                public void call(TextViewAfterTextChangeEvent textViewAfterTextChangeEvent) {
                    boolean enable = textViewAfterTextChangeEvent.editable().length() > 0;
                    addNoteButton.setEnabled(enable);
                }
            });
}
 
Example 8
Project: AddSubUtils   File: RecyclerActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler);

    initData();

    mRecyclerView = (RecyclerView) findViewById(R.id.activity_recycler);
    adapter = new MyRecyclerAdapter(RecyclerActivity.this,mList);
    mRecyclerView.setAdapter(adapter);
    //设置线性布局
    mRecyclerView.setLayoutManager(new LinearLayoutManager(RecyclerActivity.this, LinearLayoutManager.VERTICAL, false));
}
 
Example 9
Project: changApp   File: CardContentFragment.java   View Source Code Vote up 5 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    RecyclerView recyclerView = (RecyclerView) inflater.inflate(
            R.layout.recycler_view, container, false);
    ContentAdapter adapter = new ContentAdapter(recyclerView.getContext());
    recyclerView.setAdapter(adapter);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    return recyclerView;
}
 
Example 10
Project: BilibiliClient   File: VideoCommentFragment.java   View Source Code Vote up 5 votes
private void createHeadView() {
    mHeadView = LayoutInflater.from(getActivity()).inflate(R.layout.layout_video_hot_comment_head, mRecyclerView, false);
    RecyclerView recyclerView = (RecyclerView) mHeadView.findViewById(R.id.hot_comment_recycler);
    recyclerView.setHasFixedSize(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mVideoHotCommentAdapter = new VideoHotCommentAdapter(recyclerView, mHotComments);
    recyclerView.setAdapter(mVideoHotCommentAdapter);
    mAdapter.addHeaderView(recyclerView);
}
 
Example 11
Project: KakaoBot   File: MainActivity.java   View Source Code Vote up 5 votes
private void initRecyclerView() {
    ScriptProjectAdapter adapter = new ScriptProjectAdapter(projectList, this);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.project_list);

    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);

    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    recyclerView.setAdapter(adapter);
}
 
Example 12
Project: GitHub   File: LinearActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("线性排布");
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    textView1 = (TextView) findViewById(R.id.text1);
    textView2 = (TextView) findViewById(R.id.text2);
    textView3 = (TextView) findViewById(R.id.text3);
    textView4 = (TextView) findViewById(R.id.text4);
    helper = new SimpleHelper();
    SimpleHelperAdapter adapter = new SimpleHelperAdapter(helper);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter));
    recyclerView.setAdapter(adapter);

    helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
    textView3.postDelayed(new Runnable() {
        @Override
        public void run() {
            Random random = new Random();
            int rand = random.nextInt(6);
            List<MultiHeaderEntity> list = new ArrayList<>();
            for (int i = 0, size = rand + 1; i < size; i++) {
                list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
            }
            textView3.setText(String.format("类型3的数量:%d", list.size()));
            helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
        }
    }, 3000);
}
 
Example 13
Project: PicShow-zhaipin   File: PhotosFragment.java   View Source Code Vote up 5 votes
/**
 * 配置recycleview
 *
 * @param recyclerView
 * @param layoutManager
 */
private void configRecycleView(RecyclerView recyclerView
        , RecyclerView.LayoutManager layoutManager
) {
    recyclerView.setLayoutManager(layoutManager);
    //如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
 
Example 14
Project: xytodo-android   File: ActivityTaskAdd.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_task_edit);
    //设置ActionBar
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    if (mToolbar != null)
    {
        setSupportActionBar(mToolbar);
        setTitle(getText(R.string.activity_title_task_add));
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    // 加载控件
    btnAction = (RelativeLayout) findViewById(R.id.rlyt_btnAction);
    mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    // 创建一个线性布局管理器
    mLayoutManager = new LinearLayoutManager(this);
    // layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    // 设置布局管理器
    mRecyclerView.setLayoutManager(mLayoutManager);
    // 装填缓存数据
    app = (AppNaxy) this.getApplication();
    mData = new ModelTask();
    long unixTime = new Date().getTime();//获取当前时区下日期时间对应的时间戳
    mData.setTimeCreate((int) (unixTime / 1000));
    mData.setTimeTarget(mData.getTimeCreate());
    mData.setTimeSort(mData.getTimeCreate());
    //读取最后的使用色
    ToolSharedPreferences spfl = new ToolSharedPreferences(this, "set_info");
    mData.setColor(spfl.GetStringValue("color_last"));
    if (mData.getColor().length() <= 0)
    {
        mData.setColor("blue");
    }
    setColor(mData.getColor());
    initRecyclerView();
    //设置监听
    btnAction.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            // 获取输入栏消息
            if (mData.getContent().length() > 0)
            {
                mData.setSub(mAdapter.DataSubGet());
                app.DBMGet().TaskAdd(mData);
                Intent i = new Intent();
                setResult(TYPE_ACTION_SUCCESS, i);
                ActivityTaskAdd.this.onBackPressed();
            }
        }
    });
}
 
Example 15
Project: OldNews   File: FeedFragment.java   View Source Code Vote up 4 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_page, container, false);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recylerview);
    mFeedAdapter = new FeedAdapter("all");
    mRecyclerView.setAdapter(mFeedAdapter);



    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(layoutManager);

    return view;
}
 
Example 16
Project: wulkanowy   File: AbstractFragment.java   View Source Code Vote up 4 votes
protected void setAdapterOnRecyclerView(@NonNull RecyclerView recyclerView) {
    recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivityWeakReference()));
    recyclerView.setAdapter(flexibleAdapter);
}
 
Example 17
Project: Rey-MusicPlayer   File: PlaylistFragment.java   View Source Code Vote up 4 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_album_layout, container, false);
    mContext = getContext();
    setHasOptionsMenu(true);
    mApp = (Common) mContext.getApplicationContext();

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    mFastScroller = (FastScroller) view.findViewById(R.id.fast_scroller);
    TextView emptyText = (TextView) view.findViewById(R.id.empty_text_view);
    mCreatePlaylistButton = (Button) view.findViewById(R.id.create_playlist);
    mEmptyStateLayout = (RelativeLayout) view.findViewById(R.id.empty_state);


    mCreatePlaylistButton.setTypeface(TypefaceHelper.getTypeface(mContext, TypefaceHelper.FUTURA_BOLD));
    emptyText.setTypeface(TypefaceHelper.getTypeface(mContext, TypefaceHelper.FUTURA_BOLD));

    mCreatePlaylistButton.setOnClickListener(v -> {
        PlaylistDialog playlistDialog = new PlaylistDialog();
        playlistDialog.show(getActivity().getSupportFragmentManager(), "FRAGMENT_TAG");
    });


    mFastScroller.setRecyclerView(mRecyclerView);
    mAdapter = new PlaylistAdapter(this);
    mRecyclerView.setAdapter(mAdapter);

    mRecyclerView.addOnScrollListener(new HidingScrollListener() {
        @Override
        public void onHide() {
            mOnScrolledListener.onScrolledUp();
        }

        @Override
        public void onShow() {
            mOnScrolledListener.onScrolledDown();
        }

    });

    return view;
}
 
Example 18
Project: GitHub   File: FragmentSelectionModes.java   View Source Code Vote up 4 votes
@SuppressWarnings({"ConstantConditions", "NullableProblems"})
private void initializeRecyclerView(Bundle savedInstanceState) {
	//Get copy of the Database list
	List<AbstractFlexibleItem> items = DatabaseService.getInstance().getDatabaseList();

	// Initialize Adapter and RecyclerView
	// ExampleAdapter makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
	mAdapter = new ExampleAdapter(items, getActivity());
	mAdapter.setNotifyChangeOfUnfilteredItems(true) //This will rebind new item when refreshed
			.setMode(SelectableAdapter.MODE_SINGLE);

	// Experimenting NEW features (v5.0.0)
	mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
	mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
	mRecyclerView.setAdapter(mAdapter);
	mRecyclerView.setHasFixedSize(true); //Size of RV will not change
	// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
	// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
	mRecyclerView.setItemAnimator(new DefaultItemAnimator());
	// Divider item decorator with DrawOver enabled
	mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), R.drawable.divider)
			.withDrawOver(true));
	mRecyclerView.postDelayed(new Runnable() {
		@Override
		public void run() {
			Snackbar.make(getView(), "Selection MODE_SINGLE is enabled", Snackbar.LENGTH_SHORT).show();
		}
	}, 1500L);

	// Add FastScroll to the RecyclerView, after the Adapter has been attached the RecyclerView!!!
	mAdapter.setFastScroller((FastScroller) getView().findViewById(R.id.fast_scroller),
			Utils.getColorAccent(getActivity()), (MainActivity) getActivity());

	SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
	swipeRefreshLayout.setEnabled(true);
	mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_SINGLE);

	// Add 2 Scrollable Headers
	mAdapter.addUserLearnedSelection(savedInstanceState == null);
	mAdapter.addScrollableHeaderWithDelay(new ScrollableUseCaseItem(
			getString(R.string.selection_modes_use_case_title),
			getString(R.string.selection_modes_use_case_description)), 1100L, true
	);
}
 
Example 19
Project: superFileView   File: MainActivity.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    initDatas();
    initPaths();

    mRecyclerView = (RecyclerView) findViewById(R.id.mRecyclerView);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setAdapter(new RecyclerView.Adapter() {
        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

            return new RecyclerView.ViewHolder(LayoutInflater.from(MainActivity.this).inflate(R.layout.item, parent, false)) {
            };

        }

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
            holder.itemView.findViewById(R.id.item_root).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    String[] perms = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
                            Manifest.permission.WRITE_EXTERNAL_STORAGE};
                    filePath = getFilePath(position);
                    if (!EasyPermissions.hasPermissions(MainActivity.this, perms)) {
                        EasyPermissions.requestPermissions(MainActivity.this, "需要访问手机存储权限!", 10086, perms);
                    } else {
                        FileDisplayActivity.show(MainActivity.this, filePath);
                    }
                }
            });
            ((TextView) holder.itemView.findViewById(R.id.item_tv)).setText(getDatas().get(position));
        }

        @Override
        public int getItemCount() {
            return getDatas().size();
        }
    });
}
 
Example 20
Project: mobile-store   File: MainActivity.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    ((FDroidApp) getApplication()).applyTheme(this);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    adapter = new MainViewAdapter(this);

    pager = (RecyclerView) findViewById(R.id.main_view_pager);
    pager.setHasFixedSize(true);
    pager.setLayoutManager(new NonScrollingHorizontalLayoutManager(this));
    pager.setAdapter(adapter);

    // Without this, the focus is completely busted on pre 15 devices. Trying to use them
    // without this ends up with each child view showing for a fraction of a second, then
    // reverting back to the "Latest" screen again, in completely non-deterministic ways.
    if (Build.VERSION.SDK_INT <= 15) {
        pager.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
    }

    updatesBadge = new BadgeItem().hide(false);

    bottomNavigation = (BottomNavigationBar) findViewById(R.id.bottom_navigation);
    bottomNavigation.setTabSelectedListener(this)
            .setBarBackgroundColor(getBottomNavigationBackgroundColorResId())
            .setInActiveColor(R.color.bottom_nav_items)
            .setActiveColor(android.R.color.white)
            .setMode(BottomNavigationBar.MODE_FIXED)
            .addItem(new BottomNavigationItem(R.drawable.ic_latest, R.string.main_menu__latest_apps))
            .addItem(new BottomNavigationItem(R.drawable.ic_categories, R.string.main_menu__categories))
            .addItem(new BottomNavigationItem(R.drawable.ic_nearby, R.string.main_menu__swap_nearby))
            .addItem(new BottomNavigationItem(R.drawable.ic_updates, R.string.updates).setBadgeItem(updatesBadge))
            .addItem(new BottomNavigationItem(R.drawable.ic_settings, R.string.menu_settings))
            .initialise();

    IntentFilter updateableAppsFilter = new IntentFilter(AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED);
    updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_CHANGED);
    updateableAppsFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_REMOVED);
    LocalBroadcastManager.getInstance(this).registerReceiver(onUpdateableAppsChanged, updateableAppsFilter);

    if (savedInstanceState != null) {
        selectedMenuId = savedInstanceState.getInt(STATE_SELECTED_MENU_ID, R.id.whats_new);
    }
    setSelectedMenuInNav();

    initialRepoUpdateIfRequired();

    Intent intent = getIntent();
    handleSearchOrAppViewIntent(intent);
}