1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2011 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 |
10 |
* as published by the Free Software Foundation. |
11 |
* |
12 |
* JSampler is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with JSampler; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
* MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
package org.jsampler.android.view.std; |
24 |
|
25 |
import java.io.File; |
26 |
|
27 |
import org.jsampler.CC; |
28 |
import org.jsampler.JSUtils; |
29 |
import org.jsampler.android.AHF; |
30 |
import org.jsampler.android.R; |
31 |
|
32 |
import android.app.Activity; |
33 |
import android.os.Bundle; |
34 |
import android.util.Log; |
35 |
import android.widget.Button; |
36 |
import android.widget.TextView; |
37 |
|
38 |
public class JSamplerHomeChooser extends OkCancelDialog { |
39 |
private TextView tfHome; |
40 |
|
41 |
public JSamplerHomeChooser(Activity context) { |
42 |
super(context, R.string.choose_home_dir_title, R.layout.choose_home_dir); |
43 |
} |
44 |
|
45 |
protected void |
46 |
onCreate(Bundle savedInstanceState) { |
47 |
super.onCreate(savedInstanceState); |
48 |
|
49 |
tfHome = (TextView)findViewById(R.id.JSamplerHomeChooser_tfHome); |
50 |
if(CC.getJSamplerHome() != null) tfHome.setText(CC.getJSamplerHome()); |
51 |
else { |
52 |
tfHome.setText(AHF.getActivity().getFilesDir().getAbsolutePath() + File.separator + ".jsampler"); |
53 |
} |
54 |
|
55 |
|
56 |
} |
57 |
|
58 |
protected void onOk() { |
59 |
if(!((Button)findViewById(R.id.btn_ok)).isEnabled()) return; |
60 |
|
61 |
/*if(tv.getText().length() == 0) { |
62 |
JOptionPane.showMessageDialog ( |
63 |
this, i18n.getLabel("JSamplerHomeChooser.selectFile"), |
64 |
"", |
65 |
JOptionPane.INFORMATION_MESSAGE |
66 |
); |
67 |
|
68 |
return; |
69 |
} |
70 |
|
71 |
setVisible(false);*/ |
72 |
Log.w("changeJSamplerHome", tfHome.getText().toString()); |
73 |
JSUtils.changeJSamplerHome(tfHome.getText().toString()); |
74 |
dismiss(); |
75 |
} |
76 |
|
77 |
protected void |
78 |
onCancel() { } |
79 |
} |