基于NotePad应用做功能扩展

NotePad功能扩展(2) 考虑到文章的篇幅问题,我把这些问题和答案以及我多年面试所遇到的问题和一些面试资料做成了PDF文档《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》点击传送门,即可获取!_70)作者 穆昕雨原文链接考虑到文章的篇幅问题,我把这些问题和答案以及我多年面试所遇到的问题和一些面试资料做成了PDF文档[外链图片转存中…(img-TsvAcgjj-1715333154588)][外链图片转存中…(img-7dvGFRsc-1715333154591)] 阅读详情

#写在前面,解决图片不能查看问题

因为有 墙 的存在,DNS污染了,存在不能查看GitHub上图片问题

 配置hosts文件,直接指向github的服务器。用ipaddress查一下GitHub: Where the world builds software · GitHub 的ip

 hosts文件win10目录:C:\Windows\System32\drivers\etc

 在文件尾部添加:

185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
185.199.108.133 githubusercontent.com
185.199.109.133 githubusercontent.com
185.199.110.133 githubusercontent.com
185.199.111.133 githubusercontent.com

 保存,关闭,重新加载网页即可

# NotePad
This is an AndroidStudio rebuild of google SDK sample NotePad
# 新增类,修改类(部分代码展示)

• MyCursorAdapter.java

public void bindView(View view, Context context, Cursor cursor){
        super.bindView(view, context, cursor);
        //从数据库中读取的cursor中获取笔记列表对应的颜色数据,并设置笔记颜色
        int x =               
       cursor.getInt(cursor.getColumnIndex(NotePad.Notes.COLUMN_NAME_BACK_COLOR));
        switch (x){
            case NotePad.Notes.DEFAULT_COLOR:
                view.setBackgroundColor(Color.rgb(255, 255, 255));
                break;
            case NotePad.Notes.YELLOW_COLOR:
                view.setBackgroundColor(Color.rgb(247, 216, 133));
                break;
            case NotePad.Notes.BLUE_COLOR:
                view.setBackgroundColor(Color.rgb(165, 202, 237));
                break;
            case NotePad.Notes.GREEN_COLOR:
                view.setBackgroundColor(Color.rgb(161, 214, 174));
                break;
            case NotePad.Notes.RED_COLOR:
                view.setBackgroundColor(Color.rgb(244, 149, 133));
                break;
            default:
                view.setBackgroundColor(Color.rgb(255, 255, 255));
                break;
        }
    }

• NoteSearch.java

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.note_search_list);
        Intent intent = getIntent();
        if (intent.getData() == null) {
            intent.setData(NotePad.Notes.CONTENT_URI);
        }
        SearchView searchview = (SearchView)findViewById(R.id.search_view);
        searchview.setOnQueryTextListener(NoteSearch.this);  //为查询文本框注册监听器
    }

• OutputText.java

private void write()
    {
        try
        {
            // 如果手机插入了SD卡,而且应用程序具有访问SD的权限
            if (Environment.getExternalStorageState().equals(
                    Environment.MEDIA_MOUNTED)) {
                // 获取SD卡的目录
                File sdCardDir = Environment.getExternalStorageDirectory();
                //创建文件目录
                File targetFile = new File(sdCardDir.getCanonicalPath() + "/" + mName.getText() + ".txt");
                //写文件
                PrintWriter ps = new PrintWriter(new OutputStreamWriter(new FileOutputStream(targetFile), "UTF-8"));
                ps.println(TITLE);
                ps.println(NOTE);
                ps.println("创建时间:" + CREATE_DATE);
                ps.println("最后一次修改时间:" + MODIFICATION_DATE);
                ps.close();
                Toast.makeText(this, "保存成功,保存位置:" + sdCardDir.getCanonicalPath() + "/" + mName.getText() + ".txt", Toast.LENGTH_LONG).show();
            }
        }

• NoteEditor.java
    设置颜色
    

switch (x){
                case NotePad.Notes.DEFAULT_COLOR:
                    mText.setBackgroundColor(Color.rgb(255, 255, 255));
                    break;
                case NotePad.Notes.YELLOW_COLOR:
                    mText.setBackgroundColor(Color.rgb(247, 216, 133));
                    break;
                case NotePad.Notes.BLUE_COLOR:
                    mText.setBackgroundColor(Color.rgb(165, 202, 237));
                    break;
                case NotePad.Notes.GREEN_COLOR:
                    mText.setBackgroundColor(Color.rgb(161, 214, 174));
                    break;
                case NotePad.Notes.RED_COLOR:
                    mText.setBackgroundColor(Color.rgb(244, 149, 133));
                    break;
                default:
                    mText.setBackgroundColor(Color.rgb(255, 255, 255));
                    break;
            }

• NotePad.java
    设置颜色

  public static final int DEFAULT_COLOR = 0; //白
        public static final int YELLOW_COLOR = 1;//黄
        public static final int BLUE_COLOR = 2;//蓝
        public static final int GREEN_COLOR = 3;//绿
        public static final int RED_COLOR = 4;//红
        


• NotesList.java
    设置搜索,排序    

    @Override
        public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_add:
          /*
           * Launches a new Activity using an Intent. The intent filter for the Activity
           * has to have action ACTION_INSERT. No category is set, so DEFAULT is assumed.
           * In effect, this starts the NoteEditor Activity in NotePad.
           */
                startActivity(new Intent(Intent.ACTION_INSERT, getIntent().getData()));
                return true;
            case R.id.menu_paste:
          /*
           * Launches a new Activity using an Intent. The intent filter for the Activity
           * has to have action ACTION_PASTE. No category is set, so DEFAULT is assumed.
           * In effect, this starts the NoteEditor Activity in NotePad.
           */
                startActivity(new Intent(Intent.ACTION_PASTE, getIntent().getData()));
                return true;
            //添加搜素
            case R.id.menu_search:
                Intent intent = new Intent();
                intent.setClass(NotesList.this,NoteSearch.class);
                NotesList.this.startActivity(intent);
                return true;

            //创建时间排序
            case R.id.menu_sort1:
                cursor = managedQuery(
                        getIntent().getData(),            // Use the default content URI for the provider.
                        PROJECTION,                       // Return the note ID and title for each note. and modifcation date
                        null,                             // No where clause, return all records.
                        null,                             // No where clause, therefore no where column values.
                        NotePad.Notes._ID  // Use the default sort order.
                );
                adapter = new MyCursorAdapter(
                        this,
                        R.layout.noteslist_item,
                        cursor,
                        dataColumns,
                        viewIDs
                );
                setListAdapter(adapter);
                return true;

            //修改时间排序
            case R.id.menu_sort2:
                cursor = managedQuery(
                        getIntent().getData(),            // Use the default content URI for the provider.
                        PROJECTION,                       // Return the note ID and title for each note. and modifcation date
                        null,                             // No where clause, return all records.
                        null,                             // No where clause, therefore no where column values.
                        NotePad.Notes.DEFAULT_SORT_ORDER // Use the default sort order.
                );

                adapter = new MyCursorAdapter(
                        this,
                        R.layout.noteslist_item,
                        cursor,
                        dataColumns,
                        viewIDs
                );
                setListAdapter(adapter);
                return true;

            //颜色排序
            case R.id.menu_sort3:
                cursor = managedQuery(
                        getIntent().getData(),            // Use the default content URI for the provider.
                        PROJECTION,                       // Return the note ID and title for each note. and modifcation date
                        null,                             // No where clause, return all records.
                        null,                             // No where clause, therefore no where column values.
                        NotePad.Notes.COLUMN_NAME_BACK_COLOR // Use the default sort order.
                );
                adapter = new MyCursorAdapter(
                        this,
                        R.layout.noteslist_item,
                        cursor,
                        dataColumns,
                        viewIDs
                );
                setListAdapter(adapter);
                return true;

            default:
                return super.onOptionsItemSelected(item);
        }
    }

# 新建布局,修改布局

• note_color.xml
  举例

<ImageButton
        android:id="@+id/color_white"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:layout_weight="1"
        android:background="@color/colorWhite"
        android:onClick="white"/>

• note_srarch_list.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageButton
        android:id="@+id/color_white"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:layout_weight="1"
        android:background="@color/colorWhite"
        android:onClick="white"/>

    <ImageButton
        android:id="@+id/color_yellow"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:layout_weight="1"
        android:background="@color/colorYellow"
        android:onClick="yellow"/>

    <ImageButton
        android:id="@+id/color_blue"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:layout_weight="1"
        android:background="@color/colorBlue"
        android:onClick="blue"/>

    <ImageButton
        android:id="@+id/color_green"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:layout_weight="1"
        android:background="@color/colorGreen"
        android:onClick="green"/>

    <ImageButton
        android:id="@+id/color_red"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:layout_weight="1"
        android:background="@color/colorRed"
        android:onClick="red"/>
    
</LinearLayout>

 • output_text.xml

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingLeft="6dip"
    android:paddingRight="6dip"
    android:paddingBottom="3dip">

    <EditText android:id="@+id/output_name"
        android:maxLines="1"
        android:layout_marginTop="2dp"
        android:layout_marginBottom="15dp"
        android:layout_width="wrap_content"
        android:ems="25"
        android:layout_height="wrap_content"
        android:autoText="true"
        android:capitalize="sentences"
        android:scrollHorizontally="true" />

    <Button android:id="@+id/output_ok"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:text="@string/output_ok"
        android:onClick="OutputOk" />

</LinearLayout>

   

• colors.xml

 
# 页面布局

# 基本要求:
• NoteList中显示条目增加时间戳显示

• 添加笔记查询功能(根据标题查询)
默认title为输入内容,可自行更改,但查询是按照title查询,若title与笔记内容则笔记内容便无法查询到

 

 

 

# 附加功能:
• UI美化
我的排版参考PPT中的UI美化,将功能按键安排在上方

 

• 更改记事本的背景
需要在笔记中设置,在笔记初始展示页以带背景颜色的横条表示

 

 

• 导出笔记

 

• 笔记排序
可以根据创建时间、修改时间和颜色进行排序

 

 

 

源码地址:GitHub - cqm123456/NotePad: my

作者:陈巧蔓
原文链接:https://blog.csdn.net/chen_qm/article/details/121875018

【tools】Notepad++扩展功能插件(实用) Date: 2018.9.9 https://sourceforge.net/projects/npp-plugins/files/ https://sourceforge.net/projects/locationnav/ https://www.crifan.com/files/doc/docbook/rec_soft_npp/release/htmls/npp_common_pl... 阅读详情

相关推荐

Rokid眼镜高精度图像识别的五大工程破局点

图像识别是AR交互的基础能力,其核心在于将现实图像映射为可计算的数字特征,并通过几何建模解算空间姿态。在专用AR眼镜场景中,该过程面临光学畸变、传感器时序错位、低延迟跟踪与人因适配等复合挑战。尤其在工业现场,Rokid Max系列的鱼眼镜头畸变、IMU-视觉异步采样、窄FOV下快速眼动等物理约束,使传统基于AR Foundation或OpenCV的识别方案失效。本文聚焦真实部署中的关键瓶颈,涵盖实时反畸变纹理渲染、原生SDK直调优化、端侧轻量CNN模型(TinyImageNet-Rokid)、IMU-视觉紧

weixin_33681778的博客 704

notepad++给选中词句标红

notepad+可以给选中的词句设置背景色,但同时所有相同的词句都会设置同样背景色。 选中词语,右键,选择style token,任选一种格式即可

小妖666个人笔记 2497

C++ 核电站

问题描述 一个核电站有n个放核物质的坑,排列在一条直线上。如果连续m个坑中放入核物质就会发生爆炸,所以某些坑中不能放核物质。 本题的任务:对于给定的n和m,求不发生爆炸的放置核物质的方案总数。 输入格式 第一行两个正整数n和m,之间用一个空格隔开。2≤n≤50,2≤m≤5。 输出格式 一行一个正整数,表示方案总数。 输入样例 4 3 输出样例 13 数据规模与约定 2≤n≤50,2≤m≤5 CODE #include<bits/stdc++.h> using namespace

HybridCOW_HORSE的博客 1816

NotePad功能扩展

基于NotePad应用做功能扩展 附加功能 UI美化(设置背景颜色,选中时的笔记背景颜色变换) 更换背景 功能解析 UI美化(设置背景颜色,选中时的便签背景颜色变换) NotePad源码中的应用,只有简单的笔记黑色主题。本功能对此进行扩展,给予notePad一个新的主题 在AndroidManifest.xml中增加一句代码将NotePad换为白色主题 <activity and...

weixin_42479134的博客 682

Kalibr标定避坑指南:如何用AprilGrid板快速完成双目IMU标定

本文详细介绍了使用AprilGrid板进行Kalibr双目IMU联合标定的实战技巧,包括标定工具选型、数据采集优化、标定流程及结果验证。通过AprilGrid板的唯一标识性和抗遮挡优势,结合IMU静止标定和运动激励设计,显著提升标定精度。文章还提供了常见报错处理和高级优化技巧,帮助开发者高效完成传感器标定。

sunny的博客 288

值得苦练的100道Python经典练手题(全网最全,附详细答案,建议收藏)

这100道Python练习题涵盖了从基础语法到高级算法、从数据库操作到Web开发的各个方面,是备考数据库系统工程师的绝佳素材。建议按照章节顺序逐一练习,遇到难点可反复钻研,真正掌握每一道题背后的知识点。通过这些练习,不仅能提升Python编程能力,还能加深对数据库系统原理的理解,为考试和实际工作打下坚实基础。

yue_yun_的博客 9477

【Android Studio】 notepad功能扩展实现时间戳和搜索

NotePad功能扩展简介代码详解时间戳功能搜索功能UI美化 简介 实现了NotePad的基础功能时间戳和搜索,扩展了UI美化 代码详解 时间戳功能 在主页面的每个列表项中添加时间戳的位置,即在notelist_item.xml布局文件中添加一个 <TextView android:id="@+id/text2" android:layout_width="match_parent" android:layout_height="match_pare

OldA011的博客 2320

【OpenClaw从入门到精通】第60篇:多智能体协同实战——用“龙虾”搭建你的数字员工团队(2026企业版)

2026年AI Agent企业落地的核心趋势,正从“单Agent单兵作战”转向“多智能体协同组网”。本文以全球开发者先锋大会“百虾大战”真实案例为蓝本,深度拆解OpenClaw多智能体协同的技术内核——三层解耦架构(模型层-技能层-网关层),系统搭建包含项目经理、架构师、执行者、质量把关者的4大核心Agent团队。通过三种主流协作架构对比、全链路配置代码实操、故障自愈实战演练,结合电商新品上架虚拟场景全流程演示,解决企业多Agent部署中的权限隔离、任务协同、运维自治三大核心痛点。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 794

基于NotePad应用的功能扩展

基于NotePad应用的功能扩展原应用展示图1:NotePad主界面图2:新建笔记图3:新建笔记退回主页面图4:进入笔记,编辑标题菜单图5:编辑标题图6:笔记列表图7:长点“第二条笔记”,菜单 拓展功能 NoteList中显示条目增加时间显示 笔记查询(按标题查询) UI美化 背景更换 导出笔记 笔记排序 拓展应用源码源码: NotePad拓展功能解析 NoteList中显示条目增加时间显示 在No

douzajun的博客 3427

STM32实战开发(66):STM32图像处理开发教程

随着物联网、人工智能和嵌入式技术的不断发展,图像处理技术在嵌入式系统中的应用越来越广泛。图像处理不仅在视觉识别、安防监控、智能家居等领域中发挥着重要作用,也在工业自动化、医疗成像、无人驾驶等高科技领域中占据重要地位。而STM32凭借其强大的硬件性能和丰富的外设支持,成为了许多图像处理应用的理想平台。

2201_76125393的博客 1456

基于SiamFC的红外目标跟踪

初始化阶段:在第一帧中,通过用户标注获得目标框,从目标区域中提取一个固定大小的模板(称为 exemplar)。搜索阶段:在后续帧中,在以当前目标中心为中心的较大区域(称为 instance)内进行搜索,将模板与搜索区域通过卷积操作得到响应图。位置更新:在响应图中找到峰值位置,并转换到原图坐标,用以更新目标中心。部分实现中还会考虑多尺度搜索和目标尺寸更新。import cv2# 定义 SiamFC 简易网络(示例)# 特征提取部分,注意红外图像通常为单通道,使用较少的卷积核数提高实时性。

weixin_43745234的博客 779

基于NotePad应用做功能扩展 --时间戳与查询功能

## 基于NotePad应用做功能扩展 --时间戳与查询功能 NotePad源码: https://github.com/llfjfz/NotePad 1.时间戳功能实现 在布局文件中增加时间戳 找到布局文件noteslist_item.xml,源码如下: <RelativeLayout android:layout_height="match_parent" android:layout_width="match_parent" xmlns:android="http://sche

qq_36740526的博客 812

Android功耗系列专题分析之四:待机概率性功耗高的失效分析

本文分析了Android设备待机功耗异常高的问题。通过日志发现系统休眠失败,原因是PowerManagerService.Display唤醒锁未被释放。进一步排查发现,指纹解锁功能在灭屏时未正确释放屏幕锁定,导致DisplayReady状态异常。解决方案是将指纹功能的背光控制与DisplayReady状态控制分离,使用两个变量独立管理。经验表明,快速定位问题比解决问题更重要,修改原生流程时需谨慎评估风险。

463

NotePad记事本应用功能扩展(添加时间戳、查询、UI美化、修改背景)

NotePad 基于原有的代码进行功能扩展 原有项目代码: notepad-master 本项目在原有项目的基础上增加了时间戳显示和笔记查询两个基础功能,以及美化UI和更改记事本的背景两个扩展功能 项目结构和功能 主要的类: NotesList类 应用程序的入口,笔记本的首页面会显示笔记的列表 NoteEditor类 编辑笔记内容的Activity TitleEditor类 编辑笔记标题的Activity NotePadProvider类 这是笔记本应用的ContentProvider NoteColo

fjnu_se的博客 1727

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

下一篇: 基于NotePad应用做功能扩展
chen_qm
博客等级 码龄7年 0粉丝 2原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值