old phones api 9

This commit is contained in:
Alexey Kuznetsov 2016-12-22 02:53:13 +03:00
commit f02bcb9ded
8 changed files with 151 additions and 16 deletions

View file

@ -6,7 +6,7 @@ android {
defaultConfig {
applicationId "com.github.axet.audiorecorder"
minSdkVersion 16
minSdkVersion 9
targetSdkVersion 23
versionCode 89
versionName "1.2.1"
@ -38,11 +38,10 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:preference-v14:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'org.apache.commons:commons-math3:3.6.1'
compile 'com.github.axet:android-library:1.6.7' // project(':android-library')
compile 'com.github.axet:android-library:1.6.8' // compile project(':android-library')
}

View file

@ -130,7 +130,19 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
shared.registerOnSharedPreferenceChangeListener(this);
getFragmentManager().beginTransaction().replace(android.R.id.content, new GeneralPreferenceFragment()).commit();
if (Build.VERSION.SDK_INT < 11) {
addPreferencesFromResource(R.xml.pref_general);
bindPreferenceSummaryToValue(findPreference(MainApplication.PREFERENCE_STORAGE));
Preference rate = findPreference(MainApplication.PREFERENCE_ENCODING);
getPreferenceScreen().removePreference(rate);
bindPreferenceSummaryToValue(findPreference(MainApplication.PREFERENCE_RATE));
bindPreferenceSummaryToValue(findPreference(MainApplication.PREFERENCE_THEME));
bindPreferenceSummaryToValue(findPreference(MainApplication.PREFERENCE_CHANNELS));
} else {
getFragmentManager().beginTransaction().replace(android.R.id.content, new GeneralPreferenceFragment()).commit();
}
}
/**
@ -230,7 +242,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@TargetApi(11)
public static class GeneralPreferenceFragment extends PreferenceFragment {
public GeneralPreferenceFragment() {
}

View file

@ -5,11 +5,8 @@ import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Build;
import android.os.IBinder;
import android.support.annotation.Nullable;
@ -153,6 +150,10 @@ public class RecordingService extends Service {
.setSmallIcon(R.drawable.ic_mic_24dp)
.setContent(view);
if (Build.VERSION.SDK_INT < 11) {
builder.setContentIntent(main);
}
if (Build.VERSION.SDK_INT >= 21)
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);

View file

@ -0,0 +1,61 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.github.axet.androidlibrary.widgets.StoragePathPreference
android:defaultValue="Audio Recorder"
android:key="storage_path"
android:summary="/sdcard/some/"
android:title="Папка для хранения" />
<ListPreference
android:defaultValue="16000"
android:entries="@array/sample_rate_text"
android:entryValues="@array/sample_rate_values"
android:key="sample_rate"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="44100"
android:title="Частота записи" />
<ListPreference
android:defaultValue="wav"
android:entries="@array/encodings_text"
android:entryValues="@array/encodings_values"
android:key="encoding"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="Формат выходного файла (.wav, .m4a, ...)"
android:title="Кодировка" />
<ListPreference
android:defaultValue="1"
android:entries="@array/channels_text"
android:entryValues="@array/channels_values"
android:key="channels"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="Режим записи"
android:title="Режим" />
<SwitchPreference
android:defaultValue="true"
android:key="call"
android:summary="Останавливать запись на время разговора по телефону"
android:title="Пауза на время разговора" />
<SwitchPreference
android:defaultValue="true"
android:key="silence"
android:summary="Включать беззвучный режим на время записи"
android:title="Режим тишины" />
<ListPreference
android:defaultValue="Theme_White"
android:entries="@array/themes_text"
android:entryValues="@array/themes_values"
android:key="theme"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="Установить тему приложения (темная / светлая)"
android:title="Тема приложения" />
</PreferenceScreen>

View file

@ -36,13 +36,13 @@
android:summary="Режим записи"
android:title="Режим" />
<SwitchPreference
<CheckBoxPreference
android:defaultValue="true"
android:key="call"
android:summary="Останавливать запись на время разговора по телефону"
android:title="Пауза на время разговора" />
<SwitchPreference
<CheckBoxPreference
android:defaultValue="true"
android:key="silence"
android:summary="Включать беззвучный режим на время записи"

View file

@ -0,0 +1,61 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.github.axet.androidlibrary.widgets.StoragePathPreference
android:defaultValue="Audio Recorder"
android:key="storage_path"
android:summary="/sdcard/some/"
android:title="Storage Path" />
<ListPreference
android:defaultValue="16000"
android:entries="@array/sample_rate_text"
android:entryValues="@array/sample_rate_values"
android:key="sample_rate"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="44100"
android:title="Sample Rate" />
<ListPreference
android:defaultValue="wav"
android:entries="@array/encodings_text"
android:entryValues="@array/encodings_values"
android:key="encoding"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="Output file formats (.wav, .m4a, ...)"
android:title="Encoding" />
<ListPreference
android:defaultValue="1"
android:entries="@array/channels_text"
android:entryValues="@array/channels_values"
android:key="channels"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="Recording channels"
android:title="Mode" />
<SwitchPreference
android:defaultValue="true"
android:key="call"
android:summary="Stop recording on answering and continue on hangup"
android:title="Pause recording during calls" />
<SwitchPreference
android:defaultValue="true"
android:key="silence"
android:summary="Put phone in 'silence mode' during recording"
android:title="Silence mode" />
<ListPreference
android:defaultValue="Theme_White"
android:entries="@array/themes_text"
android:entryValues="@array/themes_values"
android:key="theme"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:summary="Set application theme (dark / light)"
android:title="Application Theme" />
</PreferenceScreen>

View file

@ -36,13 +36,13 @@
android:summary="Recording channels"
android:title="Mode" />
<SwitchPreference
<CheckBoxPreference
android:defaultValue="true"
android:key="call"
android:summary="Stop recording on answering and continue on hangup"
android:title="Pause recording during calls" />
<SwitchPreference
<CheckBoxPreference
android:defaultValue="true"
android:key="silence"
android:summary="Put phone in 'silence mode' during recording"

View file

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@ -15,6 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
mavenLocal()
}
}