Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling the app xml #2

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
66f92f4
Created Recording Page
ethanckim Dec 17, 2020
4ff854c
Added FAB
ethanckim Dec 17, 2020
4f5b3d6
Changed notifications to calendar
ethanckim Dec 17, 2020
170dc75
There are errors here
ethanckim Dec 28, 2020
a1f553b
Revert "There are errors here"
ethanckim Jan 3, 2021
5bc3194
Revert "Revert "There are errors here""
ethanckim Jan 3, 2021
d5e9ff4
Recording FAB Created
ethanckim Jan 3, 2021
ece2afc
Deleted Unused code
ethanckim Jan 3, 2021
bd99ed0
record in progress
ethanckim Jan 4, 2021
0f7706b
successful recording
ethanckim Jan 5, 2021
6a13afa
changed record file format to mp3
ethanckim Jan 5, 2021
97d40e5
Added Timer
ethanckim Jan 5, 2021
2cc734c
ms timer and audio visualizer
ethanckim Jan 5, 2021
8c3c9c0
Made audio visualizer appropriate speed
ethanckim Jan 5, 2021
b257a5a
Recordings List feature implemented
ethanckim Jan 5, 2021
f261de0
Adjusted top action bar
ethanckim Jan 5, 2021
68a9da8
To mp3
ethanckim Jan 5, 2021
92c7939
Sort list by most recent
ethanckim Jan 5, 2021
a397600
basic calendar UI
j97kang Jan 6, 2021
8a798e8
implement calendar fragment
j97kang Jan 6, 2021
f8f6671
Merge pull request #3 from SentimoApp/calendar-view
ethanckim Jan 6, 2021
5e44616
Update activity_audio_player.xml
ethanckim Jan 6, 2021
78040b5
Implemented Audio Player Feature
ethanckim Jan 6, 2021
0691e6a
Bug fixes regarding seek/rewind and closing activity
ethanckim Jan 6, 2021
165491d
Update single_list_item.xml
ethanckim Jan 6, 2021
ce798f8
Minor Design Changes
ethanckim Jan 6, 2021
8f99928
Improve Recording Quality
ethanckim Jan 6, 2021
af2a01d
Added Save Dialogue after recording
ethanckim Jan 6, 2021
383fb8c
enlarged some icons size
ethanckim Jan 6, 2021
f3d628e
Fix save message
ethanckim Jan 6, 2021
6034f38
fix navigation bugs
jayro0414 Jan 7, 2021
c580f60
Added welcome fragment and three onboarding screens (constraint layout).
floguo Jan 7, 2021
508c5e3
Added text styles to themes.xml and finished welcome page
floguo Jan 8, 2021
81f040a
fixed permission bug and created recording animation
ethanckim Jan 9, 2021
728bbc0
save file when leaving during recording.
ethanckim Jan 10, 2021
2fe96dc
implement days ago
ethanckim Jan 10, 2021
392cd48
Swipe to refresh
ethanckim Jan 10, 2021
a47248b
Reworked single recording data structure
ethanckim Jan 10, 2021
ff028dc
Update single_list_item.xml
ethanckim Jan 10, 2021
d132646
Update AudioListAdapter.java
ethanckim Jan 10, 2021
524bd6f
Implemented Delete File
ethanckim Jan 10, 2021
5b207b8
Update RecordActivity.java
ethanckim Jan 10, 2021
9533220
Fixed delete bug
ethanckim Jan 10, 2021
11f5f07
Implemented Rename
ethanckim Jan 11, 2021
172fb42
Implement Share file
ethanckim Jan 11, 2021
7c7240c
Removed Nav Bar
ethanckim Feb 18, 2021
a0d8d56
Replaced action bar with appropriate headings
ethanckim Feb 18, 2021
a85d3e9
Splash Screen and minor aesthetic Improvements
ethanckim Feb 18, 2021
a45898c
Merge branch 'onboarding_sequence_new' into styling-the-app-xml
ethanckim Feb 18, 2021
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
.idea/.name
5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
Expand Down Expand Up @@ -37,7 +38,12 @@ dependencies {
implementation 'androidx.navigation:navigation-ui:2.3.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'org.naishadhparmar.zcustomcalendar:zcustomcalendar:1.0.1'
implementation 'com.github.Armen101:AudioRecordView:1.0.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}
36 changes: 32 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,43 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Sentimo">
<activity
android:name=".MainActivity"
android:label="@string/app_name">

<activity android:name=".SplashScreenActivity"
android:theme="@style/SplashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name">
</activity>
<activity
android:name=".AudioPlayerActivity"
android:label="@string/audio_player_label">
</activity>
<activity
android:name=".RecordActivity"
android:label="@string/recorder_label">

</activity>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

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

</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
215 changes: 215 additions & 0 deletions app/src/main/java/ca/uwaterloo/sentimo/AudioPlayerActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
package ca.uwaterloo.sentimo;

import androidx.appcompat.app.AppCompatActivity;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.TextView;

import java.io.File;
import java.io.IOException;

public class AudioPlayerActivity extends AppCompatActivity {

private TextView txtDescription, txtFilename, txtDate, txtSeekPos, txtSeekDur;
private ImageButton btnPlay, btnFor, btnRev;
private SeekBar seekBar;

private MediaPlayer mediaPlayer;
private Runnable updateSeekBar;
private Handler seekBarHandler = new Handler();

private static boolean isPlaying = false;
private File fileToPlay;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audio_player);
fileToPlay = (File) getIntent().getSerializableExtra("FILE_TO_PLAY");

txtDate = findViewById(R.id.player_moddate_txt);
txtDescription = findViewById(R.id.player_description_txt);
txtFilename = findViewById(R.id.player_filename_txt);
txtSeekDur = findViewById(R.id.player_duration_txt);
txtSeekPos = findViewById(R.id.player_position_txt);
btnPlay = findViewById(R.id.player_play_btn);
btnFor = findViewById(R.id.player_forward_btn);
btnRev = findViewById(R.id.player_reverse_btn);
seekBar = findViewById(R.id.player_seekbar);

playAudio();

btnPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isPlaying)
pauseAudio();
else
resumeAudio();
}
});

btnFor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isPlaying)
resumeAudio();
int currentPos = mediaPlayer.getCurrentPosition();
int duration = mediaPlayer.getDuration();
if (currentPos + 5000 >= duration)
{
// go to end of audio file and pause.
txtSeekPos.setText(Utils.formatMilliSeccond(currentPos));
seekBar.setProgress(seekBar.getMax());
mediaPlayer.seekTo(duration);
pauseAudio();
} else {
// fast forward 5 secs.
currentPos = currentPos + 5000;
txtSeekPos.setText(Utils.formatMilliSeccond(currentPos));
mediaPlayer.seekTo(currentPos);
}
}
});

btnRev.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isPlaying)
resumeAudio();
int currentPos = mediaPlayer.getCurrentPosition();
int duration = mediaPlayer.getDuration();
if (currentPos - 5000 < 0)
{
// go to beginning of audio file
txtSeekPos.setText("0:00");
mediaPlayer.seekTo(0);
} else {
// rewind 5 secs.
currentPos = currentPos - 5000;
txtSeekPos.setText(Utils.formatMilliSeccond(currentPos));
mediaPlayer.seekTo(currentPos);
}
}
});

seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
mediaPlayer.seekTo(progress);
}
txtSeekPos.setText(Utils.formatMilliSeccond(mediaPlayer.getCurrentPosition()));
}

@Override
public void onStartTrackingTouch(SeekBar seekBar) {
pauseAudio();
}

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
int progress = seekBar.getProgress();
mediaPlayer.seekTo(progress);
resumeAudio();
}
});

mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
pauseAudio();
}
});
}

@Override
protected void onStop() {
super.onStop();
if (isPlaying)
stopAudio();
}

private void pauseAudio() {
mediaPlayer.pause();
btnPlay.setImageDrawable(getDrawable(R.drawable.ic_play_arrow_36dp));
isPlaying = false;
seekBarHandler.removeCallbacks(updateSeekBar);
}

private void resumeAudio() {
mediaPlayer.start();
btnPlay.setImageDrawable(getDrawable(R.drawable.ic_baseline_pause_36dp));
isPlaying = true;
updateRunnable();
seekBarHandler.postDelayed(updateSeekBar, 0);
}

private void stopAudio() {
//Stops The Audio Completely.
isPlaying = false;
mediaPlayer.pause();
mediaPlayer.stop();
mediaPlayer.release();
seekBarHandler.removeCallbacks(updateSeekBar);
}

private void playAudio() {
mediaPlayer = new MediaPlayer();
try {
mediaPlayer.setDataSource(fileToPlay.getAbsolutePath());
mediaPlayer.prepare();
mediaPlayer.start();
} catch (IOException e) {
e.printStackTrace();
}
btnPlay.setImageDrawable(getDrawable(R.drawable.ic_baseline_pause_36dp));
txtFilename.setText(fileToPlay.getName());
txtDate.setText(Utils.formatDateModified(fileToPlay.lastModified()));
//Play the audio
isPlaying = true;
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
pauseAudio();
}
});
// set seekbar max value
seekBar.setMax(mediaPlayer.getDuration());
// set audio duration
txtSeekDur.setText(Utils.formatMilliSeccond(mediaPlayer.getDuration()));

seekBarHandler = new Handler();
updateRunnable();
seekBarHandler.postDelayed(updateSeekBar, 0);
}

private void updateRunnable() {
updateSeekBar = new Runnable() {
@Override
public void run() {
seekBar.setProgress(mediaPlayer.getCurrentPosition());
seekBarHandler.postDelayed(this, 500);
}
};
}

}













22 changes: 18 additions & 4 deletions app/src/main/java/ca/uwaterloo/sentimo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package ca.uwaterloo.sentimo;

import android.content.Intent;
import android.os.Bundle;

import com.google.android.material.bottomnavigation.BottomNavigationView;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;

public class MainActivity extends AppCompatActivity {

@Override
Expand All @@ -20,11 +24,21 @@ protected void onCreate(Bundle savedInstanceState) {
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)
R.id.navigation_recordingList, R.id.navigation_dashboard, R.id.navigation_calendar)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_activity_main);
setSupportActionBar(toolbar);
NavigationUI.setupWithNavController(navView, navController);
// Not using toolbar to display titles/headings anymore
// NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
FloatingActionButton fab = findViewById(R.id.fab_record);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, RecordActivity.class));
}
});
}

}
Loading