Skip to content

Commit

Permalink
feature implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Ira committed Nov 25, 2016
1 parent c92c2ae commit c06d95f
Show file tree
Hide file tree
Showing 48 changed files with 592 additions and 180 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

buildscript {
ext.kotlin_version = '1.0.4'
ext.icepick_version = '3.2.0-SNAPSHOT'
repositories {
jcenter()
maven { url "https://clojars.org/repo/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
Expand Down
2 changes: 1 addition & 1 deletion demo/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/irinagalata/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# You can edit the include mPath and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
Expand Down
4 changes: 3 additions & 1 deletion demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity
android:name=".MainActivity"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,38 @@

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatEditText;
import android.view.LayoutInflater;
import android.view.View;

import com.yalantis.jellytoolbar.widget.JellyToolbar;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

JellyToolbar toolbar = (JellyToolbar) findViewById(R.id.toolbar);
toolbar.getToolbar().setLogo(R.drawable.ic_menu);
toolbar.getToolbar().setPadding(0, getStatusBarHeight(), 0, 0);

AppCompatEditText editText = new AppCompatEditText(this);
editText.setBackgroundResource(R.color.colorTransparent);
toolbar.setContentView(LayoutInflater.from(this).inflate(R.layout.edit_text, null));

getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}

private int getStatusBarHeight() {
int result = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = getResources().getDimensionPixelSize(resourceId);
}
return result;
}
}
Binary file added demo/src/main/res/drawable-hdpi/content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-hdpi/ic_close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-hdpi/ic_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-hdpi/ic_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-mdpi/content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-mdpi/ic_close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-mdpi/ic_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-mdpi/ic_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xhdpi/content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xhdpi/ic_close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xhdpi/ic_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xhdpi/ic_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxhdpi/content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxhdpi/ic_close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxhdpi/ic_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxhdpi/ic_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxxhdpi/content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxxhdpi/ic_close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxxhdpi/ic_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/main/res/drawable-xxxhdpi/ic_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 38 additions & 15 deletions demo/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="800dp"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:layout_width="415dp"
android:layout_height="?attr/actionBarSize"
android:background="@color/startColor"
app:title="@string/app_name"
<com.yalantis.jellytoolbar.widget.JellyToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:cancelIcon="@drawable/ic_close"
app:endColor="#8463d4"
app:icon="@drawable/ic_search"
app:startColor="#cb5ed9"
app:title=" News feed"
app:titleTextColor="@android:color/white" />

<com.yalantis.jellytoolbar.JellyEditText xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/jellyEditText"
android:layout_width="800dp"
android:layout_height="?attr/actionBarSize"
android:layout_marginLeft="300dp" />
</FrameLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:src="@drawable/content" />

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:src="@drawable/content" />

</LinearLayout>
</ScrollView>
</LinearLayout>
6 changes: 6 additions & 0 deletions demo/src/main/res/layout/edit_text.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.AppCompatEditText xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorTransparent"
android:textColor="#7fffffff" />
5 changes: 3 additions & 2 deletions demo/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorPrimary">#7e6fe2</color>
<color name="colorPrimaryDark">#8a53cf</color>
<color name="colorAccent">#FF4081</color>
<color name="colorTransparent">#00ffffff</color>
</resources>
4 changes: 3 additions & 1 deletion demo/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">#7fffffff</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>

</resources>
6 changes: 3 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
APP_HOME=`cygpath --mPath --mixed "$APP_HOME"`
CLASSPATH=`cygpath --mPath --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -130,7 +130,7 @@ if $cygwin ; then
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
eval `echo args$i`=`cygpath --mPath --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
Expand Down
1 change: 1 addition & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 24
Expand Down
2 changes: 1 addition & 1 deletion library/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/irinagalata/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# You can edit the include mPath and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
Expand Down
14 changes: 1 addition & 13 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yalantis.jellytoolbar">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

</application>

</manifest>
<manifest package="com.yalantis.jellytoolbar" />
10 changes: 10 additions & 0 deletions library/src/main/java/com/yalantis/jellytoolbar/Constant.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.yalantis.jellytoolbar

/**
* Created by irinagalata on 11/24/16.
*/
object Constant {

val ANIMATION_DURATION = 1000L

}
105 changes: 0 additions & 105 deletions library/src/main/java/com/yalantis/jellytoolbar/JellyEditText.kt

This file was deleted.

10 changes: 10 additions & 0 deletions library/src/main/java/com/yalantis/jellytoolbar/extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.yalantis.jellytoolbar

import android.support.annotation.DimenRes
import android.view.View

/**
* Created by irinagalata on 11/23/16.
*/

fun View.getDimen(@DimenRes res: Int) = context.resources.getDimensionPixelOffset(res).toFloat()
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.yalantis.jellytoolbar.interpolator

import android.view.animation.Interpolator

/**
* Created by irinagalata on 11/23/16.
*/
class BounceInterpolator : Interpolator {
val ROTATION_TIME = 0.46667f
val FIRST_BOUNCE_TIME = 0.26666f

override fun getInterpolation(t: Float): Float {
if (t < ROTATION_TIME)
return rotation(t)
else if (t < ROTATION_TIME + FIRST_BOUNCE_TIME)
return firstBounce(t)
else
return secondBounce(t)
}

private fun rotation(t: Float): Float {
return 4.592f * t * t
}

private fun firstBounce(t: Float): Float {
return 2.5f * t * t - 3f * t + 1.85556f
}

private fun secondBounce(t: Float): Float {
return 0.625f * t * t - 1.083f * t + 1.458f
}

}
Loading

0 comments on commit c06d95f

Please sign in to comment.