Merge branch 'audiorecorder-3.2.44'
This commit is contained in:
commit
13ea56adcf
5 changed files with 86 additions and 24 deletions
|
|
@ -10,8 +10,8 @@ android {
|
|||
applicationId "com.github.axet.audiorecorder"
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 26
|
||||
versionCode 301
|
||||
versionName "3.2.43"
|
||||
versionCode 302
|
||||
versionName "3.2.44"
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
|
|
@ -57,5 +57,5 @@ android {
|
|||
|
||||
dependencies {
|
||||
testImplementation 'junit:junit:4.12'
|
||||
implementation 'com.github.axet:android-audio-library:1.0.142' // implementation project(':android-audio-library')
|
||||
implementation 'com.github.axet:android-audio-library:1.0.143' // implementation project(':android-audio-library')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.github.axet.audiorecorder.activities;
|
|||
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
|
|
@ -24,16 +23,15 @@ import android.widget.ListView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.axet.androidlibrary.app.SuperUser;
|
||||
import com.github.axet.androidlibrary.services.StorageProvider;
|
||||
import com.github.axet.androidlibrary.widgets.AboutPreferenceCompat;
|
||||
import com.github.axet.androidlibrary.widgets.AppCompatThemeActivity;
|
||||
import com.github.axet.androidlibrary.widgets.ErrorDialog;
|
||||
import com.github.axet.androidlibrary.widgets.SearchView;
|
||||
import com.github.axet.audiolibrary.app.Recordings;
|
||||
import com.github.axet.audiolibrary.app.Storage;
|
||||
import com.github.axet.audiorecorder.R;
|
||||
import com.github.axet.audiorecorder.app.AudioApplication;
|
||||
import com.github.axet.audiorecorder.app.Recordings;
|
||||
import com.github.axet.audiorecorder.services.RecordingService;
|
||||
|
||||
public class MainActivity extends AppCompatThemeActivity {
|
||||
|
|
@ -47,8 +45,6 @@ public class MainActivity extends AppCompatThemeActivity {
|
|||
ListView list;
|
||||
Recordings recordings;
|
||||
Storage storage;
|
||||
View progressEmpty;
|
||||
View progressText;
|
||||
|
||||
ScreenReceiver receiver;
|
||||
|
||||
|
|
@ -74,9 +70,6 @@ public class MainActivity extends AppCompatThemeActivity {
|
|||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
progressEmpty = findViewById(R.id.progress_empty);
|
||||
progressText = findViewById(R.id.progress_text);
|
||||
|
||||
storage = new Storage(this);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
|
|
@ -93,6 +86,7 @@ public class MainActivity extends AppCompatThemeActivity {
|
|||
});
|
||||
|
||||
list = (ListView) findViewById(R.id.list);
|
||||
list.setEmptyView(findViewById(R.id.empty_list));
|
||||
recordings = new Recordings(this, list) {
|
||||
@Override
|
||||
public void showDialog(AlertDialog.Builder e) {
|
||||
|
|
@ -102,7 +96,6 @@ public class MainActivity extends AppCompatThemeActivity {
|
|||
}
|
||||
};
|
||||
list.setAdapter(recordings);
|
||||
list.setEmptyView(findViewById(R.id.empty_list));
|
||||
recordings.setToolbar((ViewGroup) findViewById(R.id.recording_toolbar));
|
||||
|
||||
RecordingService.startIfPending(this);
|
||||
|
|
@ -213,8 +206,8 @@ public class MainActivity extends AppCompatThemeActivity {
|
|||
@Override
|
||||
public void run() {
|
||||
final int selected = getLastRecording(last);
|
||||
progressEmpty.setVisibility(View.GONE);
|
||||
progressText.setVisibility(View.VISIBLE);
|
||||
recordings.progressEmpty.setVisibility(View.GONE);
|
||||
recordings.progressText.setVisibility(View.VISIBLE);
|
||||
if (selected != -1) {
|
||||
recordings.select(selected);
|
||||
list.smoothScrollToPosition(selected);
|
||||
|
|
@ -227,8 +220,8 @@ public class MainActivity extends AppCompatThemeActivity {
|
|||
}
|
||||
}
|
||||
};
|
||||
progressEmpty.setVisibility(View.VISIBLE);
|
||||
progressText.setVisibility(View.GONE);
|
||||
recordings.progressEmpty.setVisibility(View.VISIBLE);
|
||||
recordings.progressText.setVisibility(View.GONE);
|
||||
|
||||
recordings.load(!last.isEmpty(), done);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.github.axet.audiorecorder.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.axet.androidlibrary.widgets.ErrorDialog;
|
||||
import com.github.axet.audiorecorder.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Recordings extends com.github.axet.audiolibrary.app.Recordings {
|
||||
public View progressEmpty;
|
||||
public TextView progressText;
|
||||
public View refresh;
|
||||
|
||||
public Recordings(Context context, ListView list) {
|
||||
super(context, list);
|
||||
View empty = list.getEmptyView();
|
||||
progressEmpty = empty.findViewById(R.id.progress_empty);
|
||||
progressText = (TextView) empty.findViewById(android.R.id.text1);
|
||||
refresh = empty.findViewById(R.id.refresh);
|
||||
refresh.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
load(false, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Uri mount, boolean clean, Runnable done) {
|
||||
refresh.setVisibility(View.GONE);
|
||||
progressText.setText(R.string.recording_list_is_empty);
|
||||
if (!Storage.exists(getContext(), mount)) {
|
||||
clear();
|
||||
if (done != null)
|
||||
done.run();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
super.load(mount, clean, done);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "load", e);
|
||||
progressText.setText(ErrorDialog.toMessage(e));
|
||||
refresh.setVisibility(View.VISIBLE);
|
||||
clear();
|
||||
if (done != null)
|
||||
done.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -184,12 +184,19 @@ public class RecordingService extends Service {
|
|||
if (duration != null) {
|
||||
title += " (" + duration + ")";
|
||||
if (notificationIntent != null && notificationIntent.hasExtra("duration") && notificationIntent.getBooleanExtra("recording", false)) { // speed up
|
||||
RemoteViews a = new RemoteViews(getPackageName(), notification.contentView.getLayoutId());
|
||||
a.setTextViewText(R.id.title, title);
|
||||
RemoteViewsCompat.mergeRemoteViews(notification.contentView, a);
|
||||
if (Build.VERSION.SDK_INT >= 16 && notification.bigContentView != null)
|
||||
RemoteViewsCompat.mergeRemoteViews(notification.bigContentView, a);
|
||||
return notification;
|
||||
try {
|
||||
RemoteViews a = new RemoteViews(getPackageName(), notification.contentView.getLayoutId());
|
||||
a.setTextViewText(R.id.title, title);
|
||||
RemoteViewsCompat.mergeRemoteViews(notification.contentView, a);
|
||||
if (Build.VERSION.SDK_INT >= 16 && notification.bigContentView != null) {
|
||||
a = new RemoteViews(getPackageName(), notification.bigContentView.getLayoutId());
|
||||
a.setTextViewText(R.id.title, title);
|
||||
RemoteViewsCompat.mergeRemoteViews(notification.bigContentView, a);
|
||||
}
|
||||
return notification;
|
||||
} catch (RuntimeException e) {
|
||||
Log.d(TAG, "merge failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
text = ".../" + targetFile;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".activities.MainActivity"
|
||||
tools:showIn="@layout/activity_main">
|
||||
|
|
@ -42,8 +42,15 @@
|
|||
android:layout_margin="10dp"
|
||||
android:indeterminate="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/refresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_refresh_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progress_text"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue