Merge branch 'audiorecorder-3.2.45'

This commit is contained in:
Alexey Kuznetsov 2018-12-17 15:04:19 +03:00
commit 3454226007
4 changed files with 25 additions and 21 deletions

View file

@ -10,8 +10,8 @@ android {
applicationId "com.github.axet.audiorecorder"
minSdkVersion 9
targetSdkVersion 26
versionCode 302
versionName "3.2.44"
versionCode 303
versionName "3.2.45"
}
signingConfigs {
release {

View file

@ -105,7 +105,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
muted = new ErrorDialog(RecordingActivity.this, getString(R.string.mic_muted_pie)).setTitle(getString(R.string.mic_muted_error)).show();
else
muted = ErrorDialog.Error(RecordingActivity.this, getString(R.string.mic_muted_error));
RecordingActivity.startActivity(RecordingActivity.this, true);
RecordingActivity.startActivity(RecordingActivity.this);
}
if (msg.what == AudioApplication.RecordingStorage.UNMUTED) {
if (muted != null) {
@ -144,7 +144,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
new ErrorDialog(RecordingActivity.this, getString(R.string.mic_muted_pie)).setTitle(text).show();
else
ErrorDialog.Error(RecordingActivity.this, getString(R.string.mic_muted_error));
RecordingActivity.startActivity(RecordingActivity.this, true);
RecordingActivity.startActivity(RecordingActivity.this);
}
}
if (msg.what == AudioApplication.RecordingStorage.ERROR)
@ -162,6 +162,13 @@ public class RecordingActivity extends AppCompatThemeActivity {
context.startActivity(i);
}
public static void startActivity(Context context) {
Log.d(TAG, "startActivity");
Intent i = new Intent(context, RecordingActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(i);
}
class RecordingReceiver extends BluetoothReceiver {
@Override
public void onConnected() {
@ -412,6 +419,12 @@ public class RecordingActivity extends AppCompatThemeActivity {
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
void loadSamples() {
File f = recording.storage.getTempRecording();
if (!f.exists()) {
@ -535,7 +548,8 @@ public class RecordingActivity extends AppCompatThemeActivity {
}
void stopRecording() {
recording.stopRecording();
if (recording != null) // not possible, but some devices do not call onCreate
recording.stopRecording();
AudioApplication.from(this).recording = null;
handler.removeCallbacks(receiver.connected);
pitch.stop();
@ -605,7 +619,7 @@ public class RecordingActivity extends AppCompatThemeActivity {
int m = Sound.getChannels(this);
int c = Sound.DEFAULT_AUDIOFORMAT == AudioFormat.ENCODING_PCM_16BIT ? 2 : 1;
long perSec = (c * m * rate);
long perSec = c * m * rate;
String ext = shared.getString(AudioApplication.PREFERENCE_ENCODING, "");

View file

@ -71,9 +71,7 @@ public class SettingsActivity extends AppCompatSettingsThemeActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
storage = new Storage(this);
setupActionBar();
getSupportFragmentManager().beginTransaction().replace(android.R.id.content, new GeneralPreferenceFragment()).commit();
}
@ -99,16 +97,6 @@ public class SettingsActivity extends AppCompatSettingsThemeActivity implements
return super.onOptionsItemSelected(item);
}
/**
* This method stops fragment injection in malicious applications.
* Make sure to deny any unknown fragments here.
*/
@TargetApi(11)
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
|| GeneralPreferenceFragment.class.getName().equals(fragmentName);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
super.onSharedPreferenceChanged(sharedPreferences, key);

View file

@ -183,7 +183,7 @@ public class RecordingService extends Service {
title = getString(R.string.pause_title);
if (duration != null) {
title += " (" + duration + ")";
if (notificationIntent != null && notificationIntent.hasExtra("duration") && notificationIntent.getBooleanExtra("recording", false)) { // speed up
if (recording && notificationIntent != null && notificationIntent.hasExtra("duration") && notificationIntent.getBooleanExtra("recording", false)) { // speed up
try {
RemoteViews a = new RemoteViews(getPackageName(), notification.contentView.getLayoutId());
a.setTextViewText(R.id.title, title);
@ -203,8 +203,10 @@ public class RecordingService extends Service {
builder = new RemoteNotificationCompat.Builder(this, R.layout.notifictaion);
builder.setViewVisibility(R.id.notification_record, View.GONE);
builder.setViewVisibility(R.id.notification_pause, View.VISIBLE);
main = PendingIntent.getService(this, 0, new Intent(this, RecordingService.class).setAction(SHOW_ACTIVITY)
.putExtra("targetFile", targetFile).putExtra("recording", recording), PendingIntent.FLAG_UPDATE_CURRENT);
main = PendingIntent.getService(this, 0, new Intent(this, RecordingService.class)
.setAction(SHOW_ACTIVITY)
.putExtra("targetFile", targetFile)
.putExtra("recording", recording), PendingIntent.FLAG_UPDATE_CURRENT);
}
PendingIntent pe = PendingIntent.getService(this, 0,