Skip to content

Commit

Permalink
init commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
warkiz committed Nov 1, 2017
1 parent 670075d commit 996a0db
Show file tree
Hide file tree
Showing 65 changed files with 3,313 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ out/
# Gradle files
.gradle/
build/

indicatorseekbar/build/
app/build/
# Local configuration file (sdk path, etc)
local.properties

Expand Down Expand Up @@ -53,3 +54,5 @@ google-services.json
freeline.py
freeline/
freeline_project_description.json

.idea/
2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
*.iml
25 changes: 25 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.warkiz.indicatorseekbar"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile project(':indicatorseekbar')
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\develop\AS\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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.warkiz.indicatorseekbar;

import android.content.Context;
import android.support.test .InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.warkiz.indicatorseekbar", appContext.getPackageName());
}
}
20 changes: 20 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.warkiz.indicatorseekbar">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
119 changes: 119 additions & 0 deletions app/src/main/java/com/warkiz/indicatorseekbar/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package com.warkiz.indicatorseekbar;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.TypedValue;
import android.widget.TextView;

import com.warkiz.widget.IndicatorSeekBar;

public class MainActivity extends AppCompatActivity {

public static int dp2px(Context context, float dpValue) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue, context.getResources().getDisplayMetrics());
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView continuousTv = (TextView) findViewById(R.id.continuous_progress);
// final TextView discreteTv = (TextView) findViewById(R.id.discrete_progress);
// final TextView discreteBlockTv = (TextView) findViewById(R.id.discrete_block);
// final LinearLayout javaBuildContainer = (LinearLayout) findViewById(R.id.java_build);

IndicatorSeekBar continuous = (IndicatorSeekBar) findViewById(R.id.continuous);
continuous.setOnSeekChangeListener(new IndicatorSeekBar.OnSeekBarChangeListener() {

@Override
public void onProgressChanged(IndicatorSeekBar seekBar, int progress, float progressFloat, boolean fromUserTouch) {
continuousTv.setText("progress:" + progress + "; progressFloat:" + progressFloat + "; fromUser:" + fromUserTouch);
}

@Override
public void onSectionChanged(IndicatorSeekBar seekBar, int thumbPosOnTick, String tickBelowText, boolean fromUserTouch) {
}

@Override
public void onStartTrackingTouch(IndicatorSeekBar seekBar, int thumbPosOnTick) {
}

@Override
public void onStopTrackingTouch(IndicatorSeekBar seekBar) {

}
});

/* IndicatorSeekBar discrete = (IndicatorSeekBar) findViewById(R.id.discrete);
discrete.setOnSeekChangeListener(new IndicatorSeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(IndicatorSeekBar seekBar, int progress, float progressFloat, boolean fromUserTouch) {
discreteTv.setText("progress: " + progress);
}
@Override
public void onSectionChanged(IndicatorSeekBar seekBar, int thumbPosOnTick, String tickBelowText, boolean fromUserTouch) {
discreteBlockTv.setText("thumbPosOnTick: " + thumbPosOnTick + " ; tickBelowText: " + tickBelowText);
}
@Override
public void onStartTrackingTouch(IndicatorSeekBar seekBar, int thumbPosOnTick) {
}
@Override
public void onStopTrackingTouch(IndicatorSeekBar seekBar) {
}
});
//java_build
TextView textView1 = getTextView();
textView1.setText("continuous");
javaBuildContainer.addView(textView1);
//CONTINUOUS
IndicatorSeekBar indicatorSeekBar1 = new IndicatorSeekBar.Builder(this).setSeekBarType(IndicatorSeekBarType.CONTINUOUS).setMax(88).setMin(2).setProgress(33).setBackgroundTrackSize(2).setBackgroundTrackColor(Color.parseColor("#FF0000")).setProgressTrackSize(4).setProgressTrackColor(Color.parseColor("#FF0000")).setThumbColor(Color.parseColor("#FF0000")).showIndicator(true).setIndicatorType(IndicatorType.ROUNDED_CORNERS).setIndicatorColor(Color.parseColor("#FF0000")).build();
javaBuildContainer.addView(indicatorSeekBar1);
TextView textView2 = getTextView();
textView2.setText("continuous_texts_ends");
javaBuildContainer.addView(textView2);
//CONTINUOUS_TEXTS_ENDS
IndicatorSeekBar indicatorSeekBar2 = new IndicatorSeekBar.Builder(this).setThumbDrawable(R.mipmap.ic_launcher).setSeekBarType(IndicatorSeekBarType.CONTINUOUS_TEXTS_ENDS).setMax(45).setMin(3).setLeftEndText("LEFT").setRightEndText("RIGHT").setProgress(33).setBackgroundTrackSize(1).setBackgroundTrackColor(Color.parseColor("#FF0000")).setProgressTrackSize(3).setProgressTrackColor(Color.parseColor("#FF0000")).showIndicator(true).setIndicatorType(IndicatorType.SQUARE_CORNERS).setIndicatorColor(Color.parseColor("#FF0000")).build();
javaBuildContainer.addView(indicatorSeekBar2);
TextView textView3 = getTextView();
textView3.setText("discrete_ticks");
javaBuildContainer.addView(textView3);
//DISCRETE_TICKS
IndicatorSeekBar indicatorSeekBar3 = new IndicatorSeekBar.Builder(this).setMax(200).setMin(0).setSeekBarType(IndicatorSeekBarType.DISCRETE_TICKS).setTickType(TickType.OVAL).setTickColor(Color.parseColor("#0000FF")).setTickSize(8).setTickNum(8).setProgress(67).setBackgroundTrackSize(2).setBackgroundTrackColor(Color.parseColor("#666666")).setProgressTrackSize(3).setProgressTrackColor(Color.parseColor("#0000FF")).showIndicator(true).setIndicatorType(IndicatorType.SQUARE_CORNERS).setIndicatorColor(Color.parseColor("#0000FF")).build();
javaBuildContainer.addView(indicatorSeekBar3);
TextView textView4 = getTextView();
textView4.setText("discrete_ticks_texts");
javaBuildContainer.addView(textView4);
//DISCRETE_TICKS_TEXTS
IndicatorSeekBar indicatorSeekBar4 = new IndicatorSeekBar.Builder(this).setTextArray(R.array.tick_below_text_length_5).setSeekBarType(IndicatorSeekBarType.DISCRETE_TICKS_TEXTS).setTickType(TickType.REC).setTickColor(Color.parseColor("#FFFFFF")).setTextSize(13).setTextColor(Color.parseColor("#0000FF")).setBackgroundTrackColor(Color.parseColor("#800000FF")).setProgressTrackColor(Color.parseColor("#0000FF")).setProgressTrackSize(3).setBackgroundTrackSize(2).showIndicator(true).setIndicatorType(IndicatorType.ROUNDED_CORNERS).setIndicatorColor(Color.parseColor("#0000FF")).setIndicatorTextSize(20).setIndicatorTextColor(Color.parseColor("#FFFFFF")).build();
javaBuildContainer.addView(indicatorSeekBar4);
TextView textView5 = getTextView();
textView5.setText("discrete_ticks_texts_ends");
javaBuildContainer.addView(textView5);
//DISCRETE_TICKS_TEXTS_ENDS
IndicatorSeekBar indicatorSeekBar5 = new IndicatorSeekBar.Builder(this).setSeekBarType(IndicatorSeekBarType.DISCRETE_TICKS_TEXTS_ENDS).setLeftEndText("LAST").setIndicatorCustomLayout(R.layout.custom_indicator_blue).setRightEndText("NEXT").setTickDrawable(getResources().getDrawable(R.drawable.thumb_rec_0_corner)).setThumbDrawable(R.drawable.thumb_rec_0_corner_big).setTextColor(Color.parseColor("#0000FF")).showIndicator(true).build();
javaBuildContainer.addView(indicatorSeekBar5);
*/
}

@NonNull
private TextView getTextView() {
TextView textView = new TextView(this);
int padding = dp2px(this, 16);
textView.setPadding(padding, padding, padding, 0);
return textView;
}


}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/custom_indicator_bg_oval.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">

<solid android:color="#FF7E00"/>

<size
android:width="6dp"
android:height="6dp"/>
</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/thumb_custom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="3dp"
android:height="16dp"/>
<solid android:color="#FF4081"/>

</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/thumb_rec_0_corner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="5dp"
android:height="5dp"/>
<solid android:color="#FF4081"/>

</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/thumb_rec_0_corner_big.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="10dp"
android:height="10dp"/>
<solid android:color="#FF4081"/>

</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/tick_custom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="10dp"
android:height="10dp"/>
<solid android:color="#FF4081"/>

</shape>
26 changes: 26 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.warkiz.indicatorseekbar.MainActivity">

<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<include layout="@layout/continuous"/>

<!-- <include layout="@layout/discrete"/>
<include layout="@layout/custom"/>
<include layout="@layout/java_build"/>-->

</LinearLayout>

</ScrollView>
Loading

0 comments on commit 996a0db

Please sign in to comment.