add custom colors

This commit is contained in:
Alexey Kuznetsov 2017-07-06 16:44:56 +03:00
commit eaafb252e6
7 changed files with 30 additions and 23 deletions

View file

@ -43,5 +43,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.github.axet:android-audio-library:1.0.17' // compile project(':android-audio-library')
compile 'com.github.axet:android-audio-library:1.0.18' // compile project(':android-audio-library')
}

View file

@ -10,7 +10,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
@ -20,8 +19,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.provider.DocumentsContract;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.telephony.PhoneStateListener;
@ -203,7 +200,7 @@ public class RecordingActivity extends AppCompatActivity {
return;
}
title.setText(storage.getDocumentName(targetUri));
title.setText(Storage.getDocumentName(targetUri));
if (shared.getBoolean(MainApplication.PREFERENCE_CALL, false)) {
TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
@ -822,7 +819,7 @@ public class RecordingActivity extends AppCompatActivity {
if (s.startsWith(ContentResolver.SCHEME_CONTENT)) {
out = storage.getTempEncoding();
} else if (s.startsWith(ContentResolver.SCHEME_FILE)) {
out = new File(targetUri.getPath());
out = Storage.getFile(targetUri);
} else {
throw new RuntimeException("unkonwn uri");
}

View file

@ -9,6 +9,10 @@ public class MainApplication extends com.github.axet.audiolibrary.app.MainApplic
public static final String PREFERENCE_CONTROLS = "controls";
public static final String PREFERENCE_TARGET = "target";
public int getUserTheme() {
return getTheme(this, R.style.RecThemeLight, R.style.RecThemeDark);
}
@Override
public void onCreate() {
super.onCreate();

View file

@ -6,11 +6,8 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceManager;
import android.provider.DocumentsContract;
import android.webkit.MimeTypeMap;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Storage extends com.github.axet.audiolibrary.app.Storage {
@ -38,7 +35,7 @@ public class Storage extends com.github.axet.audiolibrary.app.Storage {
Uri n = getNextFile(path, format, ext);
return n;
} else if (s.startsWith(ContentResolver.SCHEME_FILE)) {
File f = new File(path.getPath());
File f = getFile(path);
if (!f.exists() && !f.mkdirs()) {
throw new RuntimeException("Unable to create: " + path);
}

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -39,7 +40,9 @@
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_centerInParent="true"
android:padding="5dp" />
android:padding="5dp"
app:cutColor="?attr/cutColor"
app:recColor="?attr/recColor" />
<FrameLayout
android:layout_width="match_parent"
@ -57,16 +60,16 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/roundButton"
android:src="@drawable/ic_content_cut_24dp"
android:contentDescription="@string/cut_button" />
android:contentDescription="@string/cut_button"
android:src="@drawable/ic_content_cut_24dp" />
<ImageButton
android:id="@+id/recording_play"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/roundButton"
android:src="@drawable/ic_play_arrow_black_24dp"
android:contentDescription="@string/play_button" />
android:contentDescription="@string/play_button"
android:src="@drawable/ic_play_arrow_black_24dp" />
<ImageButton
android:id="@+id/recording_edit_done"
@ -74,8 +77,8 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/roundButton"
android:src="@drawable/ic_close_24dp"
android:contentDescription="@string/stop_button" />
android:contentDescription="@string/stop_button"
android:src="@drawable/ic_close_24dp" />
</com.github.axet.androidlibrary.widgets.EqualLinearLayout>
</FrameLayout>
@ -103,26 +106,26 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/roundButton"
android:contentDescription="@string/cancel_button"
android:gravity="center"
android:src="@drawable/ic_close_24dp"
android:contentDescription="@string/cancel_button" />
android:src="@drawable/ic_close_24dp" />
<ImageButton
android:id="@+id/recording_pause"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/roundButton"
android:src="@drawable/ic_pause_black_24dp"
android:contentDescription="@string/pause_button" />
android:contentDescription="@string/pause_button"
android:src="@drawable/ic_pause_black_24dp" />
<ImageButton
android:id="@+id/recording_done"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="?attr/roundButton"
android:tint="@android:color/white"
android:contentDescription="@string/stop_button"
android:src="@drawable/ic_done_black_24dp"
android:contentDescription="@string/stop_button" />
android:tint="@android:color/white" />
</com.github.axet.androidlibrary.widgets.EqualLinearLayout>
</LinearLayout>

View file

@ -1,3 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="recColor" format="color" />
<attr name="cutColor" format="color" />
</resources>

View file

@ -2,10 +2,14 @@
<style name="RecThemeLight" parent="AppThemeLight">
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="recColor">@color/colorPrimaryDark</item>
<item name="cutColor">#b1b1b1</item>
</style>
<style name="RecThemeDark" parent="AppThemeDark">
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="recColor">#c6c6c6</item>
<item name="cutColor">#0e0e0e</item>
</style>
<style name="RecThemeLight.NoActionBar">