diff --git a/.gitignore b/.gitignore index ccf2efe..1f182fa 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,9 @@ proguard/ # Log Files *.log + +#IML Files +*.iml + +#IDEA files +/.idea diff --git a/README.md b/README.md index 433b01c..2a34eed 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,17 @@ -# Access Code 2.1 -- Robin Hood Hackathon -## Aug 1 - Aug 3 +# Access Code 2.1 -- Robin Hood Hackathon: The "One More Chance" App +## Created by Team Bilingual (a.k.a. Ray Acevedo, Allison Bojarski, Elvis Boves, Anthony McBride, & Jorge Reina) -This is the Access Code 2.1 Repo for the Robin Hood Hackathon. Please fork this repo for your own projects this weekend so we can easily find them on Monday. (Note: this was initialized with a .gitignore that you may need to change). +The "One More Chance" app is a bilingual (English/Spanish) portal to help NYC-based Latina/o youth pursue both financial stability and educational opportunity. We're powered by the [Aunt Bertha API](https://www.auntbertha.com/developers). + +###Features: +* Allows the user to search for local financial and educational services +* Retains user's info (name, age, location by zipcode, etc.) for future searches to return specific, tailored search results +* Attractive UI that both visually and textually appeals to a youthful Latina/o audience + + + -Taking pictures? Tweeting? Find us! -We are everywhere! [@C4Qnyc](https://twitter.com/c4qnyc), [@RobinHoodNYC](https://twitter.com/RobinHoodNYC), [@AuntBertha](https://twitter.com/AuntBertha), [@SingleStop](https://twitter.com/SingleStop) +[@C4Qnyc](https://twitter.com/c4qnyc), [@RobinHoodNYC](https://twitter.com/RobinHoodNYC), [@AuntBertha](https://twitter.com/AuntBertha), [@SingleStop](https://twitter.com/SingleStop) We're also [#RHfunded](https://twitter.com/hashtag/RHFunded?src=hash) [#QueensTech](https://twitter.com/hashtag/QueensTech?src=hash) [#AndroidDev](https://twitter.com/hashtag/AndroidDev?src=hash) [#Android](https://twitter.com/hashtag/Android?src=hash) [#hack4good]() [#hackathon](https://twitter.com/hashtag/hack4good?src=hash) diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..4291106 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,30 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "alizinha.c4q.nyc.onemorechance" + minSdkVersion 7 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:22.2.0' + compile 'com.squareup.okhttp:okhttp:2.4.0' + compile 'com.squareup.retrofit:retrofit:1.9.0' + compile 'com.google.code.gson:gson:2.3' + compile 'com.android.support:design:22.2.0' + compile 'com.memetix:microsoft-translator-java-api:0.6.2' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..7d838ea --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/c4q-Allison/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/androidTest/java/alizinha/c4q/nyc/onemorechance/ApplicationTest.java b/app/src/androidTest/java/alizinha/c4q/nyc/onemorechance/ApplicationTest.java new file mode 100644 index 0000000..c0433e9 --- /dev/null +++ b/app/src/androidTest/java/alizinha/c4q/nyc/onemorechance/ApplicationTest.java @@ -0,0 +1,13 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..0049f79 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/APIData.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/APIData.java new file mode 100644 index 0000000..a0d1777 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/APIData.java @@ -0,0 +1,10 @@ +package alizinha.c4q.nyc.onemorechance; + +import java.util.ArrayList; + +/** + * Created by c4q-anthony-mcbride on 8/2/15. + */ +public class APIData { + public ArrayList programs; +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/AddEventToCalendar.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/AddEventToCalendar.java new file mode 100644 index 0000000..c29c90d --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/AddEventToCalendar.java @@ -0,0 +1,89 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.content.Intent; +import android.os.Bundle; +import android.provider.CalendarContract; +import android.support.v7.app.ActionBarActivity; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +/** + * Created by Allison Bojarski on 8/1/15. + */ + + +public class AddEventToCalendar extends ActionBarActivity { + private Button mButtonSubmit; + private TextView mEditTextNewTitle; + private TextView mEditTextNewLocation; + private TextView mEditTextDescription; + private TextView mEditTextNewEvent; + private String getTitle; + private String getLocation; + private String getDescription; + private EditText mNewTitle; + private EditText mNewLocation; + private EditText mNewDescription; + boolean isSpanish = false; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_add_event_to_calendar); + + isSpanish = getIntent().getFlags() == 1; + + mButtonSubmit = (Button) findViewById(R.id.submit); + mEditTextNewTitle = (TextView) findViewById(R.id.title); + mEditTextNewEvent = (TextView) findViewById(R.id.evento); + mNewTitle = (EditText) findViewById(R.id.newTitle); + mNewLocation = (EditText) findViewById(R.id.newLocation); + mNewDescription = (EditText) findViewById(R.id.newDescription); + + if (isSpanish) { + mNewTitle.setHint("Titulo de Nuevo Evento"); + mNewLocation.setHint("Ubicación"); + mNewDescription.setHint("Descripción"); + mButtonSubmit.setText("Crear Evento"); + mEditTextNewEvent.setText("Añadir Evento"); + } + + mButtonSubmit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if (mNewTitle.getText() != null) { + getTitle = mNewTitle.getText().toString(); + } else { + getTitle = ""; + } + + + if (mNewLocation.getText() != null) { + getLocation = mNewLocation.getText().toString(); + } else { + getLocation = ""; + } + + + if (mNewDescription.getText() != null) { + getDescription = mNewDescription.getText().toString(); + } else { + getDescription = ""; + } + + Intent calIntent = new Intent(Intent.ACTION_INSERT); + calIntent.setType("vnd.android.cursor.item/event"); + calIntent.putExtra(CalendarContract.Events.TITLE, getTitle); + calIntent.putExtra(CalendarContract.Events.EVENT_LOCATION, getLocation); + calIntent.putExtra(CalendarContract.Events.DESCRIPTION, getDescription); + startActivity(calIntent); + } + }); + + } +} + + diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/AuntBerthaService.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/AuntBerthaService.java new file mode 100644 index 0000000..f666fa4 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/AuntBerthaService.java @@ -0,0 +1,14 @@ +package alizinha.c4q.nyc.onemorechance; + +import retrofit.Callback; +import retrofit.http.GET; +import retrofit.http.Path; +import retrofit.http.Query; + +/** + * Created by c4q-anthony-mcbride on 8/1/15. + */ +public interface AuntBerthaService { + @GET("/zipcodes/{zipcode}/programs") + void getProgramByZipcode(@Path("zipcode") String zipcode, @Query("api_key") String apiKey, @Query("serviceTag") String tags, @Query("cursor") int cursor, @Query("limit") int limit, Callback cb); +} \ No newline at end of file diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/BiographyClass.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/BiographyClass.java new file mode 100644 index 0000000..5d11340 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/BiographyClass.java @@ -0,0 +1,28 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.widget.TextView; + + +public class BiographyClass extends ActionBarActivity { + + boolean isSpanish = false; + private TextView mTextViewBio; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_biography_class); + + isSpanish = getIntent().getFlags() == 1; + + mTextViewBio = (TextView) findViewById(R.id.bio_elvis); + + if (isSpanish) { + mTextViewBio.setText(R.string.spanol_bio_elvis); + } else { + mTextViewBio.setText(R.string.bio_elvis); + } + } +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/CustomAdapter.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/CustomAdapter.java new file mode 100644 index 0000000..534439a --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/CustomAdapter.java @@ -0,0 +1,37 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.content.Context; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +/** + * Created by c4q-anthony-mcbride on 8/2/15. + */ +public class CustomAdapter extends ArrayAdapter { + + Office[] offices; + + public CustomAdapter(Context context, int resource, Office[] offices) { + super(context, resource, offices); + this.offices = offices; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + LayoutInflater inflater = (LayoutInflater) getContext() + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + View view = inflater.inflate(R.layout.row, parent, false); + TextView name = (TextView) view.findViewById(R.id.title); + TextView addy = (TextView) view.findViewById(R.id.address); + name.setText(offices[position].name); + addy.setText(offices[position].address1); + Log.w("TAG", "Called"); + return view; + + } +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/Hours.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Hours.java new file mode 100644 index 0000000..1f5e46d --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Hours.java @@ -0,0 +1,7 @@ +package alizinha.c4q.nyc.onemorechance; + +/** + * Created by c4q-anthony-mcbride on 8/2/15. + */ +public class Hours { +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/Info.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Info.java new file mode 100644 index 0000000..fa379d9 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Info.java @@ -0,0 +1,117 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.content.Intent; +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.TextView; + + +public class Info extends AppCompatActivity { + + LinearLayout advancedSearchLayout; + EditText nameEditText, zipcodeEditText, age; + String nameString, zipcodeString, ageString, immigrationStatus; + CheckBox undocumented, immigrants, refugee, latinoYes, latinoNo, english, spanish, both; + boolean isSpanish = false; + TextView preferredProgramLanguage, citizenStatus; + FloatingActionButton sb, asb, sb2; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_info); + + initializeViews(); + + isSpanish = getIntent().getFlags() == 1; + + advancedSearchLayout.setVisibility(View.GONE); + + if (isSpanish) { + + age.setHint("Edad"); + zipcodeEditText.setHint("Codigo Postal"); + undocumented.setText("Indocumentado"); + immigrants.setText("Inmigrante"); + refugee.setText("Refujiado"); + latinoYes.setText("Si"); + //search.setText("Buscar"); + //advancedSearch.setText("Busqueda Avanzada"); + preferredProgramLanguage.setText("Preferencia de Lenguaje"); + citizenStatus.setText("Status Migratorio"); + english.setText("Ingles"); + spanish.setText("Español"); + both.setText("Ambos"); + + } + } + + public void initializeViews() { + advancedSearchLayout = (LinearLayout) findViewById(R.id.advancedSearchLayoutID); + zipcodeEditText = (EditText) findViewById(R.id.zipcodeID); + age = (EditText) findViewById(R.id.ageID); + undocumented = (CheckBox) findViewById(R.id.undocumentedID); + immigrants = (CheckBox) findViewById(R.id.immigrantsID); + refugee = (CheckBox) findViewById(R.id.refugeeID); + latinoYes = (CheckBox) findViewById(R.id.latinoYesID); + latinoNo = (CheckBox) findViewById(R.id.latinoNoID); + english = (CheckBox) findViewById(R.id.englishID); + spanish = (CheckBox) findViewById(R.id.spanishID); + both = (CheckBox) findViewById(R.id.bothID); + preferredProgramLanguage = (TextView) findViewById(R.id.preferredProgramLanguageID); + citizenStatus = (TextView) findViewById(R.id.citizenStatusID); + sb = (FloatingActionButton) findViewById(R.id.searchButtonID); + asb = (FloatingActionButton) findViewById(R.id.advancedSearchButtonID); + sb2 = (FloatingActionButton) findViewById(R.id.searchButtonID2); + + } + + public void advancedSearch(View view) { + advancedSearchLayout.setVisibility(View.VISIBLE); + sb.setVisibility(View.GONE); + asb.setVisibility(View.GONE); + sb2.setVisibility(View.VISIBLE); + + } + + public void search(View view) { + + zipcodeString = zipcodeEditText.getText().toString(); +// ageString = age.getText().toString(); +// +// SharedPreferences info; +// info = Info.this.getSharedPreferences("PREFS_NAME", 0); +// SharedPreferences.Editor editor = info.edit(); +// +// editor.putString("name", nameString); +// editor.putString("zipcode", zipcodeString); +// editor.putString("age", ageString); +// +// +// if (undocumented.isChecked() == true) { +// immigrationStatus = "undocumented"; +// } else if (immigrants.isChecked() == true) { +// immigrationStatus = "immigrant"; +// } else { +// immigrationStatus = "refugee"; +// } +// +// editor.putString("immigrationStatus", immigrationStatus); +// editor.commit(); + + Intent intent = new Intent(Info.this, SearchResults.class); + if (isSpanish) { + intent.setFlags(1); + intent.putExtra("zipcode", zipcodeString); + startActivity(intent); + } else { + intent.putExtra("zipcode", zipcodeString); + startActivity(intent); + } + } +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/MainActivity.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/MainActivity.java new file mode 100644 index 0000000..5a03386 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/MainActivity.java @@ -0,0 +1,60 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +//import com.squareup.okhttp.Response; +//import javax.security.auth.callback.Callback; + +//import com.squareup.okhttp.Response; +//import javax.security.auth.callback.Callback; + + +public class MainActivity extends Activity { + + Button test; + TextView englishTextView, spanishTextView; + String name; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + + SharedPreferences settings;// = MainActivity.this.getSharedPreferences("PREFS_NAME", 0); + settings = MainActivity.this.getSharedPreferences("PREFS_NAME", 0); + name = settings.getString("name", ""); + + englishTextView = (TextView) findViewById(R.id.english_button); + spanishTextView = (TextView) findViewById(R.id.spanish_button); + + + englishTextView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(MainActivity.this, Info.class); + intent.setFlags(0); + startActivity(intent); + + } + }); + spanishTextView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(MainActivity.this, Info.class); + intent.setFlags(1); + startActivity(intent); + + } + }); + + + } +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/Office.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Office.java new file mode 100644 index 0000000..3ff2900 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Office.java @@ -0,0 +1,17 @@ +package alizinha.c4q.nyc.onemorechance; + +import com.google.gson.annotations.SerializedName; + +/** + * Created by c4q-anthony-mcbride on 8/2/15. + */ +public class Office { + + public String name; + public String city; + public String address1; + public String state; + + @SerializedName("phone_number") + public String phoneNumber; +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/Program.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Program.java new file mode 100644 index 0000000..94cd4f3 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/Program.java @@ -0,0 +1,17 @@ +package alizinha.c4q.nyc.onemorechance; + +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; + +/** + * Created by c4q-anthony-mcbride on 8/2/15. + */ +public class Program { + + public ArrayList offices; + public String description; + + @SerializedName("website_url") + public String website; +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/ProgramInfo.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/ProgramInfo.java new file mode 100644 index 0000000..3abb9e1 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/ProgramInfo.java @@ -0,0 +1,123 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.content.Intent; +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.memetix.mst.language.Language; +import com.memetix.mst.translate.Translate; + +import org.apache.http.protocol.HTTP; + + +public class ProgramInfo extends ActionBarActivity { + boolean isSpanish = false; + + private TextView mDescription; + private TextView mTitle; + private TextView mAddress; + private TextView mPhoneNumber; + private TextView mWebsite; + + private Button mButtonBio; + + private String description; + private String title; + private String address; + private String phoneNumber; + private String website; + private String textSpanish; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_program_info); + + isSpanish = getIntent().getFlags() == 1; + + description = getIntent().getStringExtra("description"); + title = getIntent().getStringExtra("title"); + address = getIntent().getStringExtra("address"); + phoneNumber = getIntent().getStringExtra("phone_number"); + website = getIntent().getStringExtra("website"); + + + mButtonBio = (Button) findViewById(R.id.button_bio); + mWebsite = (TextView) findViewById(R.id.url); + mPhoneNumber = (TextView) findViewById(R.id.phone_number); + mDescription = (TextView) findViewById(R.id.description); + mTitle = (TextView) findViewById(R.id.titleID); + mAddress = (TextView) findViewById(R.id.location); + mWebsite.setText(website); + mPhoneNumber.setText(phoneNumber); + mTitle.setText(title); + mAddress.setText(address); + + + mDescription.setText(description); + + if (isSpanish) { + + mButtonBio.setText("Biografia"); + + new MyAsyncTask() { + protected void onPostExecute(Boolean result) { + + mDescription.setText(textSpanish); + } + }.execute(); + } + + mButtonBio.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(ProgramInfo.this, BiographyClass.class); + if (isSpanish) { + intent.setFlags(1); + startActivity(intent); + } else { + startActivity(intent); + } + } + }); + } + + public void giveFeedbackOnAppointment(View v) { + Intent emailIntent = new Intent(Intent.ACTION_SEND); + // The intent does not have a URI, so declare the "text/plain" MIME type + emailIntent.setType(HTTP.PLAIN_TEXT_TYPE); + emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"support@auntbertha.com"}); // recipients + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Change Request C4Q"); + emailIntent.putExtra(Intent.EXTRA_TEXT, "If you'd like to give feedback on a particular service, please write \n" + + "their name and give a rating between one (worst) and five (best) stars. If you found any wrong information \n" + + "in our app as to when a location is open, etc., please provide that feedback here. Thank you."); + startActivity(emailIntent); + } + + public void bookAppointment(View v) { + Intent intent = new Intent(ProgramInfo.this, AddEventToCalendar.class); + startActivity(intent); + + } + + + class MyAsyncTask extends AsyncTask { + @Override + protected Boolean doInBackground(Void... arg0) { + Translate.setClientId("onemorechance2015"); + Translate.setClientSecret("VsV3a//xYxb9YAa88czH4+1pfdo5TAWyWQ25jtA6vDA="); + try { + textSpanish = Translate.execute(mDescription.getText().toString(), Language.ENGLISH, Language.SPANISH); + + } catch (Exception e) { + textSpanish = e.toString(); + } + return true; + } + } +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/SearchResults.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/SearchResults.java new file mode 100644 index 0000000..839d1a4 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/SearchResults.java @@ -0,0 +1,142 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; + +import retrofit.Callback; +import retrofit.RestAdapter; +import retrofit.RetrofitError; +import retrofit.client.Response; + + +public class SearchResults extends ActionBarActivity { + ListView lv; + private TextView mTextViewSearchResults; + private Button mButtonNewSearch; + boolean isSpanish = false; + Button app; + + public static final String BASE_URL = "https://searchbertha-hrd.appspot.com/_ah/api/search/v1/"; + private static final String API_KEY = "75ea03a922dc66db2560a23cc4eed49e"; + + RestAdapter restAdapter = new RestAdapter.Builder() + .setEndpoint(BASE_URL) + .build(); + + AuntBerthaService service = restAdapter.create(AuntBerthaService.class); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_search_results); + + isSpanish = getIntent().getFlags() == 1; + + mTextViewSearchResults = (TextView) findViewById(R.id.text_view_search_result); + mButtonNewSearch = (Button) findViewById(R.id.button_new_search); + + if (isSpanish) { + mTextViewSearchResults.setText("Resultados"); + mButtonNewSearch.setText("Nueva Busqueda"); + } + + mButtonNewSearch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(SearchResults.this, Info.class); + if (isSpanish) { + intent.setFlags(1); + startActivity(intent); + } else { + startActivity(intent); + } + } + }); + + lv = (ListView) findViewById(R.id.list_item); + + loadSearchResults(); + + } + + public void loadSearchResults() { + String zipCode = getIntent().getStringExtra("zipcode"); + Log.v("Tags", zipCode); + + service.getProgramByZipcode(zipCode, API_KEY, "mentoring,ged/high-school%20equivalency", 0, 10, new Callback() { + + @Override + public void success(final APIData apiData, Response response) { + //Toast.makeText(getApplicationContext(), apiData.programs.get(0).offices.get(0).name, Toast.LENGTH_LONG).show(); + lv = (ListView) findViewById(R.id.list_item); + + ArrayList your_array_list = new ArrayList(); + + final Office[] offices = new Office[10]; + for (int i = 0; i < 10; i++) { + Office o = new Office(); + + o.name = apiData.programs.get(i).offices.get(0).name; + o.address1 = apiData.programs.get(i).offices.get(0).address1 + "\n" + + apiData.programs.get(i).offices.get(0).city + ", " + + apiData.programs.get(i).offices.get(0).state; + + offices[i] = o; + } + + CustomAdapter adapter = new CustomAdapter(getApplicationContext(), R.layout.row, offices); + + lv.setAdapter(adapter); + lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + String description = apiData.programs.get(i).description; + String website = apiData.programs.get(i).website; + String title = apiData.programs.get(i).offices.get(0).name; + String phoneNumber = apiData.programs.get(i).offices.get(0).phoneNumber; + String address = apiData.programs.get(i).offices.get(0).address1 + "\n" + + apiData.programs.get(i).offices.get(0).city + ", " + + apiData.programs.get(i).offices.get(0).state; + + Intent intent = new Intent(SearchResults.this, ProgramInfo.class); + + if (isSpanish) { + intent.putExtra("description", description); + intent.putExtra("title", title); + intent.putExtra("address", address); + intent.putExtra("phone_number", phoneNumber); + intent.putExtra("website", website); + intent.setFlags(1); + startActivity(intent); + + } else { + intent.putExtra("description", description); + intent.putExtra("title", title); + intent.putExtra("address", address); + intent.putExtra("phone_number", phoneNumber); + intent.putExtra("website", website); + startActivity(intent); + } + } + }); + } + + @Override + public void failure(RetrofitError error) { + Toast.makeText(getApplicationContext(), "Failure", Toast.LENGTH_LONG).show(); + Log.w("TAG", error.toString()); + + } + }); + } +} diff --git a/app/src/main/java/alizinha/c4q/nyc/onemorechance/SplashScreen.java b/app/src/main/java/alizinha/c4q/nyc/onemorechance/SplashScreen.java new file mode 100644 index 0000000..ac325f3 --- /dev/null +++ b/app/src/main/java/alizinha/c4q/nyc/onemorechance/SplashScreen.java @@ -0,0 +1,36 @@ +package alizinha.c4q.nyc.onemorechance; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; + +public class SplashScreen extends Activity { + + // Splash screen timer + private static int SPLASH_TIME_OUT = 3000; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash_screen); + new Handler().postDelayed(new Runnable() { + + /* + * Showing splash screen with a timer. This will be useful when you + * want to show case your app logo / company + */ + + @Override + public void run() { + // This method will be executed once the timer is over + // Start your app main activity + Intent i = new Intent(SplashScreen.this, MainActivity.class); + startActivity(i); + + // close this activity + finish(); + } + }, SPLASH_TIME_OUT); + } +} diff --git a/app/src/main/res/drawable/appointment.png b/app/src/main/res/drawable/appointment.png new file mode 100644 index 0000000..17a8914 Binary files /dev/null and b/app/src/main/res/drawable/appointment.png differ diff --git a/app/src/main/res/drawable/auntbertha.png b/app/src/main/res/drawable/auntbertha.png new file mode 100644 index 0000000..73818b2 Binary files /dev/null and b/app/src/main/res/drawable/auntbertha.png differ diff --git a/app/src/main/res/drawable/elvis.png b/app/src/main/res/drawable/elvis.png new file mode 100644 index 0000000..34c36d2 Binary files /dev/null and b/app/src/main/res/drawable/elvis.png differ diff --git a/app/src/main/res/drawable/omclogo.png b/app/src/main/res/drawable/omclogo.png new file mode 100644 index 0000000..5974c7f Binary files /dev/null and b/app/src/main/res/drawable/omclogo.png differ diff --git a/app/src/main/res/drawable/omclogo2.png b/app/src/main/res/drawable/omclogo2.png new file mode 100644 index 0000000..5cd5d6d Binary files /dev/null and b/app/src/main/res/drawable/omclogo2.png differ diff --git a/app/src/main/res/drawable/plus.png b/app/src/main/res/drawable/plus.png new file mode 100644 index 0000000..15b1c4d Binary files /dev/null and b/app/src/main/res/drawable/plus.png differ diff --git a/app/src/main/res/drawable/robinhood.png b/app/src/main/res/drawable/robinhood.png new file mode 100644 index 0000000..e715bb8 Binary files /dev/null and b/app/src/main/res/drawable/robinhood.png differ diff --git a/app/src/main/res/drawable/search.png b/app/src/main/res/drawable/search.png new file mode 100644 index 0000000..39b3b4d Binary files /dev/null and b/app/src/main/res/drawable/search.png differ diff --git a/app/src/main/res/drawable/singlestop.png b/app/src/main/res/drawable/singlestop.png new file mode 100644 index 0000000..174f6c0 Binary files /dev/null and b/app/src/main/res/drawable/singlestop.png differ diff --git a/app/src/main/res/drawable/star.png b/app/src/main/res/drawable/star.png new file mode 100644 index 0000000..bd1c862 Binary files /dev/null and b/app/src/main/res/drawable/star.png differ diff --git a/app/src/main/res/layout/activity_add_event_to_calendar.xml b/app/src/main/res/layout/activity_add_event_to_calendar.xml new file mode 100644 index 0000000..5673a7b --- /dev/null +++ b/app/src/main/res/layout/activity_add_event_to_calendar.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + +