Commit 4bb04fea authored by bixing's avatar bixing

Initial commit

parents
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="17" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.application'
}
android {
namespace 'com.ads.cal.notes'
compileSdk 33
defaultConfig {
applicationId "com.ads.cal.notes"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'app-proguard-rules.pro'
}
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'org.greenrobot:eventbus:3.3.1'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.ads.cal.notes;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.ads.cal.notes", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:name="com.ads.cal.notes.BaseApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Notes"
tools:targetApi="31">
<activity
android:name="com.ads.cal.notes.WelcomeActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Notes">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.ads.cal.notes.MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.ads.cal.notes.NoteEditActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustUnspecified|adjustPan|adjustResize" />
<activity
android:name="com.ads.cal.notes.AbActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true"
android:screenOrientation="portrait" />
<activity
android:name="com.ads.cal.notes.TActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true"
android:screenOrientation="portrait" />
</application>
</manifest>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Privacy Policy for Note App</title>
</head>
<body>
<h1>Privacy Policy for Note App</h1>
<p><strong>Effective Date:</strong> [2023.10.21]</p>
<p><strong>1. Information Collection and Use</strong></p>
<p>We do not collect, store, or share personal information from users of our Note app. We respect your privacy and are committed to protecting your data.</p>
<p><strong>2. Network Permissions</strong></p>
<p>Our app requests network permissions to display advertisements. We use Google AdMob to provide ad services, which may involve the collection of some user data, but we do not collect or store personally identifiable information. Ads may be customized based on user interests and behavior.</p>
<p><strong>3. Child Privacy Protection</strong></p>
<p>Our Note app is intended for children aged 3 and above. We do not intentionally collect or store personal information of minors. If you are a minor, please use our app under the guidance of a parent or guardian.</p>
<p><strong>4. Adding, Deleting, and Modifying Notes</strong></p>
<p>Our app supports users in adding, deleting, and modifying notes. These note details are stored solely on your device and are not uploaded to our servers or shared with other users.</p>
<p><strong>5. Automatic Saving</strong></p>
<p>Our app may automatically save your note information to prevent data loss. These data are only stored on your device.</p>
<p><strong>6. Cookies and Tracking Technologies</strong></p>
<p>Our app does not use cookies or other tracking technologies to collect user information.</p>
<p><strong>7. Change Notification</strong></p>
<p>We may periodically update our privacy policy to reflect changes in the app or updates in regulations. When we make significant changes to our privacy policy, we will provide notification within the app.</p>
</body>
</html>
package com.ads.cal.notes;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.view.View;
import android.widget.TextView;
public class AbActivity extends BaseActivity{
@Override
int getContentLayoutId() {
return R.layout.activity_about;
}
@Override
void initView() {
findViewById(R.id.kk).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
TextView versionCode = findViewById(R.id.v_code);
try {
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
versionCode.setText(String.valueOf(packageInfo.versionName));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
@Override
void intData() {
}
}
package com.ads.cal.notes;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
public abstract class BaseActivity extends FragmentActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (this instanceof WelcomeActivity) {
} else {
getWindow().setStatusBarColor(getColor(R.color.color_6B7077)); // 设置颜色
}
setContentView(getContentLayoutId());
initView();
intData();
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onRestart() {
super.onRestart();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
abstract int getContentLayoutId();
abstract void initView();
abstract void intData();
}
package com.ads.cal.notes;
import android.app.Application;
import com.ads.cal.notes.db.DBManager;
public class BaseApplication extends Application {
private static DBManager dataBaseManager;
private static Application application;
@Override
public void onCreate() {
super.onCreate();
application = this;
DBManager.init(this);
}
public static Application getApplication() {
return application;
}
public static DBManager getDataBaseManager() {
return DBManager.init(application);
}
}
package com.ads.cal.notes;
import com.ads.cal.notes.bean.DataBean;
public class EventBusMessage {
public EventBusMessage(int type, DataBean dataBean) {
this.type = type;
this.object = dataBean;
}
public DataBean object;
public int type;
}
package com.ads.cal.notes;
import android.util.Log;
public class LLog {
private static final String TAG = "LLog";
// 输出普通信息日志
public static void d(String message) {
Log.d(TAG, message);
}
// 输出错误信息日志
public static void e(String message) {
Log.e(TAG, message);
}
// 输出警告信息日志
public static void w(String message) {
Log.w(TAG, message);
}
// 输出信息日志
public static void i(String message) {
Log.i(TAG, message);
}
// 输出调试信息日志
public static void v(String message) {
Log.v(TAG, message);
}
}
package com.ads.cal.notes;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.ads.cal.notes.adapter.MainAdapter;
import com.ads.cal.notes.bean.DataBean;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
public class MainActivity extends BaseActivity {
@Override
int getContentLayoutId() {
return R.layout.activity_main;
}
private ImageView addData;
private RecyclerView recyclerView;
private LinearLayout notDataLayout;
private ArrayList<DataBean> arrayList;
@Override
void initView() {
addData = findViewById(R.id.add);
recyclerView = findViewById(R.id.listData);
notDataLayout = findViewById(R.id.not_data_layout);
addData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NoteEditActivity.invoke(MainActivity.this, null);
}
});
ImageView setting = findViewById(R.id.setting);
setting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSettingPop(setting);
}
});
}
private MainAdapter mainAdapter;
@SuppressLint("CheckResult")
@Override
void intData() {
arrayList = new ArrayList<>();
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mainAdapter = new MainAdapter(this, arrayList);
recyclerView.setAdapter(mainAdapter);
updateLayoutStatus();
getData();
EventBus.getDefault().register(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(EventBusMessage event) {
if (event.object == null) {
return;
}
if (event.type == Utils.EVENT_TYPE_SAVE) {
mainAdapter.addData(event.object);
} else if (event.type == Utils.EVENT_TYPE_DELETE) {
mainAdapter.deleteData(event.object);
}
updateLayoutStatus();
}
private void getData() {
Observable.fromCallable(() -> {
// 执行耗时操作
return BaseApplication.getDataBaseManager().queryData();
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<List<DataBean>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(List<DataBean> dataBeans) {
mainAdapter.addData(dataBeans);
updateLayoutStatus();
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
private void updateLayoutStatus() {
if (mainAdapter.getItemCount() > 0) {
if (notDataLayout.isShown()) {
notDataLayout.setVisibility(View.GONE);
}
if (!recyclerView.isShown()) {
recyclerView.setVisibility(View.VISIBLE);
}
} else {
if (!notDataLayout.isShown()) {
notDataLayout.setVisibility(View.VISIBLE);
}
if (recyclerView.isShown()) {
recyclerView.setVisibility(View.GONE);
}
}
}
private void showSettingPop(ImageView setting) {
PopupWindow popupWindow = new PopupWindow();
View view = LayoutInflater.from(this).inflate(R.layout.pop_main_setting, null, false);
popupWindow.setContentView(view);
// 测量 contentView 的宽度
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
// 获取 contentView 的测量宽度
int popupWidth = view.getMeasuredWidth();
popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setOutsideTouchable(false);
popupWindow.setFocusable(true);
popupWindow.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setClippingEnabled(false);
// 获取按钮的位置,按钮的宽度和高度
int[] locationOnScreen = new int[2];
setting.getLocationOnScreen(locationOnScreen);
float dpValue = 32; // 你要转换的dp值
float density = getResources().getDisplayMetrics().density; // 获取屏幕的密度
int pxValue = (int) (dpValue * density + 0.5f); // 四舍五入取整数值
popupWindow.showAsDropDown(setting, popupWidth - (locationOnScreen[0]) + setting.getWidth() * 2 , pxValue);
view.findViewById(R.id.pp).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, TActivity.class);
startActivity(intent);
popupWindow.dismiss();
}
});
view.findViewById(R.id.au).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, AbActivity.class);
startActivity(intent);
popupWindow.dismiss();
}
});
}
}
package com.ads.cal.notes;
import android.content.Context;
import android.content.Intent;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.ads.cal.notes.bean.DataBean;
import com.ads.cal.notes.dialog_fragment.DeleteFragment;
import org.greenrobot.eventbus.EventBus;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
public class NoteEditActivity extends BaseActivity {
private DataBean dataBean;
private boolean isCreateNote;
private String oldContent;
@Override
int getContentLayoutId() {
return R.layout.activity_edit;
}
private EditText editText;
@Override
void initView() {
ImageView back = findViewById(R.id.back);
ImageView delete = findViewById(R.id.delete);
ImageView save = findViewById(R.id.save);
editText = findViewById(R.id.ed_text);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
functionNote();
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DeleteFragment dialogFragment = new DeleteFragment();
dialogFragment.show(getSupportFragmentManager(), "DeleteFragment");
}
});
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
functionNote();
}
});
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
@Override
void intData() {
Intent intent = getIntent();
if (intent == null) {
return;
}
dataBean = (DataBean) intent.getSerializableExtra("data");
if (dataBean == null || dataBean.content == null) {
isCreateNote = true;
return;
}
oldContent = dataBean.content;
editText.setText(oldContent);
}
private boolean startSave = false;
private void functionNote() {
if (startSave) {
return;
}
startSave = true;
if (isCreateNote) {
save();
} else {
update();
}
}
private void save() {
String content = editText.getText().toString();
if (oldContent != null && oldContent.equals(content)) {
finish();
return;
}
if (!TextUtils.isEmpty(content)) {
delete();
return;
}
long time = System.currentTimeMillis();
Observable.fromCallable(() -> {
// 执行耗时操作
return BaseApplication.getDataBaseManager().insertData(content, time);
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
LLog.d("onSubscribe = ");
}
@Override
public void onNext(Long aLong) {
LLog.d("onNext = "+aLong);
if (null == dataBean) {
dataBean = new DataBean();
}
dataBean.content = content;
dataBean.time = time;
EventBus.getDefault().post(new EventBusMessage(Utils.EVENT_TYPE_SAVE, dataBean));
Toast.makeText(NoteEditActivity.this, getResources().getString(R.string.save), Toast.LENGTH_SHORT).show();
finish();
}
@Override
public void onError(Throwable e) {
LLog.d("onError = "+e.getMessage());
}
@Override
public void onComplete() {
LLog.d("onComplete");
}
});
}
public void delete() {
if (null == dataBean) {
finish();
return;
}
long time = dataBean.time;
Utils.startTask(() -> {
BaseApplication.getDataBaseManager().deleteData(time);
runOnUiThread(() -> {
EventBus.getDefault().post(new EventBusMessage(Utils.EVENT_TYPE_DELETE, dataBean));
Toast.makeText(NoteEditActivity.this, getResources().getString(R.string.delete), Toast.LENGTH_SHORT).show();
finish();
});
});
}
private void update() {
if (null == dataBean) {
finish();
return;
}
String content = editText.getText().toString();
if (!TextUtils.isEmpty(content)) {
delete();
return;
}
long updateTime = System.currentTimeMillis();
Observable.fromCallable(() -> {
// 执行耗时操作
return BaseApplication.getDataBaseManager().updateData(content, dataBean.time, updateTime);
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Integer>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Integer integer) {
LLog.d("onNext = "+integer);
if (null == dataBean) {
dataBean = new DataBean();
}
dataBean.content = content;
dataBean.updateTime = updateTime;
EventBus.getDefault().post(new EventBusMessage(Utils.EVENT_TYPE_SAVE, dataBean));
Toast.makeText(NoteEditActivity.this, getResources().getString(R.string.save), Toast.LENGTH_SHORT).show();
finish();
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
functionNote();
}
public static void invoke(Context context, DataBean dataBean) {
Intent intent = new Intent(context, NoteEditActivity.class);
intent.putExtra("data", dataBean);
context.startActivity(intent);
}
}
package com.ads.cal.notes;
import android.text.Html;
import android.view.View;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
public class TActivity extends BaseActivity {
@Override
int getContentLayoutId() {
return R.layout.activity_t;
}
@Override
void initView() {
TextView rt = findViewById(R.id.t);
rt.setText(Html.fromHtml(loadHtmlFromAssets("content.html")));
findViewById(R.id.kk).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
@Override
void intData() {
}
private String loadHtmlFromAssets(String filename) {
String htmlContent;
try {
InputStream inputStream = getAssets().open(filename);
int size = inputStream.available();
byte[] buffer = new byte[size];
inputStream.read(buffer);
inputStream.close();
htmlContent = new String(buffer);
} catch (IOException e) {
htmlContent = "Failed to load the HTML file.";
}
return htmlContent;
}
}
package com.ads.cal.notes;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Utils {
public static final int EVENT_TYPE_DELETE = 1;
public static final int EVENT_TYPE_SAVE = 2;
private static final ExecutorService service = Executors.newFixedThreadPool(5);
public static void startTask(Runnable runnable) {
service.submit(runnable);
}
}
package com.ads.cal.notes;
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import java.lang.ref.WeakReference;
public class WelcomeActivity extends BaseActivity {
private MyHandler handler;
@Override
int getContentLayoutId() {
return R.layout.activity_welcome;
}
private ProgressBar progressBar;
@Override
void initView() {
progressBar = findViewById(R.id.progress_c);
}
@Override
void intData() {
handler = new MyHandler(this);
handler.sendEmptyMessage(1);
}
public void setProgressBarProgress(int i) {
if (i > 100) {
if (handler != null) {
handler.removeCallbacksAndMessages(null);
}
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
return;
}
progressBar.setProgress(i);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (null != handler) {
handler.removeCallbacksAndMessages(null);
handler = null;
}
}
private static class MyHandler extends Handler {
private final WeakReference<Activity> weakReference;
private int i = 0;
public MyHandler(Activity activity) {
super();
weakReference = new WeakReference<>(activity);
}
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
Activity activity = weakReference.get();
sendEmptyMessageDelayed(1, 10);
if (activity instanceof WelcomeActivity) {
((WelcomeActivity) activity).setProgressBarProgress(i++);
}
}
}
}
package com.ads.cal.notes.adapter;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.ads.cal.notes.NoteEditActivity;
import com.ads.cal.notes.R;
import com.ads.cal.notes.bean.DataBean;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
public class MainAdapter extends RecyclerView.Adapter<MainAdapter.MyViewHolder> {
private final WeakReference<Context> weakReference;
private final ArrayList<DataBean> arrayList;
public MainAdapter(Context context, ArrayList<DataBean> arrayList) {
weakReference = new WeakReference<>(context);
if (null == arrayList) {
arrayList = new ArrayList<>();
}
this.arrayList = arrayList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new MyViewHolder(LayoutInflater.from(weakReference.get()).inflate(R.layout.item_data_layout, null, false));
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
DataBean dataBean = arrayList.get(position);
if (null == dataBean) {
return;
}
if (!TextUtils.isEmpty(dataBean.content)) {
holder.title.setText(dataBean.content);
} else {
holder.title.setText("");
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NoteEditActivity.invoke(weakReference.get(), dataBean);
}
});
}
@Override
public int getItemCount() {
return arrayList.size();
}
public void addData(DataBean dataBean) {
arrayList.remove(dataBean);
arrayList.add(0, dataBean);
notifyDataSetChanged();
}
public void addData(List<DataBean> list) {
arrayList.addAll(list);
notifyDataSetChanged();
}
public void deleteData(DataBean dataBean) {
arrayList.remove(dataBean);
notifyDataSetChanged();
}
public static class MyViewHolder extends RecyclerView.ViewHolder {
private final TextView title;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.text1);
}
}
}
package com.ads.cal.notes.bean;
import androidx.annotation.Nullable;
import java.io.Serializable;
public class DataBean implements Serializable {
public String content;
public long time;
public long updateTime;
@Override
public boolean equals(@Nullable Object obj) {
return null != obj && time == ((DataBean)obj).time;
}
public long showDate() {
return updateTime == 0 ? time : updateTime;
}
}
package com.ads.cal.notes.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import com.ads.cal.notes.LLog;
import com.ads.cal.notes.bean.DataBean;
import java.util.ArrayList;
import java.util.List;
public class DBManager {
private final NotesSQLiteOpenHelper notesSQLiteOpenHelper;
private SQLiteDatabase sqLiteDatabase;
public DBManager(Context context) {
notesSQLiteOpenHelper = new NotesSQLiteOpenHelper(context);
}
private static DBManager dbManager;
public static DBManager init(Context context) {
if (null == dbManager) {
synchronized (DBManager.class) {
if (dbManager == null) {
dbManager = new DBManager(context);
}
dbManager.open();
}
}
return dbManager;
}
// 打开数据库连接
public void open() throws SQLException {
sqLiteDatabase = notesSQLiteOpenHelper.getWritableDatabase();
}
public long insertData(String content, long cTime) {
ContentValues values = new ContentValues();
values.put(NotesSQLiteOpenHelper.COLUMN_CONTENT, content);
values.put(NotesSQLiteOpenHelper.COLUMN_TIME, cTime);
return sqLiteDatabase.insert(NotesSQLiteOpenHelper.TABLE_NAME, null, values);
}
public boolean deleteData() {
int rowsAffected = sqLiteDatabase.delete(
NotesSQLiteOpenHelper.TABLE_NAME,
null,
null);
return rowsAffected > 0;
}
public boolean deleteData(long createTime) {
int rowsAffected = sqLiteDatabase.delete(
NotesSQLiteOpenHelper.TABLE_NAME,
NotesSQLiteOpenHelper.COLUMN_TIME + "=" + createTime,
null);
return rowsAffected > 0;
}
// 更新数据
public int updateData(String content, long createTime, long updateTime) {
ContentValues values = new ContentValues();
values.put(NotesSQLiteOpenHelper.COLUMN_CONTENT, content);
values.put(NotesSQLiteOpenHelper.COLUMN_TIME, updateTime);
return sqLiteDatabase.update(NotesSQLiteOpenHelper.TABLE_NAME, values, NotesSQLiteOpenHelper.COLUMN_TIME + "=" + createTime, null);
}
public List<DataBean> queryData() {
String[] columns = {NotesSQLiteOpenHelper.COLUMN_CONTENT, NotesSQLiteOpenHelper.COLUMN_TIME};
Cursor cursor = sqLiteDatabase.query(NotesSQLiteOpenHelper.TABLE_NAME, columns, null, null, null, null, null);
List<DataBean> dataList = new ArrayList<>();
if (cursor != null) {
try {
while (cursor.moveToNext()) {
String content = cursor.getString(cursor.getColumnIndex(NotesSQLiteOpenHelper.COLUMN_CONTENT));
long time = cursor.getLong(cursor.getColumnIndex(NotesSQLiteOpenHelper.COLUMN_TIME));
// 创建 PictureTranslateData 对象并添加到列表中
DataBean data = new DataBean();
data.content = content;
data.time = time;
dataList.add(0, data);
}
} catch (Exception e) {
LLog.e(e.getMessage());
} finally {
cursor.close(); // 记得关闭 Cursor
}
}
return dataList;
}
}
package com.ads.cal.notes.db;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class NotesSQLiteOpenHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "notes_database.db";
private static final int DATABASE_VERSION = 1;
// 表名和列名
public static final String TABLE_NAME = "notes";
public static final String COLUMN_CONTENT = "content";
public static final String COLUMN_TIME = "cTime";
public NotesSQLiteOpenHelper(@Nullable Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
// 创建表的 SQL 语句
private static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" +
"_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_CONTENT + " TEXT," +
COLUMN_TIME + " INTEGER);";
}
package com.ads.cal.notes.dialog_fragment;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import com.ads.cal.notes.NoteEditActivity;
import com.ads.cal.notes.R;
public class DeleteFragment extends DialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Dialog dialog = getDialog();
if (null != dialog) {
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
// 设置对话框窗口的背景为透明
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// 使用全屏
dialog.getWindow().setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
);
}
View view = inflater.inflate(R.layout.fragment_delete, container, false);
initView(view);
return view;
}
private void initView(View view) {
view.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismissAllowingStateLoss();
}
});
view.findViewById(R.id.clear).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Activity activity = getActivity();
if (activity instanceof NoteEditActivity) {
((NoteEditActivity)activity).delete();
}
dismissAllowingStateLoss();
}
});
}
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dp" android:color="#D9D9D9"/>
<solid android:color="@color/white"/>
<corners android:radius="6dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#00ffffff" android:endColor="@color/white" android:angle="-90"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="6dp"/>
<solid android:color="#5A75FF"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#626E7D"/>
<corners android:radius="5dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="#DFEFFF" /> <!-- 背景颜色 -->
<corners android:radius="10dp" /> <!-- 圆角 -->
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle">
<solid android:color="#0075FF" /> <!-- 进度条颜色 -->
<corners android:radius="10dp" /> <!-- 圆角 -->
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white"/>
<stroke android:width="2dp" android:color="@color/white"/>
<corners android:radius="6dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/kk"
android:layout_width="match_parent"
android:layout_height="76.33dp"
android:background="#6B7077">
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:src="@mipmap/icon_back"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="14dp"
android:layout_toEndOf="@+id/back"
android:gravity="center_vertical"
android:text="@string/about_us"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_marginBottom="20dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#5A75FF"
android:textStyle="bold"
android:textSize="20sp"
android:text="@string/app_name"
android:gravity="center"/>
<TextView
android:id="@+id/v_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#6B7077"
android:textSize="14sp"
android:layout_marginTop="10dp"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="76.33dp"
android:background="#6B7077">
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:src="@mipmap/icon_back"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:src="@mipmap/icon_delete02" />
<ImageView
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@mipmap/icon_done"
android:layout_marginEnd="20dp"
android:layout_toStartOf="@+id/delete"/>
</RelativeLayout>
<EditText
android:id="@+id/ed_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:background="@null"
android:paddingStart="20dp"
android:paddingTop="20dp"
android:textColor="#2D3034"
android:textSize="16sp"
android:paddingEnd="20dp" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="76.33dp"
android:background="#6B7077">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:src="@mipmap/icon_setting" />
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/not_data_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="140dp"
android:src="@mipmap/icon_box" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:gravity="center_horizontal"
android:text="@string/not_data" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listData"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="106.33dp"
android:layout_gravity="bottom"
android:background="@drawable/list_"
/>
<ImageView
android:id="@+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:src="@mipmap/icon_new" />
</FrameLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/kk"
android:layout_width="match_parent"
android:layout_height="76.33dp"
android:background="#6B7077">
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:src="@mipmap/icon_back"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="14dp"
android:layout_toEndOf="@+id/back"
android:gravity="center_vertical"
android:text="@string/privacy_policy"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp">
<TextView
android:id="@+id/t"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</ScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="180dp"
android:src="@mipmap/ic_launcher"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="#5A75FF"
android:layout_marginTop="20dp"
android:textStyle="bold"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
<ProgressBar
android:id="@+id/progress_c"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_alignParentBottom="true"
android:max="100"
android:layout_marginStart="80dp"
android:layout_marginEnd="80dp"
android:layout_marginBottom="80dp"
android:progressDrawable="@drawable/welcome_progress"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/white_corner_4"
android:orientation="vertical"
android:layout_gravity="center"
android:paddingStart="20dp"
android:paddingTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:paddingEnd="20dp"
android:paddingBottom="20dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/tip"
android:textColor="#2D3034"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/delete_top"
android:textColor="#2D3034"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/cancel"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:background="@drawable/cancel_bg"
android:gravity="center"
android:text="@string/cancel"
android:textColor="#6B7077"
android:textSize="15sp" />
<TextView
android:id="@+id/clear"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:background="@drawable/ok_bg"
android:gravity="center"
android:text="@string/clear"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="20dp"
android:paddingEnd="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp">
<ImageView
android:id="@+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@mipmap/icon_arrow" />
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:layout_toStartOf="@+id/arrow"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#2D3034"
android:textSize="16sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="0.33dp"
android:layout_alignParentBottom="true"
android:background="#D9D9D9" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:minWidth="160dp"
android:layout_height="100dp"
android:gravity="start|center_vertical"
android:orientation="vertical"
android:paddingStart="14dp"
android:background="@drawable/pop_main_setting_bg">
<TextView
android:id="@+id/pp"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:gravity="center"
android:drawablePadding="10dp"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
android:drawableStart="@mipmap/icon_policy"
android:text="@string/privacy_policy"/>
<TextView
android:id="@+id/au"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:gravity="center"
android:drawablePadding="10dp"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
android:drawableStart="@mipmap/icon_about"
android:text="@string/about_us"/>
</LinearLayout>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Notes" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="color_6B7077">#6B7077</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">SimpleNote</string>
<string name="not_data">There are no notes yet. write one.</string>
<string name="save">Saved successfully</string>
<string name="delete">Deleted successfully</string>
<string name="tip">Tip</string>
<string name="delete_top">Are you sure you want to delete this note?</string>
<string name="cancel">Cancel</string>
<string name="clear">Clear</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="about_us">About Us</string>
</resources>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment