Java Code Examples for android.support.v7.app.AppCompatActivity

The following examples show how to use android.support.v7.app.AppCompatActivity. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: MeiZiNews   Source File: RxBusMeunIView.java    License: MIT License 6 votes vote down vote up
public void initColorful(AppCompatActivity appCompatActivity) {

        mColorful = new Colorful.Builder(appCompatActivity)
                // 设置view的背景
                .backgroundColor(navigationView.getHeaderView(0), R.attr.side_nav_bar)
                .backgroundColor(R.id.nav_view, R.attr.root_view_bg)
                .backgroundColor(R.id.toolbar, R.attr.colorPrimary)
                .backgroundColor(R.id.tabLayout, R.attr.colorPrimary)
                .backgroundColor(R.id.rl_main, R.attr.root_view_bg)

                .navigationViewItemColor(R.id.nav_view, R.attr.text_color)
                .drawerLayoutStatusBarBackgroundSetter(R.id.drawer_layout, R.attr.colorPrimaryDark)

                .create();

        boolean isDay = MyProfile.getInstance(appCompatActivity).getTheme().equals(ConstantData.MY_PROFILE_THEME_DAY);
        setTheme(isDay);

    }
 
Example 2
Source Project: AppPlus   Source File: AppFileListFragment.java    License: MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(initLayout(), container, false);
    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    toolbar.setTitle(R.string.app_name);

    toolbar.setSubtitle(R.string.tab_exported);

    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
    ab.setDisplayHomeAsUpEnabled(true);

    setupSwipeLayout(rootView);
    setupRecyclerView(rootView);

    return rootView;
}
 
Example 3
Source Project: VCL-Android   Source File: MRLPanelFragment.java    License: Apache License 2.0 6 votes vote down vote up
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(R.string.open_mrl_dialog_title);
    View v = inflater.inflate(R.layout.mrl_panel, container, false);
    mRootView = v.findViewById(R.id.mrl_root);
    mEditText = (TextInputLayout) v.findViewById(R.id.mrl_edit);
    mEditText.getEditText().setOnKeyListener(this);
    mEditText.getEditText().setOnEditorActionListener(this);
    mEditText.setHint(getString(R.string.open_mrl_dialog_msg));
    mRecyclerView = (RecyclerView) v.findViewById(R.id.mrl_list);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new MRLAdapter(mHistory);
    mRecyclerView.setAdapter(mAdapter);

    return v;
}
 
Example 4
Source Project: AndroidMaterialDesign   Source File: BaseFragment.java    License: Apache License 2.0 6 votes vote down vote up
protected void showTitleBack(View view, String title) {
    Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    if (toolbar != null) {
        //toolbar.setNavigationIcon(R.mipmap.ic_back_white);
        //or
        //change gray icon to white
        Drawable icon = getResources().getDrawable(R.mipmap.ic_back_gray);
        Drawable drawable = getTintedDrawable(icon, 0xffffffff);
        toolbar.setNavigationIcon(drawable);
        if (title != null) {
            toolbar.setTitle(title);
        }
        AppCompatActivity activity = (AppCompatActivity) getActivity();
        activity.setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    }

}
 
Example 5
Source Project: AppPlus   Source File: AppListFragment.java    License: MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(initLayout(), container, false);
    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    toolbar.setTitle(R.string.app_name_inner);

    toolbar.setSubtitle(getTitleString(mType));

    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
    ab.setDisplayHomeAsUpEnabled(true);

    setupSwipeLayout(rootView);
    setupRecyclerView(rootView);
    return rootView;
}
 
Example 6
Source Project: Muzesto   Source File: SongsListAdapter.java    License: GNU General Public License v3.0 5 votes vote down vote up
public SongsListAdapter(AppCompatActivity context, List<Song> arraylist
        , boolean isPlaylistSong) {
    this.arraylist = arraylist;
    this.mContext = context;
    this.isPlaylist = isPlaylistSong;
    this.songIDs = getSongIds();
    this.ateKey = Helpers.getATEKey(context);
    this.slideUpNowPlayingFragment = slideUpNowPlayingFragment;
}
 
Example 7
Source Project: APlayer   Source File: ColorChooserDialog.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void dismissIfNecessary(AppCompatActivity context, String tag) {
  Fragment frag = context.getSupportFragmentManager().findFragmentByTag(tag);
  if (frag != null) {
    ((DialogFragment) frag).dismiss();
    context.getSupportFragmentManager().beginTransaction()
        .remove(frag).commit();
  }
}
 
Example 8
Source Project: stynico   Source File: l.java    License: MIT License 5 votes vote down vote up
private void initView()
   {
toolbar = (android.support.v7.widget.Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
       ediContent = (AppCompatEditText) findViewById(R.id.id_lxw_push_content);
       scrollPicContent = (HorizontalScrollView) findViewById(R.id.id_lxw_push_scrollPicContent);
       layPicContent = (LinearLayout) findViewById(R.id.id_lxw_push_layPicContent);
       btnCamera = (LinearLayout) findViewById(R.id.id_lxw_push_btn_btnCamera);
       btnEmotion = (LinearLayout) findViewById(R.id.id_lxw_push_btn_btnEmotion);
       btnSend = (LinearLayout) findViewById(R.id.btnSend);
       emojPager = (ViewPager) findViewById(R.id.id_lxw_push_emoj_viewpager);
SharedPreferences sharedPreferencesb = getSharedPreferences("fba", AppCompatActivity.MODE_PRIVATE); 
String r = sharedPreferencesb.getString("stytoolpro", "");
ediContent.setText(r);
   }
 
Example 9
Source Project: incubator-weex-playground   Source File: ScreenUtil.java    License: Apache License 2.0 5 votes vote down vote up
private static int getSmartBarHeight(AppCompatActivity activity) {
    ActionBar actionbar = activity.getSupportActionBar();
    if (actionbar != null)
        try {
            Class c = Class.forName("com.android.internal.R$dimen");
            Object obj = c.newInstance();
            Field field = c.getField("mz_action_button_min_height");
            int height = Integer.parseInt(field.get(obj).toString());
            return activity.getResources().getDimensionPixelSize(height);
        } catch (Exception e) {
            e.printStackTrace();
            actionbar.getHeight();
        }
    return 0;
}
 
Example 10
Source Project: SteamGifts   Source File: SearchableListFragment.java    License: MIT License 5 votes vote down vote up
protected void startSearch(String query) {
    Log.d(TAG, "Starting Search for " + query);

    AppCompatActivity activity = ((AppCompatActivity) getActivity());
    FragmentManager fragmentManager = activity.getSupportFragmentManager();

    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.replace(R.id.fragment_container, newSearchingInstance(query), CommonActivity.FRAGMENT_TAG);
    transaction.addToBackStack(TAG);
    transaction.commit();
}
 
Example 11
Source Project: wallpaperboard   Source File: LicenseCallbackHelper.java    License: Apache License 2.0 5 votes vote down vote up
private void showRetryDialog() {
    new MaterialDialog.Builder(mContext)
            .typeface(TypefaceHelper.getMedium(mContext), TypefaceHelper.getRegular(mContext))
            .title(R.string.license_check)
            .content(R.string.license_check_retry)
            .positiveText(R.string.close)
            .cancelable(false)
            .canceledOnTouchOutside(false)
            .onPositive((dialog, which) -> ((AppCompatActivity) mContext).finish())
            .show();
}
 
Example 12
Source Project: AcDisplay   Source File: DialogHelper.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static void showDialog(@NonNull AppCompatActivity activity,
                               @NonNull DialogFragment fragment,
                               @NonNull String tag) {
    Check.getInstance().isInMainThread();

    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(tag);
    if (prev != null) ft.remove(prev);
    ft.addToBackStack(null);
    fragment.show(ft, tag);
}
 
Example 13
Source Project: Muzesto   Source File: MainFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(
                R.layout.fragment_main, container, false);

        Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
        ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

        final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
        ab.setHomeAsUpIndicator(R.drawable.ic_menu);
        ab.setDisplayHomeAsUpEnabled(true);

        if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
                && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.MODIFY_AUDIO_SETTINGS) == PackageManager.PERMISSION_GRANTED) {

            requestPermissions();

        }
        
//        audioVisualization = (AudioVisualization) rootView.findViewById(R.id.visualizer);
//        audioVisualization.linkTo(DbmHandler.Factory.newVisualizerHandler(getContext(), 0));
        viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
        if (viewPager != null) {
            setupViewPager(viewPager);
            viewPager.setOffscreenPageLimit(2);
        }

        TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tabs);
        tabLayout.setTabMode(TabLayout.MODE_FIXED);
        tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
        tabLayout.setupWithViewPager(viewPager);

//        tabLayout.getTabAt(0).setIcon(R.drawable.ic_audiotrack_white_24dp);
//        tabLayout.getTabAt(1).setIcon(R.drawable.ic_album_white_24dp);
//        tabLayout.getTabAt(2).setIcon(R.drawable.ic_sentiment_satisfied_white_24dp);

        return rootView;

    }
 
Example 14
Source Project: PermissMe   Source File: PermissMeTests.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testOnPermissionDenied_whenOptionalPermissionsAutoDenied_callOptionalPermissionDeniedListenerShowNoFailUi() {
	final String[] permissions = { Manifest.permission.WRITE_EXTERNAL_STORAGE};
	PowerMockito.when(PermissMeUtils.getDeniedPermissions(any(Activity.class), any(String[].class))).thenReturn
			(permissions);
	PowerMockito.when(PermissMeUtils.isAutoDeniedPermission(any(AppCompatActivity.class), any(String.class)))
			.thenReturn(true);

	// Create mock listener to check that correct callbacks are being called
	mPermissMe.mListener = mock(TestPermissionListener.class);

	// <<< EXECUTE CALL TO METHOD >>>
	mPermissMe.onPermissionDenied(PermissMe.OPTIONAL_PERMISSION_REQUEST_CODE, permissions);

	ArgumentCaptor<String[]> permissionArgumentCaptor = ArgumentCaptor.forClass(String[].class);
	ArgumentCaptor<boolean[]> autoDeniedArgumentCaptor = ArgumentCaptor.forClass(boolean[].class);

	// Test callback methods in listener
	verify(mPermissMe.mListener, times(1)).onOptionalPermissionDenied(permissionArgumentCaptor.capture(),
			autoDeniedArgumentCaptor.capture());
	verify(mPermissMe.mListener, never()).onRequiredPermissionDenied(any(String[].class),
			any(boolean[].class));
	verify(mPermissMe.mListener, never()).onSuccess();

	// Test values of the callbacks
	assertTrue(permissionArgumentCaptor.getValue().length == 1);
	assertTrue(autoDeniedArgumentCaptor.getValue().length == 1);
	assertArrayEquals(permissions, permissionArgumentCaptor.getValue());
	assertTrue(autoDeniedArgumentCaptor.getValue()[0]);

	// Test that we do show the permission denied snackbar
	PowerMockito.verifyStatic(never());
	PermissMeUtils.showPermissionDeniedSnackbar(any(Activity.class), anyString());
}
 
Example 15
Source Project: mua   Source File: BaseEditorFragment.java    License: MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(getLayoutId(), container, false);
    ButterKnife.bind(this, view);
    context = (AppCompatActivity) getContext();
    initView();
    return view;
}
 
Example 16
Source Project: HelloActivityAndFragment   Source File: ToolbarFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    Log.i(TAG, "onViewCreated(): " + savedInstanceState);
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    setHasOptionsMenu(true);
    toolbar.setTitle("Parent Fragment");
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
}
 
Example 17
Source Project: android-ponewheel   Source File: PermissionUtil.java    License: MIT License 5 votes vote down vote up
/**
 * Requests the fine location permission. If a rationale with an additional explanation should
 * be shown to the user, displays a dialog that triggers the request.
 */
public static void requestPermission(AppCompatActivity activity, int requestId,
                                     String permission, boolean finishActivity) {
    if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
        // Display a dialog with rationale.
        PermissionUtil.RationaleDialog.newInstance(requestId, finishActivity)
                .show(activity.getSupportFragmentManager(), "dialog");
    } else {
        // Location permission has not been granted yet, request it.
        ActivityCompat.requestPermissions(activity, new String[]{permission}, requestId);

    }
}
 
Example 18
Source Project: MeiZiNews   Source File: SearchIView.java    License: MIT License 5 votes vote down vote up
private void initSearch_view(AppCompatActivity appCompatActivity) {

        search_view.setVersion(mVersion);
        search_view.setStyle(mStyle);
        search_view.setTheme(mTheme);

        // -----------------------------------------------------------------------------------------
        search_view.setDivider(true);
        search_view.setHint(R.string.search);
        search_view.setHintSize(appCompatActivity.getResources().getDimension(R.dimen.search_text_medium));
        search_view.setVoice(false);
        search_view.setAnimationDuration(300);
        search_view.setShadowColor(ContextCompat.getColor(appCompatActivity, R.color.search_shadow_layout));

    }
 
Example 19
Source Project: ClassLoader   Source File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void printHowClassLoaderWorks() {
    Log.i(TAG, "Load core java libraries by " + String.class.getClassLoader());
    Log.i(TAG, "Load user-defined classes by " + MainActivity.class.getClassLoader());
    Log.i(TAG, "Load third party libraries by " + AppCompatActivity.class.getClassLoader());//what you imported from gradle or libs/
    Log.i(TAG, "Default classLoader is " + getClassLoader());
    Log.i(TAG, "Default system classLoader is " + ClassLoader.getSystemClassLoader());

    if (getClassLoader() == ClassLoader.getSystemClassLoader())
        Log.d(TAG, "Default class loader is equal to default system class loader.");
    else
        Log.e(TAG, "Default class loader is NOT equal to default system class loader.");
}
 
Example 20
Source Project: multi-copy   Source File: NotesFragment.java    License: Apache License 2.0 5 votes vote down vote up
private void onListItemSelect(int position){
    notesAdapter.toggleSelection(position);
    boolean hasCheckedItems = notesAdapter.getSelectedCount() > 0 ; //check if any items are already selected

    if(hasCheckedItems && actionMode == null){
        //there are some items selected start the action mode
        actionMode = ((AppCompatActivity)getActivity()).startSupportActionMode(new Toolbar_ActionMode_Callback(getActivity(),notesAdapter,notesList,this));
    }else if(!hasCheckedItems && actionMode != null){
        //there are no items selected finish the action mode
        actionMode.finish();
    }
    if(actionMode != null)
        actionMode.setTitle(String.valueOf(notesAdapter.getSelectedCount()) + " selected");
}
 
Example 21
Source Project: MeiZiNews   Source File: VideoPageMainIView.java    License: MIT License 5 votes vote down vote up
@Override
public void initFragments(AppCompatActivity appCompatActivity) {
    super.initFragments(appCompatActivity);
    DyPageFragment dyPageFragment = new DyPageFragment();
    XmTvPageFragment xmTvPageFragment = new XmTvPageFragment();

    fragments.add(dyPageFragment);
    fragments.add(xmTvPageFragment);

    titles.add(appCompatActivity.getString(R.string.tab_dy));
    titles.add(appCompatActivity.getString(R.string.tab_xm));
}
 
Example 22
Source Project: SteamGifts   Source File: GiveawayDetailFragment.java    License: MIT License 5 votes vote down vote up
/**
 * Update the title in the CollapsingToolbarLayout or Actionbar, depending on which is used.
 */
private void updateTitle() {
    Log.v(TAG, "Setting title to " + getTitle());
    final CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) getActivity().findViewById(R.id.toolbar_layout);
    if (appBarLayout != null) {
        appBarLayout.setTitle(getTitle());
    } else {
        ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
        if (actionBar != null)
            actionBar.setTitle(getTitle());
    }
}
 
Example 23
public static void setProgressSpinnerVisible(AppCompatActivity activity, boolean visible) {
    ActionBar bar = activity.getSupportActionBar();

    if (bar.getCustomView() == null) {
        ProgressBar spinner = new ProgressBar(activity);
        spinner.setIndeterminate(true);
        bar.setCustomView(spinner);
    }

    bar.setDisplayShowCustomEnabled(visible);
}
 
Example 24
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_favorite_currency_list, container, false);
    setHasOptionsMenu(true);
    this.db = DatabaseHelperSingleton.getInstance(getActivity());
    sharedPreferences = getContext().getSharedPreferences(SHAREDPREF_SETTINGS, MODE_PRIVATE);
    currencyRecyclerView = rootView.findViewById(R.id.currency_favs_recycler_view);
    HorizontalDividerItemDecoration divider = new HorizontalDividerItemDecoration.Builder(getActivity()).build();
    currencyRecyclerView.addItemDecoration(divider);
    LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    currencyRecyclerView.setLayoutManager(llm);
    currencyItemFavsList = new ArrayList<>();
    adapter = new FavsCurrencyListAdapter(favsUpdateCallback, currencyItemFavsList, db, (AppCompatActivity) getActivity(), new CustomItemClickListener() {
        @Override
        public void onItemClick(int position, View v) {
            Intent intent = new Intent(getActivity(), CurrencyDetailsTabsActivity.class);
            intent.putExtra(GraphFragment.ARG_SYMBOL, currencyItemFavsList.get(position).getSymbol());
            intent.putExtra(GraphFragment.ARG_ID, currencyItemFavsList.get(position).getId());
            intent.putExtra(GraphFragment.COIN_OBJECT, currencyItemFavsList.get(position));
            getActivity().startActivity(intent);
        }
    });
    currencyRecyclerView.setAdapter(adapter);
    swipeRefreshLayout = rootView.findViewById(R.id.currency_favs_swipe_refresh);
    swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent);
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.post(new Runnable() {
        @Override
        public void run() {
            swipeRefreshLayout.setRefreshing(true);
            getCurrencyList();
        }
    });
    return rootView;
}
 
Example 25
Source Project: FastAccess   Source File: DeviceAppsView.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override public void setSelection(@NonNull String packageName, int position) {
    adapter.select(packageName, position, !adapter.isSelected(packageName));
    if (hasSelection()) {
        if (actionMode == null) {
            actionMode = ((AppCompatActivity) getActivity()).startSupportActionMode(getPresenter());
        }
        actionMode.setTitle(getString(R.string.selected) + " ( " + adapter.selectionSize() + " )");
    } else {
        actionMode.finish();
    }
}
 
Example 26
Source Project: AcDisplay   Source File: DialogHelper.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void showCryDialog(@NonNull AppCompatActivity activity) {
    Check.getInstance().isInMainThread();

    Resources res = activity.getResources();
    CharSequence message = Html.fromHtml(res.getString(R.string.cry_dialog_message));

    new MaterialDialog.Builder(activity)
            .iconRes(R.drawable.ic_action_about_white)
            .title(R.string.cry_dialog_title)
            .content(message)
            .negativeText(R.string.close)
            .build()
            .show();
}
 
Example 27
@Deprecated
private TypefaceCompatFactory(Context context, boolean typefaceDetectionEnabled) {
    TypefaceCompat.setTypefaceDetectionEnabled(typefaceDetectionEnabled);
    try {
        this.mBaseFactory = (LayoutInflaterFactory) ((AppCompatActivity) context).getDelegate();
    } catch (ClassCastException e) {
        e.printStackTrace();
    }
}
 
Example 28
private EntityHeaderController(AppCompatActivity activity, Fragment fragment, View header) {
    mAppContext = activity.getApplicationContext();
    mFragment = fragment;
    if (header != null) {
        mHeader = header;
    } else {
        mHeader = LayoutInflater.from(fragment.getContext())
                .inflate(R.layout.settings_entity_header, null /* root */);
    }
}
 
Example 29
Source Project: Androzic   Source File: WaypointProperties.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onResume()
{
	super.onResume();
	((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(R.string.waypointproperties_name);
	//tooltipCallback.postDelayed(showTooltip, TooltipManager.TOOLTIP_DELAY_SHORT);
}
 
Example 30
Source Project: talk-android   Source File: ContactsCoverFragment.java    License: MIT License 5 votes vote down vote up
private void setupToolbar() {
    toolbar.setBackgroundColor(0x00ffffff);
    toolbar.setNavigationIcon(R.drawable.ic_action_close_contact);
    toolbar.setTitleTextColor(0xde0f3666);
    toolbar.setTitle(R.string.local_contacts);
    ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
    ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayShowHomeEnabled(true);
}