├── demo.gif
├── settings.gradle
├── .gitignore
├── androidpagecontrol
├── gradle.properties
├── docs
│ └── README.txt
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── res
│ │ └── values
│ │ │ ├── colors.xml
│ │ │ └── attrs.xml
│ │ └── kotlin
│ │ └── com
│ │ └── androidpagecontrol
│ │ └── PageControl.kt
└── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── androidpagecontrol-samples
└── demos
│ ├── ic_launcher-web.png
│ ├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── menu
│ │ │ └── main.xml
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── values-v11
│ │ │ └── styles.xml
│ │ └── layout
│ │ │ ├── activity_default.xml
│ │ │ ├── list_item_main.xml
│ │ │ └── activity_about.xml
│ │ ├── java
│ │ └── com
│ │ │ └── androidpagecontrol
│ │ │ └── samples
│ │ │ └── demos
│ │ │ ├── CustomActivity.java
│ │ │ ├── CustomShapeActivity.java
│ │ │ ├── EmphasizedCurrentActivity.java
│ │ │ ├── SamplePagerAdapter.java
│ │ │ └── DefaultActivity.java
│ │ ├── kotlin
│ │ └── com
│ │ │ └── androidpagecontrol
│ │ │ └── samples
│ │ │ └── demos
│ │ │ ├── AboutActivity.kt
│ │ │ └── MainActivity.kt
│ │ └── AndroidManifest.xml
│ ├── proguard-rules.pro
│ └── build.gradle
├── .travis.yml
├── gradle.properties
├── gradlew.bat
├── README.md
├── kotlin-publish.gradle
├── gradlew
├── images
└── ic_launcher.svg
└── LICENSE
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/demo.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':androidpagecontrol'
2 | include ':androidpagecontrol-samples:demos'
3 |
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | local.properties
3 | *.keystore
4 | *.gradle/
5 | target/
6 | .idea/
7 | *.iml
8 |
--------------------------------------------------------------------------------
/androidpagecontrol/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=Android-PageControl
2 | POM_ARTIFACT_ID=androidpagecontrol
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/androidpagecontrol-samples/demos/ic_launcher-web.png
--------------------------------------------------------------------------------
/androidpagecontrol/docs/README.txt:
--------------------------------------------------------------------------------
1 | An empty javadoc.
2 |
3 | Some work is required to do javadocs for Kotlin files.
4 |
5 | See http://youtrack.jetbrains.com/issue/KT-3756 for progress
6 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/androidpagecontrol-samples/demos/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/androidpagecontrol-samples/demos/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/androidpagecontrol-samples/demos/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/androidpagecontrol-samples/demos/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/drawable-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksoichiro/Android-PageControl/HEAD/androidpagecontrol-samples/demos/src/main/res/drawable-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri May 01 07:33:57 JST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | android:
3 | components:
4 | - build-tools-20.0.0
5 | - tools
6 | - android-20
7 | - android-19
8 | - sys-img-armeabi-v7a-android-19
9 | - extra-android-support
10 | - extra-android-m2repository
11 | licenses:
12 | - 'android-sdk-license-.+'
13 | - android-sdk-preview-license-52d11cd2
14 | before_script:
15 | - echo no | android create avd --force -n test -t android-19 --abi default/armeabi-v7a
16 | - emulator -avd test -no-skin -no-audio -no-window &
17 | - android-wait-for-emulator
18 | script:
19 | - travis_retry ./gradlew assemble connectedCheck
20 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | VERSION_NAME=0.1.1
2 | VERSION_CODE=1
3 | GROUP=com.github.ksoichiro
4 |
5 | POM_DESCRIPTION=PageControl for Android apps.
6 | POM_URL=https://github.com/ksoichiro/Android-PageControl
7 | POM_SCM_URL=https://github.com/ksoichiro/Android-PageControl
8 | POM_SCM_CONNECTION=scm:git@github.com/ksoichiro/Android-PageControl.git
9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:ksoichiro/Android-PageControl.git
10 | POM_LICENCE_NAME=Apache License 2.0
11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0
12 | POM_LICENCE_DIST=repo
13 | POM_DEVELOPER_ID=ksoichiro
14 | POM_DEVELOPER_NAME=Soichiro Kashima
15 |
16 | org.gradle.jvmargs=-XX:MaxPermSize=512m
17 |
--------------------------------------------------------------------------------
/androidpagecontrol/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/java/com/androidpagecontrol/samples/demos/CustomActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Soichiro Kashima
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.androidpagecontrol.samples.demos;
18 |
19 | public class CustomActivity extends DefaultActivity {
20 | }
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/java/com/androidpagecontrol/samples/demos/CustomShapeActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Soichiro Kashima
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.androidpagecontrol.samples.demos;
18 |
19 | public class CustomShapeActivity extends DefaultActivity {
20 | }
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/java/com/androidpagecontrol/samples/demos/EmphasizedCurrentActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Soichiro Kashima
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.androidpagecontrol.samples.demos;
18 |
19 | public class EmphasizedCurrentActivity extends DefaultActivity {
20 | }
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/androidpagecontrol/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '0.11.91.1'
3 | repositories {
4 | mavenCentral()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:1.0.0'
8 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
9 | }
10 | }
11 |
12 | apply plugin: 'com.android.library'
13 | apply plugin: 'kotlin-android'
14 |
15 | dependencies {
16 | compile 'com.android.support:support-v4:20.0.0'
17 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
18 | }
19 |
20 | android {
21 | compileSdkVersion 20
22 | buildToolsVersion "20.0.0"
23 |
24 | defaultConfig {
25 | minSdkVersion 8
26 | targetSdkVersion 20
27 | }
28 |
29 | sourceSets {
30 | main.java.srcDirs += 'src/main/kotlin'
31 | }
32 |
33 | lintOptions {
34 | abortOnError false
35 | }
36 | }
37 |
38 | apply from: '../kotlin-publish.gradle'
39 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
26 |
--------------------------------------------------------------------------------
/androidpagecontrol/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | #757575
20 | #9e9e9e
21 | #bdbdbd
22 | #eeeeee
23 |
24 |
25 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '0.11.91.1'
3 | repositories {
4 | mavenCentral()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:1.0.0'
8 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
9 | }
10 | }
11 |
12 | apply plugin: 'com.android.application'
13 | apply plugin: 'kotlin-android'
14 |
15 | dependencies {
16 | compile project(':androidpagecontrol')
17 | compile 'com.android.support:support-v4:20.0.0'
18 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
19 | }
20 |
21 | android {
22 | compileSdkVersion 20
23 | buildToolsVersion "20.0.0"
24 |
25 | defaultConfig {
26 | versionCode 1
27 | versionName VERSION_NAME
28 | minSdkVersion 8
29 | targetSdkVersion 20
30 | }
31 |
32 | sourceSets {
33 | main.java.srcDirs += 'src/main/kotlin'
34 | }
35 |
36 | lintOptions {
37 | checkReleaseBuilds false
38 | abortOnError false
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 16dp
20 | 16dp
21 | 8dp
22 | 8dp
23 | 8dp
24 | 6dp
25 |
26 |
27 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
23 |
26 |
27 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/layout/activity_default.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
15 |
16 |
22 |
23 |
30 |
31 |
--------------------------------------------------------------------------------
/androidpagecontrol/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/layout/list_item_main.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
24 |
25 |
31 |
32 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/java/com/androidpagecontrol/samples/demos/SamplePagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.androidpagecontrol.samples.demos;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.PagerAdapter;
5 | import android.util.TypedValue;
6 | import android.view.Gravity;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | public class SamplePagerAdapter extends PagerAdapter {
12 |
13 | /**
14 | * Number of views(pages).
15 | */
16 | private static final int NUM_OF_VIEWS = 5;
17 |
18 | private Context mContext;
19 |
20 | public SamplePagerAdapter(Context context) {
21 | mContext = context;
22 | }
23 |
24 | @Override
25 | public int getCount() {
26 | return NUM_OF_VIEWS;
27 | }
28 |
29 | @Override
30 | public Object instantiateItem(ViewGroup container, int position) {
31 | TextView view = new TextView(mContext);
32 | view.setText(String.valueOf(position + 1));
33 | view.setGravity(Gravity.CENTER);
34 | view.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 72);
35 | ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
36 | ViewGroup.LayoutParams.MATCH_PARENT,
37 | ViewGroup.LayoutParams.MATCH_PARENT);
38 | container.addView(view, lp);
39 | return view;
40 | }
41 |
42 | @Override
43 | public void destroyItem(ViewGroup container, int position, Object object) {
44 | container.removeView((TextView) object);
45 | }
46 |
47 | @Override
48 | public boolean isViewFromObject(View view, Object object) {
49 | return view == object;
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | APC-Demos
20 | Default style
21 | Custom style
22 | Emphasize current indicator
23 | Custom shape
24 | About this app
25 |
26 | Enable click
27 | Disable click
28 |
29 | @string/activity_title_about
30 |
31 | Version
32 | © 2014 Soichiro Kashima All rights reserved.
33 | Demo app for Android-PageControl.
34 | Fork me on GitHub!
35 | https://github.com/ksoichiro/Android-PageControl
36 | PageControl for Android apps.
37 |
38 |
39 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/java/com/androidpagecontrol/samples/demos/DefaultActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Soichiro Kashima
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.androidpagecontrol.samples.demos;
18 |
19 | import android.app.Activity;
20 | import android.os.Bundle;
21 | import android.support.v4.view.ViewPager;
22 | import android.view.View;
23 | import android.widget.Button;
24 |
25 | import com.androidpagecontrol.PageControl;
26 |
27 | public class DefaultActivity extends Activity {
28 |
29 | @Override
30 | public void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_default);
33 |
34 | SamplePagerAdapter adapter = new SamplePagerAdapter(this);
35 | ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
36 | viewPager.setAdapter(adapter);
37 | final PageControl pageControl = (PageControl) findViewById(R.id.page_control);
38 | pageControl.setViewPager(viewPager);
39 | pageControl.setPosition(1);
40 |
41 | findViewById(R.id.button_toggle).setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View view) {
44 | Button b = (Button) view;
45 | if (b.getText().equals(getString(R.string.label_enable_click))) {
46 | b.setText(R.string.label_disable_click);
47 | pageControl.setClickable(true);
48 | } else {
49 | b.setText(R.string.label_enable_click);
50 | pageControl.setClickable(false);
51 | }
52 | }
53 | });
54 | }
55 |
56 | }
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/kotlin/com/androidpagecontrol/samples/demos/AboutActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Soichiro Kashima
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.androidpagecontrol.samples.demos
18 |
19 | import android.app.Activity
20 | import android.os.Build
21 | import android.os.Bundle
22 | import android.widget.TextView
23 | import android.view.MenuItem
24 | import android.content.pm.PackageManager
25 | import android.content.pm.PackageInfo
26 | import android.content.pm.PackageManager.NameNotFoundException
27 | import android.annotation.TargetApi
28 |
29 | /**
30 | * @author Soichiro Kashima
31 | */
32 | class AboutActivity() : Activity() {
33 |
34 | protected override fun onCreate(savedInstanceState: Bundle?) {
35 | super.onCreate(savedInstanceState)
36 |
37 | setContentView(R.layout.activity_about)
38 |
39 | if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
40 | getActionBar()!!.setDisplayHomeAsUpEnabled(true)
41 | if (Build.VERSION_CODES.ICE_CREAM_SANDWICH <= Build.VERSION.SDK_INT) {
42 | getActionBar()!!.setHomeButtonEnabled(true)
43 | }
44 | }
45 |
46 | (findViewById(R.id.version_name) as TextView).setText(getVersionName())
47 | }
48 |
49 | override fun onOptionsItemSelected(menu: MenuItem?): Boolean {
50 | if (menu!!.getItemId() == android.R.id.home) {
51 | finish()
52 | return true
53 | }
54 | return false
55 | }
56 |
57 | private fun getVersionName(): String? {
58 | try {
59 | return getPackageManager()!!.getPackageInfo(getPackageName(), PackageManager.GET_META_DATA).versionName
60 | } catch (e: NameNotFoundException) {
61 | return ""
62 | }
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
23 |
30 |
31 |
32 |
35 |
36 |
39 |
40 |
43 |
44 |
47 |
48 |
56 |
57 |
60 |
61 |
64 |
65 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
27 |
28 |
34 |
35 |
40 |
41 |
47 |
48 |
53 |
54 |
58 |
59 |
60 |
67 |
68 |
74 |
75 |
82 |
83 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android-PageControl
2 |
3 | [](https://travis-ci.org/ksoichiro/Android-PageControl)
4 | [](https://github.com/ksoichiro/Android-PageControl/releases/latest)
5 |
6 | 
7 |
8 | Clickable PageControl for Android apps.
9 | There are some great libraries like `ViewPagerIndicator` but they don't handle taps on indicator like `PageControl` on iOS.
10 | This widget handles taps just as `PageControl` does.
11 |
12 | ## Usage
13 |
14 | ### build.gradle
15 |
16 | Available in the Maven Central Repository.
17 | It depends on `support-v4` library.
18 |
19 | ```groovy
20 | dependencies {
21 | compile 'com.android.support:support-v4:20.0.0'
22 | compile 'com.github.ksoichiro:androidpagecontrol:0.1.1'
23 | }
24 | ```
25 |
26 | ### Add to layout XML
27 |
28 | ```xml
29 |
33 |
34 |
40 | ```
41 |
42 | ### Add Java codes
43 |
44 | ```java
45 | SamplePagerAdapter adapter = new SamplePagerAdapter(this);
46 | ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
47 | viewPager.setAdapter(adapter);
48 |
49 | final PageControl pageControl = (PageControl) findViewById(R.id.page_control);
50 | pageControl.setViewPager(viewPager);
51 | pageControl.setPosition(1);
52 | ```
53 |
54 | ### Styling
55 |
56 | ```xml
57 |
60 |
61 |
74 | ```
75 |
76 | ### Controlling enable/clickable
77 |
78 | `PageControl`'s `setEnable(boolean)` and `setClickable(boolean)` methods affect to its children(indicators).
79 | So if you want to disable taps for indicators, you don't have to access each indicator views.
80 |
81 | ## Developed By
82 |
83 | * Soichiro Kashima -
84 |
85 | ## License
86 |
87 | Copyright 2014 Soichiro Kashima
88 |
89 | Licensed under the Apache License, Version 2.0 (the "License");
90 | you may not use this file except in compliance with the License.
91 | You may obtain a copy of the License at
92 |
93 | http://www.apache.org/licenses/LICENSE-2.0
94 |
95 | Unless required by applicable law or agreed to in writing, software
96 | distributed under the License is distributed on an "AS IS" BASIS,
97 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98 | See the License for the specific language governing permissions and
99 | limitations under the License.
100 |
101 | [Publishing script](kotlin-publish.gradle) is based on [chrisbanes/gradle-mvn-push](https://github.com/chrisbanes/gradle-mvn-push).
102 |
103 | Copyright 2013 Chris Banes
104 |
105 | Licensed under the Apache License, Version 2.0 (the "License");
106 | you may not use this file except in compliance with the License.
107 | You may obtain a copy of the License at
108 |
109 | http://www.apache.org/licenses/LICENSE-2.0
110 |
111 | Unless required by applicable law or agreed to in writing, software
112 | distributed under the License is distributed on an "AS IS" BASIS,
113 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114 | See the License for the specific language governing permissions and
115 | limitations under the License.
116 |
--------------------------------------------------------------------------------
/kotlin-publish.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Chris Banes
3 | * Copyright 2014 Soichiro Kashima
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | // Kotlin has KDoc for generating docs,
19 | // but currently it cannot be used from gradle plugin.
20 | // So this script generate javadoc jar with a text file as a workaround.
21 | // The kotlin-gradle-plugin project includes 'kotlin' plugin
22 | // and it has KDoc task, but it has Android plugin dependency
23 | // which causes gradle evaluation errors.
24 | // To generate docs properly, following tasks might be required:
25 | //
26 | // * Create a gradle plugin to use KDoc task
27 | // in kotlin-gradle-plugin-core without Android plugin dependency
28 | // * Apply the plugin
29 | // * Replace workaround codes with KDoc task
30 |
31 | apply plugin: 'maven'
32 | apply plugin: 'signing'
33 |
34 | def isReleaseBuild() {
35 | return VERSION_NAME.contains("SNAPSHOT") == false
36 | }
37 |
38 | def getReleaseRepositoryUrl() {
39 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
40 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
41 | }
42 |
43 | def getSnapshotRepositoryUrl() {
44 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
45 | : "https://oss.sonatype.org/content/repositories/snapshots/"
46 | }
47 |
48 | def getRepositoryUsername() {
49 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
50 | }
51 |
52 | def getRepositoryPassword() {
53 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
54 | }
55 |
56 | afterEvaluate { project ->
57 | uploadArchives {
58 | repositories {
59 | mavenDeployer {
60 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
61 |
62 | pom.groupId = GROUP
63 | pom.artifactId = POM_ARTIFACT_ID
64 | pom.version = VERSION_NAME
65 |
66 | repository(url: getReleaseRepositoryUrl()) {
67 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
68 | }
69 | snapshotRepository(url: getSnapshotRepositoryUrl()) {
70 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
71 | }
72 |
73 | pom.project {
74 | name POM_NAME
75 | packaging POM_PACKAGING
76 | description POM_DESCRIPTION
77 | url POM_URL
78 |
79 | scm {
80 | url POM_SCM_URL
81 | connection POM_SCM_CONNECTION
82 | developerConnection POM_SCM_DEV_CONNECTION
83 | }
84 |
85 | licenses {
86 | license {
87 | name POM_LICENCE_NAME
88 | url POM_LICENCE_URL
89 | distribution POM_LICENCE_DIST
90 | }
91 | }
92 |
93 | developers {
94 | developer {
95 | id POM_DEVELOPER_ID
96 | name POM_DEVELOPER_NAME
97 | }
98 | }
99 | }
100 | }
101 | }
102 | }
103 |
104 | signing {
105 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
106 | sign configurations.archives
107 | }
108 |
109 | task androidJavadocsJar(type: Jar) {
110 | classifier = 'javadoc'
111 | from 'docs/README.txt'
112 | }
113 |
114 | task androidSourcesJar(type: Jar) {
115 | classifier = 'sources'
116 | from android.sourceSets.main.java.sourceFiles
117 | }
118 |
119 | artifacts {
120 | archives androidSourcesJar
121 | archives androidJavadocsJar
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/androidpagecontrol-samples/demos/src/main/kotlin/com/androidpagecontrol/samples/demos/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Soichiro Kashima
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.androidpagecontrol.samples.demos
18 |
19 | import android.app.ListActivity
20 | import java.text.Collator
21 | import android.os.Bundle
22 | import android.widget.SimpleAdapter
23 | import android.view.Menu
24 | import android.view.MenuItem
25 | import android.content.Intent
26 | import android.widget.ListView
27 | import android.view.View
28 | import android.content.Context
29 | import java.util.Comparator
30 | import java.util.HashMap
31 | import java.util.ArrayList
32 | import java.util.Collections
33 |
34 | /**
35 | * @author Soichiro Kashima
36 | */
37 | class MainActivity() : ListActivity() {
38 |
39 | protected override fun onCreate(savedInstanceState: Bundle?) {
40 | super.onCreate(savedInstanceState)
41 | setListAdapter(SimpleAdapter(this, getData(), R.layout.list_item_main, array("className", "description"), intArray(R.id.className, R.id.description)))
42 | }
43 |
44 | override fun onCreateOptionsMenu(menu: Menu?): Boolean {
45 | getMenuInflater().inflate(R.menu.main, menu)
46 | return true
47 | }
48 |
49 | override fun onOptionsItemSelected(menu: MenuItem?): Boolean {
50 | if (menu!!.getItemId() == R.id.menu_about) {
51 | startActivity(Intent(getApplicationContext(), javaClass()))
52 | return true
53 | }
54 | return false
55 | }
56 |
57 | private fun getData(): kotlin.List