// Path: app/src/main/java/moe/yukinoneko/diycode/base/BaseActivity.java
// public abstract class BaseActivity extends RxAppCompatActivity {
// 
//     protected Unbinder unbinder;
// 
//     @Nullable
//     @BindView(R.id.toolbar)
//     protected Toolbar toolbar;
// 
//     @BindColor(R.color.navigation)
//     protected int navigationColor;
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(provideContentViewId());
// 
//         unbinder = ButterKnife.bind(this);
// 
//         if (toolbar != null) {
//             setSupportActionBar(toolbar);
//             if (getSupportActionBar() != null) {
//                 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//             }
//         }
//     }
// 
//     @Override
//     protected void onPostCreate(@Nullable Bundle savedInstanceState) {
//         super.onPostCreate(savedInstanceState);
//         setNavigationIconColor(navigationColor);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         if (item.getItemId() == android.R.id.home) {
//             finish();
//             return true;
//         }
//         return super.onOptionsItemSelected(item);
//     }
// 
//     @Override
//     protected void onDestroy() {
//         super.onDestroy();
// 
//         if (unbinder != null) {
//             unbinder.unbind();
//         }
//     }
// 
//     protected abstract int provideContentViewId();
// 
//     protected void setToolBarTitle(CharSequence title) {
//         if (toolbar != null) {
//             toolbar.setTitle(title);
//         }
//     }
// 
//     protected void setDisplayShowTitleEnabled(boolean enabled) {
//         ActionBar actionBar = getSupportActionBar();
//         if (actionBar != null) {
//             actionBar.setDisplayShowTitleEnabled(enabled);
//         }
//     }
// 
//     protected void setNavigationIconColor(@ColorInt int color) {
//         if (toolbar != null) {
//             Drawable icon = toolbar.getNavigationIcon();
//             if (icon != null) {
//                 DrawableCompat.setTint(icon, color);
//             }
//         }
//     }
// }
// 
// Path: app/src/main/java/moe/yukinoneko/diycode/tool/ImageLoadHelper.java
// public class ImageLoadHelper {
// 
//     public static void loadImage(Context context, String url, ImageView imageView, @Nullable RequestListener<String, GlideDrawable> listener) {
//         Glide.with(context).load(url).diskCacheStrategy(DiskCacheStrategy.SOURCE).listener(listener).into(imageView);
//     }
// 
//     public static void loadAvatar(Context context, String url, ImageView imageView) {
//         Glide.with(context).load(url).placeholder(R.mipmap.default_avatar).dontAnimate().into(imageView);
//     }
// }


import com.github.chrisbanes.photoview.PhotoView;
import butterknife.BindView;
import moe.yukinoneko.diycode.R;
import moe.yukinoneko.diycode.base.BaseActivity;
import moe.yukinoneko.diycode.tool.ImageLoadHelper;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
/*
 * Copyright (c) 2017 SamuelGjk <samuel.alva@outlook.com>
 *
 * This file is part of DiyCode
 *
 * DiyCode is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DiyCode is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with DiyCode. If not, see <http://www.gnu.org/licenses/>.
 */

package moe.yukinoneko.diycode.module.image;






/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class ImageActivity extends BaseActivity {
    private static final String EXTRA_IMAGE_URL = "extra_image_url";

    @BindView(R.id.photo_view) PhotoView photoView;
    @BindView(R.id.progress_bar) ProgressBar progressBar;

    public static void launch(Context context, String imageUrl) {
        Intent intent = new Intent(context, ImageActivity.class);
        intent.putExtra(EXTRA_IMAGE_URL, imageUrl);
        context.startActivity(intent);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_image;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        photoView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

// Path: app/src/main/java/moe/yukinoneko/diycode/base/BaseActivity.java
// public abstract class BaseActivity extends RxAppCompatActivity {
// 
//     protected Unbinder unbinder;
// 
//     @Nullable
//     @BindView(R.id.toolbar)
//     protected Toolbar toolbar;
// 
//     @BindColor(R.color.navigation)
//     protected int navigationColor;
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(provideContentViewId());
// 
//         unbinder = ButterKnife.bind(this);
// 
//         if (toolbar != null) {
//             setSupportActionBar(toolbar);
//             if (getSupportActionBar() != null) {
//                 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//             }
//         }
//     }
// 
//     @Override
//     protected void onPostCreate(@Nullable Bundle savedInstanceState) {
//         super.onPostCreate(savedInstanceState);
//         setNavigationIconColor(navigationColor);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         if (item.getItemId() == android.R.id.home) {
//             finish();
//             return true;
//         }
//         return super.onOptionsItemSelected(item);
//     }
// 
//     @Override
//     protected void onDestroy() {
//         super.onDestroy();
// 
//         if (unbinder != null) {
//             unbinder.unbind();
//         }
//     }
// 
//     protected abstract int provideContentViewId();
// 
//     protected void setToolBarTitle(CharSequence title) {
//         if (toolbar != null) {
//             toolbar.setTitle(title);
//         }
//     }
// 
//     protected void setDisplayShowTitleEnabled(boolean enabled) {
//         ActionBar actionBar = getSupportActionBar();
//         if (actionBar != null) {
//             actionBar.setDisplayShowTitleEnabled(enabled);
//         }
//     }
// 
//     protected void setNavigationIconColor(@ColorInt int color) {
//         if (toolbar != null) {
//             Drawable icon = toolbar.getNavigationIcon();
//             if (icon != null) {
//                 DrawableCompat.setTint(icon, color);
//             }
//         }
//     }
// }
// 
// Path: app/src/main/java/moe/yukinoneko/diycode/tool/ImageLoadHelper.java
// public class ImageLoadHelper {
// 
//     public static void loadImage(Context context, String url, ImageView imageView, @Nullable RequestListener<String, GlideDrawable> listener) {
//         Glide.with(context).load(url).diskCacheStrategy(DiskCacheStrategy.SOURCE).listener(listener).into(imageView);
//     }
// 
//     public static void loadAvatar(Context context, String url, ImageView imageView) {
//         Glide.with(context).load(url).placeholder(R.mipmap.default_avatar).dontAnimate().into(imageView);
//     }
// }


// Path: app/src/main/java/moe/yukinoneko/diycode/module/image/ImageActivity.java
import com.github.chrisbanes.photoview.PhotoView;
import butterknife.BindView;
import moe.yukinoneko.diycode.R;
import moe.yukinoneko.diycode.base.BaseActivity;
import moe.yukinoneko.diycode.tool.ImageLoadHelper;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;

/*
 * Copyright (c) 2017 SamuelGjk <samuel.alva@outlook.com>
 *
 * This file is part of DiyCode
 *
 * DiyCode is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DiyCode is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with DiyCode. If not, see <http://www.gnu.org/licenses/>.
 */

package moe.yukinoneko.diycode.module.image;






/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class ImageActivity extends BaseActivity {
    private static final String EXTRA_IMAGE_URL = "extra_image_url";

    @BindView(R.id.photo_view) PhotoView photoView;
    @BindView(R.id.progress_bar) ProgressBar progressBar;

    public static void launch(Context context, String imageUrl) {
        Intent intent = new Intent(context, ImageActivity.class);
        intent.putExtra(EXTRA_IMAGE_URL, imageUrl);
        context.startActivity(intent);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_image;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        photoView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        ImageLoadHelper.loadImage(this, getIntent().getStringExtra(EXTRA_IMAGE_URL), photoView, new RequestListener<String, GlideDrawable>() {