Use Tab with new ToolBar (AppCompat v7-21)

With the API 21 the method setNavigationMode(ActionBar.NAVIGATION_MODE_TABS) is deprecated. UPDATE 01/08/2019 (Material Components Library) Add the dependency to your build.gradle: dependencies { implementation ‘com.google.android.material:material:1.1.0’ } Then you can use the new TabLayout. <androidx.constraintlayout.widget.ConstraintLayout> <com.google.android.material.appbar.AppBarLayout …> <androidx.appcompat.widget.Toolbar …/> <com.google.android.material.tabs.TabLayout … /> </com.google.android.material.appbar.AppBarLayout> <androidx.viewpager.widget.ViewPager android:id=”@+id/viewpager” app:layout_behavior=”@string/appbar_scrolling_view_behavior” /> </androidx.constraintlayout.widget.ConstraintLayout> The code is simple: TabLayout tabs = (TabLayout) findViewById(R.id.tabs); … Read more

How to change tab size on GitHub?

You can append ?ts=2 or ?ts=4 to the URL to change the tab-size. Example: https://github.com/jquery/jquery/blob/main/src/core.js?ts=2 It seems that the value can be anything from 1 to 12. It does not work on Gists or raw file views though. Source: GitHub Cheat Sheet

Selenium Switch Tabs

A few words about Tab/Window switching/handling: Always keep track of the Parent Window handle so you can traverse back later if required as per your usecase. Always use WebDriverWait with expected_conditions as number_of_windows_to_be(num_windows) before switching between Tabs/Windows. Always keep track of the Child Window handles so you can traverse whenever required. Always use WebDriverWait with … Read more

Programmatically open new pages on Tabs

You can, in Firefox it works, add the attribute target=”_newtab” to the anchor to force the opening of a new tab. <a href=”https://stackoverflow.com/questions/427479/some url” target=”_newtab”>content of the anchor</a> In javascript you can use window.open(‘page.html’,’_newtab’); Said that, I partially agree with Sam. You shouldn’t force user to open new pages or new tab without showing them … Read more

Redirect a state to default substate with UI-Router in AngularJS

Update: 1.0 Onwards Supports redirectTo out of the box. https://ui-router.github.io/ng1/docs/latest/interfaces/state.statedeclaration.html#redirectto I created an example here. This solution comes from a nice “Comment” to an an issue with redirection using .when() (https://stackoverflow.com/a/27131114/1679310) and really cool solution for it (by Chris T, but the original post was by yahyaKacem) https://github.com/angular-ui/ui-router/issues/1584#issuecomment-75137373 So firstly let’s extend main with redirection … Read more