Skip to content
This repository has been archived by the owner on Apr 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from Arjun-sna/dev
Browse files Browse the repository at this point in the history
UI updates
  • Loading branch information
Arjun authored Sep 29, 2017
2 parents a438b46 + f3d7514 commit 7e6aacc
Show file tree
Hide file tree
Showing 25 changed files with 492 additions and 126 deletions.
15 changes: 9 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "in.arjsna.audiorecorder"
minSdkVersion 16
targetSdkVersion 26
versionCode 3
versionName "3.0"
versionCode 4
versionName "3.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -39,10 +39,10 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:recyclerview-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:design:26.1.0'

compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
Expand All @@ -59,4 +59,7 @@ dependencies {
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
provided 'javax.annotation:jsr250-api:1.0'
compile 'javax.inject:javax.inject:1'

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity
android:name="in.arjsna.audiorecorder.activities.MainActivity"
android:screenOrientation="portrait"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Application;
import com.orhanobut.hawk.Hawk;
import com.squareup.leakcanary.LeakCanary;
import in.arjsna.audiorecorder.di.components.ApplicationComponent;
import in.arjsna.audiorecorder.di.components.DaggerApplicationComponent;
import in.arjsna.audiorecorder.di.modules.ApplicationModule;
Expand All @@ -11,6 +12,10 @@ public class AudioRecorderApp extends Application {

@Override public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
Hawk.init(getApplicationContext()).build();
applicationComponent =
DaggerApplicationComponent.builder().applicationModule(new ApplicationModule(this)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import in.arjsna.audiorecorder.R;
import in.arjsna.audiorecorder.playlist.PlayListFragment;
import in.arjsna.audiorecorder.mvpbase.BaseActivity;
import in.arjsna.audiorecorder.playlist.PlayListFragment;

public class PlayListActivity extends BaseActivity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import in.arjsna.audiorecorder.R;
import in.arjsna.audiorecorder.settings.SettingsFragment;
import in.arjsna.audiorecorder.mvpbase.BaseActivity;
import in.arjsna.audiorecorder.settings.SettingsFragment;

public class SettingsActivity extends BaseActivity {
@Override public void onCreate(@Nullable Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import in.arjsna.audiorecorder.activities.PlayListActivity;
import in.arjsna.audiorecorder.activities.SettingsActivity;
import in.arjsna.audiorecorder.audiovisualization.GLAudioVisualizationView;
import in.arjsna.audiorecorder.di.qualifiers.ActivityContext;
import in.arjsna.audiorecorder.di.components.ActivityComponent;
import in.arjsna.audiorecorder.di.qualifiers.ActivityContext;
import in.arjsna.audiorecorder.mvpbase.BaseFragment;
import in.arjsna.audiorecorder.recordingservice.AudioRecordService;
import in.arjsna.audiorecorder.recordingservice.AudioRecorder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package in.arjsna.audiorecorder.db;

import android.arch.persistence.room.Entity;
import android.arch.persistence.room.Ignore;
import android.arch.persistence.room.PrimaryKey;
import android.os.Parcel;
import android.os.Parcelable;
Expand All @@ -15,6 +16,14 @@ public class RecordingItem implements Parcelable {
private long mLength; // length of recording in seconds
private long mTime; // date/time of the recording

@Ignore
public boolean isPlaying = false;

@Ignore
public boolean isPaused;
@Ignore
public long playProgress;

public RecordingItem() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import in.arjsna.audiorecorder.activities.MainActivity;
import in.arjsna.audiorecorder.activities.PlayListActivity;
import in.arjsna.audiorecorder.activities.SettingsActivity;
import in.arjsna.audiorecorder.di.scopes.ActivityScope;
import in.arjsna.audiorecorder.di.modules.ActivityModule;
import in.arjsna.audiorecorder.audiorecording.RecordFragment;
import in.arjsna.audiorecorder.di.modules.ActivityModule;
import in.arjsna.audiorecorder.di.scopes.ActivityScope;
import in.arjsna.audiorecorder.playlist.PlayListFragment;

@ActivityScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import dagger.Component;
import in.arjsna.audiorecorder.AudioRecorderApp;
import in.arjsna.audiorecorder.db.RecordItemDataSource;
import in.arjsna.audiorecorder.di.qualifiers.ApplicationContext;
import in.arjsna.audiorecorder.di.modules.ApplicationModule;
import in.arjsna.audiorecorder.di.qualifiers.ApplicationContext;
import javax.inject.Singleton;

@Singleton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package in.arjsna.audiorecorder.di.components;

import dagger.Component;
import in.arjsna.audiorecorder.di.scopes.ServiceScope;
import in.arjsna.audiorecorder.di.modules.ServiceModule;
import in.arjsna.audiorecorder.di.scopes.ServiceScope;
import in.arjsna.audiorecorder.recordingservice.AudioRecordService;

@ServiceScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.support.v7.widget.LinearLayoutManager;
import dagger.Module;
import dagger.Provides;
import in.arjsna.audiorecorder.playlist.PlayListAdapter;
import in.arjsna.audiorecorder.audiorecording.AudioRecordMVPView;
import in.arjsna.audiorecorder.audiorecording.AudioRecordPresenter;
import in.arjsna.audiorecorder.audiorecording.AudioRecordPresenterImpl;
Expand All @@ -14,7 +13,6 @@
import in.arjsna.audiorecorder.playlist.PlayListPresenter;
import in.arjsna.audiorecorder.playlist.PlayListPresenterImpl;
import io.reactivex.disposables.CompositeDisposable;
import java.util.ArrayList;

@Module
public class ActivityModule {
Expand Down Expand Up @@ -43,12 +41,6 @@ LinearLayoutManager provideLinearLayoutManager(@ActivityContext AppCompatActivit
return new LinearLayoutManager(context);
}

@Provides
@ActivityScope
PlayListAdapter providesPlayListAdapter(@ActivityContext AppCompatActivity context) {
return new PlayListAdapter(context, new ArrayList<>());
}

@Provides
@ActivityScope
AudioRecordPresenter<AudioRecordMVPView> provideAudioRecordPresenter(
Expand Down
89 changes: 89 additions & 0 deletions app/src/main/java/in/arjsna/audiorecorder/libs/FillSeekBar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package in.arjsna.audiorecorder.libs;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import in.arjsna.audiorecorder.R;
import in.arjsna.audiorecorder.theme.ThemedActivity;

public class FillSeekBar extends FrameLayout {
private final int mFillColor;
private long mProgress = 0;
private Solid mSolid;

private final int DEFAULT_FILL_COLOR = Color.WHITE;
private double mMaxValue = 1.0;

public FillSeekBar(Context context, AttributeSet attrs) {
super(context, attrs);
//load styled attributes.
final TypedArray attributes = context.getTheme()
.obtainStyledAttributes(attrs, R.styleable.FillSeekBar, R.attr.fillseekbarViewStyle, 0);
mFillColor =
((ThemedActivity) context).getPrimaryColor();
mProgress = attributes.getInt(R.styleable.FillSeekBar_progress, 0);
attributes.recycle();
mSolid = new Solid(context, null);
mSolid.initPaint(mFillColor);
addView(mSolid, 0, LayoutParams.MATCH_PARENT);
}

public void setMaxVal(double maxVal) {
this.mMaxValue = maxVal;
}

public void setProgress(long progress) {
mProgress = progress > mMaxValue ? (long) mMaxValue : progress;
computeProgressRight();
}

private void computeProgressRight() {
int mSolidRight = (int) (getWidth() * (1f - mProgress / mMaxValue));
//Log.i("Stats ", mSolidRight + " " + mProgress);
ViewGroup.LayoutParams params = mSolid.getLayoutParams();
if (params != null) {
((LayoutParams) params).width = getWidth() - mSolidRight;
}
mSolid.setLayoutParams(params);
}

private static class Solid extends View {

private Paint progressPaint;

public Solid(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

public Solid(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.weight = 1;
setLayoutParams(params);
}

public void initPaint(int mFillColor) {
progressPaint = new Paint();
progressPaint.setColor(mFillColor);
progressPaint.setAlpha(125);
progressPaint.setStyle(Paint.Style.FILL);
progressPaint.setAntiAlias(true);
}

@Override protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//Log.i("Statsinneer ", getRight() + " ");
canvas.drawRect(getLeft(), 0, getWidth(), getBottom(), progressPaint);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

public interface IMVPPresenter<V extends IMVPView> {
void onAttach(V view);

void onDetach();
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ private void stopPlaying() {
if (mMediaPlayer != null) {

int mCurrentPosition = mMediaPlayer.getCurrentPosition();
Log.i("Seekbar", " " + mCurrentPosition);
mSeekBar.setProgress(mCurrentPosition);

long minutes = TimeUnit.MILLISECONDS.toMinutes(mCurrentPosition);
Expand Down

This file was deleted.

Loading

0 comments on commit 7e6aacc

Please sign in to comment.