Java Code Examples for androidx.appcompat.app.actionbar#setHomeAsUpIndicator()

The following examples show how to use androidx.appcompat.app.actionbar#setHomeAsUpIndicator() . 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 check out the related API usage on the sidebar.
Example 1
Source File: BaseActivity.java    From CloudReader with Apache License 2.0 6 votes vote down vote up
/**
 * 设置titlebar
 */
protected void setToolBar(Toolbar toolbar) {
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.icon_back);
    }
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            supportFinishAfterTransition();
        }
    });
}
 
Example 2
Source File: ChatBackgroundActivity.java    From deltachat-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState, boolean ready) {
    setContentView(R.layout.activity_select_chat_background);

    defaultButton = findViewById(R.id.set_default_button);
    galleryButton = findViewById(R.id.from_gallery_button);
    preview = findViewById(R.id.preview);

    defaultButton.setOnClickListener(new DefaultClickListener());
    galleryButton.setOnClickListener(new GalleryClickListener());

    String backgroundImagePath = Prefs.getBackgroundImagePath(this);
    if(backgroundImagePath.isEmpty()){
        setDefaultLayoutBackgroundImage();
    }else {
        setLayoutBackgroundImage(backgroundImagePath);
    }

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.pref_background);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
    }

}
 
Example 3
Source File: ChromaDoze.java    From chromadoze with GNU General Public License v3.0 6 votes vote down vote up
public void setFragmentId(int id) {
    mFragmentId = id;

    final boolean enableUp = id != FragmentIndex.ID_CHROMA_DOZE;
    ActionBar actionBar = getSupportActionBar();
    supportInvalidateOptionsMenu();

    // Use the default left arrow, or a scaled-down Chroma Doze icon.
    actionBar.setHomeAsUpIndicator(enableUp ? null : mToolbarIcon);

    // When we're on the main page, make the icon non-clickable.
    ImageButton navUp = findImageButton(findViewById(R.id.toolbar));
    if (navUp != null) {
        navUp.setClickable(enableUp);
    }

    mNavSpinner.setSelection(id);
}
 
Example 4
Source File: BaseHeaderActivity.java    From CloudReader with Apache License 2.0 6 votes vote down vote up
/**
 * 设置toolbar
 */
protected void setToolBar() {
    setSupportActionBar(bindingTitleView.tbBaseTitle);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.icon_back);
    }
    bindingTitleView.tbBaseTitle.setOverflowIcon(ContextCompat.getDrawable(this, R.drawable.actionbar_more));
    bindingTitleView.tbBaseTitle.setNavigationOnClickListener(v -> {
        supportFinishAfterTransition();
    });
    bindingTitleView.tbBaseTitle.setOnMenuItemClickListener(item -> {
        if (item.getItemId() == R.id.actionbar_more) {
            // 更多信息
            setTitleClickMore();
        }
        return false;
    });
}
 
Example 5
Source File: EditTriggerFragment.java    From science-journal with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.menu_edit_trigger, menu);

  ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  if (isNewTrigger()) {
    actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
    actionBar.setHomeActionContentDescription(android.R.string.cancel);
  }

  menu.findItem(R.id.action_save).setVisible(isNewTrigger());
  menu.findItem(R.id.action_save).setEnabled(!isSavingNewTrigger);

  SensorAppearance appearance =
      AppSingleton.getInstance(getActivity())
          .getSensorAppearanceProvider(appAccount)
          .getAppearance(sensorId);
  String triggerTitle =
      getString(
          isNewTrigger()
              ? R.string.title_fragment_add_trigger
              : R.string.title_fragment_edit_trigger);
  actionBar.setTitle(String.format(triggerTitle, appearance.getName(getActivity())));

  super.onCreateOptionsMenu(menu, inflater);
}
 
Example 6
Source File: LttrsActivity.java    From lttrs-android with Apache License 2.0 5 votes vote down vote up
private void configureActionBarForDestination(NavDestination destination) {
    final ActionBar actionbar = getSupportActionBar();
    if (actionbar == null) {
        return;
    }
    final int destinationId = destination.getId();
    final boolean showMenu = MAIN_DESTINATIONS.contains(destinationId);
    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setHomeAsUpIndicator(showMenu ? R.drawable.ic_menu_black_24dp : R.drawable.ic_arrow_back_white_24dp);
    actionbar.setDisplayShowTitleEnabled(destinationId != R.id.thread);
}
 
Example 7
Source File: LabelDetailsFragment.java    From science-journal with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();

  actionBar.setDisplayHomeAsUpEnabled(true);
  actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24dp);
  actionBar.setHomeActionContentDescription(R.string.action_save);

  super.onCreateOptionsMenu(menu, inflater);
}
 
Example 8
Source File: UpdateRunFragment.java    From science-journal with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.menu_update_run, menu);

  ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
  actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
  actionBar.setHomeActionContentDescription(android.R.string.cancel);

  super.onCreateOptionsMenu(menu, inflater);
}
 
Example 9
Source File: BaseToolbarFragment.java    From Jockey with Apache License 2.0 5 votes vote down vote up
protected void setUpToolbar(Toolbar toolbar) {
    toolbar.setTitle(getFragmentTitle());

    setActivitySupportActionBar(toolbar);
    ActionBar actionBar = getActivitySupportActionBar();

    if (actionBar != null) {
        boolean showUpButton = canNavigateUp();
        actionBar.setDisplayHomeAsUpEnabled(showUpButton);
        actionBar.setHomeButtonEnabled(showUpButton);
        actionBar.setDisplayShowHomeEnabled(showUpButton);

        actionBar.setHomeAsUpIndicator(getUpButtonDrawable());
    }
}
 
Example 10
Source File: ExperimentDetailsFragment.java    From science-journal with Apache License 2.0 5 votes vote down vote up
@Override
public void onPrepareOptionsMenu(Menu menu) {
  NoteTakingActivity activity = (NoteTakingActivity) getActivity();
  if (!activity.isToolFragmentVisible() || activity.isTwoPane()) {
    menu.findItem(R.id.action_archive_experiment).setVisible(canArchive());
    menu.findItem(R.id.action_unarchive_experiment).setVisible(canUnarchive());
    // Disable archive option when recording.
    menu.findItem(R.id.action_archive_experiment).setEnabled(!isRecording());
    menu.findItem(R.id.action_delete_experiment).setEnabled(canDelete());
    menu.findItem(R.id.action_remove_cover_image).setVisible(canRemoveCoverImage());
    menu.findItem(R.id.action_include_archived).setVisible(!includeArchived);
    menu.findItem(R.id.action_exclude_archived).setVisible(includeArchived);
    menu.findItem(R.id.action_edit_experiment).setVisible(canEdit() && !isRecording());
    menu.findItem(R.id.run_review_overflow_menu).setVisible(!isRecording());

    boolean isShareIntentValid =
        FileMetadataUtil.getInstance()
            .validateShareIntent(getContext(), appAccount, experimentId);

    menu.findItem(R.id.action_export_experiment)
        .setVisible(experiment != null && isShareIntentValid);
    menu.findItem(R.id.action_export_experiment).setEnabled(!isRecording());
    menu.findItem(R.id.action_download_experiment).setVisible(experiment != null);
    menu.findItem(R.id.action_download_experiment).setEnabled(!isRecording());
    setHomeButtonState(isRecording());
  } else {
    if (activity.isSensorFragmentVisible() && isRecording()) {
      final Drawable v =
          ContextCompat.getDrawable(activity, R.drawable.ic_keyboard_arrow_down_24dp);
      ActionBar actionBar = activity.getSupportActionBar();
      actionBar.setHomeAsUpIndicator(v);
    } else {
      setHomeButtonState(!activity.isToolFragmentVisible() && isRecording());
    }
  }
}
 
Example 11
Source File: SelectEntriesActivity.java    From Aegis with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_entries);

    ActionBar bar = getSupportActionBar();
    bar.setHomeAsUpIndicator(R.drawable.ic_close);
    bar.setDisplayHomeAsUpEnabled(true);

    _adapter = new ImportEntriesAdapter();
    RecyclerView entriesView = findViewById(R.id.list_entries);
    entriesView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            onScroll(dx, dy);
        }
    });

    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    entriesView.setLayoutManager(layoutManager);
    entriesView.setAdapter(_adapter);
    entriesView.setNestedScrollingEnabled(false);

    Intent intent = getIntent();
    List<ImportEntry> entries = (ArrayList<ImportEntry>) intent.getSerializableExtra("entries");
    List<DatabaseImporterEntryException> errors = (ArrayList<DatabaseImporterEntryException>) intent.getSerializableExtra("errors");

    for (ImportEntry entry : entries) {
        _adapter.addEntry(entry);
    }

    if (errors.size() > 0) {
        showErrorDialog(errors);
    }

    FloatingActionButton fabMenu = findViewById(R.id.fab);
    fabMenu.setOnClickListener(v -> returnSelectedEntries());
    _fabScrollHelper = new FabScrollHelper(fabMenu);
}
 
Example 12
Source File: MonthlyReportActivity.java    From Medicine-Time- with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_monthly_report);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeAsUpIndicator(R.drawable.ic_clear);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    //Create Fragment
    MonthlyReportFragment monthlyReportFragment = (MonthlyReportFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame);
    if (monthlyReportFragment == null) {
        monthlyReportFragment = MonthlyReportFragment.newInstance();
        ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), monthlyReportFragment, R.id.contentFrame);
    }

    //Create TaskPresenter
    presenter = new MonthlyReportPresenter(Injection.provideMedicineRepository(MonthlyReportActivity.this), monthlyReportFragment);

    //Load previous saved Instance
    if (savedInstanceState != null) {
        FilterType taskFilterType = (FilterType) savedInstanceState.getSerializable(CURRENT_FILTERING_TYPE);
        presenter.setFiltering(taskFilterType);
    }
}
 
Example 13
Source File: BaseFragment.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
protected void showBack() {
    ActionBar actionBar = mActivity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.mipmap.ic_back);
    }
}
 
Example 14
Source File: BaseActivity.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
protected void showBack() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.mipmap.ic_back);
    }
}
 
Example 15
Source File: MapFragment.java    From nearby-android with Apache License 2.0 5 votes vote down vote up
/**
 * When activity first starts, the action bar
 * shows the back arrow for navigating back
 * to parent activity.  Menu item click listener
 * responds in one of the following ways:
 * 1) navigating back to list of places,
 * 2) showing the filter UI
 * 3) showing the route to selected place in map
 */
private void setUpToolbar(){
  final Toolbar toolbar = getActivity().findViewById(R.id.map_toolbar);
  ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
  toolbar.setTitle("");
  final ActionBar ab = ((AppCompatActivity)getActivity()).getSupportActionBar();
  if (ab != null){
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setHomeAsUpIndicator(0); // Use default home icon
  }

  // Menu items change depending on presence/absence of bottom sheet
  toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
    @Override public boolean onMenuItemClick(final MenuItem item) {
      if (item.getTitle().toString().equalsIgnoreCase(getString(R.string.list_view))){
        // Show the list of places
        showList();
      }
      if (item.getTitle().toString().equalsIgnoreCase(getString(R.string.filter))){
        final FilterDialogFragment dialogFragment = new FilterDialogFragment();
        final FilterContract.Presenter filterPresenter = new FilterPresenter();
        dialogFragment.setPresenter(filterPresenter);
        dialogFragment.show(getActivity().getFragmentManager(),"dialog_fragment");

      }
        if (item.getTitle().toString().equalsIgnoreCase("Route")){
          mPresenter.getRoute();

      }
      return false;
    }
  });
}
 
Example 16
Source File: BaseScannerActivity.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.scan_toolbar);
    setSupportActionBar(toolbar);

    final ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setDisplayShowTitleEnabled(false);
        ab.setHomeAsUpIndicator(R.drawable.ic_close);
    }
}
 
Example 17
Source File: DesignActivity.java    From Android-Plugin-Framework with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.design_activity);

	Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);

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

	mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

	NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
	if (navigationView != null) {
		setupDrawerContent(navigationView);
	}

	ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
	if (viewPager != null) {
		setupViewPager(viewPager);
	}

	FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
	fab.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View view) {
			Snackbar snackbar = Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG)
					.setAction("Action", null);

			View snapBarContentView = snackbar.getView();
			snapBarContentView.setBackgroundColor(getResources().getColor(R.color.text_color));
			TextView textView = (TextView) snapBarContentView.findViewById(com.example.pluginmain.R.id.snackbar_text);
			textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
			snackbar.show();
		}
	});

	TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
	tabLayout.setupWithViewPager(viewPager);
}
 
Example 18
Source File: MainActivity.java    From Open-Source-Android-Weather-App with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    // Initializations
    drawerLayout = findViewById(R.id.drawer_layout);
    navigationView = findViewById(R.id.nav_view);
    toolbar = findViewById(R.id.toolbar_main);

    // Sets the Toolbar to act as the ActionBar for this Activity
    setSupportActionBar(toolbar);

    // Disable title (There is a textView instead of title, so we can skip the title)
    Objects.requireNonNull(getSupportActionBar()).setDisplayShowTitleEnabled(false);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white);
    }


    cityCountryName = sharedPreferences.getString(CITY_COUNTRY_NAME, "");
    actvCityCountryName.setText(cityCountryName);


    if (database.isOpen()) {
        checkDatabaseState();
    } else {
        database = databaseHelper.getReadableDatabase();
        checkDatabaseState();
    }

    // Create a SimpleCursorAdapter for the State Name field.
    mAdapter = new SimpleCursorAdapter(this,
            R.layout.dropdown_text,
            null,
            new String[]{CITY_COUNTRY_NAME},
            new int[]{R.id.text}, 0);
    mAdapter.setFilterQueryProvider(constraint -> {
        if (constraint != null) {
            if (constraint.length() >= 3 && !TextUtils.isEmpty(constraint)) {
                Bundle bundle = new Bundle();
                String query = charArrayUpperCaser(constraint);
                bundle.putString(CITY_ARGS, query);
                getLoaderManager().restartLoader(0, bundle, MainActivity.this).forceLoad();
            }
        }
        return null;
    });

    // Set an OnItemClickListener, to update dependent fields when
    // a choice is made in the AutoCompleteTextView.
    actvCityCountryName.setOnItemClickListener((listView, view, position, id) -> {
        // Get the cursor, positioned to the corresponding row in the
        // result set
        Cursor cursor = (Cursor) listView.getItemAtPosition(position);

        // Get the state's capital from this row in the database.
        cityCountryName = cursor.getString(cursor.getColumnIndexOrThrow(CITY_COUNTRY_NAME));

        // Update the parent class's TextView
        actvCityCountryName.setText(cityCountryName);

        requestWeather();
        hideKeyboard();
    });

    actvCityCountryName.setAdapter(mAdapter);

    actionBarDrawerToggle = new ActionBarDrawerToggle(
            this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);

    // Activate navigation drawer's listener
    activateDrawerListener();
}
 
Example 19
Source File: MainActivity.java    From science-journal with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  savedItemId =
      (savedInstanceState == null)
          ? NO_SELECTED_ITEM
          : savedInstanceState.getInt(ARG_SELECTED_NAV_ITEM_ID, NO_SELECTED_ITEM);

  WhistlePunkApplication.getPerfTrackerProvider(this).onActivityInit();

  accountsProvider = WhistlePunkApplication.getAppServices(this).getAccountsProvider();

  setContentView(R.layout.activity_main);
  accountsProvider.installAccountSwitcher(this);

  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);

  boolean isTablet = getResources().getBoolean(R.bool.is_tablet);
  if (!isTablet) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  }

  final ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
    actionBar.setHomeActionContentDescription(R.string.navigation_drawer_content_description);
    actionBar.setDisplayShowTitleEnabled(true);
  }

  drawerLayout = (MultiTouchDrawerLayout) findViewById(R.id.drawer_layout);
  drawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.color_primary_dark));
  navigationView = (NavigationView) findViewById(R.id.navigation);
  navigationView.setNavigationItemSelectedListener(this);

  // Only show dev testing options when requested.
  if (!Flags.showTestingOptions()) {
    navigationView.getMenu().removeItem(R.id.dev_testing_options);
  }

  feedbackProvider = WhistlePunkApplication.getAppServices(this).getFeedbackProvider();

  setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
 
Example 20
Source File: ViewImgurMediaActivity.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ((Infinity) getApplication()).getAppComponent().inject(this);

    getTheme().applyStyle(R.style.Theme_Normal, true);

    getTheme().applyStyle(FontStyle.valueOf(sharedPreferences
            .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);

    getTheme().applyStyle(TitleFontStyle.valueOf(sharedPreferences
            .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);

    getTheme().applyStyle(ContentFontStyle.valueOf(sharedPreferences
            .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);

    getTheme().applyStyle(FontFamily.valueOf(sharedPreferences
            .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true);

    getTheme().applyStyle(TitleFontFamily.valueOf(sharedPreferences
            .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true);

    getTheme().applyStyle(ContentFontFamily.valueOf(sharedPreferences
            .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true);

    setContentView(R.layout.activity_view_imgur_media);

    ButterKnife.bind(this);

    ActionBar actionBar = getSupportActionBar();
    Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
    actionBar.setHomeAsUpIndicator(upArrow);
    actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor)));

    setTitle(" ");

    String imgurId = getIntent().getStringExtra(EXTRA_IMGUR_ID);
    if (imgurId == null) {
        finish();
        return;
    }

    if (savedInstanceState != null) {
        images = savedInstanceState.getParcelableArrayList(IMGUR_IMAGES_STATE);
    }

    haulerView.setOnDragDismissedListener(dragDirection -> {
        int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down;
        finish();
        overridePendingTransition(0, slide);
    });

    if (images == null) {
        fetchImgurMedia(imgurId);
    } else {
        progressBar.setVisibility(View.GONE);
        setupViewPager();
    }

    errorLinearLayout.setOnClickListener(view -> fetchImgurMedia(imgurId));
}