package com.appsoul.pip;
import android.app.Activity;
import android.app.Dialog;
import android.app.WallpaperManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AlertDialog;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.Gallery;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.commit451.nativestackblur.NativeStackBlur;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import com.myandroid.views.MultiTouchListener;
import com.squareup.picasso.Picasso;
import com.appsoul.pip.chiralcode.colorpicker.ColorPickerDialog;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Calendar;
public class SelectedImageActivity extends Activity {
ImageView imageview_id;
ImageView mFrameIv;
ImageView mMovImage;
Global mGlobal;
GalleryImageAdapter galImageAdapter;
Spinner mSpinner_text_style;
ImageButton mIbtn_color_text;
AutoResizeTextView mTv_text;
private InterstitialAd interstitial;
AdView adView;
String style[] = {"1.ttf", "2.ttf", "3.ttf", "4.ttf", "5.ttf", "6.ttf",
"7.ttf", "8.ttf"};
Integer[] ic
R.drawable.nature_thumb_1,
R.drawable.nature_thumb_2,
R.drawable.nature_thumb_3,
R.drawable.nature_thumb_4,
R.drawable.nature_thumb_5,
R.drawable.q1,
R.drawable.i1,
R.drawable.i2,
R.drawable.i3,
R.drawable.i4,
R.drawable.i5,
R.drawable.i6,
R.drawable.i7,
R.drawable.i8,
// R.drawable.i9,
R.drawable.i10,
R.drawable.i11,
R.drawable.i12,
R.drawable.i13,
R.drawable.i14,
R.drawable.i15,
R.drawable.i16,
R.drawable.i17,
R.drawable.i18,
R.drawable.i19,
R.drawable.i20,
R.drawable.i21,
R.drawable.i22,
R.drawable.i23,
R.drawable.i24,
R.drawable.i25,
R.drawable.i26,
R.drawable.i27
};
Integer[] frameImages = {
R.drawable.z1,
R.drawable.nature_frm_2,
R.drawable.nature_frm_3,
R.drawable.nature_frm_4,
R.drawable.nature_frm_5,
R.drawable.q2,
R.drawable.f1,
R.drawable.f2,
R.drawable.f3,
R.drawable.f4,
R.drawable.f5,
R.drawable.f6,
R.drawable.f7,
R.drawable.f8,
// R.drawable.f9,
R.drawable.f10,
R.drawable.f11,
R.drawable.f12,
R.drawable.f13,
R.drawable.f14,
R.drawable.f15,
R.drawable.f16,
R.drawable.f17,
R.drawable.f18,
R.drawable.f19,
R.drawable.f20,
R.drawable.f21,
R.drawable.f22,
R.drawable.f23,
R.drawable.f24,
R.drawable.f25,
R.drawable.f26,
R.drawable.f27
};
Integer[] maskImages = {
R.drawable.nature_frm_d1,
R.drawable.nature_frm_d2,
R.drawable.nature_frm_d3,
R.drawable.nature_frm_d4,
R.drawable.nature_frm_d5,
R.drawable.q3,
R.drawable.f1m,
R.drawable.f2m,
R.drawable.f3m,
R.drawable.f4m,
R.drawable.f5m,
R.drawable.f6m,
R.drawable.f7m,
R.drawable.f8m,
// R.drawable.f9m,
R.drawable.f10m,
R.drawable.f11m,
R.drawable.f12m,
R.drawable.f13m,
R.drawable.f14m,
R.drawable.f15m,
R.drawable.f16m,
R.drawable.f17m,
R.drawable.f18m,
R.drawable.f19m,
R.drawable.f20m,
R.drawable.f21m,
R.drawable.f22m,
R.drawable.f23m,
R.drawable.f24m,
R.drawable.f25m,
R.drawable.f25m,
R.drawable.f25m //same mask for 25 26 27
};
int currentimg = 0;
int currentalpha = 25;
Bitmap mask;
Bitmap result;
Bitmap original;
FrameLayout frotext;
EditText et_view;
RelativeLayout relMain;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selected_image);
relMain= (RelativeLayout) findViewById(R.id.rl);
try {
AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(AppsoulConst.BANNER_AD_PUB_ID);
RelativeLayout layout = (RelativeLayout) findViewById(R.id.adView);
layout.addView(adView);
// Create ad request.
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId(AppsoulConst.INTRESTITIAL_AD_PUB_ID);
interstitial.loadAd(adRequest);
// Set the AdListener.
interstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
@Override
public void onAdFailedToLoad(int errorCode) {
}
});
} catch (Exception e) {
}
galImageAdapter = new GalleryImageAdapter(this);
mTv_text = new AutoResizeTextView(getApplicationContext());
frotext = (FrameLayout) findViewById(R.id.frame_txt);
frotext.addView(mTv_text);
imageview_id = (ImageView) findViewById(R.id.imageview_id);
mMovImage = (ImageView) findViewById(R.id.iv_mov);
mFrameIv = (ImageView) findViewById(R.id.mFrameIv);
mGlobal = ((Global) getApplication());
//RUNTIME
mMovImage.setImageBitmap(mGlobal.getImage());
makeMaskImage(imageview_id, maskImages[0], frameImages[0]);
mMovImage.setOnTouchListener(new MultiTouchListener());
}