Skip to content

Commit

Permalink
changes in navigation animation
Browse files Browse the repository at this point in the history
  • Loading branch information
VishalNehra committed Nov 28, 2015
1 parent 1e1bb33 commit 0988b63
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 47 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Icon
# Android Studio
.idea/*
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
.gradle/*
build/*
.gradle/
build/
.settings
bin/
gen/
Expand All @@ -52,3 +52,4 @@ gradlew.bat
.project
AmazeFileManager.iml
libs/libs.iml
.idea/
69 changes: 42 additions & 27 deletions AmazeFileManager.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="playRelease" />
<option name="SELECTED_BUILD_VARIANT" value="playDebug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assemblePlayRelease" />
<option name="COMPILE_JAVA_TASK_NAME" value="compilePlayReleaseSources" />
<option name="ASSEMBLE_TASK_NAME" value="assemblePlayDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compilePlayDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assemblePlayDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compilePlayDebugAndroidTestSources" />
<afterSyncTasks>
<task>generatePlayReleaseSources</task>
<task>generatePlayDebugAndroidTestSources</task>
<task>generatePlayDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
Expand All @@ -23,23 +26,29 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/play/release" />
<output url="file://$MODULE_DIR$/build/intermediates/classes/play/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/play/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/play/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/play/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/play/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/play/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/play/release" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/play/release" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playRelease/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playRelease/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playRelease/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playRelease/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/playRelease/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/playRelease/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/playRelease/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/play/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/play/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/play/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/play/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/play/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/play/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playDebug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playDebug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playDebug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/playDebug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/playDebug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/playDebug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/playDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/play/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/play/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/play/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/play/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/play/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/play/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/play/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/play/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/play/assets" type="java-resource" />
Expand All @@ -54,13 +63,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPlay/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPlay/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPlay/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build-types/release/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/release/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/release/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/release/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/release/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/release/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/release/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
Expand All @@ -76,7 +85,9 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
Expand All @@ -91,13 +102,17 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/me.zhanghai.android.materialprogressbar/library/1.1.4/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.sufficientlysecure/donations/2.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
buildToolsVersion '23.0.1'

packagingOptions {
exclude 'proguard-project.txt'
Expand Down
4 changes: 2 additions & 2 deletions local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Nov 22 01:49:11 IST 2015
sdk.dir=/home/arpitkh96/android-sdk-linux
#Tue Nov 24 21:13:26 IST 2015
sdk.dir=/home/vishal/work/android-studio/plugins/android-sdk-linux
8 changes: 5 additions & 3 deletions src/main/java/com/amaze/filemanager/fragments/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -976,9 +976,11 @@ public void loadlist(String path, boolean back, int openMode) {
void initNoFileLayout() {
nofilesview = rootView.findViewById(R.id.nofilelayout);
if (theme1 == 0)
((ImageView) nofilesview.findViewById(R.id.image)).setColorFilter(Color.parseColor
("#666666"));
else ((TextView) nofilesview.findViewById(R.id.nofiletext)).setTextColor(Color.WHITE);
((ImageView) nofilesview.findViewById(R.id.image)).setColorFilter(Color.parseColor("#666666"));
else {
nofilesview.setBackgroundColor(getResources().getColor(R.color.holo_dark_background));
((TextView) nofilesview.findViewById(R.id.nofiletext)).setTextColor(Color.WHITE);
}
}

public boolean checkforpath(String path){
Expand Down
1 change: 1 addition & 0 deletions src/main/res/layout/main_frag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
android:id="@+id/nofilelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:visibility="gone">

<ImageView
Expand Down
122 changes: 110 additions & 12 deletions src/play/java/com/amaze/filemanager/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public class MainActivity extends AppCompatActivity implements
private View drawerHeaderView;
private RoundedImageView drawerProfilePic;
private DisplayImageOptions displayImageOptions;
private int sdk;
private int sdk, COUNTER=0;
private TextView mGoogleName, mGoogleId;
private LinearLayout buttons;
private HorizontalScrollView scroll, scroll1;
Expand All @@ -215,6 +215,9 @@ public class MainActivity extends AppCompatActivity implements
*/
private boolean mIntentInProgress, topfab = false, showHidden = false;

// string builder object variables for pathBar animations
private StringBuilder newPathBuilder, oldPathBuilder;

/**
* Called when the activity is first created.
*/
Expand Down Expand Up @@ -1917,15 +1920,21 @@ else if (openmode == 2)
final String oldPath = bapath.getText().toString();
if (oldPath != null && oldPath.equals(newPath)) return;

// implement animation while setting text
newPathBuilder = new StringBuilder().append(newPath);
oldPathBuilder = new StringBuilder().append(oldPath);

final Animation slideIn = AnimationUtils.loadAnimation(this, R.anim.slide_in);
Animation slideOut = AnimationUtils.loadAnimation(this, R.anim.slide_out);

final StringBuilder stringBuilder = new StringBuilder();
if (newPath.length() >= oldPath.length()) {
if (newPath.length() >= oldPath.length() &&
newPathBuilder.delete(oldPath.length(), newPath.length()).toString().equals(oldPath) &&
oldPath.length()!=0) {

// navigate forward
stringBuilder.append(newPath);
stringBuilder.delete(0, oldPath.length());
newPathBuilder.delete(0, newPathBuilder.length());
newPathBuilder.append(newPath);
newPathBuilder.delete(0, oldPath.length());
animPath.setAnimation(slideIn);
animPath.animate().setListener(new AnimatorListenerAdapter() {
@Override
Expand All @@ -1939,7 +1948,7 @@ public void onAnimationEnd(Animator animation) {
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
animPath.setVisibility(View.VISIBLE);
animPath.setText(stringBuilder.toString());
animPath.setText(newPathBuilder.toString());
//bapath.setText(oldPath);

scroll.post(new Runnable() {
Expand All @@ -1949,11 +1958,14 @@ public void run() {
}
});
}
}).start();
} else if (newPath.length() <= oldPath.length()) {
}).setStartDelay(500).start();
} else if (newPath.length() <= oldPath.length() &&
oldPathBuilder.delete(newPath.length(), oldPath.length()).toString().equals(newPath)) {

// navigate backwards
stringBuilder.append(oldPath);
stringBuilder.delete(0, newPath.length());
oldPathBuilder.delete(0, oldPathBuilder.length());
oldPathBuilder.append(oldPath);
oldPathBuilder.delete(0, newPath.length());
animPath.setAnimation(slideOut);
animPath.animate().setListener(new AnimatorListenerAdapter() {
@Override
Expand All @@ -1974,7 +1986,7 @@ public void run() {
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
animPath.setVisibility(View.VISIBLE);
animPath.setText(stringBuilder.toString());
animPath.setText(oldPathBuilder.toString());
bapath.setText(newPath);

scroll.post(new Runnable() {
Expand All @@ -1984,7 +1996,93 @@ public void run() {
}
});
}
}).start();
}).setStartDelay(500).start();
} else if (oldPath.isEmpty()) {

// case when app starts
// FIXME: COUNTER is incremented twice on app startup
COUNTER++;
if (COUNTER==2) {

animPath.setAnimation(slideIn);
animPath.setText(newPath);
animPath.animate().setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
animPath.setVisibility(View.VISIBLE);
bapath.setText("");
scroll.post(new Runnable() {
@Override
public void run() {
scroll1.fullScroll(View.FOCUS_RIGHT);
}
});
}

@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
animPath.setVisibility(View.GONE);
bapath.setText(newPath);
}
}).setStartDelay(500).start();
}

} else {

// completely different path
// first slide out of old path followed by slide in of new path
animPath.setAnimation(slideOut);
animPath.animate().setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
super.onAnimationStart(animator);
animPath.setVisibility(View.VISIBLE);
animPath.setText(oldPath);
bapath.setText("");

scroll.post(new Runnable() {
@Override
public void run() {
scroll1.fullScroll(View.FOCUS_LEFT);
}
});
}

@Override
public void onAnimationEnd(Animator animator) {
super.onAnimationEnd(animator);

//animPath.setVisibility(View.GONE);
animPath.setText(newPath);
bapath.setText("");
animPath.setAnimation(slideIn);

animPath.animate().setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
animPath.setVisibility(View.GONE);
bapath.setText(newPath);
}

@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
// we should not be having anything here in path bar
animPath.setVisibility(View.VISIBLE);
bapath.setText("");
scroll.post(new Runnable() {
@Override
public void run() {
scroll1.fullScroll(View.FOCUS_RIGHT);
}
});
}
}).start();
}
}).setStartDelay(500).start();
}
}

Expand Down

0 comments on commit 0988b63

Please sign in to comment.