Initial commit
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
94
app/build.gradle.kts
Normal file
@ -0,0 +1,94 @@
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
@Suppress("DSL_SCOPE_VIOLATION")
|
||||
plugins {
|
||||
id(libs.plugins.android.application.get().pluginId)
|
||||
id(libs.plugins.kotlin.android.get().pluginId)
|
||||
id(libs.plugins.kotlin.kapt.get().pluginId)
|
||||
id(libs.plugins.kotlin.parcelize.get().pluginId)
|
||||
id("realm-android")
|
||||
}
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
applicationId = "ru.myitschool.lab23"
|
||||
versionCode = 1
|
||||
versionName = "0.0.1"
|
||||
|
||||
targetSdk = 33
|
||||
minSdk = 27
|
||||
compileSdk = 33
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
lint {
|
||||
warningsAsErrors = true
|
||||
ignoreWarnings = false
|
||||
abortOnError = true
|
||||
checkAllWarnings = true
|
||||
lintConfig = file("lint.xml")
|
||||
lint {
|
||||
disable.addAll(
|
||||
listOf(
|
||||
"InvalidPackage",
|
||||
"UnusedIds",
|
||||
"GradleDependency",
|
||||
"UnusedResources",
|
||||
"SyntheticAccessor",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
applicationVariants.all {
|
||||
val lintTask = tasks["lint${name.capitalize()}"]
|
||||
assembleProvider.get().dependsOn.add(lintTask)
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
namespace = "ru.myitschool.lab23"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation(libs.android.material)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.androidx.lifecycle.livedata.ktx)
|
||||
implementation(libs.androidx.lifecycle.viewmodel.ktx)
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.koin.core)
|
||||
implementation(libs.koin.android)
|
||||
implementation(libs.androidx.constraintlayout)
|
||||
|
||||
implementation("com.instabug.library:instabug:11.8.0")
|
||||
|
||||
// only this version does not generate gradle merge problems
|
||||
androidTestImplementation(libs.androidx.test.espresso.accessibility)
|
||||
androidTestImplementation(libs.kotlinx.coroutines.test)
|
||||
|
||||
implementation("io.realm.kotlin:library-base:1.5.0")
|
||||
implementation("io.realm:android-adapters:4.0.0")
|
||||
|
||||
// Coroutines
|
||||
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
|
||||
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
|
||||
|
||||
// Coroutine Lifecycle Scopes
|
||||
// implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
|
||||
// implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
|
||||
|
||||
androidTestImplementation(libs.kakao)
|
||||
androidTestImplementation(libs.androidx.test.uiautomator)
|
||||
androidTestImplementation(libs.androidx.test.ext)
|
||||
androidTestImplementation(libs.androidx.test.runner)
|
||||
androidTestImplementation(libs.androidx.test.rules)
|
||||
androidTestImplementation(libs.androidx.test.espresso.core)
|
||||
androidTestImplementation(libs.androidx.navigation.testing)
|
||||
androidTestImplementation(libs.androidx.test.ext)
|
||||
androidTestImplementation(libs.androidx.test.rules)
|
||||
androidTestImplementation(kotlin("test"))
|
||||
testImplementation(libs.androidx.test.ext)
|
||||
}
|
44
app/lint.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
<issue id="UnusedAttribute" severity="error">
|
||||
<ignore regexp="importantForAutofill"/>
|
||||
<ignore regexp="autofillHints"/>
|
||||
</issue>
|
||||
<issue id="InvalidPackage">
|
||||
<ignore path="**/freemarker-2.*.*.jar" />
|
||||
<ignore path="**/nnio-0.2.jar"/>
|
||||
<ignore path="**/bcpkix-jdk15on-1.69.jar" />
|
||||
</issue>
|
||||
|
||||
<issue id="UnusedResources" severity="error">
|
||||
<ignore regexp="store_short_desc|store_full_desc|store_short_dev_desc|store_full_dev_desc" />
|
||||
</issue>
|
||||
|
||||
<issue id="UnusedResources">
|
||||
<ignore path="**/values-**/strings.xml" />
|
||||
<ignore path="**/values/setup.xml" />
|
||||
</issue>
|
||||
|
||||
<issue id="Typos">
|
||||
<ignore path="**/values-**/strings.xml" />
|
||||
<ignore path="**/values/setup.xml" />
|
||||
</issue>
|
||||
|
||||
<issue id="RestrictedApi" severity="error">
|
||||
<ignore path="build" />
|
||||
</issue>
|
||||
|
||||
<issue id="NewApi" severity="error">
|
||||
<ignore path="build" />
|
||||
</issue>
|
||||
|
||||
<issue id="ObsoleteLintCustomCheck" severity="warning">
|
||||
<ignore path="**/fragment-1.2.5/**/lint.jar" />
|
||||
<ignore path="**/work-runtime-2.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-butterknife-runtime-10.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-dagger-lint-aar-2.**.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-annotation-experimental-1.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-firebase-installations**/**/lint.jar" />
|
||||
<ignore path="**/appcompat-1.**/**/lint.jar" />
|
||||
</issue>
|
||||
</lint>
|
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
@ -0,0 +1,12 @@
|
||||
package ru.myitschool.lab23
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.MediumTest
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@MediumTest
|
||||
class InstrumentedTestRealm
|
24
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="ru.myitschool.lab23">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Lab">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
76
app/src/main/java/ru/myitschool/lab23/AdapterTask.java
Normal file
@ -0,0 +1,76 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import io.realm.OrderedRealmCollection;
|
||||
import io.realm.RealmRecyclerViewAdapter;
|
||||
import kotlin.NotImplementedError;
|
||||
|
||||
public class AdapterTask extends RealmRecyclerViewAdapter<Task, AdapterTask.TaskViewHolder> {
|
||||
|
||||
OrderedRealmCollection<Task> data;
|
||||
TaskListChangeListener listener;
|
||||
|
||||
public AdapterTask(@NonNull OrderedRealmCollection<Task> data, @NonNull TaskListChangeListener listener) {
|
||||
super(data, true);
|
||||
this.data = data;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public TaskViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
// todo implement
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull TaskViewHolder holder, int position) {
|
||||
final Task model = getItem(position);
|
||||
if (model != null) {
|
||||
holder.tvTaskContents.setText(model.getTaskContents());
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int holderPosition = holder.getAdapterPosition();
|
||||
listener.updateFocusedItem(data.get(holderPosition).getTaskContents());
|
||||
}
|
||||
});
|
||||
|
||||
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
int holderPosition = holder.getAdapterPosition();
|
||||
RealmManager realmManager = new RealmManager();
|
||||
realmManager.deleteTask(data.get(holderPosition).getTaskId());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int index) {
|
||||
Task task = getItem(index);
|
||||
if (task != null) {
|
||||
return task.getTaskId();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public class TaskViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvTaskContents;
|
||||
|
||||
public TaskViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvTaskContents = itemView.findViewById(R.id.task_contents);
|
||||
}
|
||||
}
|
||||
}
|
102
app/src/main/java/ru/myitschool/lab23/MainActivity.java
Normal file
@ -0,0 +1,102 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import io.realm.OrderedRealmCollection;
|
||||
import io.realm.Realm;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
RecyclerView rvTasks;
|
||||
EditText etTask;
|
||||
TextView tvTotalTasks;
|
||||
|
||||
RealmManager realmManager;
|
||||
AdapterTask adapterTask;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Realm.init(getApplicationContext());
|
||||
realmManager = new RealmManager();
|
||||
|
||||
etTask = findViewById(R.id.new_task_contents);
|
||||
tvTotalTasks = findViewById(R.id.total_tasks);
|
||||
rvTasks = findViewById(R.id.vRV);
|
||||
rvTasks.setLayoutManager(new LinearLayoutManager(this));
|
||||
updateRecycler();
|
||||
updateTotalTasks(realmManager.getNumberOfTasks());
|
||||
|
||||
etTask.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int keyCode, KeyEvent event) {
|
||||
if (keyCode >= KeyEvent.KEYCODE_CALL) {
|
||||
insert(etTask.getText().toString());
|
||||
v.setText(getString(R.string.new_task));
|
||||
v.clearFocus();
|
||||
v.setFocusableInTouchMode(true);
|
||||
InputMethodManager inputManager = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
inputManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
etTask.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
((TextView) v).setText("");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void insert(@NonNull String text) {
|
||||
realmManager.insertTask(new Task(text));
|
||||
etTask.setText("");
|
||||
updateRecycler();
|
||||
}
|
||||
|
||||
|
||||
public void updateRecycler() {
|
||||
if (adapterTask == null) {
|
||||
adapterTask = new AdapterTask(
|
||||
(OrderedRealmCollection<Task>) realmManager.getData(),
|
||||
new TaskListChangeListener() {
|
||||
@Override
|
||||
public void updateFocusedItem(String receivedTaskContents) {
|
||||
etTask.setText(receivedTaskContents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTotalNumber(long totalNumber) {
|
||||
updateTotalTasks(totalNumber);
|
||||
}
|
||||
}
|
||||
);
|
||||
rvTasks.setAdapter(adapterTask);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTotalTasks(long totalNumber) {
|
||||
tvTotalTasks.setText(String.format(getResources().getString(R.string.total_tasks), totalNumber + ""));
|
||||
}
|
||||
|
||||
}
|
55
app/src/main/java/ru/myitschool/lab23/RealmManager.java
Normal file
@ -0,0 +1,55 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.realm.Realm;
|
||||
import io.realm.RealmConfiguration;
|
||||
import kotlin.NotImplementedError;
|
||||
|
||||
public class RealmManager {
|
||||
|
||||
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().name(Realm.DEFAULT_REALM_NAME).schemaVersion(0).allowWritesOnUiThread(true).deleteRealmIfMigrationNeeded().build();
|
||||
Realm realm = Realm.getInstance(realmConfiguration);
|
||||
|
||||
public void insertTask(@NonNull Task task) {
|
||||
Number number = realm.where(Task.class).max("taskId");
|
||||
final int nextId;
|
||||
|
||||
if (number == null) {
|
||||
nextId = 0;
|
||||
} else {
|
||||
nextId = number.intValue() + 1;
|
||||
}
|
||||
|
||||
task.setTaskId(nextId);
|
||||
|
||||
realm.beginTransaction();
|
||||
realm.copyToRealm(task);
|
||||
realm.commitTransaction();
|
||||
}
|
||||
|
||||
public @Nullable List<Task> getData() {
|
||||
return realm.where(Task.class).findAll();
|
||||
}
|
||||
|
||||
public long getNumberOfTasks() {
|
||||
// todo implement
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public void deleteTask(int Task_id) {
|
||||
final Task model = realm.where(Task.class).equalTo("taskId", Task_id).findFirst();
|
||||
realm.executeTransaction(new Realm.Transaction() {
|
||||
@Override
|
||||
public void execute(@NonNull Realm realm) {
|
||||
if (model != null) {
|
||||
// todo implement
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
36
app/src/main/java/ru/myitschool/lab23/Task.java
Normal file
@ -0,0 +1,36 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import io.realm.RealmObject;
|
||||
import kotlin.NotImplementedError;
|
||||
|
||||
public class Task extends RealmObject {
|
||||
|
||||
int taskId;
|
||||
String taskContents;
|
||||
|
||||
public Task() {
|
||||
}
|
||||
|
||||
public Task(@NonNull String taskContents) {
|
||||
// todo implement
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public int getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(int taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public @NonNull String getTaskContents() {
|
||||
return taskContents;
|
||||
}
|
||||
|
||||
public void setTaskContents(@NonNull String taskContents) {
|
||||
this.taskContents = taskContents;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public interface TaskListChangeListener {
|
||||
|
||||
void updateFocusedItem(@NonNull String receivedTaskContents);
|
||||
|
||||
void updateTotalNumber(long totalNumber);
|
||||
}
|
9
app/src/main/res/drawable/add.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
|
||||
android:fillColor="@color/design_default_color_background"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/assignment.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,3c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM14,17L7,17v-2h7v2zM17,13L7,13v-2h10v2zM17,9L7,9L7,7h10v2z"
|
||||
android:fillColor="@color/design_default_color_background"/>
|
||||
</vector>
|
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?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>
|
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<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>
|
43
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/content_main_padding"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/add_new_task"
|
||||
layout="@layout/new_task"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBaseline_toTopOf="@id/vRV"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/vRV"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:contentDescription="@string/all_tasks"
|
||||
app:layout_constraintBottom_toTopOf="@+id/total_tasks"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/add_new_task"
|
||||
tools:listitem="@layout/task_row" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/total_tasks"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom|start"
|
||||
android:paddingTop="@dimen/content_main_padding"
|
||||
android:text="@string/total_tasks"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
24
app/src/main/res/layout/new_task.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="@dimen/size_l"
|
||||
android:layout_gravity="top|end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/new_task_contents"
|
||||
style="@style/TextView.NavigationDrawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/size_l"
|
||||
android:autofillHints="name"
|
||||
android:background="@android:color/transparent"
|
||||
android:drawablePadding="@dimen/icon_padding"
|
||||
android:gravity="center_vertical|start"
|
||||
android:hint="@string/new_task"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textAutoComplete"
|
||||
android:text="@string/new_task"
|
||||
app:drawableLeftCompat="@drawable/add" />
|
||||
|
||||
</LinearLayout>
|
18
app/src/main/res/layout/task_row.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="@dimen/size_l"
|
||||
android:layout_marginBottom="@dimen/size_xs">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_contents"
|
||||
style="@style/TextView.NavigationDrawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/size_l"
|
||||
android:drawablePadding="@dimen/icon_padding"
|
||||
android:gravity="center_vertical|start"
|
||||
android:text="@string/app_name"
|
||||
app:drawableLeftCompat="@drawable/assignment" />
|
||||
|
||||
</LinearLayout>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 7.6 KiB |
10
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="blue_200">#3E91FF</color>
|
||||
<color name="blue_500">#0381FE</color>
|
||||
<color name="blue_700">#0072DE</color>
|
||||
<color name="teal_200">#3E91FF</color>
|
||||
<color name="teal_700">#3E91FF</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
11
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="content_main_padding">24dp</dimen>
|
||||
<dimen name="icon_padding">16dp</dimen>
|
||||
|
||||
<dimen name="size_xs">4dp</dimen>
|
||||
<dimen name="size_s">16dp</dimen>
|
||||
<dimen name="size_m">32dp</dimen>
|
||||
<dimen name="size_l">48dp</dimen>
|
||||
<dimen name="ruler_weight">2dp</dimen>
|
||||
</resources>
|
6
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<string name="app_name">Tasks</string>
|
||||
<string name="new_task">New Task</string>
|
||||
<string name="total_tasks">"Total tasks: %1$s</string>
|
||||
<string name="all_tasks">All tasks here</string>
|
||||
</resources>
|
11
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="TextView">
|
||||
</style>
|
||||
|
||||
<style name="TextView.NavigationDrawer">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:fontFamily">sans-serif-medium</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
</style>
|
||||
</resources>
|
24
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Lab" parent="Theme.Material3.DayNight">
|
||||
<!-- Primary color -->
|
||||
<item name="colorPrimary">@color/blue_500</item>
|
||||
<item name="colorPrimaryVariant">@color/blue_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary color -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color -->
|
||||
<!--<item name="android:statusBarColor" >?attr/colorPrimaryVariant</item>-->
|
||||
<!-- Floating Action Button Container -->
|
||||
<item name="colorPrimaryContainer">@color/blue_500</item>
|
||||
<!--ActionBar -->
|
||||
<item name="colorSurface">@color/blue_700</item>
|
||||
<item name="colorOnSurface">@color/white</item>
|
||||
|
||||
<item name="android:navigationBarColor">@color/blue_200</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
17
app/src/test/java/ru/myitschool/lab23/ExampleUnitTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|