Skip to content

Instantly share code, notes, and snippets.

View frogermcs's full-sized avatar
🤓
Did you do good today?

Mirosław Stanek frogermcs

🤓
Did you do good today?
View GitHub Profile
@frogermcs
frogermcs / FABAnimation
Last active August 29, 2015 14:09
InstaMaterial source files
//...
//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 August 29, 2015 14:10
InstaMaterial source files (comments transitions)
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)
@frogermcs
frogermcs / MainActivity_extra_layout_space.java
Last active August 29, 2015 14:10
InstaMaterial source files
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 August 29, 2015 14:11
InstaMaterial source files - post 4
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 / FeedAdapter_animatePhotoLike.java
Last active February 3, 2019 20:56
InstaMaterial source files (comments transitions)
private void animatePhotoLike(final CellFeedViewHolder holder) {
if (!likeAnimations.containsKey(holder)) {
holder.vBgLike.setVisibility(View.VISIBLE);
holder.ivLike.setVisibility(View.VISIBLE);
holder.vBgLike.setScaleY(0.1f);
holder.vBgLike.setScaleX(0.1f);
holder.vBgLike.setAlpha(1f);
holder.ivLike.setScaleY(0.1f);
holder.ivLike.setScaleX(0.1f);
@frogermcs
frogermcs / CircleTransformation.java
Last active August 29, 2015 14:13
InstaMaterial source files (user profile)
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 August 29, 2015 14:14
InstaMaterial source files (Navigation drawer)
@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 August 29, 2015 14:15
InstaMaterial source files (photo capture)
<?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 August 29, 2015 14:16
InstaMaterial source files (Photo publishing)
// 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 March 30, 2015 22:01
Sources for Dagger 1 -> 2 migration process
@Scope
@Retention(RetentionPolicy.RUNTIME)
public @interface ActivityScope {
}