diff --git a/.idea/gradle.xml b/.idea/gradle.xml index baf8b7c..cd1cd85 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -13,6 +13,13 @@ + diff --git a/.idea/libraries/deadskunk_1_0_4_SNAPSHOT.xml b/.idea/libraries/deadskunk_1_0_4_SNAPSHOT.xml deleted file mode 100644 index 397e56e..0000000 --- a/.idea/libraries/deadskunk_1_0_4_SNAPSHOT.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/gson_2_3_1.xml b/.idea/libraries/gson_2_3_1.xml deleted file mode 100644 index d9b8331..0000000 --- a/.idea/libraries/gson_2_3_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/example/build.gradle b/example/build.gradle index 6d37b33..ea686b1 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -28,15 +28,23 @@ android { } +ext{ + supportLibraryVersion = '23.1.1' + kitVersion = '0.4.1' + +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':library') - compile 'com.android.support:appcompat-v7:23.0.1' - compile 'com.android.support:recyclerview-v7:23.0.1' - compile 'com.android.support:cardview-v7:23.0.1' + compile "com.android.support:appcompat-v7:${supportLibraryVersion}" + compile "com.android.support:recyclerview-v7:${supportLibraryVersion}" + compile "com.android.support:cardview-v7:${supportLibraryVersion}" + + compile 'com.52inc:52Kit-core:0.4.1' + compile 'com.jakewharton:butterknife:6.1.0' compile 'com.github.bumptech.glide:glide:3.6.0' - compile 'com.r0adkll:deadskunk:1.0.4-SNAPSHOT' - compile 'com.google.code.gson:gson:2.3.1' + compile 'com.google.code.gson:gson:2.4' } diff --git a/example/example.iml b/example/example.iml index 19e2cb8..215f777 100644 --- a/example/example.iml +++ b/example/example.iml @@ -65,44 +65,42 @@ - - - - - - - - + + + + + + + - - - - - - + + + - - - - - + + + + + + + + - - - - + + + \ No newline at end of file diff --git a/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java b/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java index c823ca2..7dfc02d 100644 --- a/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java +++ b/example/src/main/java/com/r0adkll/slidr/example/MainActivity.java @@ -4,13 +4,14 @@ import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; +import com.ftinc.kit.adapter.BetterRecyclerAdapter; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import com.r0adkll.deadskunk.adapters.BetterRecyclerAdapter; import com.r0adkll.slidr.example.model.AndroidOS; import java.io.InputStream; @@ -19,12 +20,12 @@ import java.util.List; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.Bind; -public class MainActivity extends ActionBarActivity { +public class MainActivity extends AppCompatActivity { - @InjectView(R.id.recycler) + @Bind(R.id.recycler) RecyclerView mRecycler; private OSVersionAdapter mAdapter; @@ -33,7 +34,7 @@ public class MainActivity extends ActionBarActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - ButterKnife.inject(this); + ButterKnife.bind(this); initRecycler(); } diff --git a/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java b/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java index a563035..80d4855 100644 --- a/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java +++ b/example/src/main/java/com/r0adkll/slidr/example/OSVersionAdapter.java @@ -6,11 +6,11 @@ import android.view.ViewGroup; import android.widget.TextView; -import com.r0adkll.deadskunk.adapters.BetterRecyclerAdapter; +import com.ftinc.kit.adapter.BetterRecyclerAdapter; import com.r0adkll.slidr.example.model.AndroidOS; import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.Bind; /** * Created by r0adkll on 1/11/15. @@ -33,12 +33,12 @@ public void onBindViewHolder(OSViewHolder viewHolder, int i) { } public static class OSViewHolder extends RecyclerView.ViewHolder{ - @InjectView(R.id.title) public TextView title; - @InjectView(R.id.description) public TextView description; + @Bind(R.id.title) public TextView title; + @Bind(R.id.description) public TextView description; public OSViewHolder(View itemView) { super(itemView); - ButterKnife.inject(this, itemView); + ButterKnife.bind(this, itemView); } } diff --git a/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java b/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java index 34e31d6..10ccae9 100644 --- a/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java +++ b/example/src/main/java/com/r0adkll/slidr/example/ViewerActivity.java @@ -1,22 +1,27 @@ package com.r0adkll.slidr.example; +import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; +import android.view.View; import android.widget.TextView; import com.bumptech.glide.Glide; -import com.r0adkll.deadskunk.utils.Utils; -import com.r0adkll.deadskunk.views.AspectRatioImageView; +import com.ftinc.kit.util.Utils; +import com.ftinc.kit.widget.AspectRatioImageView; import com.r0adkll.slidr.Slidr; import com.r0adkll.slidr.example.model.AndroidOS; import com.r0adkll.slidr.model.SlidrConfig; import com.r0adkll.slidr.model.SlidrPosition; +import java.util.List; + import butterknife.ButterKnife; -import butterknife.InjectView; +import butterknife.Bind; +import butterknife.OnClick; /** * Created by r0adkll on 1/11/15. @@ -25,41 +30,42 @@ public class ViewerActivity extends AppCompatActivity { public static final String EXTRA_OS = "extra_os_version"; - @InjectView(R.id.toolbar) + @Bind(R.id.toolbar) Toolbar mToolbar; - @InjectView(R.id.cover) + @Bind(R.id.cover) AspectRatioImageView mCover; - @InjectView(R.id.title) + @Bind(R.id.title) TextView mTitle; - @InjectView(R.id.description) + @Bind(R.id.description) TextView mDescription; - @InjectView(R.id.date) + @Bind(R.id.date) TextView mDate; - @InjectView(R.id.version) + @Bind(R.id.version) TextView mVersion; - @InjectView(R.id.sdk) + @Bind(R.id.sdk) TextView mSdk; - @InjectView(R.id.position) + @Bind(R.id.position) TextView mPosition; private AndroidOS mOS; + private SlidrConfig mConfig; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_viewer); - ButterKnife.inject(this); + ButterKnife.bind(this); // Get the status bar colors to interpolate between int primary = getResources().getColor(R.color.primaryDark); - int secondary = getResources().getColor(R.color.transparent); + int secondary = getResources().getColor(R.color.red_500); // Build the slidr config int numPositions = SlidrPosition.values().length; SlidrPosition position = SlidrPosition.values()[Utils.getRandom().nextInt(numPositions)]; mPosition.setText(position.name()); - SlidrConfig config = new SlidrConfig.Builder() + mConfig = new SlidrConfig.Builder() .primaryColor(primary) .secondaryColor(secondary) .position(position) @@ -70,7 +76,7 @@ protected void onCreate(Bundle savedInstanceState) { .build(); // Attach the Slidr Mechanism to this activity - Slidr.attach(this, config); + Slidr.attach(this, mConfig); setSupportActionBar(mToolbar); getSupportActionBar().setTitle(""); @@ -92,6 +98,13 @@ protected void onCreate(Bundle savedInstanceState) { .into(mCover); } + @OnClick({R.id.color1, R.id.color2, R.id.color3, R.id.color4, R.id.color5}) + void onColorClicked(View v){ + int color = ((ColorDrawable)v.getBackground()).getColor(); + getWindow().setStatusBarColor(color); + mConfig.setColorSecondary(color); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId() == android.R.id.home){ diff --git a/example/src/main/res/layout/activity_viewer.xml b/example/src/main/res/layout/activity_viewer.xml index 056d86a..c4750ef 100644 --- a/example/src/main/res/layout/activity_viewer.xml +++ b/example/src/main/res/layout/activity_viewer.xml @@ -13,7 +13,7 @@ android:layout_marginBottom="8dp" android:elevation="4dp"> - - - - + + + + + + + + + + @@ -128,18 +152,59 @@ + android:orientation="horizontal"> - + + + + + + + + + diff --git a/gradle.properties b/gradle.properties index d6fdba4..6b31c70 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=2.0.4 +VERSION_NAME=2.0.5-SNAPSHOT VERSION_CODE=9 GROUP=com.r0adkll diff --git a/library/library.iml b/library/library.iml index 5fa7157..4209311 100644 --- a/library/library.iml +++ b/library/library.iml @@ -65,27 +65,23 @@ + - - - - - - - - - + + + + diff --git a/library/src/main/java/com/r0adkll/slidr/model/SlidrConfig.java b/library/src/main/java/com/r0adkll/slidr/model/SlidrConfig.java index 9772749..c3a8d95 100644 --- a/library/src/main/java/com/r0adkll/slidr/model/SlidrConfig.java +++ b/library/src/main/java/com/r0adkll/slidr/model/SlidrConfig.java @@ -34,6 +34,12 @@ public class SlidrConfig { */ private SlidrConfig(){} + /*********************************************************************************************** + * + * Getters + * + */ + /** * Get the primary color that the slider will interpolate. That is this color is the color * of the status bar of the Activity you are returning to @@ -168,6 +174,48 @@ public float getEdgeSize(float size) { return edgeSize * size; } + /*********************************************************************************************** + * + * Setters + * + */ + + public void setColorPrimary(int colorPrimary) { + this.colorPrimary = colorPrimary; + } + + public void setColorSecondary(int colorSecondary) { + this.colorSecondary = colorSecondary; + } + + public void setTouchSize(float touchSize) { + this.touchSize = touchSize; + } + + public void setSensitivity(float sensitivity) { + this.sensitivity = sensitivity; + } + + public void setScrimColor(int scrimColor) { + this.scrimColor = scrimColor; + } + + public void setScrimStartAlpha(float scrimStartAlpha) { + this.scrimStartAlpha = scrimStartAlpha; + } + + public void setScrimEndAlpha(float scrimEndAlpha) { + this.scrimEndAlpha = scrimEndAlpha; + } + + public void setVelocityThreshold(float velocityThreshold) { + this.velocityThreshold = velocityThreshold; + } + + public void setDistanceThreshold(float distanceThreshold) { + this.distanceThreshold = distanceThreshold; + } + /** * The Builder for this configuration class. This is the only way to create a * configuration