Stefano Pacifici
9 years ago
14 changed files with 206 additions and 49 deletions
@ -1,19 +0,0 @@
@@ -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 @@
@@ -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); |
||||
} |
@ -0,0 +1,41 @@
@@ -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; |
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -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 @@
@@ -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 @@
@@ -0,0 +1,7 @@
|
||||
package acr.browser.lightning.dialog; |
||||
|
||||
/** |
||||
* Created by Stefano Pacifici on 02/09/15. |
||||
*/ |
||||
public class BookmarksDialogBuilder { |
||||
} |
@ -0,0 +1,16 @@
@@ -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> |
@ -0,0 +1,16 @@
@@ -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> |
@ -0,0 +1,12 @@
@@ -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> |
@ -0,0 +1,12 @@
@@ -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> |
@ -0,0 +1,12 @@
@@ -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> |
@ -0,0 +1,12 @@
@@ -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…
Reference in new issue