Skip to content

Commit c7cd4ac

Browse files
committed
Counter_v1.7.5
1 parent ed4fbf5 commit c7cd4ac

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

.idea/deploymentTargetDropDown.xml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ android {
77

88
defaultConfig {
99
applicationId "com.myapp.textcounter"
10-
minSdk 21
10+
minSdk 19
1111
targetSdk 34
1212
versionCode 1
13-
versionName "1.7"
13+
versionName "1.7.5"
1414

1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616
}
@@ -34,4 +34,4 @@ dependencies {
3434
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
3535
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
3636

37-
}
37+
}

app/src/main/java/com/myapp/textcounter/activity/MainActivity.java

+13-11
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ protected void onCreate(Bundle savedInstanceState) {
9494
//dbの状態に応じて設定をアプリ起動時に反映
9595
bindSettingData( );
9696

97-
/*ディスプレイの密度を取得し、密度が2.75以下の場合はサイズを変える*/
98-
if(getResources().getDisplayMetrics().density> 2.75){
99-
myLibrary.setLayoutDp(this, textBOX, 335f, 300f);//テキストボックス
97+
98+
/*ディスプレイの密度を取得し、サイズを変える*/
99+
//System.out.println(getResources().getDisplayMetrics().scaledDensity);
100+
if(getResources().getDisplayMetrics().scaledDensity> 450){
101+
myLibrary.setLayoutDp(this, textBOX, 320f, 300f);//テキストボックス
100102
myLibrary.setLayoutDp(this, Watcher, 95f, 50f);//スイッチ
101103
}
102104
}
@@ -152,9 +154,9 @@ public void onClick(View view) {
152154
else{
153155
//クリップボードにセット
154156
clipboard.setPrimaryClip(ClipData.newPlainText(null, textBOX.getText ()));
155-
if(Build.VERSION.SDK_INT > 33) {//os 13以下の時だけメッセージを出す
156-
myLibrary.msgToast(getApplicationContext(),R.string.burble_message_copied,Toast.LENGTH_SHORT);
157-
}
157+
if(Build.VERSION.SDK_INT > 33) {//os 13以下の時だけメッセージを出す
158+
myLibrary.msgToast(getApplicationContext(),R.string.burble_message_copied,Toast.LENGTH_SHORT);
159+
}
158160
}
159161
}
160162
}
@@ -179,9 +181,9 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
179181
LayoutInflater inflater = requireActivity().getLayoutInflater();
180182
View myDia = inflater.inflate(R.layout.dialog_detail, null);
181183
CheckBox half_engCheckbox = myDia.findViewById(R.id.half_alphabet_Checkbox),
182-
half_numCheckbox = myDia.findViewById(R.id.half_number_CheckBox),
183-
full_engCheckbox = myDia.findViewById(R.id.full_alphabet_Checkbox),
184-
full_numCheckbox = myDia.findViewById(R.id.full_number_Checkbox);
184+
half_numCheckbox = myDia.findViewById(R.id.half_number_CheckBox),
185+
full_engCheckbox = myDia.findViewById(R.id.full_alphabet_Checkbox),
186+
full_numCheckbox = myDia.findViewById(R.id.full_number_Checkbox);
185187
EditText setMaxNum = myDia.findViewById(R.id.editSetLength);
186188
TextView letter = myDia.findViewById(R.id.text_letters2),
187189
line = myDia.findViewById(R.id.text_lines2),
@@ -323,8 +325,8 @@ void bindSettingData(){
323325
myLibrary.dataAllDelete(modeDB,"watcherModeData");
324326
}
325327
//compound btnイベント呼び出し//
326-
if (myLibrary.isMode(modeDB,"maxLengthData",new String[]{"size"},"TRUE")){
327-
maxCursor = modeDB.query("maxLengthData",new String[]{"size"},null,null,null,null,null);
328+
maxCursor = modeDB.query("maxLengthData",new String[]{"size"},null,null,null,null,null);
329+
if (maxCursor.moveToFirst()){
328330
maxText[0] = new InputFilter.LengthFilter(Integer.parseInt(maxCursor.getString(0)));
329331
textBOX.setFilters(maxText);
330332
}

app/src/main/java/com/myapp/textcounter/model/MyLibrary.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ public void configUpdate(SQLiteDatabase db, String tableName,String key ,String
6868
//引数のカーソルからテーブルの列にデータがるかつ、そこに含まれている場合はCompoundButtonをtrueにする
6969
public boolean isMode(SQLiteDatabase db, String tableName, String[] value, String matchFlags){
7070
Cursor modeCursor = db.query(tableName, value,null,null,null,null,null);
71-
if (modeCursor.moveToFirst()) {
72-
if (modeCursor.getString(0).equals(matchFlags))modeCursor.close(); return true;
71+
if(modeCursor.moveToFirst() && modeCursor.getString(0).equals(matchFlags)){
72+
modeCursor.close();
73+
return true;
74+
}else {
75+
modeCursor.close();
76+
return false;
7377
}
74-
modeCursor.close();
75-
return false;
78+
7679
}
7780
//CompoundButton系統でスイッチが操作され、trueならdbにデータを格納し、falseなら消すメソッド
7881
public void dataMatchListener(boolean isChecked, SQLiteDatabase db, String tableName, String[] values , String[] flag){

app/src/main/java/com/myapp/textcounter/model/PatternModel.java

-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
import android.widget.Toast;
66

77
import com.myapp.textcounter.R;
8-
98
import java.util.regex.Pattern;
109

1110
public class PatternModel {
1211
MyLibrary myLibrary = new MyLibrary();
13-
static SQLiteDatabase modeDB;
1412

1513
public PatternModel(Context c,SQLiteDatabase db,Object tryText){//チェックボックスがタッチされているパターンに応じてメッセージを振り分け
1614
//1項目以上押された時 英字全角+数字全角+数字半角@@

0 commit comments

Comments
 (0)