Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Did you do good today?

Mirosław Stanek frogermcs

🤓
Did you do good today?
View GitHub Profile
@frogermcs
frogermcs / FABAnimation
Last active Aug 29, 2015
InstaMaterial source files
View FABAnimation
//...
//FAB animation
private static final int ANIM_DURATION_FAB = 400;
private void startContentAnimation() {
btnCreate.animate()
.translationY(0)
.setInterpolator(new OvershootInterpolator(1.f))
.setStartDelay(300)
.setDuration(ANIM_DURATION_FAB)
@frogermcs
frogermcs / CommentsActivity_enter_transition.java
Last active Aug 29, 2015
InstaMaterial source files (comments transitions)
View CommentsActivity_enter_transition.java
public class CommentsActivity extends ActionBarActivity {
public static final String ARG_DRAWING_START_LOCATION = "arg_drawing_start_location";
@InjectView(R.id.toolbar)
Toolbar toolbar;
@InjectView(R.id.contentRoot)
LinearLayout contentRoot;
@InjectView(R.id.rvComments)
RecyclerView rvComments;
@InjectView(R.id.llAddComment)
View MainActivity_extra_layout_space.java
public class MainActivity extends ActionBarActivity implements FeedAdapter.OnFeedItemClickListener {
//...
private void setupFeed() {
//Increase the amount of extra space that should be laid out by LayoutManager.
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this) {
@Override
protected int getExtraLayoutSpace(RecyclerView.State state) {
return 300;
@frogermcs
frogermcs / FeedContextMenu.java
Last active Aug 29, 2015
InstaMaterial source files - post 4
View FeedContextMenu.java
public class FeedContextMenu extends LinearLayout {
private static final int CONTEXT_MENU_WIDTH = Utils.dpToPx(240);
private int feedItem = -1;
private OnFeedContextMenuItemClickListener onItemClickListener;
public FeedContextMenu(Context context) {
super(context);
init();
@frogermcs
frogermcs / CircleTransformation.java
Last active Aug 29, 2015
InstaMaterial source files (user profile)
View CircleTransformation.java
public class CircleTransformation implements Transformation {
private static final int STROKE_WIDTH = 6;
@Override
public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
int x = (source.getWidth() - size) / 2;
int y = (source.getHeight() - size) / 2;
@frogermcs
frogermcs / BaseActivity_globalMenuHeaderClick.java
Last active Aug 29, 2015
InstaMaterial source files (Navigation drawer)
View BaseActivity_globalMenuHeaderClick.java
@Override
public void onGlobalMenuHeaderClick(final View v) {
drawerLayout.closeDrawer(Gravity.START);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
int[] startingLocation = new int[2];
v.getLocationOnScreen(startingLocation);
startingLocation[0] += v.getWidth() / 2;
UserProfileActivity.startUserProfileFromLocation(startingLocation, BaseActivity.this);
@frogermcs
frogermcs / AndroidManifest.xml
Last active Aug 29, 2015
InstaMaterial source files (photo capture)
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.froger.instamaterial">
<!--...-->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
@frogermcs
frogermcs / MainActivity.java
Last active Aug 29, 2015
InstaMaterial source files (Photo publishing)
View MainActivity.java
// MainActivity.java
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (ACTION_SHOW_LOADING_ITEM.equals(intent.getAction())) {
showFeedLoadingItemDelayed();
}
}
@frogermcs
frogermcs / ActivityScope.java
Created Mar 30, 2015
Sources for Dagger 1 -> 2 migration process
View ActivityScope.java
@Scope
@Retention(RetentionPolicy.RUNTIME)
public @interface ActivityScope {
}
@frogermcs
frogermcs / Snackbar.java
Last active Aug 29, 2015
InstaMaterial source files - Design Support Library
View Snackbar.java
public void showLikedSnackbar() {
Snackbar.make(clContent, "Liked!", Snackbar.LENGTH_SHORT).show();
}
You can’t perform that action at this time.