1.5.8 UI Fix

This commit is contained in:
icewithcola 2024-06-01 16:21:54 +08:00
parent 001975aab1
commit 14b41f2f2d
12 changed files with 51 additions and 17 deletions

View file

@ -11,8 +11,8 @@ android {
applicationId = "uk.kagurach.android101"
minSdk = 31
targetSdk = 34
versionCode = 157
versionName = "1.5.7"
versionCode = 158
versionName = "1.5.8"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

View file

@ -55,7 +55,7 @@
android:label="@string/title_activity_add_page"
android:theme="@style/Theme.TODOList" />
<activity
android:name=".todoList.MainActivity"
android:name=".todoList.TodoListMainActivity"
android:exported="true"
android:label="todoListMain"
android:theme="@style/Theme.TODOList">

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.IBinder;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
@ -20,6 +21,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.room.util.StringUtil;
public class MainActivity2 extends AppCompatActivity {
@ -156,7 +158,9 @@ public class MainActivity2 extends AppCompatActivity {
private void updateCurrentSettingShower(){
TextView tv = findViewById(R.id.P2SettingResult);
String sb = "Color = #" + Integer.toString(_text_color&0xffffff, 16) +
String sb = "Color = #" +
String.format("%6s",Integer.toString(_text_color&0xffffff, 16))
.replace(" ","0") +
"; TextSize = " +
_text_size +
"." +
@ -169,6 +173,11 @@ public class MainActivity2 extends AppCompatActivity {
public void onClick(View v) {
FrameLayout fl = findViewById(R.id.P2SettingPage);
fl.setVisibility(View.VISIBLE);
// Disable NextPage Button
Button nextPageButton = findViewById(R.id.next_page_nav_2);
nextPageButton.setEnabled(false);
}
}
@ -177,6 +186,13 @@ public class MainActivity2 extends AppCompatActivity {
public void onClick(View v) {
FrameLayout fl = findViewById(R.id.P2SettingPage);
fl.setVisibility(View.GONE);
// Close Input Method
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
Button nextPageButton = findViewById(R.id.next_page_nav_2);
nextPageButton.setEnabled(true);
}
}
@ -223,6 +239,14 @@ public class MainActivity2 extends AppCompatActivity {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (getCurrentFocus() != null) {
// If the Setting float window shows, do nothing
FrameLayout fl = findViewById(R.id.P2SettingPage);
if (fl!=null){
if (fl.getVisibility() == View.VISIBLE){
return super.dispatchTouchEvent(ev);
}
}
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}

View file

@ -27,7 +27,7 @@ public class Page5 extends AppCompatActivity {
AnimalTypeAutoCompleteHelper completeHelper = null;
final AnimalDatabaseHelper dbHelper = new AnimalDatabaseHelper(this);
PageHelper pageHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -39,6 +39,8 @@ public class Page5 extends AppCompatActivity {
return insets;
});
pageHelper = new PageHelper(this, Page4.class,null);
// Set auto-suggestions for animals
AutoCompleteTextView autoCompleteTextView = findViewById(R.id.AnimalTypeAutoCompleteInput);
try {
@ -64,6 +66,10 @@ public class Page5 extends AppCompatActivity {
Button P5QueryButton = findViewById(R.id.P5QueryButton);
P5QueryButton.setOnClickListener(new QueryButtonHandler());
Button P5NextPage = findViewById(R.id.P5NextPage);
P5NextPage.setOnClickListener(pageHelper.pageButtonHandler);
P5NextPage.setOnLongClickListener(pageHelper.longClickHandler);
}
class AddAnimalButtonHandler implements View.OnClickListener {

View file

@ -10,6 +10,7 @@ import android.view.View;
public class PageHelper {
public final LongClickHandler longClickHandler = new LongClickHandler();
public final PageButtonHandler pageButtonHandler = new PageButtonHandler();
private final Context _curr;
private final Class<?> _prev;
private final Class<?> _next;

View file

@ -171,7 +171,7 @@ class AddPage() : ComponentActivity() {
timePickerState.minute.toString()
)
loader.changeItem(todoItem)
val myIntent = Intent(context, MainActivity::class.java)
val myIntent = Intent(context, TodoListMainActivity::class.java)
ContextCompat.startActivity(context, myIntent, null)
}
},

View file

@ -24,7 +24,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.core.content.ContextCompat
import uk.kagurach.android101.todoList.ui.theme.LightBlue100
class MainActivity : ComponentActivity() {
class TodoListMainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
val loader = TodoItemLoader(this)
val tmpList = loader.getTodoItems()
@ -65,6 +65,7 @@ fun LayOut(tmpList: List<TodoItem>?) {
floatingActionButton = {
NextPage {
val myIntent = Intent(context, AddPage::class.java)
myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
ContextCompat.startActivity(context, myIntent, null)
}
},

View file

@ -6,4 +6,5 @@
android:top="20dp"
android:right="20dp"
android:bottom="20dp"/>
<stroke android:color="#6A000000" android:width="3dp"/>
</shape>

View file

@ -98,7 +98,7 @@
android:textAllCaps="false"
android:text="@string/font_size"
android:textSize="18sp"
android:layout_marginTop="18dp"/>
android:layout_marginTop="5dp"/>
<Button
android:id="@+id/Page2SetSP"
@ -247,7 +247,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginStart="45dp"
android:layout_marginStart="20dp"
android:text="@string/test_color"
android:textAllCaps="false"/>
@ -281,21 +281,22 @@
android:layout_height="70dp"
android:orientation="horizontal"
android:layout_marginTop="5dp"
android:layout_marginBottom="15dp"
>
<EditText
android:id="@+id/P2SetTextSize"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ems="10"
android:layout_weight="1"
android:inputType="number"
android:hint="设置字体大小"
/>
<Button
android:id="@+id/Page2SetSize"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="30dp"
android:layout_weight="1"
android:onClick="setSize"
android:textAllCaps="false"
android:text="@string/set" />

View file

@ -42,6 +42,6 @@
<string name="rgb_g_range">G:0-255</string>
<string name="rgb_b_range">B:0-255</string>
<string name="set_per_unit_font_size">设置每个单位的字体大小</string>
<string name="font_size">字体大小</string>
<string name="p2_default_setting">Color = #ffffff; TextSize = 70.sp</string>
<string name="font_size">字体\n大小</string>
<string name="p2_default_setting">Color = #000000; TextSize = 70.sp</string>
</resources>

View file

@ -42,6 +42,6 @@
<string name="rgb_g_range">G:0-255</string>
<string name="rgb_b_range">B:0-255</string>
<string name="set_per_unit_font_size">Set per unit font size</string>
<string name="font_size">Font Size:</string>
<string name="p2_default_setting">Color = #ffffff; TextSize = 70.sp</string>
<string name="font_size">Font\nSize</string>
<string name="p2_default_setting">Color = #000000; TextSize = 70.sp</string>
</resources>

View file

@ -9,7 +9,7 @@
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="uk.kagurach.android101"
android:targetClass="uk.kagurach.android101.todoList.MainActivity" />
android:targetClass="uk.kagurach.android101.todoList.TodoListMainActivity" />
<categories android:name="android.shortcut.conversation" />
<capability-binding android:key="actions.intent.CREATE_MESSAGE" />
</shortcut>