Skip to content

Commit

Permalink
WIP: audio messages
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Aug 30, 2024
1 parent 69ca2a1 commit 97c66ae
Show file tree
Hide file tree
Showing 9 changed files with 273 additions and 15 deletions.
3 changes: 3 additions & 0 deletions android-refimpl-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ dependencies {
exclude group: 'com.android.support'
}
//
implementation 'com.github.piasy:rxandroidaudio:1.7.0'
implementation 'com.github.piasy:AudioProcessor:1.7.0'
//
implementation("com.daimajia.swipelayout:library:1.2.0@aar")
//
implementation('net.zetetic:android-database-sqlcipher:4.5.4@aar') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public class GroupMessageListActivity extends AppCompatActivity
static final int NGC_VIDEO_ICON_STATE_ACTIVE = 2;
ImageButton ml_phone_icon = null;
ImageButton ml_button_01 = null;
ImageButton ml_button_recaudio = null;
static ImageButton ml_video_icon = null;
static boolean sending_video_to_group = false;
static String ngc_video_showing_video_from_peer_pubkey = "-1";
Expand Down Expand Up @@ -473,6 +474,7 @@ public boolean onItemClick(View view, int position, IDrawerItem drawerItem)
ngc_video_off_button = (ImageButton) findViewById(R.id.ngc_video_off_button);
ngc_camera_info_text = findViewById(R.id.ngc_camera_info_text);
ml_button_01 = (ImageButton) findViewById(R.id.ml_button_01);
ml_button_recaudio = (ImageButton) findViewById(R.id.ml_button_recaudio);
ngc_audio_bar_in_v = (BarLevelDrawable) findViewById(R.id.ngc_audio_bar_in_v);
ngc_audio_bar_out_v = (BarLevelDrawable) findViewById(R.id.ngc_audio_bar_out_v);

Expand Down Expand Up @@ -1023,6 +1025,15 @@ public void onClick(final View v)
set_peer_count_header();
set_peer_names_and_avatars();

ml_button_recaudio.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(final View v)
{
Log.i(TAG, "onCreate:record_audio:start");
}
});

Log.i(TAG, "onCreate:099");
oncreate_finished = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ static outgoing_file_wrapped copy_outgoing_file_to_sdcard_dir(final String filep

if (filename_sd_card == null)
{
Log.i(TAG, "copy_outgoing_file_to_sdcard_dir:003");
return null;
}

Expand Down Expand Up @@ -1080,6 +1081,7 @@ static outgoing_file_wrapped copy_outgoing_file_to_sdcard_dir(final String filep

if (filename2 == null)
{
Log.i(TAG, "copy_outgoing_file_to_sdcard_dir:004");
return null;
}

Expand All @@ -1090,6 +1092,7 @@ static outgoing_file_wrapped copy_outgoing_file_to_sdcard_dir(final String filep

if (counter > 5000)
{
Log.i(TAG, "copy_outgoing_file_to_sdcard_dir:005");
return null;
}
}
Expand All @@ -1098,7 +1101,17 @@ static outgoing_file_wrapped copy_outgoing_file_to_sdcard_dir(final String filep
ret.filename_wrapped = filename2;

// now write that contents of the virtual file to the actual file on SD card ----------------
InputStream in = context_s.getContentResolver().openInputStream(Uri.parse(filepath));
// Log.i(TAG, "copy_outgoing_file_to_sdcard_dir:filepath=" + filepath);
InputStream in = null;
try
{
in = context_s.getContentResolver().openInputStream(Uri.parse(filepath));
}
catch(Exception e)
{
File fin_regular_file = new File(filepath + "/" + filename);
in = new java.io.FileInputStream(fin_regular_file);
}
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(SD_CARD_FILES_OUTGOING_WRAPPER_DIR + "/" + filename2));

Expand All @@ -1120,13 +1133,16 @@ static outgoing_file_wrapped copy_outgoing_file_to_sdcard_dir(final String filep
if (ret.file_size_wrapped < 1)
{
file2.delete();
Log.i(TAG, "copy_outgoing_file_to_sdcard_dir:006");
return null;
}

return ret;
}
catch (Exception e)
{
Log.i(TAG, "copy_outgoing_file_to_sdcard_dir:007:" + e.getMessage());
e.printStackTrace();
return null;
}
}
Expand Down
Loading

0 comments on commit 97c66ae

Please sign in to comment.