最终版本

pull/19/head
xxl 3 years ago
parent 775d22645f
commit 0bbb5e0bf0

@ -14,10 +14,63 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<EditText
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/et_foler_name"
android:layout_width="fill_parent"
android:hint="@string/hint_foler_name"
android:layout_height="fill_parent" />
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/old_password_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="输入原密码:"/>
<EditText
android:id="@+id/old_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/new_password_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="输入新建密码:"/>
<EditText
android:id="@+id/new_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/new_password_again_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认密码:"/>
<EditText
android:id="@+id/new_password_again"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
</LinearLayout>

@ -17,6 +17,7 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/note_item"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
@ -75,4 +76,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"/>
<ImageView
android:id="@+id/iv_locker_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"/>
</FrameLayout>

@ -62,5 +62,4 @@
android:id="@+id/menu_font_select"
android:title="@string/menu_font_style" />
</menu>

@ -54,7 +54,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.graphics.Typeface;
import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.TextNote;
@ -77,7 +77,10 @@ import java.util.regex.Pattern;
public class NoteEditActivity extends Activity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener {
private AlertDialog alertDialog2;
private class HeadViewHolder {
public TextView tvModified;
public ImageView ivAlertIcon;
@ -396,6 +399,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (mNoteBgColorSelector.getVisibility() == View.VISIBLE
&& !inRangeOfView(mNoteBgColorSelector, ev)) {
@ -410,6 +414,56 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
return super.dispatchTouchEvent(ev);
}
public void showSingleAlertDiglog(){
final String[] items = {"方正舒体","仿宋","黑体","隶书","行楷","幼圆"};
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setTitle("字体选择");
alertBuilder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
switch(i){
case 0:
Typeface typeface0 = Typeface.createFromAsset(getAssets(),"font/FZSTK.TTF");
mNoteEditor.setTypeface(typeface0);
break;
case 1:
Typeface typeface1 = Typeface.createFromAsset(getAssets(),"font/SIMYOU.TTF");
mNoteEditor.setTypeface(typeface1);
break;
case 2:
Typeface typeface2 = Typeface.createFromAsset(getAssets(),"font/STLITI.TTF");
mNoteEditor.setTypeface(typeface2);
break;
case 3:
Typeface typeface3 = Typeface.createFromAsset(getAssets(),"font/STXINGKA.TTF");
mNoteEditor.setTypeface(typeface3);
break;
case 4:
Typeface typeface4 = Typeface.createFromAsset(getAssets(),"font/simfang.ttf");
mNoteEditor.setTypeface(typeface4);
break;
case 5:
Typeface typeface5 = Typeface.createFromAsset(getAssets(),"font/simhei.ttf");
mNoteEditor.setTypeface(typeface5);
break;
}
}
});
alertBuilder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
alertDialog2.dismiss();
}
});
alertBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
alertDialog2.dismiss();
}
});
alertDialog2 = alertBuilder.create();
alertDialog2.show();
}
private boolean inRangeOfView(View view, MotionEvent ev) {
int []location = new int[2];
@ -635,6 +689,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
case R.id.top:
mWorkingNote.setTop((mWorkingNote.getTopId()) == 1 ? "0" : "1");
break;
case R.id.menu_font_select:
showSingleAlertDiglog();
break;
default:
break;
}

Loading…
Cancel
Save