diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 6975d07..07202ae 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/build.gradle b/app/build.gradle index 88a7089..18fef6e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,16 +20,17 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + defaultPublishConfig "debug" } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.0.2' + implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation 'com.android.support:design:27.1.1' testImplementation 'junit:junit:4.12' implementation 'com.android.support:support-dynamic-animation:27.1.1' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' - implementation project(":hiddenlinearlayoutview") + implementation project(':hidden-layout-view') } diff --git a/build.gradle b/build.gradle index eccff49..5c37802 100644 --- a/build.gradle +++ b/build.gradle @@ -8,8 +8,8 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.1.1' - - + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/hiddenlinearlayoutview/.gitignore b/hidden-layout-view/.gitignore similarity index 100% rename from hiddenlinearlayoutview/.gitignore rename to hidden-layout-view/.gitignore diff --git a/hiddenlinearlayoutview/build.gradle b/hidden-layout-view/build.gradle similarity index 54% rename from hiddenlinearlayoutview/build.gradle rename to hidden-layout-view/build.gradle index 2037fd4..124f6ce 100644 --- a/hiddenlinearlayoutview/build.gradle +++ b/hidden-layout-view/build.gradle @@ -1,5 +1,29 @@ apply plugin: 'com.android.library' +ext { + bintrayRepo = 'HiddenLayoutView' + bintrayName = 'hidden-layout-view' + + publishedGroupId = 'com.psx95' + libraryName = 'HiddenLayoutView' + artifact = 'hidden-layout-view' + + libraryDescription = 'A library to show hidden layouts with built-in animations' + + siteUrl = 'https://github.com/psx95/HiddenLayout' + gitUrl = 'https://github.com/psx95/HiddenLayout.git' + + libraryVersion = '0.1.0' + + developerId = 'psx95' + developerName = 'Pranav Sharma' + developerEmail = 'pranav.ps95@hotmail.com' + + licenseName = 'MIT License' + licenseUrl = 'https://opensource.org/licenses/MIT' + allLicenses = ["MIT"] +} + android { compileSdkVersion 27 @@ -36,3 +60,5 @@ dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation 'com.android.support:support-dynamic-animation:27.1.1' } +apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' +apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' \ No newline at end of file diff --git a/hiddenlinearlayoutview/proguard-rules.pro b/hidden-layout-view/proguard-rules.pro similarity index 100% rename from hiddenlinearlayoutview/proguard-rules.pro rename to hidden-layout-view/proguard-rules.pro diff --git a/hiddenlinearlayoutview/src/androidTest/java/com/psx/hiddenlinearlayoutview/ExampleInstrumentedTest.java b/hidden-layout-view/src/androidTest/java/com/psx/hiddenlinearlayoutview/ExampleInstrumentedTest.java similarity index 100% rename from hiddenlinearlayoutview/src/androidTest/java/com/psx/hiddenlinearlayoutview/ExampleInstrumentedTest.java rename to hidden-layout-view/src/androidTest/java/com/psx/hiddenlinearlayoutview/ExampleInstrumentedTest.java diff --git a/hiddenlinearlayoutview/src/main/AndroidManifest.xml b/hidden-layout-view/src/main/AndroidManifest.xml similarity index 100% rename from hiddenlinearlayoutview/src/main/AndroidManifest.xml rename to hidden-layout-view/src/main/AndroidManifest.xml diff --git a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/HiddenLayoutView.java b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/HiddenLayoutView.java similarity index 95% rename from hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/HiddenLayoutView.java rename to hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/HiddenLayoutView.java index 6507fa9..e201d00 100644 --- a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/HiddenLayoutView.java +++ b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/HiddenLayoutView.java @@ -68,7 +68,7 @@ private void initView(AttributeSet attributeSet) { inflatedUnderLayout = under.inflate(); inflatedOverLayout = over.inflate(); } else { - Log.d(TAG, "Layout inflater null"); + Log.e(TAG, "Layout inflater null"); } initListeners(); setupListeners(); @@ -88,7 +88,6 @@ private void initListeners() { overLayoutEventListener = (view) -> { }; animationUpdateListeners = () -> { - Log.d(TAG, "Max Pulled"); }; } @@ -96,13 +95,12 @@ private void setupAnimations(String animationType) { int animType = Integer.parseInt(animationType); switch (animType) { case 1: - Log.d(TAG, "Spring Animation"); SpringAnimationUtil springAnimationUtil = new SpringAnimationUtil(context, inflatedOverLayout, - revealViewPercentageRight, inflatedUnderLayout.findViewById(R.id.revealed_view_right), + revealViewPercentageRight, inflatedUnderLayout, scaleHiddenView, maxMovementFactor, this); SpringAnimation springAnimation = springAnimationUtil.getxAnimation(); if (springAnimation == null) - Log.wtf(TAG, "SPringanimation is null"); + Log.wtf(TAG, "SpringAnimation is null"); springReverseAnim = springAnimationUtil.getReverseXAnim(); animation = springAnimation; reverseAnimation = springReverseAnim; @@ -121,7 +119,6 @@ private void setupAnimations(String animationType) { private void loadPreferencesFromAttributes(AttributeSet attributeSet) { if (attributeSet != null) { - Log.d(TAG, "Attribute set not null"); TypedArray typedArray = getContext().obtainStyledAttributes(attributeSet, R.styleable.HiddenLayoutView); try { layout_over = typedArray.getResourceId(R.styleable.HiddenLayoutView_layout_over, R.layout.over_layout_default); @@ -132,14 +129,11 @@ private void loadPreferencesFromAttributes(AttributeSet attributeSet) { maxMovementFactor = typedArray.getFloat(R.styleable.HiddenLayoutView_maxMovementFactorForSpring, 2); flingFriction = typedArray.getFloat(R.styleable.HiddenLayoutView_flingFriction, 0.8f); flingFrictionReverse = typedArray.getFloat(R.styleable.HiddenLayoutView_flingFrictionReverse, 0.001f); - Log.d(TAG, "Animation typed Array " + animationType); if (animationType == null || animationType.equals("")) animationType = "2"; } finally { typedArray.recycle(); } - } else { - Log.d(TAG, "Attribute set is null "); } } @@ -227,7 +221,6 @@ public float getFlingFrictionReverse() { @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) private void closeOpenHiddenView() { - Log.i(TAG, "Closing View"); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override diff --git a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Interfaces/AnimationUpdateListeners.java b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Interfaces/AnimationUpdateListeners.java similarity index 100% rename from hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Interfaces/AnimationUpdateListeners.java rename to hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Interfaces/AnimationUpdateListeners.java diff --git a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/FlingAnimationUtil.java b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/FlingAnimationUtil.java similarity index 90% rename from hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/FlingAnimationUtil.java rename to hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/FlingAnimationUtil.java index dc39fd9..2040753 100644 --- a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/FlingAnimationUtil.java +++ b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/FlingAnimationUtil.java @@ -53,7 +53,6 @@ private void setSpeedForReverseAnimation() { float pixelsRevealed = displayMetrics.widthPixels * minValue; float dpsRevealed = UtilityFunctions.convertPixelsToDp(pixelsRevealed, activityContext); reverseAnimationStartVelocity = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpsRevealed, this.activityContext.getResources().getDisplayMetrics()); - Log.d(TAG, "pixels per second " + reverseAnimationStartVelocity + " \n pixels revealed " + pixelsRevealed); } private void createFlingAnimationForHome(View inflatedOverLayout) { @@ -76,7 +75,6 @@ private void initTouchListener() { boolean clickOccoured = false; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: - Log.d(TAG, "Motion Action Down"); clickStart = Calendar.getInstance().getTimeInMillis(); pressedX = event.getX(); pressedY = event.getY(); @@ -91,17 +89,14 @@ else if (reverseFlingAnimation!=null) if (velocityTracker == null) break; velocityTracker.addMovement(event); - Log.d(TAG, "Motion Action Up"); long clickDuration = Calendar.getInstance().getTimeInMillis() - clickStart; if (clickDuration < CLICK_DURATION_IN_MILLIS && UtilityFunctions.distance(pressedX, pressedY, event.getX(), event.getY(), activityContext) < MOVE_THRESHOLD_IN_DP) { - Log.d(TAG, " Click duration " + clickDuration + " Distance " + UtilityFunctions.distance(pressedX, pressedY, event.getX(), event.getY(), activityContext)); clickOccoured = true; } velocityTracker.recycle(); velocityTracker = null; break; case MotionEvent.ACTION_MOVE: - Log.d(TAG,"ACTION MOVE"); if (velocityTracker == null) break; velocityTracker.addMovement(event); @@ -114,14 +109,12 @@ else if (reverseFlingAnimation!=null) cancelEvent.recycle(); break; case MotionEvent.ACTION_CANCEL: - Log.d(TAG,"ACTION CANCEL"); if (velocityTracker == null) break; velocityTracker.recycle(); velocityTracker = null; long clickDuration1 = Calendar.getInstance().getTimeInMillis() - clickStart; if (clickDuration1 < CLICK_DURATION_IN_MILLIS && UtilityFunctions.distance(pressedX, pressedY, event.getX(), event.getY(), activityContext) < MOVE_THRESHOLD_IN_DP) { - Log.d(TAG, " Click duration " + clickDuration1 + " Distance " + UtilityFunctions.distance(pressedX, pressedY, event.getX(), event.getY(), activityContext)); clickOccoured = true; } break; @@ -138,14 +131,11 @@ else if (reverseFlingAnimation!=null) private void setTouchListenerOnView(View inflatedOverLayout) { if (inflatedOverLayout instanceof ViewGroup) { - Log.d(TAG, "FOUND multiple children inside view"); for (int i = 0; i < ((ViewGroup) inflatedOverLayout).getChildCount(); i++) { View childView = ((ViewGroup) inflatedOverLayout).getChildAt(i); childView.setOnTouchListener(onTouchListener); - Log.d(TAG, " ID " + childView.getId() + " found at pos " + i); } } else { - Log.d(TAG, "No Child views"); inflatedOverLayout.setOnTouchListener(onTouchListener); } } diff --git a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/SpringAnimationUtil.java b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/SpringAnimationUtil.java similarity index 84% rename from hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/SpringAnimationUtil.java rename to hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/SpringAnimationUtil.java index 22ff3ee..2ce74de 100644 --- a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/SpringAnimationUtil.java +++ b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/SpringAnimationUtil.java @@ -41,8 +41,6 @@ public SpringAnimationUtil(Context context, View animatedView, float revealViewP ((Activity)animatedView.getContext()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); finalPosDiff = displayMetrics.widthPixels * revealViewPercentageRight; maxMovement = maxMovementFactor*finalPosDiff; - Log.i(TAG,"FInal pos Diff "+finalPosDiff); - Log.d(TAG,"MaX Movement allowed "+maxMovement); this.hiddenLayoutView = hiddenLayoutView; this.animatedView = animatedView; this.underLayout = underLayout; @@ -70,7 +68,6 @@ public boolean onTouch(View v, MotionEvent event) { reverseXAnim.cancel(); xAnimation.cancel(); maxReached = false; - Log.d(TAG,"MOTION ACTION DOWN"); velocityTracker = VelocityTracker.obtain(); velocityTracker.addMovement(event); return false; @@ -79,7 +76,6 @@ public boolean onTouch(View v, MotionEvent event) { break; velocityTracker.addMovement(event); float movement = event.getRawX() + dX; - Log.d(TAG,"Movement Action move"+movement); float scaleFactor = movement > 0 ? -0.04f : 0.04f; if (!scalehiddenView) scaleFactor = 0; @@ -100,10 +96,7 @@ public boolean onTouch(View v, MotionEvent event) { if (velocityTracker == null) break; velocityTracker.addMovement(event); - Log.d(TAG,"Motion UP "); if ((event.getRawX() + dX) < -finalPosDiff/2) { - // Toast.makeText(context,"X Animation", Toast.LENGTH_SHORT).show(); - Log.d(TAG,"Anim "+(event.getRawX() + dX)); xAnimation.start(); hiddenViewRevealed = true; } else if ((event.getRawX() + dX) < 0 && (event.getRawX() + dX) > -finalPosDiff/2){ @@ -112,48 +105,35 @@ public boolean onTouch(View v, MotionEvent event) { hiddenViewRevealed = false; } else if ((event.getRawX() + dX) > 0){ - Toast.makeText(context,"Reverse Animation",Toast.LENGTH_SHORT).show(); - Log.d(TAG,"reverse Anim "+(event.getRawX() + dX)); reverseXAnim.start(); hiddenViewRevealed = false; } underLayout.animate().scaleX(1f).setDuration(0).start(); if (Math.abs(event.getRawX() + dX) >= maxMovement) { hiddenLayoutView.animationUpdateListeners.onMaxSpringPull(); - } else { - Log.i(TAG,"Not a max pull event max Movement "+maxMovement +" actual move "+(event.getRawX()+dX)); } - Log.d(TAG,"Motion UP "); velocityTracker.recycle(); velocityTracker = null; break; case MotionEvent.ACTION_CANCEL: - Log.d(TAG,"ACTION CANCEL"); if (velocityTracker == null) break; velocityTracker.recycle(); velocityTracker = null; if ((event.getRawX() + dX) < -finalPosDiff/2) { - // Toast.makeText(context,"X Animation", Toast.LENGTH_SHORT).show(); - Log.d(TAG,"Anim "+(event.getRawX() + dX)); xAnimation.start(); hiddenViewRevealed = true; } else if ((event.getRawX() + dX) < 0 && (event.getRawX() + dX) > -finalPosDiff/2){ - // Log.d(TAG,"Reverse Anim "+(event.getRawX() + dX)); reverseXAnim.start(); hiddenViewRevealed = false; } else if ((event.getRawX() + dX) > 0){ - Toast.makeText(context,"Reverse Animation",Toast.LENGTH_SHORT).show(); - Log.d(TAG,"reverse Anim "+(event.getRawX() + dX)); reverseXAnim.start(); hiddenViewRevealed = false; } underLayout.animate().scaleX(1f).setDuration(0).start(); if (Math.abs(event.getRawX() + dX) >= maxMovement) { hiddenLayoutView.animationUpdateListeners.onMaxSpringPull(); - } else { - Log.i(TAG,"Not a max pull event max Movement "+maxMovement +" actual move "+(event.getRawX()+dX)); } break; } diff --git a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/UtilityFunctions.java b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/UtilityFunctions.java similarity index 88% rename from hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/UtilityFunctions.java rename to hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/UtilityFunctions.java index cc7910e..e6320e8 100644 --- a/hiddenlinearlayoutview/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/UtilityFunctions.java +++ b/hidden-layout-view/src/main/java/com/psx/hiddenlinearlayoutview/Utilities/UtilityFunctions.java @@ -19,7 +19,6 @@ private static float pxToDp(float px, Context context) { public static float convertPixelsToDp(float px, Context context){ Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); - float dp = px / ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT); - return dp; + return px / ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT); } } diff --git a/hiddenlinearlayoutview/src/main/res/drawable/ic_chevron_right_default_color_24dp.xml b/hidden-layout-view/src/main/res/drawable/ic_chevron_right_default_color_24dp.xml similarity index 100% rename from hiddenlinearlayoutview/src/main/res/drawable/ic_chevron_right_default_color_24dp.xml rename to hidden-layout-view/src/main/res/drawable/ic_chevron_right_default_color_24dp.xml diff --git a/hiddenlinearlayoutview/src/main/res/drawable/ic_sync_white_24dp.xml b/hidden-layout-view/src/main/res/drawable/ic_sync_white_24dp.xml similarity index 100% rename from hiddenlinearlayoutview/src/main/res/drawable/ic_sync_white_24dp.xml rename to hidden-layout-view/src/main/res/drawable/ic_sync_white_24dp.xml diff --git a/hiddenlinearlayoutview/src/main/res/layout/hidded_layout.xml b/hidden-layout-view/src/main/res/layout/hidded_layout.xml similarity index 100% rename from hiddenlinearlayoutview/src/main/res/layout/hidded_layout.xml rename to hidden-layout-view/src/main/res/layout/hidded_layout.xml diff --git a/hiddenlinearlayoutview/src/main/res/layout/over_layout_default.xml b/hidden-layout-view/src/main/res/layout/over_layout_default.xml similarity index 99% rename from hiddenlinearlayoutview/src/main/res/layout/over_layout_default.xml rename to hidden-layout-view/src/main/res/layout/over_layout_default.xml index 850e656..7da63e6 100644 --- a/hiddenlinearlayoutview/src/main/res/layout/over_layout_default.xml +++ b/hidden-layout-view/src/main/res/layout/over_layout_default.xml @@ -111,7 +111,7 @@ android:layout_height="wrap_content" android:layout_below="@+id/current_area_home" android:gravity="center" - android:text="ACRES" + android:text="SPEED" android:textSize="12dp" android:textStyle="bold" /> diff --git a/hiddenlinearlayoutview/src/main/res/layout/under_layout_default.xml b/hidden-layout-view/src/main/res/layout/under_layout_default.xml similarity index 98% rename from hiddenlinearlayoutview/src/main/res/layout/under_layout_default.xml rename to hidden-layout-view/src/main/res/layout/under_layout_default.xml index c70e352..8cf1021 100644 --- a/hiddenlinearlayoutview/src/main/res/layout/under_layout_default.xml +++ b/hidden-layout-view/src/main/res/layout/under_layout_default.xml @@ -47,7 +47,7 @@