drop storage path
This commit is contained in:
parent
b24782fb48
commit
a893869626
4 changed files with 2 additions and 100 deletions
|
|
@ -1,80 +0,0 @@
|
|||
package com.github.axet.audiorecorder.widgets;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.preference.DialogPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.axet.androidlibrary.widgets.OpenFileDialog;
|
||||
import com.github.axet.audiorecorder.R;
|
||||
import com.github.axet.audiorecorder.activities.SettingsActivity;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class StoragePathPreference extends EditTextPreference {
|
||||
OpenFileDialog f;
|
||||
|
||||
public StoragePathPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public StoragePathPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public StoragePathPreference(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDialogView(View view) {
|
||||
super.onBindDialogView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showDialog(Bundle state) {
|
||||
f = new OpenFileDialog(getContext());
|
||||
f.setCurrentPath(new File(getText()));
|
||||
f.setFolderIcon(R.drawable.ic_folder_24dp);
|
||||
f.setFileIcon(R.drawable.ic_file);
|
||||
f.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
File ff = f.getCurrentPath();
|
||||
String fileName = ff.getPath();
|
||||
if (!ff.isDirectory())
|
||||
fileName = ff.getParent();
|
||||
if (callChangeListener(fileName)) {
|
||||
setText(fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
f.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object onGetDefaultValue(TypedArray a, int index) {
|
||||
String s = a.getString(index);
|
||||
if (s.isEmpty()) {
|
||||
s = new File(Environment.getExternalStorageDirectory(), "Audio Recorder").getAbsolutePath();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Parcelable state) {
|
||||
super.onRestoreInstanceState(state);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2H18c1.1,0 2,-0.9 2,-2V8l-6,-6H6zm7,7V3.5L18.5,9H13z"/>
|
||||
</vector>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z"/>
|
||||
</vector>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<com.github.axet.audiorecorder.widgets.StoragePathPreference
|
||||
android:defaultValue=""
|
||||
<com.github.axet.androidlibrary.widgets.StoragePathPreference
|
||||
android:defaultValue="Audio Recorder"
|
||||
android:key="storage_path"
|
||||
android:summary="/sdcard/some/"
|
||||
android:title="Storage Path" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue