Skip to content

Commit

Permalink
Created text tabs, ready for alpha release on Jitpack.io
Browse files Browse the repository at this point in the history
  • Loading branch information
vontell committed Jul 14, 2016
1 parent bc76371 commit 0761acc
Show file tree
Hide file tree
Showing 19 changed files with 285 additions and 114 deletions.
4 changes: 2 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile project(path: ':iindicatorbinder')
compile project(path: ':indicatorbinder')
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.avontell.pagerindicatorbinder.ImageAdapter;
import com.avontell.pagerindicatorbinder.IndicatorBinder;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

@Override
Expand Down Expand Up @@ -39,13 +43,38 @@ protected void onCreate(Bundle savedInstanceState) {
selectedImage,
unselectedImage);

// OPTIONAL: Attach more than one indicator container!
LinearLayout alternateContainer = (LinearLayout) findViewById(R.id.indicator_alt);
IndicatorBinder.bind(this,
viewPager,
alternateContainer,
selectedImage,
unselectedImage);
// EXAMPLE WITH TABS -----------------------------------------------------------------------

// Create each tab TextView
List<TextView> tabViews = new ArrayList<>();
tabViews.add(new TextView(this));
tabViews.add(new TextView(this));
tabViews.add(new TextView(this));
tabViews.add(new TextView(this));
tabViews.add(new TextView(this));
tabViews.get(0).setText("Tab 1");
tabViews.get(1).setText("Tab 2");
tabViews.get(2).setText("Tab 3");
tabViews.get(3).setText("Tab 4");
tabViews.get(4).setText("Tab 6");

// Set the requested colors
int selectedBackgroundColor = R.color.tabBackgroundSelected;
int selectedTextColor = R.color.tabTextSelected;
int unselectedBackgroundColor = R.color.tabBackgroundUnselected;
int unselectedTextColor = R.color.tabTextUnselected;

// Grab the LinearLayout
LinearLayout tabContainer = (LinearLayout) findViewById(R.id.tab_container);

IndicatorBinder.bindTextTabs(this,
viewPager,
tabContainer,
tabViews,
selectedBackgroundColor,
unselectedBackgroundColor,
selectedTextColor,
unselectedTextColor);

}
}
24 changes: 10 additions & 14 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.avontell.pagerindicatorbinderexample.MainActivity">

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="30dp"
android:id="@+id/tab_container"></LinearLayout>

<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/view_pager_one">
android:id="@+id/view_pager_one"
android:layout_below="@+id/tab_container"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">

</android.support.v4.view.ViewPager>

Expand All @@ -26,18 +35,5 @@

</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_below="@+id/indicator_cont"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="16dp"
android:gravity="center_vertical"
android:id="@+id/indicator_alt">

</LinearLayout>


</RelativeLayout>
6 changes: 6 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

<color name="tabBackgroundSelected">#3f51b5</color>
<color name="tabBackgroundUnselected">#5c6bc0</color>
<color name="tabTextSelected">#FFFFFF</color>
<color name="tabTextUnselected">#FFFFFF</color>

</resources>

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "0.1"
versionName "0.1.1"
}
buildTypes {
release {
Expand Down
File renamed without changes.
Loading

0 comments on commit 0761acc

Please sign in to comment.