Example usage for android.view LayoutInflater from

List of usage examples for android.view LayoutInflater from

Introduction

In this page you can find the example usage for android.view LayoutInflater from.

Prototype

public static LayoutInflater from(Context context) 

Source Link

Document

Obtains the LayoutInflater from the given context.

Usage

From source file:br.liveo.searchliveo.SearchCardLiveo.java

private void init(Context context) {
    View view = LayoutInflater.from(context).inflate(R.layout.search_liveo_card, this, true);

    mEdtSearch = (EditText) view.findViewById(R.id.edt_search);

    mImgArrowSearch = (ImageView) view.findViewById(R.id.img_arrow_search);
    mImgVoiceSearch = (ImageView) view.findViewById(R.id.img_voice_search);

    mImgCloseSearch = (ImageView) view.findViewById(R.id.img_close_search);
    mImgCloseSearch.setVisibility(isVoice() ? View.GONE : View.VISIBLE);

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_search_view);

    mCardSearch = (CardView) view.findViewById(R.id.card_search);
    mCardSearch.setVisibility(View.VISIBLE);

    mEdtSearch.setOnKeyListener(onKeyListener);

    mImgArrowSearch.setOnClickListener(onClickSearchArrow);
    mRecyclerView.setOnClickListener(onClickRecyclerView);
    mImgVoiceSearch.setOnClickListener(onClickVoiceSearch);
    mImgCloseSearch.setOnClickListener(onClickCloseSearch);

    mEdtSearch.setOnEditorActionListener(onEditorActionListener);
    mEdtSearch.addTextChangedListener(new OnTextWatcherEdtSearch());
}

From source file:android.support.wear.widget.drawer.WearableDrawerView.java

public WearableDrawerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    LayoutInflater.from(context).inflate(R.layout.ws_wearable_drawer_view, this, true);

    setClickable(true);//from w  ww.java  2  s.co m
    setElevation(context.getResources().getDimension(R.dimen.ws_wearable_drawer_view_elevation));

    mPeekContainer = (ViewGroup) findViewById(R.id.ws_drawer_view_peek_container);
    mPeekIcon = (ImageView) findViewById(R.id.ws_drawer_view_peek_icon);

    mPeekContainer.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            onPeekContainerClicked(v);
        }
    });

    parseAttributes(context, attrs, defStyleAttr, defStyleRes);
}

From source file:com.android.mms.ui.ConversationList.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String launchMode = getLaunchMode(MMS_LAUNCH_MODE_PATH);
    if (!"folder".equals(launchMode)) {
        setLaunchMode(MMS_LAUNCH_MODE_PATH, "conversation");

        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setContentView(R.layout.conversation_list_screen);

        mQueryHandler = new ThreadListQueryHandler(getContentResolver());

        //            ListView
        listView = getListView();//ww  w. jav  a 2s .  c  o  m
        LayoutInflater inflater = LayoutInflater.from(this);
        ConversationListItem headerView = (ConversationListItem) inflater
                .inflate(R.layout.conversation_list_item, listView, false);

        /*---------------------by lai----------------------------*/
        headerView.setVisibility(View.GONE);
        LayoutParams laParams = (LayoutParams) headerView.getLayoutParams();
        laParams.height = 1;//
        headerView.setLayoutParams(laParams);//
        /*---------------------by lai----------------------------*/

        headerView.bind(getString(R.string.new_message), getString(R.string.create_new_message));
        listView.addHeaderView(headerView, null, true);

        listView.setOnCreateContextMenuListener(mConvListOnCreateContextMenuListener);
        listView.setOnKeyListener(mThreadListKeyListener);

        initListAdapter();

        mTitle = getString(R.string.app_label);

        mHandler = new Handler();
        mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
        boolean checkedMessageLimits = mPrefs.getBoolean(CHECKED_MESSAGE_LIMITS, false);
        if (DEBUG)
            Log.v(TAG, "checkedMessageLimits: " + checkedMessageLimits);
        if (!checkedMessageLimits || DEBUG) {
            runOneTimeStorageLimitCheckForLegacyMessages();
        }

        // fixed bug for 19102 19105 start
        if (MmsApp.initMms) {
            Conversation.init(this, true);
        }
        // fixed bug for 19102 19105 end
    } else {
        Intent it = new Intent(this, MessageFolderActivity.class);
        startActivity(it);
        this.finish();
    }
}

From source file:com.sunho.nating.fragments.DetailPlaceFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    root = (FrameLayout) view;/*from   w w  w . ja  v  a  2  s  .  c o m*/
    context = view.getContext();
    assert context != null;
    // This is how the fragment looks at first. Since the transition is one-way, we don't need to make
    // this a Scene.
    View item = LayoutInflater.from(context).inflate(R.layout.item_gridview, root, false);
    assert item != null;
    bind(item);
    // We adjust the position of the initial image with LayoutParams using the values supplied
    // as the fragment arguments.
    Bundle args = getArguments();
    FrameLayout.LayoutParams params = null;
    if (args != null) {
        params = new FrameLayout.LayoutParams(args.getInt(ARG_WIDTH), args.getInt(ARG_HEIGHT));
        params.topMargin = args.getInt(ARG_Y);
        params.leftMargin = args.getInt(ARG_X);
    }
    root.addView(item, params);
}

From source file:com.app.jdy.activity.GoldActivity.java

private void initView() {
    mContext = this;
    notice_tip = getResources().getString(R.string.no_more_product);
    linearLayout_net_error = (LinearLayout) findViewById(R.id.linearLayout_net_error);
    linearLayout_content = (LinearLayout) findViewById(R.id.linearLayout_content);
    //imageLayout_net_error = (LinearLayout) findViewById(R.id.imageLayout_net_error);
    back_img = (ImageView) findViewById(R.id.back_img);
    title_tv = (TextView) findViewById(R.id.title_tv);
    right_img = (ImageView) findViewById(R.id.right_img);

    right_img.setBackgroundResource(R.drawable.search);
    right_img.setOnClickListener(this);
    if (flag == 0) {
        request_url = URLs.GETPRODUCTLIST;
        title_tv.setText("");
        back_img.setVisibility(View.INVISIBLE);
    } else if (flag == 1) {
        request_url = URLs.FOLLOWLIST_URL;
        title_tv.setText("?");
        back_img.setVisibility(View.VISIBLE);

        menu = new SlidingMenu(this);
        menu.setMode(SlidingMenu.RIGHT);
        menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        menu.setShadowWidthRes(R.dimen.shadow_width);
        menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menu.setFadeDegree(0.35f);//from www  . ja v a2 s. com
        menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        View view = LayoutInflater.from(mContext).inflate(R.layout.search_popuwindow, null);
        edit_search = (EditText) view.findViewById(R.id.edit_search);
        lv_search = (ListView) view.findViewById(R.id.lv_search);
        searchListViewAdapter = new SearchListViewAdapter(strs, mContext);
        lv_search.setAdapter(searchListViewAdapter);
        lv_search.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
                TextView tv = (TextView) view.findViewById(R.id.tv_search);
                Intent intent = new Intent();
                intent.setAction("org.jdy.action.LV_SEARCH_BROADCAST");
                intent.putExtra("search_ProdType", CommonUtils.CodeForName(tv.getText().toString()));
                intent.putExtra("reqFlag", 1);
                sendBroadcast(intent);
                menu.showContent();
            };
        });
        btn_search = (Button) view.findViewById(R.id.btn_search);
        btn_search.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                CommonUtils.HideKeyBoard(mContext, edit_search);
                Intent intent = new Intent();
                intent.setAction("org.jdy.action.KEYWORD_SEARCH_BROADCAST");
                intent.putExtra("search_keyWord", edit_search.getText().toString());
                intent.putExtra("reqFlag", 1);
                sendBroadcast(intent);
                menu.showContent();
            }
        });
        menu.setMenu(view);
        slidingMenuLayout = (LinearLayout) findViewById(R.id.slidingmenu);
        final Bitmap bitmap = BitmapUtils.readBitMap(mContext, R.drawable.sliding_bg,
                slidingMenuLayout.getMeasuredWidth(), slidingMenuLayout.getMeasuredHeight());
        slidingMenuLayout.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                slidingMenuLayout.getViewTreeObserver().removeOnPreDrawListener(this);
                BitmapUtils.blur(bitmap, slidingMenuLayout);
                return true;
            }
        });
    }

    back_img.setOnClickListener(this);
    order_layout = (LinearLayout) findViewById(R.id.order_layout);
    line_minSubsAmount = (LinearLayout) findViewById(R.id.line_minSubsAmount);
    line_expeAnnuRevnue = (LinearLayout) findViewById(R.id.line_expeAnnuRevnue);
    line_period = (LinearLayout) findViewById(R.id.line_period);

    orderLayouts.add(line_minSubsAmount);
    orderLayouts.add(line_expeAnnuRevnue);
    orderLayouts.add(line_period);
    line_expeAnnuRevnue.setOnClickListener(this);
    line_minSubsAmount.setOnClickListener(this);
    line_period.setOnClickListener(this);
    ATListview = (MyListView) findViewById(R.id.gold_Listview);
    ATListview.setOnItemClickListener(new onClickview());
    listViewAdapter = new ListViewAdapter(mContext, productList);
    ATListview.setAdapter(listViewAdapter);

    mPullRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.gold_pull_refresh_scrollview);
    /**
     * 
     */
    lvSearchReceiver = new LV_SEARCH_BROADCAST();
    IntentFilter intentFilter2 = new IntentFilter("org.jdy.action.LV_SEARCH_BROADCAST");
    registerReceiver(lvSearchReceiver, intentFilter2);
    keyWordSearchReceiver = new KeyWordSearchReceiver();
    IntentFilter intentFilter3 = new IntentFilter("org.jdy.action.KEYWORD_SEARCH_BROADCAST");
    registerReceiver(keyWordSearchReceiver, intentFilter3);
    /**
     * ?
     */
    mPullRefreshScrollView.setOnRefreshListener(new OnRefreshListener<ScrollView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ScrollView> refreshView) {
            pageNumber++;
            notice_tip = getResources().getString(R.string.no_more_product);
            new QueryProductListTask().execute();
            mPullRefreshScrollView.onRefreshComplete();
        }
    });

    new QueryProductListTask().execute();
}

From source file:cm.aptoide.pt.RemoteInSearch.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    switch (item.getItemId()) {
    case MANAGE_REPO:
        Intent i = new Intent(this, ManageRepo.class);
        startActivity(i);//from  w  w  w .  ja v  a 2  s .c om
        return true;
    case SEARCH_MENU:
        onSearchRequested();
        return true;
    case ABOUT:
        LayoutInflater li = LayoutInflater.from(this);
        View view = li.inflate(R.layout.about, null);
        Builder p = new AlertDialog.Builder(this).setView(view);
        final AlertDialog alrt = p.create();
        alrt.setIcon(R.drawable.icon);
        alrt.setTitle("APTOIDE");
        alrt.setButton("ChangeLog", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                Uri uri = Uri.parse("http://aptoide.com/changelog.html");
                startActivity(new Intent(Intent.ACTION_VIEW, uri));
            }
        });
        alrt.show();
        return true;
    case SETTINGS:
        Intent s = new Intent(RemoteInSearch.this, Settings.class);
        s.putExtra("order", order_lst);
        startActivityForResult(s, SETTINGS_FLAG);
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.layer.atlas.AtlasMessagesList.java

public void init(final LayerClient layerClient, final Atlas.ParticipantProvider participantProvider) {
    if (layerClient == null)
        throw new IllegalArgumentException("LayerClient cannot be null");
    if (participantProvider == null)
        throw new IllegalArgumentException("ParticipantProvider cannot be null");

    this.client = layerClient;
    LayoutInflater.from(getContext()).inflate(R.layout.atlas_messages_list, this);

    // --- message view
    messagesList = (ListView) findViewById(R.id.atlas_messages_list);
    messagesList.setAdapter(messagesAdapter = new BaseAdapter() {

        public View getView(int position, View convertView, ViewGroup parent) {
            final Cell cell = cells.get(position);
            MessagePart part = cell.messagePart;
            String userId = part.getMessage().getSender().getUserId();

            boolean myMessage = client.getAuthenticatedUserId().equals(userId);

            if (convertView == null) {
                convertView = LayoutInflater.from(parent.getContext())
                        .inflate(R.layout.atlas_view_messages_convert, parent, false);
            }/*from   w  w w .j  a  v a 2  s . c o m*/

            View spacerTop = convertView.findViewById(R.id.atlas_view_messages_convert_spacer_top);
            spacerTop.setVisibility(
                    cell.clusterItemId == cell.clusterHeadItemId && !cell.timeHeader ? View.VISIBLE
                            : View.GONE);

            View spacerBottom = convertView.findViewById(R.id.atlas_view_messages_convert_spacer_bottom);
            spacerBottom.setVisibility(cell.clusterTail ? View.VISIBLE : View.GONE);

            // format date
            View timeBar = convertView.findViewById(R.id.atlas_view_messages_convert_timebar);
            TextView timeBarDay = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_timebar_day);
            TextView timeBarTime = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_timebar_time);
            if (cell.timeHeader) {

                Calendar cal = Calendar.getInstance();
                cal.set(Calendar.HOUR_OF_DAY, 0);
                cal.set(Calendar.MINUTE, 0);
                cal.set(Calendar.SECOND, 0);
                long todayMidnight = cal.getTimeInMillis();
                long yesterMidnight = todayMidnight - (24 * 60 * 60 * 1000); // 24h less
                Date sentAt = cell.messagePart.getMessage().getSentAt();
                if (sentAt == null)
                    sentAt = new Date();

                String timeBarTimeText = timeFormat.format(sentAt.getTime());
                String timeBarDayText = null;
                if (sentAt.getTime() > todayMidnight) {
                    timeBarDayText = "Today";
                } else if (sentAt.getTime() > yesterMidnight) {
                    timeBarDayText = "Yesterday";
                } else {
                    timeBarDayText = Tools.sdfDayOfWeek.format(sentAt);
                }
                timeBarDay.setText(timeBarDayText);
                timeBarTime.setText(timeBarTimeText);
                timeBar.setVisibility(View.VISIBLE);
            } else {
                timeBar.setVisibility(View.GONE);
            }

            TextView textAvatar = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_initials);
            View spacerRight = convertView.findViewById(R.id.atlas_view_messages_convert_spacer_right);
            if (myMessage) {
                spacerRight.setVisibility(View.GONE);
                textAvatar.setVisibility(View.INVISIBLE);
            } else {
                spacerRight.setVisibility(View.VISIBLE);
                Atlas.Participant participant = participantProvider.getParticipant(userId);
                String displayText = participant != null ? Atlas.getInitials(participant) : "";
                textAvatar.setText(displayText);
                textAvatar.setVisibility(View.VISIBLE);
            }

            // mark unsent messages
            View cellContainer = convertView.findViewById(R.id.atlas_view_messages_cell_container);
            cellContainer.setAlpha(
                    (myMessage && !cell.messagePart.getMessage().isSent()) ? CELL_CONTAINER_ALPHA_UNSENT
                            : CELL_CONTAINER_ALPHA_SENT);

            // delivery receipt check
            TextView receiptView = (TextView) convertView
                    .findViewById(R.id.atlas_view_messages_convert_delivery_receipt);
            receiptView.setVisibility(View.GONE);
            if (latestDeliveredMessage != null
                    && latestDeliveredMessage.getId().equals(cell.messagePart.getMessage().getId())) {
                receiptView.setVisibility(View.VISIBLE);
                receiptView.setText("Delivered");
            }
            if (latestReadMessage != null
                    && latestReadMessage.getId().equals(cell.messagePart.getMessage().getId())) {
                receiptView.setVisibility(View.VISIBLE);
                receiptView.setText("Read");
            }

            // processing cell
            bindCell(convertView, cell);

            // mark displayed message as read
            Message msg = part.getMessage();
            if (!msg.getSender().getUserId().equals(client.getAuthenticatedUserId())) {
                msg.markAsRead();
            }

            timeBarDay.setTextColor(dateTextColor);
            timeBarTime.setTextColor(dateTextColor);
            textAvatar.setTextColor(avatarTextColor);
            ((GradientDrawable) textAvatar.getBackground()).setColor(avatarBackgroundColor);

            return convertView;
        }

        private void bindCell(View convertView, final Cell cell) {

            ViewGroup cellContainer = (ViewGroup) convertView
                    .findViewById(R.id.atlas_view_messages_cell_container);

            View cellRootView = cell.onBind(cellContainer);
            boolean alreadyInContainer = false;
            // cleanUp container
            cellRootView.setVisibility(View.VISIBLE);
            for (int iChild = 0; iChild < cellContainer.getChildCount(); iChild++) {
                View child = cellContainer.getChildAt(iChild);
                if (child != cellRootView) {
                    child.setVisibility(View.GONE);
                } else {
                    alreadyInContainer = true;
                }
            }
            if (!alreadyInContainer) {
                cellContainer.addView(cellRootView);
            }
        }

        public long getItemId(int position) {
            return position;
        }

        public Object getItem(int position) {
            return cells.get(position);
        }

        public int getCount() {
            return cells.size();
        }

    });

    messagesList.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Cell item = cells.get(position);
            if (clickListener != null) {
                clickListener.onItemClick(item);
            }
        }
    });
    // --- end of messageView

    updateValues();
}

From source file:com.hhunj.hhudata.SearchBookContentsActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Make sure that expired cookies are removed on launch.
    CookieSyncManager.createInstance(this);
    CookieManager.getInstance().removeExpiredCookie();

    Intent intent = getIntent();//w  w w.java 2  s  .c  o  m
    if (intent == null || (!intent.getAction().equals(Intents.SearchBookContents.ACTION))) {
        finish();
        return;
    }

    //pageid,pagenumber
    //ISBN  ---stationid,
    isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);//stationid
    if (isbn.startsWith("http://google.com/books?id=")) {
        setTitle(getString(R.string.sbc_name));
    } else {
        setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
    }

    setContentView(R.layout.search_book_contents);
    queryTextView = (EditText) findViewById(R.id.query_text_view);

    String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
    if (initialQuery != null && initialQuery.length() > 0) {
        // Populate the search box but don't trigger the search
        queryTextView.setText(initialQuery);
    }
    queryTextView.setOnKeyListener(keyListener);

    queryButton = (Button) findViewById(R.id.query_button);
    queryButton.setOnClickListener(buttonListener);

    resultListView = (ListView) findViewById(R.id.result_list_view);
    LayoutInflater factory = LayoutInflater.from(this);
    headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false);
    resultListView.addHeaderView(headerView);
}

From source file:com.moto.miletus.application.tabs.ComponentsAdapter.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int position) {
    final CardView cardView = (CardView) LayoutInflater.from(parent.getContext())
            .inflate(R.layout.listitem_component, parent, false);

    return new ViewHolder(cardView, (RelativeLayout) cardView.findViewById(R.id.component_layout),
            (RelativeLayout) cardView.findViewById(R.id.show_layout),
            (TextView) cardView.findViewById(R.id.component_name),
            (TextView) cardView.findViewById(R.id.state_value1),
            (TextView) cardView.findViewById(R.id.state_value2),
            (TextView) cardView.findViewById(R.id.show_more),
            (ImageView) cardView.findViewById(R.id.command_settings),
            (ImageView) cardView.findViewById(R.id.arrow));
}

From source file:com.example.camera360.ui.ImageDetailActivity.java

@SuppressWarnings("unchecked")
@TargetApi(11)// ww  w  .  jav  a 2s .  c o  m
@Override
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    arrayList = (ArrayList<HashMap<String, String>>) getIntent().getSerializableExtra(IMAGE_URL);

    // Fetch screen height and width, to use as our max size when loading
    // images as this
    // activity runs full screen

    baseAnimate = new BaseAnimate();

    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    // For this sample we'll use half of the longest width to resize our
    // images. As the
    // image scaling ensures the image is larger than this, we should be
    // left with a
    // resolution that is appropriate for both portrait and landscape. For
    // best image quality
    // we shouldn't divide by 2, but this will use more memory and require a
    // larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR);
    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of
    // app memory

    mImageDetailLayout = (FrameLayout) findViewById(R.id.image_detail_layout);

    mImageDetailView = (LinearLayout) findViewById(R.id.image_detail);

    // The ImageFetcher takes care of loading images into our ImageView
    // children asynchronously
    mImageFetcher = new ImageFetcher(this, longest);
    mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
    mImageFetcher.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), arrayList.size());

    mInflater = LayoutInflater.from(mImageDetailLayout.getContext());

    mPager = (ViewPager) findViewById(R.id.view_pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));
    mPager.setOffscreenPageLimit(2);

    // Set up activity to go full screen
    getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to
    // create a more
    // immersive photo viewing experience
    if (Utils.hasHoneycomb()) {
        final ActionBar actionBar = getActionBar();

        // Hide title text and set home as up
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);

        // Hide and show the ActionBar as the visibility changes
        mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int vis) {
                if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                    actionBar.hide();
                } else {
                    actionBar.show();
                }
            }
        });

        // Start low profile mode and hide ActionBar
        mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        actionBar.hide();
    }

    // Set the current item based on the extra passed in to this activity
    final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1);

    currentIndex = extraCurrentItem;

    if (extraCurrentItem != -1) {
        mPager.setCurrentItem(extraCurrentItem);
    }

    mPager.setOnPageChangeListener(new ImageOnPageChangeListener());

    initHeaderMenu();

    addFooterMenu();

    initImageDetail();

    setImageInfo();
}