wyj_branch
吴丽丽 3 months ago
parent 418a35b571
commit 72c5a725cb

@ -331,6 +331,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
public void onClick(DialogInterface dialog, public void onClick(DialogInterface dialog,
int which) { int which) {
batchDelete(); batchDelete();
//Notesback();
} }
}); });
builder.setNegativeButton(android.R.string.cancel, null); builder.setNegativeButton(android.R.string.cancel, null);
@ -505,6 +506,32 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
} }
}.execute(); }.execute();
} }
private void Notesback(){
new AsyncTask<Void, Void, HashSet<AppWidgetAttribute>>() {
protected HashSet<AppWidgetAttribute> doInBackground(Void... unused) {
HashSet<AppWidgetAttribute> widgets = mNotesListAdapter.getSelectedWidget();
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
.getSelectedItemIds(), Notes.ID_ROOT_FOLDER)) {
Log.e(TAG, "Move notes to trash folder error, should not happens");
}
return widgets;
}
@Override
protected void onPostExecute(HashSet<AppWidgetAttribute> widgets) {
if (widgets != null) {
for (AppWidgetAttribute widget : widgets) {
if (widget.widgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& widget.widgetType != Notes.TYPE_WIDGET_INVALIDE) {
updateWidget(widget.widgetId, widget.widgetType);
}
}
}
mModeCallBack.finishActionMode();
}
}.execute();
//DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter.getSelectedItemIds(),Notes.ID_ROOT_FOLDER);
}
private void deleteFolder(long folderId) { private void deleteFolder(long folderId) {
if (folderId == Notes.ID_ROOT_FOLDER) { if (folderId == Notes.ID_ROOT_FOLDER) {
@ -579,6 +606,74 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
private void showTimeGet() {//获取倒计时时间
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("请输入倒计时时间");//标题
View view = LayoutInflater.from(this).inflate(R.layout.get_time, null);
final EditText hour = (EditText) view.findViewById(R.id.hour);
final EditText min = (EditText) view.findViewById(R.id.min);
final EditText sec = (EditText) view.findViewById(R.id.sec);
showSoftInput();//打开键盘
builder.setPositiveButton(android.R.string.ok, null);// 确认(逻辑在下方)
builder.setNegativeButton(android.R.string.cancel, null);
final Dialog dialog = builder.setView(view).show();//显示
final Button positive = (Button) dialog.findViewById(android.R.id.button1);
positive.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), net.micode.notes.timer.CountDown.class);
long h=Long.parseLong(hour.getText().toString());
intent.putExtra("hour",h);
long m=Long.parseLong(min.getText().toString());
intent.putExtra("min",m);
long s=Long.parseLong(sec.getText().toString());
intent.putExtra("sec",s);
Toast.makeText(v.getContext(), "正在跳转", Toast.LENGTH_SHORT).show();
startActivity(intent);//跳转页面到倒计时
dialog.dismiss();
}
});
//后面全是监听器
if (TextUtils.isEmpty(hour.getText())) {
positive.setEnabled(false);
}
hour.addTextChangedListener(new TextWatcher() {//监听器
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(hour.getText())&&!TextUtils.isEmpty(min.getText())
&&!TextUtils.isEmpty(sec.getText()))
{positive.setEnabled(true);}
else{positive.setEnabled(false);}
}
public void afterTextChanged(Editable s) {}
});
min.addTextChangedListener(new TextWatcher() {//监听器
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(hour.getText())&&!TextUtils.isEmpty(min.getText())
&&!TextUtils.isEmpty(sec.getText()))
{positive.setEnabled(true);}
else{positive.setEnabled(false);}
}
public void afterTextChanged(Editable s) {}
});
sec.addTextChangedListener(new TextWatcher() {//监听器
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(hour.getText())&&!TextUtils.isEmpty(min.getText())
&&!TextUtils.isEmpty(sec.getText()))
{positive.setEnabled(true);}
else{positive.setEnabled(false);}
}
public void afterTextChanged(Editable s) {}
});
}
private void showCreateOrModifyFolderDialog(final boolean create) { private void showCreateOrModifyFolderDialog(final boolean create) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this); final AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null); View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
@ -812,6 +907,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
case R.id.menu_search: case R.id.menu_search:
onSearchRequested(); onSearchRequested();
break; break;
case R.id.menu_countdown:
showTimeGet();
break;
default: default:
break; break;
} }

@ -15,7 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<menu <menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:id="@+id/menu_new_folder" android:id="@+id/menu_new_folder"
@ -35,5 +35,8 @@
<item <item
android:id="@+id/menu_search" android:id="@+id/menu_search"
android:title="@string/menu_search"/> android:title="@string/menu_search" />
<item
android:id="@+id/menu_countdown"
android:title="countdown" />
</menu> </menu>

Loading…
Cancel
Save