Skip to content

Commit 4cc0421

Browse files
Merge pull request #45 from daeynasvistas/Imagens
Imagens
2 parents 3fc44ed + fa94a89 commit 4cc0421

14 files changed

Lines changed: 96 additions & 70 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ captures/
3838

3939
# Keystore files
4040
*.jks
41+
-545 Bytes
Binary file not shown.

.idea/caches/gradle_models.ser

-133 KB
Binary file not shown.

.idea/libraries/Gradle__com_android_support_support_annotations_26_1_0_jar.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_8_1_jar.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.idea/libraries/Gradle__com_squareup_okio_okio_1_13_0_jar.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.idea/libraries/Gradle__com_squareup_picasso_picasso_2_4_0_jar.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/pt/IPG/messenger/Conversation.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import android.widget.Button;
1313
import android.widget.EditText;
1414
import android.widget.ImageButton;
15+
import android.widget.ProgressBar;
16+
1517
import org.json.JSONArray;
1618
import org.json.JSONException;
1719
import org.json.JSONObject;
@@ -202,7 +204,7 @@ private void onPhotosReturned(List<File> returnedPhotos) {
202204
// já há string ----
203205
String msg = encodedImage;
204206

205-
item.setType("3");
207+
item.setType("2");
206208
item.setText(msg);
207209
data.add(item);
208210
mAdapter.addItem(data);
@@ -229,7 +231,7 @@ public void run() {
229231
});
230232

231233
// IPG - Alteração -------------- Dinis
232-
mSocket.emit("new message", room,msg, ID);
234+
mSocket.emit("new message", room, msg, ID);
233235
//mSocket.emit("new message", room, text.getText() , ID);
234236
} catch (Exception e) {
235237
e.printStackTrace();
@@ -305,6 +307,10 @@ protected void onCreate(Bundle savedInstanceState) {
305307
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
306308
mRecyclerView.setAdapter(mAdapter);
307309

310+
// initiate progress bar and start button
311+
final ProgressBar simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
312+
313+
simpleProgressBar.setVisibility(View.VISIBLE);
308314
// receber conversa do mongodb
309315
AsyncTask.execute(new Runnable() {
310316
List<ChatData> data = new ArrayList<ChatData>();
@@ -369,6 +375,8 @@ public void run() {
369375
e.printStackTrace();
370376
}
371377
// update do UI deve ser feito pelo UI
378+
379+
372380
Collections.reverse(data);
373381
runOnUiThread(new Runnable() {
374382

@@ -383,6 +391,7 @@ public void run() {
383391

384392
// todo BUG "Invalid target position"
385393
mRecyclerView.smoothScrollToPosition(mRecyclerView.getAdapter().getItemCount() - 1);
394+
simpleProgressBar.setVisibility(View.INVISIBLE);
386395
} catch (Exception e) {
387396
e.printStackTrace();
388397
}
@@ -451,8 +460,15 @@ public void onClick(View view) {
451460
EasyImage.openGallery(Conversation.this, 0);
452461
}
453462
});
454-
455-
463+
/*
464+
findViewById(R.id.).setOnClickListener(new View.OnClickListener() {
465+
@Override
466+
public void onClick(View view) {
467+
finish();
468+
return;
469+
}
470+
});
471+
*/
456472

457473

458474
// --- Daey enviar localização

app/src/main/java/pt/IPG/messenger/Tools.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.location.Address;
99
import android.location.Geocoder;
1010
import android.location.Location;
11+
1112
import android.support.annotation.NonNull;
1213
import android.support.v4.app.ActivityCompat;
1314
import android.util.Base64;
@@ -217,11 +218,11 @@ public static String getPictureString(List<File> returnedPhotos) {
217218
Bitmap bm = BitmapFactory.decodeFile(returnedPhotos.get(returnedPhotos.size()-1).toString());
218219
ByteArrayOutputStream baos = new ByteArrayOutputStream();
219220

220-
Bitmap converetdImage = getResizedBitmap(bm, 350);
221-
Bitmap.createScaledBitmap(converetdImage, 350, 350, true);
221+
Bitmap converetdImage = getResizedBitmap(bm, 250);
222+
Bitmap.createScaledBitmap(converetdImage, 250, 250, true);
222223

223224

224-
converetdImage.compress(Bitmap.CompressFormat.JPEG, 60, baos); //bm is the bitmap object
225+
converetdImage.compress(Bitmap.CompressFormat.JPEG, 50, baos); //bm is the bitmap object
225226
byte[] b = baos.toByteArray();
226227

227228
String encodedImage = "5_";

0 commit comments

Comments
 (0)