From 8945e50a41a10563cee7dbd1b66583f849f31fa8 Mon Sep 17 00:00:00 2001 From: alshell7 Date: Tue, 4 Jul 2017 18:16:53 +0530 Subject: [PATCH] Initial commit --- .gitignore | 7 + .idea/.name | 1 + .idea/compiler.xml | 22 + .idea/copyright/profiles_settings.xml | 3 + .idea/dictionaries/Ashraf_Khan.xml | 3 + .idea/encodings.xml | 6 + .idea/gradle.xml | 20 + .idea/inspectionProfiles/Project_Default.xml | 10 + .../inspectionProfiles/profiles_settings.xml | 7 + .idea/misc.xml | 101 ++++ .idea/modules.xml | 10 + .idea/runConfigurations.xml | 12 + .idea/vcs.xml | 6 + TerminalSeekBar.iml | 19 + app/.gitignore | 1 + app/app.iml | 97 ++++ app/build.gradle | 28 + app/proguard-rules.pro | 17 + .../alshell/sample/ApplicationTest.java | 15 + app/src/main/AndroidManifest.xml | 21 + .../projects/alshell/sample/MainActivity.java | 102 ++++ app/src/main/res/layout/activity_main.xml | 64 +++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes app/src/main/res/values-w820dp/dimens.xml | 6 + app/src/main/res/values/dimens.xml | 5 + app/src/main/res/values/strings.xml | 6 + app/src/main/res/values/styles.xml | 8 + build.gradle | 21 + gradle.properties | 18 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 49896 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 164 ++++++ gradlew.bat | 90 ++++ lib/.gitignore | 1 + lib/build.gradle | 23 + lib/lib.iml | 90 ++++ lib/proguard-rules.pro | 17 + .../alshell/android/ApplicationTest.java | 15 + lib/src/main/AndroidManifest.xml | 10 + .../android/SeekBarValueChangedListener.java | 12 + .../projects/alshell/android/Terminal.java | 158 ++++++ .../android/TerminalAnimationType.java | 12 + .../alshell/android/TerminalBackDrawable.java | 172 +++++++ .../android/TerminalChangedListener.java | 15 + .../alshell/android/TerminalSeekBar.java | 483 ++++++++++++++++++ lib/src/main/res/values/attrs.xml | 12 + lib/src/main/res/values/strings.xml | 3 + settings.gradle | 1 + 51 files changed, 1920 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/dictionaries/Ashraf_Khan.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/vcs.xml create mode 100644 TerminalSeekBar.iml create mode 100644 app/.gitignore create mode 100644 app/app.iml create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/projects/alshell/sample/ApplicationTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/projects/alshell/sample/MainActivity.java create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/values-w820dp/dimens.xml create mode 100644 app/src/main/res/values/dimens.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 lib/.gitignore create mode 100644 lib/build.gradle create mode 100644 lib/lib.iml create mode 100644 lib/proguard-rules.pro create mode 100644 lib/src/androidTest/java/com/projects/alshell/android/ApplicationTest.java create mode 100644 lib/src/main/AndroidManifest.xml create mode 100644 lib/src/main/java/com/projects/alshell/android/SeekBarValueChangedListener.java create mode 100644 lib/src/main/java/com/projects/alshell/android/Terminal.java create mode 100644 lib/src/main/java/com/projects/alshell/android/TerminalAnimationType.java create mode 100644 lib/src/main/java/com/projects/alshell/android/TerminalBackDrawable.java create mode 100644 lib/src/main/java/com/projects/alshell/android/TerminalChangedListener.java create mode 100644 lib/src/main/java/com/projects/alshell/android/TerminalSeekBar.java create mode 100644 lib/src/main/res/values/attrs.xml create mode 100644 lib/src/main/res/values/strings.xml create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c4de58 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..506d299 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +TerminalSeekBar \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/dictionaries/Ashraf_Khan.xml b/.idea/dictionaries/Ashraf_Khan.xml new file mode 100644 index 0000000..6fadb1b --- /dev/null +++ b/.idea/dictionaries/Ashraf_Khan.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..61eb313 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..97d68e3 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5eacb6b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + Java + + + Spelling + + + + + Java + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..dbdfa96 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TerminalSeekBar.iml b/TerminalSeekBar.iml new file mode 100644 index 0000000..8f41c06 --- /dev/null +++ b/TerminalSeekBar.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/app.iml b/app/app.iml new file mode 100644 index 0000000..1ad676f --- /dev/null +++ b/app/app.iml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..1856cde --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.3" + defaultConfig { + applicationId "com.projects.alshell.terminalseekbar" + minSdkVersion 14 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + productFlavors { + } +} + +dependencies { + compile fileTree(include: ['*.jar'], dir: 'libs') + compile 'com.android.support:appcompat-v7:23.0.0' + + compile project(':lib') +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..6d19fa8 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Ashraf Khan\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/androidTest/java/com/projects/alshell/sample/ApplicationTest.java b/app/src/androidTest/java/com/projects/alshell/sample/ApplicationTest.java new file mode 100644 index 0000000..4fca917 --- /dev/null +++ b/app/src/androidTest/java/com/projects/alshell/sample/ApplicationTest.java @@ -0,0 +1,15 @@ +package com.projects.alshell.sample; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase +{ + public ApplicationTest() + { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b6736b3 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/projects/alshell/sample/MainActivity.java b/app/src/main/java/com/projects/alshell/sample/MainActivity.java new file mode 100644 index 0000000..5c1d0f9 --- /dev/null +++ b/app/src/main/java/com/projects/alshell/sample/MainActivity.java @@ -0,0 +1,102 @@ +package com.projects.alshell.sample; + +import android.app.Activity; +import android.graphics.Color; +import android.os.Bundle; +import android.os.SystemClock; +import android.view.View; +import android.widget.TextView; + +import com.projects.alshell.android.SeekBarValueChangedListener; +import com.projects.alshell.android.Terminal; +import com.projects.alshell.android.TerminalAnimationType; +import com.projects.alshell.android.TerminalChangedListener; +import com.projects.alshell.android.TerminalSeekBar; +import com.projects.alshell.terminalseekbar.R; + +import java.util.ArrayList; + + +/** + * Sample application that demonstrates the use of TerminalSeekBar. + */ +public class MainActivity extends Activity + implements TerminalChangedListener, SeekBarValueChangedListener +{ + TerminalSeekBar terminalSeekBar; + TextView textViewTerminalChanged; + TextView textViewSeekChanged; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_main); + + terminalSeekBar = (TerminalSeekBar) findViewById(R.id.terminalSeekBar); + textViewTerminalChanged = (TextView) findViewById(R.id.textView); + textViewSeekChanged = (TextView) findViewById(R.id.positionSeekTextView); + + ArrayList terminals = new ArrayList<>(); + + //Note that an exception is thrown if TerminalPosition is greater than the setMaxValue of TerminalSeekBar + terminals.add(new Terminal(10, Color.GREEN, "...this..." , Terminal.DEFAULT_PRIORITY_NORMAL)); + terminals.add(new Terminal(100, Color.RED, "...HIGH...", Terminal.DEFAULT_PRIORITY_HIGH)); + terminals.add(new Terminal(25, Color.BLUE, "...is...", Terminal.DEFAULT_PRIORITY_NORMAL)); + terminals.add(new Terminal(70, Color.YELLOW, "...gettING...", Terminal.DEFAULT_PRIORITY_MEDIATE)); + terminals.add(new Terminal(50, Color.GRAY, "...check...", Terminal.DEFAULT_PRIORITY_HIGH)); + + terminalSeekBar.setTerminals(terminals); + + terminalSeekBar.enablePriorityBlinking(TerminalAnimationType.BLINK_ACTIVE); + + //Or + //terminalSeekBar.enablePriorityBlinking(TerminalAnimationType.BLINK_STILL); + + terminalSeekBar.setTerminalChangedListener(this); + terminalSeekBar.setSeekBarValueChangedListener(this); //Optional + + } + + + @Override + public void onTerminalChanged(Terminal terminal) + { + textViewTerminalChanged.setTextColor(terminal.getColor()); + CharSequence sequence = terminal.getInformation() + terminal.getPosition(); + textViewTerminalChanged.setText(sequence); + } + + @Override + public void onValueChanged(int position, boolean thumbPressed) + { + CharSequence sequence = "Current seek position : " + position; + textViewSeekChanged.setText(sequence); + } + + int i; + public void simulate(View view){ + Thread seeker = new Thread(new Runnable() + { + @Override + public void run() + { + for( i = 0 ; i<= 100; i++){ + MainActivity.this.runOnUiThread(new Runnable() + { + @Override + public void run() + { + terminalSeekBar.setProgress(i); + } + }); + SystemClock.sleep(20); + } + } + }); + seeker.start(); + } + + +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..387a1bf --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,64 @@ + + + + + + + + +