This file contains hidden or 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
// http://guides.codepath.com/android/shared-element-activity-transition | |
// https://medium.com/@andkulikov/animate-all-the-things-transitions-in-android-914af5477d50#.1jj56i6dy | |
//Activity.class | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
Helper.MakeActivitiesTransitions(this); //sempre antes de setContent | |
setContentView(R.layout.activity_tv); |
This file contains hidden or 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
//more on: | |
// http://www.androidcodesnippets.com | |
// http://www.androidsnippets.com | |
// https://github.com/changer/android-utils/blob/master/Utils/app/src/main/java/nl/changer/android/opensource/Utils.java | |
static void TintDrawable(Context c, int drawable, int color){ | |
//example: HelperUtils.TintDrawable(this, R.drawable.logo,R.color.colorPrimaryDark); | |
Drawable mDrawable = null; | |
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { | |
mDrawable = c.getResources().getDrawable(R.drawable.x, null); |
This file contains hidden or 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
//java | |
static void PepeToast(AppCompatActivity a, String message){ | |
LayoutInflater inflater = a.getLayoutInflater(); | |
View layout = inflater.inflate(R.layout.toast_layout, (ViewGroup) a.findViewById(R.id.toast_layout_root)); | |
TextView text = (TextView) layout.findViewById(R.id.text); | |
text.setText(message); | |
Toast toast = new Toast(a); | |
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); |
This file contains hidden or 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
//link: | |
// https://medium.com/@kevalpatel2106/how-to-decrease-your-gradle-build-time-by-65-310b572b0c43#.4rmzrcuj9 | |
// https://gradle.org/install | |
//no terminal depois de ter o device instalado uma vez, usar | |
./gradlew android:assembleDebug --profile --configure-on-demand --daemon | |
// or this "app" root file name: | |
./gradlew app:assembleDebug --profile --configure-on-demand --daemon | |
This file contains hidden or 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
//java class | |
JustifiedTextView id_example = (JustifiedTextView) v.findViewById(R.id.id_example); | |
//limpar todo o "[" e "]" bem como o que está entre os mesmos. | |
//Usado quando o html vem com shortcodes tipo:[vc_row]. | |
String clean_string = string_example.replaceAll("\\[.*?\\]", ""); | |
//mostrar string com elemntos do html | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |
id_example.setText(Html.fromHtml(newsContent, Html.FROM_HTML_MODE_COMPACT)); |
This file contains hidden or 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
// important links | |
// Retrofit 2 - https://futurestud.io/tutorials/retrofit-getting-started-and-android-client | |
// Android/Java Pojo Objects for JSON requests - http://www.jsonschema2pojo.org | |
// +RxJava - https://medium.freecodecamp.com/rxandroid-and-retrofit-2-0-66dc52725fff#.eai8dux4j | |
// - https://github.com/JakeWharton/retrofit2-rxjava2-adapter | |
// - http://www.androidauthority.com/reactive-programming-with-rxandroid-711104/ | |
// - https://www.learn2crack.com/2016/11/android-rxjava-2-and-retrofit.html | |
// - https://www.raywenderlich.com/141980/rxandroid-tutorial | |
// - https://github.com/kaushikgopal/RxJava-Android-Samples |
This file contains hidden or 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
// res/drawable | |
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | |
<gradient | |
android:startColor="@android:color/black" | |
android:centerColor="@color/black_overlay" | |
android:endColor="@android:color/transparent" | |
android:angle="90" | |
/> |
This file contains hidden or 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
@Override | |
public void onBackPressed() { | |
List<Fragment> all_frags = getSupportFragmentManager().getFragments(); | |
if(all_frags != null){ | |
if (all_frags.size() == 0) { | |
super.onBackPressed(); | |
} else { | |
for (Fragment frag : all_frags) { | |
getSupportFragmentManager().beginTransaction().remove(frag).commit(); | |
} |
This file contains hidden or 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
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:background="@color/colorAccent"> | |
<android.support.v4.widget.NestedScrollView | |
android:id="@+id/scroll" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" |
This file contains hidden or 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
public final static int REQUEST_CODE = 1; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_initial); | |
checkDrawOverlayPermission(); | |
} |
NewerOlder