Activity Transaction animations merged
This commit is contained in:
commit
47103ba3d0
@ -13,6 +13,8 @@ import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
|
||||
/**
|
||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||
* to be used with AppCompat.
|
||||
@ -26,6 +28,7 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
overridePendingTransition(R.anim.slide_in_from_right, R.anim.fade_out_scale);
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -89,6 +92,14 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (isFinishing()) {
|
||||
overridePendingTransition(R.anim.fade_in_scale, R.anim.slide_out_to_right);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
|
@ -178,7 +178,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
// Image
|
||||
private Bitmap mDefaultVideoPoster, mWebpageBitmap;
|
||||
private final ColorDrawable mBackground = new ColorDrawable();
|
||||
private Drawable mDeleteIcon, mRefreshIcon, mSearchIcon, mIcon;
|
||||
private Drawable mDeleteIcon, mRefreshIcon, mClearIcon, mIcon;
|
||||
private DrawerArrowDrawable mArrowDrawable;
|
||||
|
||||
// Proxy
|
||||
@ -324,12 +324,12 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
}
|
||||
mDeleteIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_delete);
|
||||
mRefreshIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_refresh);
|
||||
mSearchIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_forward);
|
||||
mClearIcon = ThemeUtils.getLightThemedDrawable(this, R.drawable.ic_action_delete);
|
||||
|
||||
int iconBounds = Utils.dpToPx(30);
|
||||
mDeleteIcon.setBounds(0, 0, iconBounds, iconBounds);
|
||||
mRefreshIcon.setBounds(0, 0, iconBounds, iconBounds);
|
||||
mSearchIcon.setBounds(0, 0, iconBounds, iconBounds);
|
||||
mClearIcon.setBounds(0, 0, iconBounds, iconBounds);
|
||||
mIcon = mRefreshIcon;
|
||||
SearchListenerClass search = new SearchListenerClass();
|
||||
mSearch.setCompoundDrawables(null, null, mRefreshIcon, null);
|
||||
@ -418,8 +418,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
((AutoCompleteTextView) v).selectAll(); // Hack to make sure
|
||||
// the text gets
|
||||
// selected
|
||||
mIcon = mSearchIcon;
|
||||
mSearch.setCompoundDrawables(null, null, mSearchIcon, null);
|
||||
mIcon = mClearIcon;
|
||||
mSearch.setCompoundDrawables(null, null, mClearIcon, null);
|
||||
}
|
||||
final Animation anim = new Animation() {
|
||||
|
||||
@ -485,12 +485,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
if (tappedX) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
if (mSearch.hasFocus()) {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
|
||||
searchTheWeb(mSearch.getText().toString());
|
||||
if (mCurrentView != null) {
|
||||
mCurrentView.requestFocus();
|
||||
}
|
||||
mSearch.setText("");
|
||||
} else {
|
||||
refreshOrStop();
|
||||
}
|
||||
@ -739,6 +734,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
return true;
|
||||
case R.id.action_incognito:
|
||||
startActivity(new Intent(this, IncognitoActivity.class));
|
||||
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale);
|
||||
return true;
|
||||
case R.id.action_share:
|
||||
if (mCurrentView != null && !mCurrentView.getUrl().startsWith(Constants.FILE)) {
|
||||
@ -1203,6 +1199,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (isIncognito() && isFinishing()) {
|
||||
overridePendingTransition(R.anim.fade_in_scale, R.anim.slide_down_out);
|
||||
}
|
||||
|
||||
BusProvider.getInstance().unregister(busEventListener);
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
package acr.browser.lightning.activity;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
public class BrowserApp extends Application {
|
||||
|
||||
private static Context context;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
context = getApplicationContext();
|
||||
}
|
||||
|
||||
public static Context getAppContext() {
|
||||
return context;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package acr.browser.lightning.app;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import acr.browser.lightning.activity.BrowserActivity;
|
||||
import acr.browser.lightning.fragment.BookmarkSettingsFragment;
|
||||
import acr.browser.lightning.fragment.BookmarksFragment;
|
||||
import acr.browser.lightning.object.SearchAdapter;
|
||||
import dagger.Component;
|
||||
|
||||
/**
|
||||
* Created by Stefano Pacifici on 01/09/15.
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {AppModule.class})
|
||||
public interface AppComponent {
|
||||
|
||||
void inject(BrowserActivity activity);
|
||||
|
||||
void inject(BookmarksFragment fragment);
|
||||
|
||||
void inject(BookmarkSettingsFragment fragment);
|
||||
|
||||
void inject(SearchAdapter adapter);
|
||||
}
|
41
app/src/main/java/acr/browser/lightning/app/AppModule.java
Normal file
41
app/src/main/java/acr/browser/lightning/app/AppModule.java
Normal file
@ -0,0 +1,41 @@
|
||||
package acr.browser.lightning.app;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.squareup.otto.Bus;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import acr.browser.lightning.database.BookmarkManager;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
/**
|
||||
* Created by Stefano Pacifici on 01/09/15.
|
||||
*/
|
||||
@Module
|
||||
public class AppModule {
|
||||
private final BrowserApp app;
|
||||
private final Bus bus;
|
||||
|
||||
public AppModule(BrowserApp app) {
|
||||
this.app = app;
|
||||
this.bus = new Bus();
|
||||
}
|
||||
|
||||
@Provides
|
||||
public Context provideContext() {
|
||||
return app.getApplicationContext();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public BookmarkManager provideBookmarkManager() {
|
||||
return new BookmarkManager(app.getApplicationContext());
|
||||
}
|
||||
|
||||
@Provides
|
||||
public Bus provideBus() {
|
||||
return bus;
|
||||
}
|
||||
}
|
32
app/src/main/java/acr/browser/lightning/app/BrowserApp.java
Normal file
32
app/src/main/java/acr/browser/lightning/app/BrowserApp.java
Normal file
@ -0,0 +1,32 @@
|
||||
package acr.browser.lightning.app;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import acr.browser.lightning.activity.DaggerAppComponent;
|
||||
|
||||
public class BrowserApp extends Application {
|
||||
|
||||
private static Context context;
|
||||
private static AppComponent appComponent;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
context = getApplicationContext();
|
||||
buildDepencyGraph();
|
||||
}
|
||||
|
||||
public static Context getAppContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public static AppComponent getAppComponent() {
|
||||
return appComponent;
|
||||
}
|
||||
|
||||
public void buildDepencyGraph() {
|
||||
appComponent = DaggerAppComponent.builder().appModule(new AppModule(this)).build();
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package acr.browser.lightning.bus;
|
||||
|
||||
import com.squareup.otto.Bus;
|
||||
|
||||
/**
|
||||
* Created by Stefano Pacifici on 25/08/15.
|
||||
*/
|
||||
public class BusProvider {
|
||||
|
||||
private static final Bus bus = new Bus();
|
||||
|
||||
public static Bus getInstance() {
|
||||
return bus;
|
||||
}
|
||||
|
||||
private BusProvider() {
|
||||
// No instances
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package acr.browser.lightning.dialog;
|
||||
|
||||
/**
|
||||
* Created by Stefano Pacifici on 02/09/15.
|
||||
*/
|
||||
public class BookmarksDialogBuilder {
|
||||
}
|
16
app/src/main/res/anim/fade_in_scale.xml
Normal file
16
app/src/main/res/anim/fade_in_scale.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromXScale="0.85"
|
||||
android:fromYScale="0.85"
|
||||
android:interpolator="@android:interpolator/decelerate_cubic"
|
||||
android:pivotX="50%p"
|
||||
android:pivotY="50%p"
|
||||
android:toXScale="1.0"
|
||||
android:toYScale="1.0" />
|
||||
<alpha
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0" />
|
||||
</set>
|
16
app/src/main/res/anim/fade_out_scale.xml
Normal file
16
app/src/main/res/anim/fade_out_scale.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromXScale="1.0"
|
||||
android:fromYScale="1.0"
|
||||
android:interpolator="@android:interpolator/decelerate_cubic"
|
||||
android:pivotX="50%p"
|
||||
android:pivotY="50%p"
|
||||
android:toXScale="0.85"
|
||||
android:toYScale="0.85" />
|
||||
<alpha
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
12
app/src/main/res/anim/slide_down_out.xml
Normal file
12
app/src/main/res/anim/slide_down_out.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromYDelta="0%p"
|
||||
android:interpolator="@android:interpolator/accelerate_cubic"
|
||||
android:toYDelta="100%p" />
|
||||
<alpha
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
12
app/src/main/res/anim/slide_in_from_right.xml
Normal file
12
app/src/main/res/anim/slide_in_from_right.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromXDelta="100%p"
|
||||
android:interpolator="@android:interpolator/decelerate_cubic"
|
||||
android:toXDelta="0%p" />
|
||||
<!--<alpha-->
|
||||
<!--android:duration="@android:integer/config_mediumAnimTime"-->
|
||||
<!--android:fromAlpha="0.0"-->
|
||||
<!--android:toAlpha="1.0" />-->
|
||||
</set>
|
12
app/src/main/res/anim/slide_out_to_right.xml
Normal file
12
app/src/main/res/anim/slide_out_to_right.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromXDelta="0%p"
|
||||
android:interpolator="@android:interpolator/decelerate_cubic"
|
||||
android:toXDelta="100%p" />
|
||||
<!--<alpha-->
|
||||
<!--android:duration="@android:integer/config_mediumAnimTime"-->
|
||||
<!--android:fromAlpha="0.0"-->
|
||||
<!--android:toAlpha="1.0" />-->
|
||||
</set>
|
12
app/src/main/res/anim/slide_up_in.xml
Normal file
12
app/src/main/res/anim/slide_up_in.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromYDelta="100%p"
|
||||
android:interpolator="@android:interpolator/decelerate_cubic"
|
||||
android:toYDelta="0%p" />
|
||||
<!--<alpha-->
|
||||
<!--android:duration="@android:integer/config_mediumAnimTime"-->
|
||||
<!--android:fromAlpha="0.5"-->
|
||||
<!--android:toAlpha="1.0" />-->
|
||||
</set>
|
Loading…
x
Reference in New Issue
Block a user