Example usage for android.view ViewGroup findViewById

List of usage examples for android.view ViewGroup findViewById

Introduction

In this page you can find the example usage for android.view ViewGroup findViewById.

Prototype

@Nullable
public final <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.

Usage

From source file:io.vit.vitio.Fragments.Today.TodayFragment.java

private void init(ViewGroup rootView) {
    subjectCode = (TextView) rootView.findViewById(R.id.subject_code);
    subjectName = (TextView) rootView.findViewById(R.id.subject_name);
    subjectTime = (TextView) rootView.findViewById(R.id.subject_time);
    subjectPer = (TextView) rootView.findViewById(R.id.subject_per);
    subjectVenue = (TextView) rootView.findViewById(R.id.subject_venue);
    ifmissedPer = (TextView) rootView.findViewById(R.id.ifmissed_per);
    ocassionQoute = (TextView) rootView.findViewById(R.id.ocassion_qoute);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.today_recycler_view);
    attendanceBar = (LinearLayout) rootView.findViewById(R.id.attendance_bar);
    bottomHalf = (LinearLayout) rootView.findViewById(R.id.bottom_half_content);
    topHalf = (LinearLayout) rootView.findViewById(R.id.top_half_content);
    ocassionContainer = (LinearLayout) rootView.findViewById(R.id.ocassion_container);
    ocassionContainerInner = (LinearLayout) rootView.findViewById(R.id.ocassion_container_inner);
    headerLayout = (LinearLayout) rootView.findViewById(R.id.header_layout);

    ocassionImage = (ImageView) rootView.findViewById(R.id.ocassion_image);

    /* weekendMusicImage=(ImageView)rootView.findViewById(R.id.weekend_music_image);
     weekendGlassesImage=(ImageView)rootView.findViewById(R.id.weekend_glasses_image);
     weekendShirtImage=(ImageView)rootView.findViewById(R.id.weekend_shirt_image);
     weekendCameraImage=(ImageView)rootView.findViewById(R.id.weekend_camera_image);
     */// w  w w.  j  a v a  2 s .c  om

    connectAPI = new ConnectAPI(getActivity());
    dataHandler = new DataHandler(getActivity());

    dialog = new ProgressDialog(getActivity());

    swipeRefreshLayout = (GeneralSwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setRecyclerView(recyclerView);

    theme = new MyTheme(getActivity());
}

From source file:com.adithya321.sharesanalysis.fragments.SummaryFragment.java

@Nullable
@Override/*from www .  j a  v  a2 s.  co m*/
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_summary, container, false);

    Window window = getActivity().getWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
    ((AppCompatActivity) getActivity()).getSupportActionBar()
            .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));

    currentInvestmentsTV = (TickerView) root.findViewById(R.id.current_investments);
    netWorthTV = (TickerView) root.findViewById(R.id.net_worth);
    potentialProfitTV = (TickerView) root.findViewById(R.id.potential_profit);
    targetProfitTV = (TickerView) root.findViewById(R.id.target_profit);

    currentInvestmentsTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency());
    netWorthTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency());
    potentialProfitTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency());
    targetProfitTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency());

    currentInvestmentsTV.setText("0");
    netWorthTV.setText("0");
    potentialProfitTV.setText("0");
    targetProfitTV.setText("0");

    databaseHandler = new DatabaseHandler(getContext());
    sharesList = databaseHandler.getShares();
    calculateValues();

    return root;
}

From source file:gov.wa.wsdot.android.wsdot.ui.tollrates.SR167TollRatesFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_dynamic_toll_rates, null);

    mRecyclerView = root.findViewById(R.id.my_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new SR167TollRatesItemAdapter(getActivity());
    mRecyclerView.setAdapter(mAdapter);/*from ww w  .  jav a  2 s .  c  om*/

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));

    mRecyclerView.setPadding(0, 0, 0, 120);

    addDisclaimerView(root);

    directionRadioGroup = root.findViewById(R.id.segment_control);

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
    radioGroupDirectionIndex = sharedPref.getInt(getString(R.string.toll_rates_167_travel_direction_key), 0);

    if (radioGroupDirectionIndex == 0) {
        RadioButton leftSegment = root.findViewById(R.id.radio_left);
        leftSegment.setChecked(true);
    } else {
        RadioButton rightSegment = root.findViewById(R.id.radio_right);
        rightSegment.setChecked(true);
    }

    directionRadioGroup.setOnCheckedChangeListener((group, checkedId) -> {

        RadioButton selectedDirection = directionRadioGroup.findViewById(checkedId);

        mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));

        mLayoutManager.scrollToPositionWithOffset(0, 0);
        SharedPreferences sharedPref1 = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sharedPref1.edit();

        radioGroupDirectionIndex = directionRadioGroup.indexOfChild(selectedDirection);

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);
        travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));

        editor.putInt(getString(R.string.toll_rates_167_travel_direction_key), radioGroupDirectionIndex);

        editor.apply();

    });

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    swipeRefreshLayout = root.findViewById(R.id.swipe_container);
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light,
            R.color.holo_orange_light, R.color.holo_red_light);

    mEmptyView = root.findViewById(R.id.empty_list_view);

    TextView header_link = root.findViewById(R.id.header_text);

    // create spannable string for underline
    SpannableString content = new SpannableString(
            getActivity().getResources().getString(R.string.sr167_info_link));
    content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
    header_link.setText(content);

    header_link.setTextColor(getResources().getColor(R.color.primary_default));
    header_link.setOnClickListener(v -> {
        Intent intent = new Intent();
        // GA tracker
        mTracker = ((WsdotApplication) getActivity().getApplication()).getDefaultTracker();
        mTracker.setScreenName("/Toll Rates/Learn about SR-167");
        mTracker.send(new HitBuilders.ScreenViewBuilder().build());
        intent.setAction(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("https://www.wsdot.wa.gov/Tolling/SR167HotLanes/HOTtollrates.htm"));
        startActivity(intent);

    });

    viewModel = ViewModelProviders.of(this, viewModelFactory).get(TollRatesViewModel.class);

    viewModel.getResourceStatus().observe(this, resourceStatus -> {
        if (resourceStatus != null) {
            switch (resourceStatus.status) {
            case LOADING:
                swipeRefreshLayout.setRefreshing(true);
                break;
            case SUCCESS:
                swipeRefreshLayout.setRefreshing(false);
                break;
            case ERROR:
                swipeRefreshLayout.setRefreshing(false);
                Toast.makeText(this.getContext(), "connection error", Toast.LENGTH_LONG).show();
            }
        }
    });

    viewModel.getSR167TollRateItems().observe(this, tollRateGroups -> {
        if (tollRateGroups != null) {
            mEmptyView.setVisibility(View.GONE);

            Collections.sort(tollRateGroups, new SortTollGroupByLocation());
            Collections.sort(tollRateGroups, new SortTollGroupByDirection());

            tollGroups = new ArrayList<>(tollRateGroups);

            directionRadioGroup.getCheckedRadioButtonId();
            RadioButton selectedDirection = directionRadioGroup
                    .findViewById(directionRadioGroup.getCheckedRadioButtonId());

            mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));
        }
    });

    viewModel.getTravelTimesForETLFor("167").observe(this, travelTimes -> {

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);

        if (travelTimes.size() > 0) {
            travelTimeView.setVisibility(View.VISIBLE);

            this.travelTimes = new ArrayList<>(travelTimes);

            travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));
        } else {

            travelTimeView.setVisibility(View.GONE);
        }
    });

    timer = new Timer();
    timer.schedule(new SR167TollRatesFragment.RatesTimerTask(), 0, 60000); // Schedule rates to update every 60 seconds

    return root;
}

From source file:cx.ring.fragments.CallFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.i(TAG, "onCreateView");
    final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_call, container, false);

    contactBubbleView = (ImageView) rootView.findViewById(R.id.contact_bubble);
    contactBubbleTxt = (TextView) rootView.findViewById(R.id.contact_bubble_txt);
    contactBubbleNumTxt = (TextView) rootView.findViewById(R.id.contact_bubble_num_txt);
    acceptButton = rootView.findViewById(R.id.call_accept_btn);
    refuseButton = rootView.findViewById(R.id.call_refuse_btn);
    hangupButton = rootView.findViewById(R.id.call_hangup_btn);
    mCallStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt);
    mSecuritySwitch = (ViewSwitcher) rootView.findViewById(R.id.security_switcher);
    securityIndicator = rootView.findViewById(R.id.security_indicator);
    return rootView;
}

From source file:com.evandroid.musica.fragment.LyricsViewFragment.java

private void showFirstStart() {
    stopRefreshAnimation();/* w w  w .  ja v  a  2  s  .c  o  m*/
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    ViewGroup parent = (ViewGroup) ((ViewGroup) getActivity().findViewById(R.id.scrollview)).getChildAt(0);
    if (parent.findViewById(R.id.tracks_msg) == null)
        inflater.inflate(R.layout.no_tracks, parent);

    TypedValue typedValue = new TypedValue();
    getActivity().getTheme().resolveAttribute(R.attr.firstLaunchCoverDrawable, typedValue, true);
    ((TextSwitcher) getActivity().findViewById(R.id.switcher)).setText("");
    getActivity().findViewById(R.id.error_msg).setVisibility(View.INVISIBLE);

}

From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteSchedulesDaySailingsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);

    return root;/* www  .java  2  s  .  com*/
}

From source file:gov.wa.wsdot.android.wsdot.ui.amtrakcascades.AmtrakCascadesSchedulesDetailsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Regular.ttf");
    tfb = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Bold.ttf");

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_recycler_with_textview_swipe_refresh, null);
    TextView schedule_title = root.findViewById(R.id.title);
    schedule_title.setTypeface(tfb);//from   w  ww .j av a 2 s .c  o m

    if ((fromLocation.equalsIgnoreCase(toLocation))) {
        schedule_title.setText(amtrakStations.get(fromLocation));
    } else {
        schedule_title.setText("Departing: " + amtrakStations.get(fromLocation) + " and Arriving: "
                + amtrakStations.get(toLocation));
    }

    mRecyclerView = root.findViewById(R.id.my_recycler_view);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new ScheduleAdapter(null);

    mRecyclerView.setAdapter(mAdapter);

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    swipeRefreshLayout = root.findViewById(R.id.swipe_container);
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light,
            R.color.holo_orange_light, R.color.holo_red_light);

    mEmptyView = root.findViewById(R.id.empty_list_view);

    viewModel = ViewModelProviders.of(this, viewModelFactory)
            .get(AmtrakCascadesSchedulesDetailsViewModel.class);

    viewModel.getResourceStatus().observe(this, resourceStatus -> {
        if (resourceStatus != null) {
            switch (resourceStatus.status) {
            case LOADING:
                swipeRefreshLayout.setRefreshing(true);
                break;
            case SUCCESS:
                swipeRefreshLayout.setRefreshing(false);
                break;
            case ERROR:
                swipeRefreshLayout.setRefreshing(false);
                TextView t = (TextView) mEmptyView;
                t.setText(R.string.no_connection);
                mEmptyView.setVisibility(View.VISIBLE);
                Toast.makeText(getContext(), "connection error", Toast.LENGTH_SHORT).show();
            }
        }
    });

    viewModel.getSchedule(statusDate, fromLocation, toLocation).observe(this, serviceItems -> {
        if (serviceItems != null) {
            mEmptyView.setVisibility(View.GONE);
            if (!serviceItems.isEmpty()) {
                mAdapter.setData(new ArrayList<>(serviceItems));
            } else {
                TextView t = (TextView) mEmptyView;
                t.setText("schedule unavailable.");
                mEmptyView.setVisibility(View.VISIBLE);
            }
        }
    });

    viewModel.refresh();

    return root;
}

From source file:gov.wa.wsdot.android.wsdot.ui.tollrates.I405TollRatesFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_dynamic_toll_rates, null);

    mRecyclerView = root.findViewById(R.id.my_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new I405TollRatesItemAdapter(getActivity());
    mRecyclerView.setAdapter(mAdapter);// ww w  .j  a  va 2  s . c o  m

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));

    mRecyclerView.setPadding(0, 0, 0, 120);

    addDisclaimerView(root);

    directionRadioGroup = root.findViewById(R.id.segment_control);

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
    radioGroupDirectionIndex = sharedPref.getInt(getString(R.string.toll_rates_405_travel_direction_key), 0);

    if (radioGroupDirectionIndex == 0) {
        RadioButton leftSegment = root.findViewById(R.id.radio_left);
        leftSegment.setChecked(true);
    } else {
        RadioButton rightSegment = root.findViewById(R.id.radio_right);
        rightSegment.setChecked(true);
    }

    directionRadioGroup.setOnCheckedChangeListener((group, checkedId) -> {

        RadioButton selectedDirection = directionRadioGroup.findViewById(checkedId);

        mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));

        mLayoutManager.scrollToPositionWithOffset(0, 0);
        SharedPreferences sharedPref1 = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sharedPref1.edit();

        radioGroupDirectionIndex = directionRadioGroup.indexOfChild(selectedDirection);

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);
        travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));

        editor.putInt(getString(R.string.toll_rates_405_travel_direction_key), radioGroupDirectionIndex);

        editor.apply();

    });

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    swipeRefreshLayout = root.findViewById(R.id.swipe_container);
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light,
            R.color.holo_orange_light, R.color.holo_red_light);

    mEmptyView = root.findViewById(R.id.empty_list_view);

    TextView header_link = root.findViewById(R.id.header_text);

    // create spannable string for underline
    SpannableString content = new SpannableString(
            getActivity().getResources().getString(R.string.i405_info_link));
    content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
    header_link.setText(content);

    header_link.setTextColor(getResources().getColor(R.color.primary_default));
    header_link.setOnClickListener(v -> {
        Intent intent = new Intent();
        // GA tracker
        mTracker = ((WsdotApplication) getActivity().getApplication()).getDefaultTracker();
        mTracker.setScreenName("/Toll Rates/Learn about I-405");
        mTracker.send(new HitBuilders.ScreenViewBuilder().build());
        intent.setAction(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("https://www.wsdot.wa.gov/Tolling/405/rates.htm"));
        startActivity(intent);
    });

    viewModel = ViewModelProviders.of(this, viewModelFactory).get(TollRatesViewModel.class);

    viewModel.getResourceStatus().observe(this, resourceStatus -> {
        if (resourceStatus != null) {
            switch (resourceStatus.status) {
            case LOADING:
                swipeRefreshLayout.setRefreshing(true);
                break;
            case SUCCESS:
                swipeRefreshLayout.setRefreshing(false);
                break;
            case ERROR:
                swipeRefreshLayout.setRefreshing(false);
                Toast.makeText(this.getContext(), "connection error", Toast.LENGTH_LONG).show();
            }
        }
    });

    viewModel.getTravelTimesStatus().observe(this, resourceStatus -> {
        if (resourceStatus != null) {
            switch (resourceStatus.status) {
            case LOADING:
                break;
            case SUCCESS:
                root.findViewById(R.id.travel_time_text).setVisibility(View.VISIBLE);
                break;
            case ERROR:
                root.findViewById(R.id.travel_time_text).setVisibility(View.GONE);
            }
        }
    });

    viewModel.getI405TollRateItems().observe(this, tollRateGroups -> {
        if (tollRateGroups != null) {

            mEmptyView.setVisibility(View.GONE);

            Collections.sort(tollRateGroups, new SortTollGroupByLocation());
            Collections.sort(tollRateGroups, new SortTollGroupByDirection());

            tollGroups = new ArrayList<>(tollRateGroups);

            directionRadioGroup.getCheckedRadioButtonId();
            RadioButton selectedDirection = directionRadioGroup
                    .findViewById(directionRadioGroup.getCheckedRadioButtonId());

            mAdapter.setData(filterTollsForDirection(String.valueOf(selectedDirection.getText().charAt(0))));
        }
    });

    viewModel.getTravelTimesForETLFor("405").observe(this, travelTimes -> {

        TextView travelTimeView = root.findViewById(R.id.travel_time_text);

        if (travelTimes.size() > 0) {
            travelTimeView.setVisibility(View.VISIBLE);

            this.travelTimes = new ArrayList<>(travelTimes);

            travelTimeView.setText(getTravelTimeStringForDirection(radioGroupDirectionIndex == 0 ? "N" : "S"));
        } else {
            travelTimeView.setVisibility(View.GONE);
        }
    });

    timer = new Timer();
    timer.schedule(new RatesTimerTask(), 0, 60000); // Schedule rates to update every 60 seconds

    return root;
}

From source file:com.money.manager.ex.home.DashboardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (container == null)
        return null;

    // parse layout
    ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.dashboard_fragment, container, false);
    if (layout == null)
        return null;
    linearScreens = new LinearLayout[ID_LOADER_SCREEN4 + 1];
    // get sub linearlayout
    linearScreens[ID_LOADER_SCREEN1] = (LinearLayout) layout.findViewById(R.id.linearLayoutScreen1);
    linearScreens[ID_LOADER_SCREEN2] = (LinearLayout) layout.findViewById(R.id.linearLayoutScreen2);
    linearScreens[ID_LOADER_SCREEN3] = (LinearLayout) layout.findViewById(R.id.linearLayoutScreen3);
    linearScreens[ID_LOADER_SCREEN4] = (LinearLayout) layout.findViewById(R.id.linearLayoutScreen4);
    // calculate padding
    scale = getResources().getDisplayMetrics().density;
    padding_in_px = (int) (padding_in_dp * scale + 0.5f);

    return layout;
}

From source file:com.adithya321.sharesanalysis.fragments.ShareHoldingsFragment.java

@Nullable
@Override//w w  w.  ja v  a  2  s  . c om
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_share_holdings, container, false);

    Window window = getActivity().getWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        window.setStatusBarColor(getResources().getColor(R.color.blue_700));
    ((AppCompatActivity) getActivity()).getSupportActionBar()
            .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorAccent)));

    databaseHandler = new DatabaseHandler(getContext());
    shareHoldingsRecyclerView = (RecyclerView) root.findViewById(R.id.share_holdings_recycler_view);
    setRecyclerViewAdapter();

    return root;
}