Commit cc689fce67319d5caa7a9fc2c5b7eaebabbbc6b2
1 parent
0861f1f4
Exists in
master
mudanca de cores
correcao de bugs logo inserida tela sobre implementada
Showing
39 changed files
with
306 additions
and
144 deletions
Show diff stats
app/app.iml
... | ... | @@ -75,10 +75,10 @@ |
75 | 75 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/mediarouter-v7/22.0.0/jars" /> |
76 | 76 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.0/jars" /> |
77 | 77 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" /> |
78 | - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/answers/1.2.2/jars" /> | |
78 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/answers/1.3.0/jars" /> | |
79 | 79 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/beta/1.1.3/jars" /> |
80 | 80 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics-core/2.3.3/jars" /> |
81 | - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics/2.4.0/jars" /> | |
81 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics/2.5.0/jars" /> | |
82 | 82 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads/7.5.0/jars" /> |
83 | 83 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-analytics/7.5.0/jars" /> |
84 | 84 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-appindexing/7.5.0/jars" /> |
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services/7.5.0/jars" /> |
103 | 103 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/iconics/1.0.2/jars" /> |
104 | 104 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.mikepenz/materialdrawer/3.0.6/jars" /> |
105 | - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.fabric.sdk.android/fabric/1.3.4/jars" /> | |
105 | + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.fabric.sdk.android/fabric/1.3.5/jars" /> | |
106 | 106 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> |
107 | 107 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" /> |
108 | 108 | <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" /> |
... | ... | @@ -142,23 +142,23 @@ |
142 | 142 | <orderEntry type="library" exported="" name="bolts-android-1.2.0" level="project" /> |
143 | 143 | <orderEntry type="library" exported="" name="play-services-appinvite-7.5.0" level="project" /> |
144 | 144 | <orderEntry type="library" exported="" name="iconics-1.0.2" level="project" /> |
145 | - <orderEntry type="library" exported="" name="fabric-1.3.4" level="project" /> | |
146 | 145 | <orderEntry type="library" exported="" name="beta-1.1.3" level="project" /> |
147 | 146 | <orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" /> |
147 | + <orderEntry type="library" exported="" name="fabric-1.3.5" level="project" /> | |
148 | 148 | <orderEntry type="library" exported="" name="universal-image-loader-1.9.3" level="project" /> |
149 | 149 | <orderEntry type="library" exported="" name="crashlytics-core-2.3.3" level="project" /> |
150 | 150 | <orderEntry type="library" exported="" name="play-services-fitness-7.5.0" level="project" /> |
151 | 151 | <orderEntry type="library" exported="" name="play-services-nearby-7.5.0" level="project" /> |
152 | - <orderEntry type="library" exported="" name="crashlytics-2.4.0" level="project" /> | |
152 | + <orderEntry type="library" exported="" name="crashlytics-2.5.0" level="project" /> | |
153 | 153 | <orderEntry type="library" exported="" name="play-services-plus-7.5.0" level="project" /> |
154 | 154 | <orderEntry type="library" exported="" name="play-services-wearable-7.5.0" level="project" /> |
155 | 155 | <orderEntry type="library" exported="" name="play-services-appstate-7.5.0" level="project" /> |
156 | 156 | <orderEntry type="library" exported="" name="play-services-games-7.5.0" level="project" /> |
157 | 157 | <orderEntry type="library" exported="" name="play-services-identity-7.5.0" level="project" /> |
158 | 158 | <orderEntry type="library" exported="" name="MPAndroidChart-v2.1.0" level="project" /> |
159 | - <orderEntry type="library" exported="" name="answers-1.2.2" level="project" /> | |
160 | 159 | <orderEntry type="library" exported="" name="design-22.2.0" level="project" /> |
161 | 160 | <orderEntry type="library" exported="" name="play-services-maps-7.5.0" level="project" /> |
161 | + <orderEntry type="library" exported="" name="answers-1.3.0" level="project" /> | |
162 | 162 | <orderEntry type="library" exported="" name="cardview-v7-22.2.0" level="project" /> |
163 | 163 | </component> |
164 | 164 | </module> |
165 | 165 | \ No newline at end of file | ... | ... |
app/build.gradle
app/src/main/AndroidManifest.xml
... | ... | @@ -77,6 +77,14 @@ |
77 | 77 | android:name=".ComentarioActivity" |
78 | 78 | android:label="@string/title_activity_comentario" > |
79 | 79 | </activity> |
80 | + <activity | |
81 | + android:name=".SobreActivity" | |
82 | + android:label="@string/title_activity_sobre" | |
83 | + android:parentActivityName=".MainActivity" > | |
84 | + <meta-data | |
85 | + android:name="android.support.PARENT_ACTIVITY" | |
86 | + android:value="com.monitorabrasil.monitoralegislativo.MainActivity" /> | |
87 | + </activity> | |
80 | 88 | </application> |
81 | 89 | |
82 | 90 | </manifest> | ... | ... |
5.76 KB
40.5 KB
app/src/main/java/com/monitorabrasil/monitoralegislativo/CamaraActivity.java
... | ... | @@ -59,9 +59,7 @@ public class CamaraActivity extends AppCompatActivity { |
59 | 59 | int id = item.getItemId(); |
60 | 60 | |
61 | 61 | //noinspection SimplifiableIfStatement |
62 | - if (id == R.id.action_settings) { | |
63 | - return true; | |
64 | - } | |
62 | + | |
65 | 63 | |
66 | 64 | return super.onOptionsItemSelected(item); |
67 | 65 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/ComentarioActivity.java
... | ... | @@ -223,9 +223,6 @@ public class ComentarioActivity extends AppCompatActivity { |
223 | 223 | int id = item.getItemId(); |
224 | 224 | |
225 | 225 | //noinspection SimplifiableIfStatement |
226 | - if (id == R.id.action_settings) { | |
227 | - return true; | |
228 | - } | |
229 | 226 | |
230 | 227 | return super.onOptionsItemSelected(item); |
231 | 228 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/LoginActivity.java
... | ... | @@ -11,6 +11,7 @@ import android.content.Intent; |
11 | 11 | import android.content.Loader; |
12 | 12 | import android.database.Cursor; |
13 | 13 | import android.graphics.Bitmap; |
14 | +import android.graphics.BitmapFactory; | |
14 | 15 | import android.net.Uri; |
15 | 16 | import android.os.AsyncTask; |
16 | 17 | |
... | ... | @@ -30,10 +31,13 @@ import android.widget.ArrayAdapter; |
30 | 31 | import android.widget.AutoCompleteTextView; |
31 | 32 | import android.widget.Button; |
32 | 33 | import android.widget.EditText; |
34 | +import android.widget.ImageButton; | |
33 | 35 | import android.widget.ImageView; |
34 | 36 | import android.widget.LinearLayout; |
35 | 37 | import android.widget.TextView; |
36 | 38 | |
39 | +import java.io.FileNotFoundException; | |
40 | +import java.io.InputStream; | |
37 | 41 | import java.text.ParseException; |
38 | 42 | import java.util.ArrayList; |
39 | 43 | import java.util.List; |
... | ... | @@ -54,7 +58,7 @@ import org.w3c.dom.Text; |
54 | 58 | /** |
55 | 59 | * A login screen that offers login via email/password. |
56 | 60 | */ |
57 | -public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> { | |
61 | +public class LoginActivity extends AppCompatActivity { | |
58 | 62 | |
59 | 63 | |
60 | 64 | /** |
... | ... | @@ -77,6 +81,9 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
77 | 81 | private TextView lblEmail; |
78 | 82 | private ImageView foto; |
79 | 83 | private ParseUser currentUser; |
84 | + private ImageButton btnFoto; | |
85 | + | |
86 | + private final int PICK_IMAGE=2; | |
80 | 87 | |
81 | 88 | @Override |
82 | 89 | protected void onCreate(Bundle savedInstanceState) { |
... | ... | @@ -85,23 +92,39 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
85 | 92 | setupActionBar(); |
86 | 93 | mLoginFormView = findViewById(R.id.login_form); |
87 | 94 | mLogoutFormView = findViewById(R.id.logout_form); |
95 | + mProgressView = findViewById(R.id.login_progress); | |
96 | + btnFoto = (ImageButton) findViewById(R.id.btnFoto); | |
88 | 97 | currentUser = ParseUser.getCurrentUser(); |
89 | 98 | |
90 | 99 | |
100 | + | |
101 | + | |
91 | 102 | if (currentUser != null) { |
92 | 103 | montaFormLogout(); |
93 | 104 | |
94 | 105 | }else{ |
95 | - | |
96 | 106 | mLogoutFormView.setVisibility(View.GONE); |
97 | 107 | mLoginFormView.setVisibility(View.VISIBLE); |
98 | 108 | |
99 | 109 | } |
100 | 110 | |
111 | + // Set up the login form. | |
112 | + btnFoto.setOnClickListener(new OnClickListener() { | |
113 | + @Override | |
114 | + public void onClick(View v) { | |
115 | + Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT); | |
116 | + getIntent.setType("image/*"); | |
101 | 117 | |
118 | + Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); | |
119 | + pickIntent.setType("image/*"); | |
102 | 120 | |
121 | + Intent chooserIntent = Intent.createChooser(getIntent, "Selecione uma foto"); | |
122 | + chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent}); | |
123 | + | |
124 | + startActivityForResult(chooserIntent, PICK_IMAGE); | |
125 | + } | |
126 | + }); | |
103 | 127 | |
104 | - // Set up the login form. | |
105 | 128 | mNome = (EditText)findViewById(R.id.txtNome); |
106 | 129 | mNome.setVisibility(View.GONE); |
107 | 130 | |
... | ... | @@ -112,13 +135,11 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
112 | 135 | |
113 | 136 | @Override |
114 | 137 | public void onClick(View v) { |
115 | - showProgress(true); | |
138 | + showProgress(true,null); | |
116 | 139 | ParseUser.logOutInBackground(new LogOutCallback() { |
117 | 140 | @Override |
118 | 141 | public void done(com.parse.ParseException e) { |
119 | - mLogoutFormView.setVisibility(View.GONE); | |
120 | - mLoginFormView.setVisibility(View.VISIBLE); | |
121 | - showProgress(false); | |
142 | + showProgress(false, mLoginFormView); | |
122 | 143 | } |
123 | 144 | }); |
124 | 145 | } |
... | ... | @@ -153,6 +174,8 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
153 | 174 | Snackbar.make(mLoginFormView, "Login cancelado ", Snackbar.LENGTH_LONG) |
154 | 175 | .setAction("Action", null).show(); |
155 | 176 | } else if (parseUser.isNew()) { |
177 | + parseUser.put("nome",ParseTwitterUtils.getTwitter().getScreenName()); | |
178 | + parseUser.saveInBackground(); | |
156 | 179 | montaFormLogout(); |
157 | 180 | } else { |
158 | 181 | montaFormLogout(); |
... | ... | @@ -163,7 +186,7 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
163 | 186 | }); |
164 | 187 | |
165 | 188 | mEmailView = (AutoCompleteTextView) findViewById(R.id.email); |
166 | - populateAutoComplete(); | |
189 | + | |
167 | 190 | |
168 | 191 | mPasswordView = (EditText) findViewById(R.id.password); |
169 | 192 | mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { |
... | ... | @@ -186,7 +209,38 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
186 | 209 | }); |
187 | 210 | |
188 | 211 | |
189 | - mProgressView = findViewById(R.id.login_progress); | |
212 | + | |
213 | + } | |
214 | + | |
215 | + @Override | |
216 | + public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
217 | + super.onActivityResult(requestCode, resultCode, data); | |
218 | + if (requestCode == PICK_IMAGE && resultCode == Activity.RESULT_OK) { | |
219 | + if (data == null) { | |
220 | + //Display an error | |
221 | + return; | |
222 | + } | |
223 | + try { | |
224 | + Uri selectedImage = data.getData(); | |
225 | + InputStream imageStream = getContentResolver().openInputStream(selectedImage); | |
226 | + Bitmap yourSelectedImage = BitmapFactory.decodeStream(imageStream); | |
227 | + btnFoto.setImageBitmap(yourSelectedImage); | |
228 | + } catch (FileNotFoundException e) { | |
229 | + e.printStackTrace(); | |
230 | + } | |
231 | + //Now you can do whatever you want with your inpustream, save it as file, upload to a server, decode a bitmap... | |
232 | + } | |
233 | + } | |
234 | + | |
235 | + private void showProgress(boolean b,View v) { | |
236 | + if(b){ | |
237 | + mProgressView.setVisibility(View.VISIBLE); | |
238 | + mLogoutFormView.setVisibility(View.GONE); | |
239 | + mLoginFormView.setVisibility(View.GONE); | |
240 | + }else{ | |
241 | + mProgressView.setVisibility(View.GONE); | |
242 | + v.setVisibility(View.VISIBLE); | |
243 | + } | |
190 | 244 | } |
191 | 245 | |
192 | 246 | private void montaFormLogout() { |
... | ... | @@ -194,10 +248,10 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
194 | 248 | lblEmail = (TextView)findViewById(R.id.lblEmail); |
195 | 249 | foto = (ImageView)findViewById(R.id.foto); |
196 | 250 | |
197 | - mLogoutFormView.setVisibility(View.VISIBLE); | |
198 | 251 | mLoginFormView.setVisibility(View.GONE); |
252 | + showProgress(false,mLogoutFormView); | |
199 | 253 | |
200 | - if(ParseTwitterUtils.getTwitter()!=null){ | |
254 | + if(ParseTwitterUtils.getTwitter().getUserId() !=null){ | |
201 | 255 | String screenName = ParseTwitterUtils.getTwitter().getScreenName(); |
202 | 256 | lblNome.setText(screenName); |
203 | 257 | lblEmail.setText(""); |
... | ... | @@ -216,7 +270,7 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
216 | 270 | |
217 | 271 | @Override |
218 | 272 | public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { |
219 | - foto.setImageBitmap(loadedImage); | |
273 | + foto.setImageBitmap(loadedImage); | |
220 | 274 | } |
221 | 275 | |
222 | 276 | @Override |
... | ... | @@ -279,7 +333,7 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
279 | 333 | } else { |
280 | 334 | // Show a progress spinner, and kick off a background task to |
281 | 335 | // perform the user login attempt. |
282 | - showProgress(true); | |
336 | + showProgress(true,null); | |
283 | 337 | |
284 | 338 | ParseUser user = new ParseUser(); |
285 | 339 | user.setUsername(email); |
... | ... | @@ -292,11 +346,11 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
292 | 346 | @Override |
293 | 347 | public void done(com.parse.ParseException e) { |
294 | 348 | if (e == null) { |
295 | - showProgress(false); | |
296 | 349 | montaFormLogout(); |
297 | 350 | } else { |
298 | - showProgress(false); | |
299 | - | |
351 | + showProgress(false,mLoginFormView); | |
352 | + Snackbar.make(mLoginFormView, "Houve um erro ao fazer seu cadastro ", Snackbar.LENGTH_LONG) | |
353 | + .setAction("Action", null).show(); | |
300 | 354 | } |
301 | 355 | } |
302 | 356 | |
... | ... | @@ -306,9 +360,7 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
306 | 360 | } |
307 | 361 | } |
308 | 362 | |
309 | - private void populateAutoComplete() { | |
310 | - getLoaderManager().initLoader(0, null, this); | |
311 | - } | |
363 | + | |
312 | 364 | |
313 | 365 | /** |
314 | 366 | * Set up the {@link android.app.ActionBar}, if the API is available. |
... | ... | @@ -370,7 +422,7 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
370 | 422 | } else { |
371 | 423 | // Show a progress spinner, and kick off a background task to |
372 | 424 | // perform the user login attempt. |
373 | - showProgress(true); | |
425 | + showProgress(true,null); | |
374 | 426 | |
375 | 427 | //fazer o login aqui |
376 | 428 | fazerLogin(email, password); |
... | ... | @@ -388,7 +440,7 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
388 | 440 | } else { |
389 | 441 | mPasswordView.setError(getString(R.string.error_incorrect_password)); |
390 | 442 | mPasswordView.requestFocus(); |
391 | - showProgress(false); | |
443 | + showProgress(false,mLoginFormView); | |
392 | 444 | } |
393 | 445 | } |
394 | 446 | |
... | ... | @@ -406,94 +458,8 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks< |
406 | 458 | return password.length() > 4; |
407 | 459 | } |
408 | 460 | |
409 | - /** | |
410 | - * Shows the progress UI and hides the login form. | |
411 | - */ | |
412 | - @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) | |
413 | - public void showProgress(final boolean show) { | |
414 | - // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow | |
415 | - // for very easy animations. If available, use these APIs to fade-in | |
416 | - // the progress spinner. | |
417 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { | |
418 | - int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); | |
419 | - | |
420 | - mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); | |
421 | - mLoginFormView.animate().setDuration(shortAnimTime).alpha( | |
422 | - show ? 0 : 1).setListener(new AnimatorListenerAdapter() { | |
423 | - @Override | |
424 | - public void onAnimationEnd(Animator animation) { | |
425 | - mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); | |
426 | - } | |
427 | - }); | |
428 | - mLogoutFormView.setVisibility(show ? View.GONE : View.VISIBLE); | |
429 | - mLogoutFormView.animate().setDuration(shortAnimTime).alpha( | |
430 | - show ? 0 : 1).setListener(new AnimatorListenerAdapter() { | |
431 | - @Override | |
432 | - public void onAnimationEnd(Animator animation) { | |
433 | - mLogoutFormView.setVisibility(show ? View.GONE : View.VISIBLE); | |
434 | - } | |
435 | - }); | |
436 | - | |
437 | - mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); | |
438 | - mProgressView.animate().setDuration(shortAnimTime).alpha( | |
439 | - show ? 1 : 0).setListener(new AnimatorListenerAdapter() { | |
440 | - @Override | |
441 | - public void onAnimationEnd(Animator animation) { | |
442 | - mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); | |
443 | - } | |
444 | - }); | |
445 | - } else { | |
446 | - // The ViewPropertyAnimator APIs are not available, so simply show | |
447 | - // and hide the relevant UI components. | |
448 | - mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); | |
449 | - mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); | |
450 | - mLogoutFormView.setVisibility(show ? View.GONE : View.VISIBLE); | |
451 | - } | |
452 | - } | |
453 | - | |
454 | - @Override | |
455 | - public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { | |
456 | - return new CursorLoader(this, | |
457 | - // Retrieve data rows for the device user's 'profile' contact. | |
458 | - Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI, | |
459 | - ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION, | |
460 | - | |
461 | - // Select only email addresses. | |
462 | - ContactsContract.Contacts.Data.MIMETYPE + | |
463 | - " = ?", new String[]{ContactsContract.CommonDataKinds.Email | |
464 | - .CONTENT_ITEM_TYPE}, | |
465 | - | |
466 | - // Show primary email addresses first. Note that there won't be | |
467 | - // a primary email address if the user hasn't specified one. | |
468 | - ContactsContract.Contacts.Data.IS_PRIMARY + " DESC"); | |
469 | - } | |
470 | - | |
471 | - @Override | |
472 | - public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { | |
473 | - List<String> emails = new ArrayList<String>(); | |
474 | - cursor.moveToFirst(); | |
475 | - while (!cursor.isAfterLast()) { | |
476 | - emails.add(cursor.getString(ProfileQuery.ADDRESS)); | |
477 | - cursor.moveToNext(); | |
478 | - } | |
479 | 461 | |
480 | - addEmailsToAutoComplete(emails); | |
481 | - } | |
482 | - | |
483 | - @Override | |
484 | - public void onLoaderReset(Loader<Cursor> cursorLoader) { | |
485 | 462 | |
486 | - } | |
487 | - | |
488 | - private interface ProfileQuery { | |
489 | - String[] PROJECTION = { | |
490 | - ContactsContract.CommonDataKinds.Email.ADDRESS, | |
491 | - ContactsContract.CommonDataKinds.Email.IS_PRIMARY, | |
492 | - }; | |
493 | - | |
494 | - int ADDRESS = 0; | |
495 | - int IS_PRIMARY = 1; | |
496 | - } | |
497 | 463 | |
498 | 464 | |
499 | 465 | private void addEmailsToAutoComplete(List<String> emailAddressCollection) { | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/MainActivity.java
... | ... | @@ -179,7 +179,8 @@ public class MainActivity extends AppCompatActivity implements HomeFragment.OnFr |
179 | 179 | new DividerDrawerItem(), |
180 | 180 | new PrimaryDrawerItem().withName("Vereadores"), |
181 | 181 | new SecondaryDrawerItem().withName("Indicações"), |
182 | - new SecondaryDrawerItem().withName("Câmara") | |
182 | + new SecondaryDrawerItem().withName("Câmara"), | |
183 | + new SecondaryDrawerItem().withName("Sobre") | |
183 | 184 | ) |
184 | 185 | .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { |
185 | 186 | @Override |
... | ... | @@ -207,6 +208,9 @@ public class MainActivity extends AppCompatActivity implements HomeFragment.OnFr |
207 | 208 | case 4: |
208 | 209 | startActivity(new Intent(getApplicationContext(), CamaraActivity.class)); |
209 | 210 | break; |
211 | + case 5: | |
212 | + startActivity(new Intent(getApplicationContext(), SobreActivity.class)); | |
213 | + break; | |
210 | 214 | |
211 | 215 | } |
212 | 216 | navigationDrawerLeft.closeDrawer(); |
... | ... | @@ -237,7 +241,8 @@ public class MainActivity extends AppCompatActivity implements HomeFragment.OnFr |
237 | 241 | int id = item.getItemId(); |
238 | 242 | |
239 | 243 | //noinspection SimplifiableIfStatement |
240 | - if (id == R.id.action_settings) { | |
244 | + if (id == R.id.action_sobre) { | |
245 | + startActivity(new Intent(getApplicationContext(),SobreActivity.class)); | |
241 | 246 | return true; |
242 | 247 | } |
243 | 248 | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/PoliticoFichaActivity.java
... | ... | @@ -176,9 +176,7 @@ public class PoliticoFichaActivity extends AppCompatActivity { |
176 | 176 | int id = item.getItemId(); |
177 | 177 | |
178 | 178 | //noinspection SimplifiableIfStatement |
179 | - if (id == R.id.action_settings) { | |
180 | - return true; | |
181 | - } | |
179 | + | |
182 | 180 | |
183 | 181 | return super.onOptionsItemSelected(item); |
184 | 182 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/PoliticosActivity.java
... | ... | @@ -62,9 +62,7 @@ public class PoliticosActivity extends AppCompatActivity { |
62 | 62 | int id = item.getItemId(); |
63 | 63 | |
64 | 64 | //noinspection SimplifiableIfStatement |
65 | - if (id == R.id.action_settings) { | |
66 | - return true; | |
67 | - } | |
65 | + | |
68 | 66 | |
69 | 67 | return super.onOptionsItemSelected(item); |
70 | 68 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/ProjetosActivity.java
... | ... | @@ -70,9 +70,7 @@ public class ProjetosActivity extends ActionBarActivity { |
70 | 70 | int id = item.getItemId(); |
71 | 71 | |
72 | 72 | //noinspection SimplifiableIfStatement |
73 | - if (id == R.id.action_settings) { | |
74 | - return true; | |
75 | - } | |
73 | + | |
76 | 74 | |
77 | 75 | return super.onOptionsItemSelected(item); |
78 | 76 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/SobreActivity.java
0 → 100644
... | ... | @@ -0,0 +1,71 @@ |
1 | +package com.monitorabrasil.monitoralegislativo; | |
2 | + | |
3 | +import android.content.pm.PackageManager; | |
4 | +import android.support.v7.app.ActionBarActivity; | |
5 | +import android.os.Bundle; | |
6 | +import android.support.v7.app.AppCompatActivity; | |
7 | +import android.support.v7.widget.Toolbar; | |
8 | +import android.text.Html; | |
9 | +import android.text.method.LinkMovementMethod; | |
10 | +import android.view.Menu; | |
11 | +import android.view.MenuItem; | |
12 | +import android.widget.TextView; | |
13 | + | |
14 | +import com.crashlytics.android.answers.Answers; | |
15 | +import com.crashlytics.android.answers.ContentViewEvent; | |
16 | +import com.monitorabrasil.monitoralegislativo.R; | |
17 | + | |
18 | +import org.w3c.dom.Text; | |
19 | + | |
20 | +public class SobreActivity extends AppCompatActivity { | |
21 | + | |
22 | + Toolbar toolbar; | |
23 | + | |
24 | + @Override | |
25 | + protected void onCreate(Bundle savedInstanceState) { | |
26 | + super.onCreate(savedInstanceState); | |
27 | + setContentView(R.layout.activity_sobre); | |
28 | + initToolbar(); | |
29 | + toolbar.setTitle("Sobre"); | |
30 | + setSupportActionBar(toolbar); | |
31 | + getSupportActionBar().setDisplayHomeAsUpEnabled(true); | |
32 | + | |
33 | + | |
34 | + | |
35 | + TextView versao = (TextView)findViewById(R.id.versao); | |
36 | + try { | |
37 | + versao.setText("Versão: "+getPackageManager().getPackageInfo(getPackageName(), 0).versionName); | |
38 | + } catch (PackageManager.NameNotFoundException e) { | |
39 | + e.printStackTrace(); | |
40 | + } | |
41 | + | |
42 | + Answers.getInstance().logContentView(new ContentViewEvent() | |
43 | + .putContentName("SobreActivity") | |
44 | + .putContentType("Activity")); | |
45 | + } | |
46 | + | |
47 | + private void initToolbar() { | |
48 | + toolbar = (Toolbar) findViewById(R.id.toolbar); | |
49 | + setSupportActionBar(toolbar); | |
50 | + } | |
51 | + | |
52 | + @Override | |
53 | + public boolean onCreateOptionsMenu(Menu menu) { | |
54 | + // Inflate the menu; this adds items to the action bar if it is present. | |
55 | + getMenuInflater().inflate(R.menu.menu_sobre, menu); | |
56 | + return true; | |
57 | + } | |
58 | + | |
59 | + @Override | |
60 | + public boolean onOptionsItemSelected(MenuItem item) { | |
61 | + // Handle action bar item clicks here. The action bar will | |
62 | + // automatically handle clicks on the Home/Up button, so long | |
63 | + // as you specify a parent activity in AndroidManifest.xml. | |
64 | + int id = item.getItemId(); | |
65 | + | |
66 | + //noinspection SimplifiableIfStatement | |
67 | + | |
68 | + | |
69 | + return super.onOptionsItemSelected(item); | |
70 | + } | |
71 | +} | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/adapters/ProjetoAdapter.java
... | ... | @@ -225,9 +225,11 @@ public class ProjetoAdapter extends RecyclerView.Adapter<ProjetoAdapter.ViewHold |
225 | 225 | } |
226 | 226 | if(votado){ |
227 | 227 | |
228 | + if(null!= viewHolder2.projetoVotado){ | |
229 | + viewHolder2.projetoVotado.unpinInBackground(); | |
230 | + viewHolder2.projetoVotado.deleteInBackground(); | |
231 | + } | |
228 | 232 | |
229 | - viewHolder2.projetoVotado.unpinInBackground(); | |
230 | - viewHolder2.projetoVotado.deleteInBackground(); | |
231 | 233 | |
232 | 234 | |
233 | 235 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/HomeFragment.java
... | ... | @@ -4,6 +4,7 @@ import android.app.Activity; |
4 | 4 | import android.content.Intent; |
5 | 5 | import android.net.Uri; |
6 | 6 | import android.os.Bundle; |
7 | +import android.support.design.widget.FloatingActionButton; | |
7 | 8 | import android.support.v4.app.Fragment; |
8 | 9 | import android.support.v7.widget.LinearLayoutManager; |
9 | 10 | import android.support.v7.widget.RecyclerView; |
... | ... | @@ -23,6 +24,7 @@ import com.github.mikephil.charting.data.BarDataSet; |
23 | 24 | import com.github.mikephil.charting.data.BarEntry; |
24 | 25 | import com.github.mikephil.charting.data.Entry; |
25 | 26 | import com.github.mikephil.charting.utils.ValueFormatter; |
27 | +import com.monitorabrasil.monitoralegislativo.ComentarioActivity; | |
26 | 28 | import com.monitorabrasil.monitoralegislativo.PoliticoFichaActivity; |
27 | 29 | import com.monitorabrasil.monitoralegislativo.R; |
28 | 30 | import com.monitorabrasil.monitoralegislativo.adapters.VereadorAdapter; |
... | ... | @@ -107,8 +109,23 @@ public class HomeFragment extends Fragment implements RecyclerViewOnClickListene |
107 | 109 | |
108 | 110 | //buscar o grafico de gastos |
109 | 111 | mChart = (BarChart)view.findViewById(R.id.chart1); |
112 | + | |
110 | 113 | buscaGastos(); |
111 | 114 | |
115 | + FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab); | |
116 | + fab.setOnClickListener(new View.OnClickListener() { | |
117 | + @Override | |
118 | + public void onClick(View view) { | |
119 | + Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); | |
120 | + sharingIntent.setType("text/plain"); | |
121 | + String shareBody = "Recomendo o app Participa Cidadão https://play.google.com/store/apps/details?id=com.monitorabrasil.monitoramunicipio"; | |
122 | + sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Participa Cidadão"); | |
123 | + sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); | |
124 | + startActivity(Intent.createChooser(sharingIntent, "Compartilhar via")); | |
125 | + | |
126 | + } | |
127 | + }); | |
128 | + | |
112 | 129 | |
113 | 130 | return view; |
114 | 131 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/ListaProjetosFragment.java
... | ... | @@ -12,6 +12,8 @@ import android.view.View; |
12 | 12 | import android.view.ViewGroup; |
13 | 13 | import android.widget.ProgressBar; |
14 | 14 | |
15 | +import com.crashlytics.android.answers.Answers; | |
16 | +import com.crashlytics.android.answers.ContentViewEvent; | |
15 | 17 | import com.monitorabrasil.monitoralegislativo.R; |
16 | 18 | import com.monitorabrasil.monitoralegislativo.adapters.ProjetoAdapter; |
17 | 19 | import com.monitorabrasil.monitoralegislativo.adapters.VereadorAdapter; |
... | ... | @@ -97,6 +99,10 @@ public class ListaProjetosFragment extends Fragment implements RecyclerViewOnCli |
97 | 99 | |
98 | 100 | if(tipoProjeto != null){ |
99 | 101 | query.whereEqualTo("classificacao", tipoProjeto); |
102 | + Answers.getInstance().logContentView(new ContentViewEvent() | |
103 | + .putContentName("ListaProjetosFragment") | |
104 | + .putContentType("Fragment") | |
105 | + .putCustomAttribute("tipoProjeto", tipoProjeto)); | |
100 | 106 | } |
101 | 107 | |
102 | 108 | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/fragments/PoliticoFichaFragment.java
... | ... | @@ -27,6 +27,8 @@ import com.parse.ParseObject; |
27 | 27 | import com.parse.ParseQuery; |
28 | 28 | import com.parse.ParseUser; |
29 | 29 | |
30 | +import java.text.NumberFormat; | |
31 | + | |
30 | 32 | /** |
31 | 33 | * Created by geral_000 on 20/06/2015. |
32 | 34 | */ |
... | ... | @@ -125,10 +127,10 @@ public class PoliticoFichaFragment extends Fragment { |
125 | 127 | facebook.setText(politico.get("facebook").toString()); |
126 | 128 | //gastos |
127 | 129 | TextView gastos = (TextView) view.findViewById(R.id.gastos); |
128 | - gastos.setText(politico.get("gasto_campanha").toString()); | |
130 | + gastos.setText(politico.get("gasto_campanha").toString().replace(",","").replace(".",",")); | |
129 | 131 | //bens declarados |
130 | 132 | TextView bens = (TextView) view.findViewById(R.id.bens); |
131 | - bens.setText(politico.get("bens_declarados").toString()); | |
133 | + bens.setText(politico.get("bens_declarados").toString().replace(",", "").replace(".",",")); | |
132 | 134 | |
133 | 135 | return view; |
134 | 136 | } | ... | ... |
app/src/main/java/com/monitorabrasil/monitoralegislativo/util/MyValueFormatter.java
... | ... | @@ -3,6 +3,7 @@ package com.monitorabrasil.monitoralegislativo.util; |
3 | 3 | import com.github.mikephil.charting.utils.ValueFormatter; |
4 | 4 | |
5 | 5 | import java.text.DecimalFormat; |
6 | +import java.text.NumberFormat; | |
6 | 7 | |
7 | 8 | /** |
8 | 9 | * Created by geral_000 on 21/06/2015. |
... | ... | @@ -17,7 +18,7 @@ public class MyValueFormatter implements ValueFormatter { |
17 | 18 | |
18 | 19 | @Override |
19 | 20 | public String getFormattedValue(float value) { |
20 | - return "R$" + mFormat.format(value) ; | |
21 | + return "R$" + NumberFormat.getCurrencyInstance().format(value) ; | |
21 | 22 | } |
22 | 23 | |
23 | 24 | } | ... | ... |
575 Bytes
411 Bytes
760 Bytes
1.11 KB
app/src/main/res/layout/activity_login.xml
... | ... | @@ -30,6 +30,14 @@ |
30 | 30 | |
31 | 31 | <LinearLayout android:id="@+id/email_login_form" android:layout_width="match_parent" |
32 | 32 | android:layout_height="wrap_content" android:orientation="vertical"> |
33 | + <ImageButton | |
34 | + android:layout_width="50dp" | |
35 | + android:paddingTop="5dp" | |
36 | + android:layout_height="50dp" | |
37 | + android:visibility="gone" | |
38 | + android:layout_gravity="center" | |
39 | + android:background="@drawable/person_1" | |
40 | + android:id="@+id/btnFoto"/> | |
33 | 41 | <android.support.design.widget.TextInputLayout |
34 | 42 | android:layout_width="match_parent" |
35 | 43 | android:layout_height="wrap_content"> | ... | ... |
... | ... | @@ -0,0 +1,66 @@ |
1 | +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
3 | + android:id="@+id/main_content" | |
4 | + android:layout_width="match_parent" | |
5 | + android:layout_height="match_parent"> | |
6 | + | |
7 | + | |
8 | + <android.support.design.widget.AppBarLayout | |
9 | + android:id="@+id/appbar" | |
10 | + android:layout_width="match_parent" | |
11 | + android:layout_height="70dp" | |
12 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | |
13 | + android:fitsSystemWindows="true"> | |
14 | + | |
15 | + <android.support.v7.widget.Toolbar | |
16 | + android:id="@+id/toolbar" | |
17 | + android:layout_height="70dp" | |
18 | + android:gravity="bottom" | |
19 | + android:paddingBottom="12dp" | |
20 | + android:paddingTop="16dp" | |
21 | + android:minHeight="?attr/actionBarSize" | |
22 | + app:layout_scrollFlags="scroll|exitUntilCollapsed" | |
23 | + android:layout_width="match_parent" | |
24 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" | |
25 | + app:layout_collapseMode="pin" /> | |
26 | + | |
27 | + | |
28 | + <android.support.design.widget.TabLayout | |
29 | + android:id="@+id/tabLayout" | |
30 | + android:layout_width="match_parent" | |
31 | + android:layout_height="wrap_content" | |
32 | + app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> | |
33 | + | |
34 | + | |
35 | + | |
36 | + </android.support.design.widget.AppBarLayout> | |
37 | + | |
38 | +<LinearLayout android:layout_width="match_parent" | |
39 | + android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" | |
40 | + android:paddingRight="@dimen/activity_horizontal_margin" | |
41 | + android:paddingTop="90dp" | |
42 | + android:paddingBottom="@dimen/activity_vertical_margin" | |
43 | + android:orientation="vertical"> | |
44 | +<ImageView | |
45 | + android:layout_width="fill_parent" | |
46 | + android:layout_height="80dp" android:src="@drawable/marca_1024_500" android:paddingBottom="15dp"/> | |
47 | + | |
48 | + <TextView | |
49 | + android:layout_width="fill_parent" | |
50 | + android:layout_height="wrap_content" | |
51 | + android:text="@string/sobre"/> | |
52 | + | |
53 | + <TextView | |
54 | + android:layout_width="fill_parent" | |
55 | + android:layout_height="wrap_content" | |
56 | + android:id="@+id/credito" | |
57 | + android:autoLink="email" | |
58 | + android:text="@string/credito"/> | |
59 | + <TextView | |
60 | + android:layout_width="wrap_content" | |
61 | + android:layout_height="wrap_content" android:layout_gravity="right" | |
62 | + android:text="Versão" android:id="@+id/versao"/> | |
63 | + | |
64 | + | |
65 | +</LinearLayout> | |
66 | +</android.support.design.widget.CoordinatorLayout> | |
0 | 67 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_home.xml
... | ... | @@ -79,4 +79,11 @@ |
79 | 79 | </LinearLayout> |
80 | 80 | |
81 | 81 | </android.support.v4.widget.NestedScrollView> |
82 | + <android.support.design.widget.FloatingActionButton | |
83 | + android:id="@+id/fab" | |
84 | + android:layout_width="wrap_content" | |
85 | + android:layout_height="wrap_content" | |
86 | + android:layout_gravity="end|bottom" | |
87 | + android:layout_margin="@dimen/fab_margin" | |
88 | + android:src="@android:drawable/ic_menu_share" /> | |
82 | 89 | </FrameLayout> | ... | ... |
app/src/main/res/menu/menu_main.xml
1 | 1 | <menu xmlns:android="http://schemas.android.com/apk/res/android" |
2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto" |
3 | 3 | xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> |
4 | - <item android:id="@+id/action_settings" android:title="@string/action_sobre" | |
4 | + <item android:id="@+id/action_sobre" android:title="@string/action_sobre" | |
5 | 5 | android:orderInCategory="100" app:showAsAction="never" /> |
6 | 6 | </menu> | ... | ... |
1.28 KB
app/src/main/res/mipmap-hdpi/ic_launcher.png
731 Bytes
app/src/main/res/mipmap-mdpi/ic_launcher.png
1.9 KB
app/src/main/res/mipmap-xhdpi/ic_launcher.png
2.97 KB
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
3.48 KB
8.64 KB
app/src/main/res/values/colors.xml
... | ... | @@ -3,15 +3,19 @@ |
3 | 3 | <color name="grey">#ddd</color> |
4 | 4 | <color name="black">#000</color> |
5 | 5 | |
6 | - <color name="colorPrimaryLight">#C8E6C9</color> | |
7 | - <color name="colorPrimary">#4CAF50</color> | |
8 | - <color name="colorPrimaryDark">#388E3C</color> | |
6 | + <color name="colorPrimary">#FF5722</color> | |
7 | + <color name="colorPrimaryDark">#E64A19</color> | |
8 | + <color name="colorPrimaryLight">#FFCCBC</color> | |
9 | + <color name="colorAccent">#536DFE</color> | |
9 | 10 | <color name="colorPrimarytext">#212121</color> |
10 | 11 | <color name="colorSecondText">#727272</color> |
12 | + <color name="icons">#FFFFFF</color> | |
13 | + <color name="divider">#B6B6B6</color> | |
14 | + | |
15 | + | |
11 | 16 | <color name="coloLink">#1ea4f7</color> |
12 | - <color name="colorDivider">#ccc</color> | |
17 | + <color name="colorDivider">#B6B6B6</color> | |
13 | 18 | |
14 | - <color name="colorAccent">#448AFF</color> | |
15 | 19 | |
16 | 20 | <color name="colorFAB">#FF9800</color> |
17 | 21 | <color name="colorFABPressed">#F57C00</color> | ... | ... |
app/src/main/res/values/strings.xml
... | ... | @@ -17,10 +17,14 @@ |
17 | 17 | |
18 | 18 | <string name="projeto_apoio">Apoio</string> |
19 | 19 | <string name="projeto_naoapoio">Não Apoio</string> |
20 | - <string name="title_activity_comentario">ComentarioActivity</string> | |
20 | + <string name="title_activity_comentario">Comente</string> | |
21 | 21 | |
22 | 22 | <!-- TODO: Remove or change this placeholder text --> |
23 | 23 | <string name="hello_blank_fragment">Hello blank fragment</string> |
24 | + <string name="title_activity_sobre">Sobre</string> | |
24 | 25 | |
26 | + <string name="hello_world">Hello world!</string> | |
27 | + <string name="sobre">O ParticipaCidadão é um aplicativo em fase experimental destinado a tornar mais fácil e atraente a conexão/interação do cidadão com a Câmara de Vereadores e com temas públicos. Em outras palavras, é também uma plataforma de cidadania e democracia para o cidadão que quer participar mais ativamente do desenvolvimento de sua cidade.\n\n Essa versão piloto, por enquanto, só disponibiliza os dados da Câmara Municipal de Ouro Branco/MG. Entretanto, gradativamente, outros municípios serão incluídos na base de dados. \n\n Mais do que um aplicativo, é uma atitude! Participe! Venha construir conosco as cidades do Brasil de 2030.</string> | |
28 | + <string name="credito">Agradecimentos:\nWesley Rocha wesleyweb@gmail.com - criador da logomarca</string> | |
25 | 29 | |
26 | 30 | </resources> | ... | ... |