Skip to content

Instantly share code, notes, and snippets.

@Danil0v3s
Last active October 4, 2017 17:23
Show Gist options
  • Save Danil0v3s/8b91487a4a080506d8f7d98b84247fbe to your computer and use it in GitHub Desktop.
Save Danil0v3s/8b91487a4a080506d8f7d98b84247fbe to your computer and use it in GitHub Desktop.
Herança
public class BaseActivity extends AppCompatActivity {
public void setupViews(Toolbar toolbar, String title) {
setTitle(title);
setSupportActionBar(toolbar);
try {
getSupportActionBar().setElevation(0);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
final Drawable upArrow = getResources().getDrawable(R.drawable.ic_back);
upArrow.setColorFilter(getResources().getColor(R.color.colorPrimary), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class TermsActivity extends BaseActivity {
@BindView(R2.id.toolbar)
Toolbar toolbar;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_terms);
ButterKnife.bind(this);
super.setupViews(toolbar, "diretrizes");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment