From e2a78fee8c7a91be1e60d4894c4f735b34c30897 Mon Sep 17 00:00:00 2001 From: QiubyZ Date: Fri, 9 Feb 2024 04:23:38 +0800 Subject: [PATCH] LICENSE --- .androidide/editor/openedFiles.json | 20 ---------- LICENSE.txt | 9 +++++ .../java/qz/userdictionary/MainActivity.java | 38 ++++++++++++++++--- app/src/main/res/layout/activity_main.xml | 2 + 4 files changed, 43 insertions(+), 26 deletions(-) delete mode 100644 .androidide/editor/openedFiles.json create mode 100644 LICENSE.txt diff --git a/.androidide/editor/openedFiles.json b/.androidide/editor/openedFiles.json deleted file mode 100644 index aefcf47..0000000 --- a/.androidide/editor/openedFiles.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "allFiles": [ - { - "file": "/storage/emulated/0/AndroidIDEProjects/QZ UserDict/settings.gradle", - "selection": { - "end": { - "column": 31, - "index": 283, - "line": 16 - }, - "start": { - "column": 31, - "index": 283, - "line": 16 - } - } - } - ], - "selectedFile": "/storage/emulated/0/AndroidIDEProjects/QZ UserDict/settings.gradle" -} \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..4583c3a --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 Qiuby Zhukhi + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/app/src/main/java/qz/userdictionary/MainActivity.java b/app/src/main/java/qz/userdictionary/MainActivity.java index d95372f..32063d4 100644 --- a/app/src/main/java/qz/userdictionary/MainActivity.java +++ b/app/src/main/java/qz/userdictionary/MainActivity.java @@ -4,6 +4,7 @@ import android.os.Handler; import android.os.Looper; import android.provider.UserDictionary; +import android.widget.Toast; import qz.userdictionary.ViewModel.Dialogs; import android.text.Editable; @@ -31,14 +32,14 @@ protected void onCreate(Bundle savedInstanceState) { // Inflate and get instance of binding binding = ActivityMainBinding.inflate(getLayoutInflater()); - + // set content view to binding's root setContentView(binding.getRoot()); - if(getIntent() != null) { + if (getIntent() != null) { String words = getIntent().getStringExtra(Intent.EXTRA_PROCESS_TEXT); binding.checkleng.setText(words); } - + textitem = new ArrayList(); adapter = new mAdpView(textitem, new Handler(Looper.getMainLooper())); dictionary = new UserDictionaryHelper(this); @@ -46,12 +47,37 @@ protected void onCreate(Bundle savedInstanceState) { binding.recyclerView.setLayoutManager(new LinearLayoutManager(this)); binding.recyclerView.setAdapter(adapter); -// binding.keys.setText("coba"); -// binding.checkleng.setText("makan ikan tapi nete"); -// + // binding.keys.setText("coba"); + // binding.checkleng.setText("makan ikan tapi nete"); + // textitem.addAll(dictionary.getListItem()); adapter.notifyDataSetChanged(); + binding.tergetAngka.addTextChangedListener( + new TextWatcher() { + + @Override + public void beforeTextChanged( + CharSequence arg0, int arg1, int arg2, int arg3) {} + @Override + public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { + try { + if(Integer.valueOf(binding.tergetAngka.getText().toString()) != null){ + if(Integer.valueOf(binding.tergetAngka.getText().toString()) > 101){ + binding.tergetAngka.setError("Aturan Google panjang kata tidak lebih dari 101"); + } + } + } catch(Exception err) { + Toast.makeText(binding.getRoot().getContext(), err.toString(), Toast.LENGTH_LONG).show(); + } + + } + @Override + public void afterTextChanged(Editable arg0) { + + } + }); + binding.checkleng.addTextChangedListener( new TextWatcher() { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 3c5b67b..4cad015 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -16,6 +16,8 @@ android:layout_height="wrap_content" android:layout_width="match_parent" android:inputType="number" + app:counterMaxLength="101" + app:errorEnabled="true" android:id="@+id/tergetAngka" />