修正 file select 对话框
No files matched your search
|
Before Width: | Height: | Size: 407 B |
|
After Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 562 B |
|
After Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 898 B |
|
After Width: | Height: | Size: 853 B |
@@ -26,15 +26,15 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:src="@drawable/ic_dir_dark" />
|
||||
android:src="@drawable/ic_dir_dark_dialog" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
style="@style/DialogMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="8.0dp"
|
||||
android:layout_toRightOf="@id/icon"
|
||||
android:textColor="@android:color/black" />
|
||||
android:layout_toRightOf="@id/icon" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -881,7 +881,7 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
lus.setSearchImage(intent.getStringExtra(KEY_IMAGE_KEY),
|
||||
intent.getStringExtra(KEY_IMAGE_URL),
|
||||
EhClient.IMAGE_SEARCH_USE_SIMILARITY_SCAN);
|
||||
mTitle = getString(R.string.similar_content); // TODO
|
||||
mTitle = getString(R.string.similar_content);
|
||||
setTitle(mTitle);
|
||||
break;
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -702,7 +704,8 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
warning.setVisibility(View.VISIBLE);
|
||||
|
||||
mDirSelectDialog = new MaterialAlertDialog.Builder(mActivity).setTitle(downloadPath)
|
||||
.setView(view, false).setActionButton("New") // TODO
|
||||
.setView(view, false, new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, Ui.dp2pix(360))).setActionButton(R.string._new)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@@ -710,6 +713,34 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
switch (which) {
|
||||
case MaterialAlertDialog.ACTION:
|
||||
final EditText et = new EditText(mActivity);
|
||||
et.setText("New folder"); // TODO
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
int x = Ui.dp2pix(8);
|
||||
lp.leftMargin = x;
|
||||
lp.rightMargin = x;
|
||||
lp.topMargin = x;
|
||||
lp.bottomMargin = x;
|
||||
new MaterialAlertDialog.Builder(mActivity).setTitle(R.string.new_folder)
|
||||
.setView(et, true, lp)
|
||||
.setPositiveButton(R.string._new)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(
|
||||
MaterialAlertDialog dialog,
|
||||
int which) {
|
||||
if (which == MaterialAlertDialog.POSITIVE) {
|
||||
File dir = new File(fileExplorerView.getCurPath(),
|
||||
et.getText().toString());
|
||||
dir.mkdirs();
|
||||
fileExplorerView.refresh();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}).show();
|
||||
return false;
|
||||
case MaterialAlertDialog.POSITIVE:
|
||||
if (!fileExplorerView.canWrite()) {
|
||||
@@ -734,88 +765,6 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
}
|
||||
}).create();
|
||||
mDirSelectDialog.show();
|
||||
/*
|
||||
DialogBuilder dialogBuilder = new DialogBuilder(mActivity)
|
||||
.setView(view, new LinearLayout.LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, Ui.dp2pix(360)), false)
|
||||
.setTitle(downloadPath)
|
||||
.setAction(R.drawable.ic_plus,
|
||||
new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final EditText et = new EditText(mActivity);
|
||||
et.setText("New folder");
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
int x = Ui.dp2pix(8);
|
||||
lp.leftMargin = x;
|
||||
lp.rightMargin = x;
|
||||
lp.topMargin = x;
|
||||
lp.bottomMargin = x;
|
||||
new DialogBuilder(mActivity).setView(et, lp)
|
||||
.setTitle(R.string.new_folder)
|
||||
.setPositiveButton(R.string._new, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
File dir = new File(fileExplorerView.getCurPath(),
|
||||
et.getText().toString());
|
||||
dir.mkdirs();
|
||||
fileExplorerView.refresh();
|
||||
// TODO check if the directory was created
|
||||
}
|
||||
}).setSimpleNegativeButton().create().show();
|
||||
}
|
||||
}).setPositiveButton(android.R.string.ok,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!fileExplorerView.canWrite())
|
||||
MaterialToast.showToast(R.string.cur_dir_not_writable);
|
||||
else {
|
||||
String downloadPath = fileExplorerView.getCurPath();
|
||||
|
||||
// Update .nomedia file
|
||||
// TODO Should I delete .nomedia in old download dir ?
|
||||
if (!Config.getMediaScan()) {
|
||||
try {
|
||||
new File(Config.getDownloadPath(), ".nomedia").createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Config.setDownloadPath(downloadPath);
|
||||
mDownloadPath.setSummary(downloadPath);
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
}
|
||||
}
|
||||
}).setSimpleNegativeButton();
|
||||
final TextView title = dialogBuilder.getTitleView();
|
||||
|
||||
if (fileExplorerView.canWrite())
|
||||
warning.setVisibility(View.GONE);
|
||||
else
|
||||
warning.setVisibility(View.VISIBLE);
|
||||
|
||||
fileExplorerView.setPath(downloadPath);
|
||||
fileExplorerView.setOnItemClickListener(
|
||||
new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
fileExplorerView.onItemClick(parent, view, position, id);
|
||||
title.setText(fileExplorerView.getCurPath());
|
||||
if (fileExplorerView.canWrite())
|
||||
warning.setVisibility(View.GONE);
|
||||
else
|
||||
warning.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
mDirSelectDialog = dialogBuilder.create();
|
||||
mDirSelectDialog.show();*/
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||