Browse Source

minior tweak

KngStr 3 năm trước cách đây
mục cha
commit
1c4aa297a5
2 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 4 1
      Source/ksAndroid.Helpers.pas
  2. 6 1
      Source/ksString.pas

+ 4 - 1
Source/ksAndroid.Helpers.pas

@@ -439,7 +439,10 @@ var
   AService: JObject;
 begin
   AService := Context.getSystemService(TJContext.JavaClass.ACTIVITY_SERVICE);
-  Result := TJActivityManager.Wrap((AService as ILocalObject).GetObjectID);
+  if AService <> nil then
+    Result := TJActivityManager.Wrap((AService as ILocalObject).GetObjectID)
+  else
+    Result := nil;
 end;
 
 class function TAndroidHelperEx.GetJContext: JContext;

+ 6 - 1
Source/ksString.pas

@@ -240,7 +240,12 @@ var
   LUnit: Char;
 begin
   Result := 1;
-  LUnit := LowerCase(AUnit);
+  case AUnit of
+    'A'..'Z':
+      LUnit := Char(Word(AUnit) or $0020);
+  else
+    LUnit := AUnit;
+  end;
   for I := Low(Units) to High(Units) do begin
     if (I > 0) then
       Result := Result * 1024;