Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="meme5.c4q.nyc.meme_project" >
<uses-feature android:name="android.hardware.camera"

<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:largeHeap="true">
android:largeHeap="true"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity>

<activity
android:name=".ChooseMemeStyle"
android:label="@string/title_activity_choose_meme_style" >
</activity>
<activity
android:name=".VanillaMeme"
android:label="@string/title_activity_vanilla_test" >

</activity>

<activity
android:name=".add_text"
android:label="@string/title_activity_add_text">
android:label="@string/title_activity_add_text" >
</activity>

<activity
android:name=".DemotivationalMemeActivity"
android:label="@string/title_activity_demotivational_meme">
android:label="@string/title_activity_demotivational_meme" >
</activity>
<activity
android:name=".SplashScreen"
Expand All @@ -45,7 +43,14 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".MainActivity2Activity"
android:label="@string/title_activity_main_activity2" >
</activity>
<activity
android:name=".PopularMemes"
android:label="@string/title_activity_popular_memes" >
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ public class ChooseMemeStyle extends Activity {
protected Button nextButton;
protected boolean vanilla;
protected Random slideShow;
ImageView img, thumbnail;
AnimationDrawable frameAnimation;
String imgFilePath;
private ImageView img, thumbnail;
private AnimationDrawable frameAnimation;
private String imgFilePath;
private String imageUri;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -45,11 +46,13 @@ protected void onCreate(Bundle savedInstanceState) {
{
imgFilePath = bundle.getString("imgFilePath");
}

Bundle popular = getIntent().getExtras();
thumbnail = (ImageView) findViewById(R.id.thumbnail);
Bitmap bmp2 = BitmapFactory.decodeFile(imgFilePath);
thumbnail.setImageBitmap(bmp2);

//apply fonts -
//apply fonts
//TODO: need to find a way to add this font globally through style!
TextView step1 = (TextView) findViewById(R.id.step1);
TextView step2 = (TextView) findViewById(R.id.step2);
Expand All @@ -71,24 +74,21 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
Log.d(TAG, "onCheckedChanged()");
// Is the button now checked?
// boolean checked = ((RadioButton) view).isChecked();

// Check which radio button was clicked
switch (checkedId) {
case R.id.chooseVanilla:

Log.d(TAG, "onCheckedChanged() -- chooseVanilla");
//determine if user chose vanilla or demotivational

vanilla = true;
img = (ImageView) findViewById(R.id.sampleImageHolder);
img.setImageResource(R.drawable.vanilla_animation);

frameAnimation = (AnimationDrawable) img.getDrawable();

frameAnimation.start();
break;

case R.id.chooseDemotivational:

Log.d(TAG, "onCheckedChanged() -- chooseDemotivational");
Expand All @@ -98,7 +98,6 @@ public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
img.setImageResource(R.drawable.demotivational_animation);

frameAnimation = (AnimationDrawable) img.getDrawable();

frameAnimation.start();
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@
*/
public class DemotivationalMemeActivity extends Activity {

Bitmap image;
Bitmap memeImage;
ImageView preview;
EditText largeText;
EditText smallText;
//ELEMENTS
private Bitmap image;
private Bitmap memeImage;
private ImageView preview;
private EditText largeText;
private EditText smallText;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demotivational_meme);

//INITIALIZE
preview = (ImageView) findViewById(R.id.preview);
largeText = (EditText) findViewById(R.id.large);
smallText = (EditText) findViewById(R.id.small);

String imgFilePath = "";
Bundle bundle = getIntent().getExtras();
Expand All @@ -44,8 +48,7 @@ protected void onCreate(Bundle savedInstanceState) {
decodeFile(imgFilePath);
}

largeText = (EditText) findViewById(R.id.large);
smallText = (EditText) findViewById(R.id.small);

Button previewText = (Button) findViewById(R.id.previewText);
previewText.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down Expand Up @@ -109,6 +112,7 @@ private void decodeFile(String filePath) {
while (true) {
if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
break;

width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
Expand Down
44 changes: 40 additions & 4 deletions app/src/main/java/meme5/c4q/nyc/meme_project/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.content.Intent;
import android.database.Cursor;
Expand All @@ -13,18 +15,34 @@
import android.view.View;

public class MainActivity extends Activity {

//ELEMENTS
private String imgFilePath, popMemes;
private ImageView popular_memes;

// KEY VALUE PAIRS
private static final int RESULT_LOAD_IMG = 1;
private static final int REQUEST_IMAGE_CAPTURE = 1;
private String imgFilePath;



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

popular_memes = (ImageView) findViewById(R.id.ivPreset);
// popular_memes.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent popular = new Intent(MainActivity.this, PopularMemes.class);
// startActivity(popular);
// }
// });

}
private void launchChooseMeme(){
Intent chooseMeme = new Intent(this,ChooseMemeStyle.class);
Intent chooseMeme = new Intent(this, ChooseMemeStyle.class);
chooseMeme.putExtra("imgFilePath",imgFilePath);
startActivity(chooseMeme);
}
Expand All @@ -45,9 +63,13 @@ public void loadImagefromGallery(View view) {

}

public void presetsMemes (View view) {
Intent popular_memes = new Intent(this, PopularMemes.class);
startActivity(popular_memes);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);

try {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Expand All @@ -59,9 +81,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
cursor.moveToFirst();

int columnIndex = cursor.getColumnIndex(filePathColumn[0]);

//file path of captured image
imgFilePath = cursor.getString(columnIndex);

cursor.close();
launchChooseMeme();

Expand All @@ -80,6 +102,20 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
cursor.close();
launchChooseMeme();

} else if (requestCode == PopularMemes.RESULT_OK){

Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };

Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();

int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
//file path of gallery image
imgFilePath = cursor.getString(columnIndex);
cursor.close();
launchChooseMeme();

} else {
Toast.makeText(this, "You haven't picked Image",
Toast.LENGTH_LONG).show();
Expand Down
75 changes: 75 additions & 0 deletions app/src/main/java/meme5/c4q/nyc/meme_project/PopularMemes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package meme5.c4q.nyc.meme_project;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;


public class PopularMemes extends ActionBarActivity {

public static String IMAGE_URI_KEY = "uri";
private ListView memeListView;
private String imageUri = "";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_popular_memes);

memeListView = (ListView) findViewById(R.id.meme_list_view);

Integer[] memeResources = {
R.drawable.popular0,
R.drawable.popular1,
R.drawable.popular2,
R.drawable.popular3,
R.drawable.popular4,
R.drawable.popular5,
R.drawable.popular6,
R.drawable.popular7,
R.drawable.popular8,
R.drawable.popular9,
R.drawable.popular10,
R.drawable.popular11,

};
MemeAdapter memeAdapter = new MemeAdapter(this, memeResources);
memeListView.setAdapter(memeAdapter);
memeListView.setOnItemClickListener( new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int meme = (Integer) parent.getItemAtPosition(position);
Intent popularMemes = new Intent(PopularMemes.this, ChooseMemeStyle.class);
imageUri += meme;
popularMemes.putExtra(IMAGE_URI_KEY, imageUri);
startActivity(popularMemes);
}
});

}

class MemeAdapter extends ArrayAdapter<Integer> {
public MemeAdapter(Context context, Integer[] memeList) {
super(context, 0, memeList);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
int singleMeme = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.imageholder, parent, false);
}
ImageView appIcon = (ImageView) convertView.findViewById(R.id.ivMemePopularHolder);
appIcon.setImageResource(singleMeme);
return convertView;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
public class SplashScreen extends Activity {

/** Duration of wait **/
private final int SPLASH_DISPLAY_LENGTH = 2500;
ImageView img;
AnimationDrawable frameAnimation;
//ELEMENTS
private ImageView img;
private AnimationDrawable frameAnimation;

//KEY VALUE PAIR
private final int SPLASH_DISPLAY_LENGTH = 1000;

/** Called when the activity is first created. */
@Override
Expand Down
Loading