You can see other best Android Gists or offer your just here https://github.com/lopspower/BestAndroidGists 👍.
-
-
Save lopspower/9d37377f063dd26bf1eb to your computer and use it in GitHub Desktop.
My default Android Base Archi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical"> | |
<include layout="@layout/toolbar" /> | |
<LinearLayout | |
android:id="@+id/content" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="horizontal"/> | |
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/toolbar" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/colorPrimary" | |
android:paddingTop="@dimen/toolbar_top_padding" | |
android:elevation="@dimen/elevation" | |
android:theme="@style/ThemeOverlay.AppCompat.Dark" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<transitionSet> | |
<explode/> | |
</transitionSet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<resources> | |
<!-- APP DEFAULT --> | |
<color name="colorPrimary">#00BFA5</color> | |
<color name="colorPrimaryDark">#00796B</color> | |
<color name="colorPrimaryLight">#1DE9B6</color> | |
<color name="colorAccent">#9C27B0</color> | |
<color name="colorHighlight">#212121</color> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<resources> | |
<!-- GENERAL --> | |
<dimen name="activity_horizontal_margin">16dp</dimen> | |
<dimen name="activity_vertical_margin">16dp</dimen> | |
<dimen name="elevation">4dp</dimen> | |
<!-- TOOLBAR --> | |
<dimen name="toolbar_top_padding">0dp</dimen> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<resources> | |
<!-- APP DEFAULT --> | |
<style name="AppTheme" parent="AppTheme.Base"/> | |
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> | |
<item name="colorControlHighlight">@color/colorHighlight</item> | |
<item name="android:windowBackground">@android:color/white</item> | |
</style> | |
<!-- CUSTOM --> | |
<style name="AppTheme.NoTransition" parent="AppTheme"/> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<resources> | |
<!-- TOOLBAR --> | |
<dimen name="toolbar_top_padding">24dp</dimen> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (C) 2016 Mikhael LOPEZ | |
~ Licensed under the Apache License Version 2.0 | |
--> | |
<resources> | |
<!-- APP DEFAULT --> | |
<style name="AppTheme" parent="AppTheme.Base"> | |
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | |
<item name="android:windowTranslucentStatus">true</item> | |
<item name="android:statusBarColor">@android:color/transparent</item> | |
<item name="android:navigationBarColor">@color/colorPrimary</item> | |
<!-- TRANSITION --> | |
<item name="android:windowContentTransitions">true</item> | |
<item name="android:windowAllowEnterTransitionOverlap">true</item> | |
<item name="android:windowAllowReturnTransitionOverlap">true</item> | |
<!-- specify enter and exit transitions --> | |
<item name="android:windowEnterTransition">@transition/explode</item> | |
<item name="android:windowExitTransition">@transition/explode</item> | |
</style> | |
<!-- CUSTOM --> | |
<style name="AppTheme.NoTransition" parent="AppTheme"> | |
<!-- NO TRANSITION --> | |
<item name="android:windowContentTransitions">false</item> | |
<item name="android:windowAllowEnterTransitionOverlap">false</item> | |
<item name="android:windowAllowReturnTransitionOverlap">false</item> | |
<!-- remove enter and exit transitions --> | |
<item name="android:windowEnterTransition">@null</item> | |
<item name="android:windowExitTransition">@null</item> | |
</style> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Build; | |
import android.support.v7.app.AppCompatActivity; | |
import android.support.v7.widget.Toolbar; | |
/** | |
* Copyright (C) 2016 Mikhael LOPEZ | |
* Licensed under the Apache License Version 2.0 | |
*/ | |
public abstract class ABaseActivity extends AppCompatActivity { | |
protected Toolbar mToolbar; | |
@Override | |
public void setContentView(int layoutResID) { | |
super.setContentView(layoutResID); | |
mToolbar = (Toolbar) findViewById(R.id.toolbar); | |
//mToolbar.setTitle(null); // To remove title | |
setSupportActionBar(mToolbar); | |
} | |
@Override | |
public void finishAfterTransition() { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
super.finishAfterTransition(); | |
} else { | |
super.finish(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment