Skip to content

Commit

Permalink
Merge branch 'feature/item_options'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimowner committed Aug 17, 2019
2 parents 2bafbb7 + 6c63532 commit 8178981
Show file tree
Hide file tree
Showing 66 changed files with 2,455 additions and 492 deletions.
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ ext.versions = [
]

def versionMajor = 0
def versionMinor = 5
def versionPatch = 18
def versionMinor = 6
def versionPatch = 2

android {
compileSdkVersion versions.targetSdkVersion
Expand Down Expand Up @@ -59,9 +59,9 @@ android {

buildTypes {
release {
minifyEnabled false
shrinkResources false
useProguard false
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
Expand Down Expand Up @@ -98,9 +98,9 @@ android {
}
}

//repositories {
// maven { url 'https://maven.fabric.io/public' }
//}
repositories {
maven { url 'https://maven.fabric.io/public' }
}

// Remove not needed buildVariants.
android.variantFilter { variant ->
Expand Down
2 changes: 2 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep class com.dimowner.audiorecorder.** { *; }
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@
android:screenOrientation="portrait"/>
<activity android:name="com.dimowner.audiorecorder.app.settings.SettingsActivity"
android:screenOrientation="portrait"/>
<activity android:name="com.dimowner.audiorecorder.app.info.ActivityInformation"
android:screenOrientation="portrait"/>

<service android:name="com.dimowner.audiorecorder.app.RecordingService" />
<service android:name="com.dimowner.audiorecorder.app.PlaybackService" />

<!--<meta-data-->
<!--android:name="io.fabric.ApiKey"-->
<!--android:value="@string/fabric_api_key" />-->
<!--android:value="" />-->

<receiver android:name=".app.RecordingService$StopRecordingReceiver" />
<receiver android:name=".app.PlaybackService$StopPlaybackReceiver" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ private AppConstants() {}
public static final int RECORDING_FORMAT_M4A = 0;
public static final int RECORDING_FORMAT_WAV = 1;

public static final int DEFAULT_PER_PAGE = 50;

//BEGINNING-------------- Waveform visualisation constants ----------------------------------

/** Density pixel count per one second of time.
Expand Down Expand Up @@ -73,6 +75,10 @@ private AppConstants() {}
public final static int RECORD_ENCODING_BITRATE_128000 = 128000;
public final static int RECORD_ENCODING_BITRATE_192000 = 192000;

public static final int SORT_DATE = 1;
public static final int SORT_NAME = 2;
public static final int SORT_DURATION = 3;

// public final static int RECORD_AUDIO_CHANNELS_COUNT = 2;
public final static int RECORD_AUDIO_MONO = 1;
public final static int RECORD_AUDIO_STEREO = 2;
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/dimowner/audiorecorder/Contract.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface View {
void showError(String message);

void showError(int resId);

void showMessage(int resId);
}

interface UserActionsListener<T extends View> {
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/com/dimowner/audiorecorder/Injector.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class Injector {
private BackgroundQueue recordingTasks;
private BackgroundQueue importTasks;
private BackgroundQueue processingTasks;
private BackgroundQueue copyTasks;

private MainContract.UserActionsListener mainPresenter;
private RecordsContract.UserActionsListener recordsPresenter;
Expand Down Expand Up @@ -105,6 +106,13 @@ public BackgroundQueue provideProcessingTasksQueue() {
return processingTasks;
}

public BackgroundQueue provideCopyTasksQueue() {
if (copyTasks == null) {
copyTasks = new BackgroundQueue("CopyTasks");
}
return copyTasks;
}

public ColorMap provideColorMap() {
return ColorMap.getInstance(providePrefs());
}
Expand Down Expand Up @@ -133,8 +141,8 @@ public MainContract.UserActionsListener provideMainPresenter() {
public RecordsContract.UserActionsListener provideRecordsPresenter() {
if (recordsPresenter == null) {
recordsPresenter = new RecordsPresenter(provideLocalRepository(), provideFileRepository(),
provideLoadingTasksQueue(), provideRecordingTasksQueue(), provideAudioPlayer(),
provideAppRecorder(), providePrefs());
provideLoadingTasksQueue(), provideRecordingTasksQueue(), provideCopyTasksQueue(),
provideAudioPlayer(), provideAppRecorder(), providePrefs());
}
return recordsPresenter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import com.dimowner.audiorecorder.data.Prefs;
import com.dimowner.audiorecorder.data.database.LocalRepository;
import com.dimowner.audiorecorder.exception.AppException;
import com.dimowner.audiorecorder.exception.CantProcessRecord;
import com.dimowner.audiorecorder.util.AndroidUtils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import timber.log.Timber;
Expand Down Expand Up @@ -113,7 +113,12 @@ public void run() {
onRecordFinishProcessing();
}
});
} catch (IOException e) {
} catch (IOException | OutOfMemoryError e) {
AndroidUtils.runOnUIThread(new Runnable() {
@Override public void run() {
onError(new CantProcessRecord());
}
});
Timber.e(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Copyright 2019 Dmitriy Ponomarenko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.dimowner.audiorecorder.app.info;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dimowner.audiorecorder.ARApplication;
import com.dimowner.audiorecorder.ColorMap;
import com.dimowner.audiorecorder.R;
import com.dimowner.audiorecorder.util.AndroidUtils;
import com.dimowner.audiorecorder.util.TimeUtils;

public class ActivityInformation extends Activity {

private static final String KEY_NAME = "pref_name";
private static final String KEY_FORMAT = "pref_format";
private static final String KEY_DURATION = "pref_duration";
private static final String KEY_SIZE = "pref_size";
private static final String KEY_LOCATION = "pref_location";

private ColorMap colorMap;


public static Intent getStartIntent(Context context, String name, String format, long duration, long size, String location) {
Intent intent = new Intent(context, ActivityInformation.class);
intent.putExtra(KEY_NAME, name);
intent.putExtra(KEY_FORMAT, format);
intent.putExtra(KEY_DURATION, duration);
intent.putExtra(KEY_SIZE, size);
intent.putExtra(KEY_LOCATION, location);
return intent;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
colorMap = ARApplication.getInjector().provideColorMap();
setTheme(colorMap.getAppThemeResource());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info);

getWindow().setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
LinearLayout toolbar = findViewById(R.id.toolbar);
toolbar.setPadding(0, AndroidUtils.getStatusBarHeight(getApplicationContext()), 0, 0);

Bundle extras = getIntent().getExtras();
TextView txtName = findViewById(R.id.txt_name);
TextView txtFormat = findViewById(R.id.txt_format);
TextView txtDuration = findViewById(R.id.txt_duration);
TextView txtSize = findViewById(R.id.txt_size);
TextView txtLocation = findViewById(R.id.txt_location);

if (extras != null) {
if (extras.containsKey(KEY_NAME)) {
txtName.setText(extras.getString(KEY_NAME));
}
if (extras.containsKey(KEY_FORMAT)) {
txtFormat.setText(extras.getString(KEY_FORMAT));
}
if (extras.containsKey(KEY_DURATION)) {
txtDuration.setText(TimeUtils.formatTimeIntervalHourMinSec2(extras.getLong(KEY_DURATION)));
}
if (extras.containsKey(KEY_SIZE)) {
txtSize.setText(AndroidUtils.formatSize(extras.getLong(KEY_SIZE)));
}
if (extras.containsKey(KEY_LOCATION)) {
txtLocation.setText(extras.getString(KEY_LOCATION));
}
}

findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
Loading

0 comments on commit 8178981

Please sign in to comment.