Перейти к содержанию
Fire Monkey от А до Я

tromani

Пользователи
  • Постов

    31
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные tromani

  1. В 14.04.2017 в 19:54, enatechno сказал:

    libmidas.dylib - это только для IOS-симулятора. Для реальных iOS устройств нужно деплоить libmidas.a:
    C:\Program Files (x86)\Embarcadero\Studio\<версия RAD>\lib\iosDevice64\release\libmidas.a
    C:\Program Files (x86)\Embarcadero\Studio\<версия RAD>\lib\iosDevice32\release\libmidas.a
    http://docwiki.embarcadero.com/RADStudio/Berlin/en/DbExpress_Supported_Database_Management_Systems
     

    http://prntscr.com/gybz77

    *.a тоже пишет что нельзя деплоить

  2. Собственно сабж, перенес из основной программы в сервис ничего не работает может чтото не так делаю подскажите

    смысл в том чтоб в сервисе обрабатывать входящие смс

    unit utMainsmsResolver;
    
    interface
    
    uses
      System.SysUtils,
      System.Classes,
      System.Android.Service,
      AndroidApi.JNI.GraphicsContentViewText,
      Androidapi.JNI.Os,
      Androidapi.JNI.App,
      CSBroadcastReceiver,
      Androidapi.JNI.JavaTypes,
      IdHTTP, IdCoderMIME,RR.HTTPwider,
    
      Androidapi.Jni,
      Androidapi.Helpers,
      Androidapi.JNI.Provider,
      Androidapi.JNI.Net,
      Androidapi.JNIBridge,
      Androidapi.JNI.Telephony;
    
    type
      TDM = class(TAndroidIntentService)
        function AndroidServiceStartCommand(const Sender: TObject;
          const Intent: JIntent; Flags, StartId: Integer): Integer;
        procedure AndroidServiceDestroy(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
        procedure CreateBroadcastReceiver;
        procedure BroadcastReceiverOnReceive(csContext: JContext; csIntent: JIntent);
        procedure CheckSmsInState(Context: JContext; Intent: JIntent);
      end;
    
    var
      DM: TDM;
      BroadcastReceiver: TCSBroadcastReceiver;
    
    implementation
    
    {%CLASSGROUP 'FMX.Controls.TControl'}
    
    {$R *.dfm}
    
    procedure TDM.CreateBroadcastReceiver;
    begin
      if not Assigned(BroadcastReceiver) then
        begin
          BroadcastReceiver:= TCSBroadcastReceiver.Create(nil);
          BroadcastReceiver.OnReceive:= BroadcastReceiverOnReceive;
          BroadcastReceiver.RegisterReceive;
          BroadcastReceiver.Add('android.provider.Telephony.SMS_RECEIVED',-1);
        end;
    end;
    
    procedure TDM.BroadcastReceiverOnReceive(csContext: JContext; csIntent: JIntent);
    begin
      CheckSmsInState(csContext, csIntent);
    end;
    
    procedure TDM.CheckSmsInState(Context: JContext; Intent: JIntent);
    begin
      // чтото делаем с смс
    end;
    
    procedure TDM.AndroidServiceDestroy(Sender: TObject);
    begin
      if Assigned(BroadcastReceiver) then
        FreeAndNil(BroadcastReceiver);
    end;
    
    function TDM.AndroidServiceStartCommand(const Sender: TObject;
      const Intent: JIntent; Flags, StartId: Integer): Integer;
    begin
      CreateBroadcastReceiver;
      Result:=TJService.JavaClass.START_STICKY;
      //CreateBroadcastReceiver;
    end;

    пробовал метод 

    CreateBroadcastReceiver

    вставлять и до и после start_sticky и в onCreate результат один ничего не происходит

    версия IDE - berlin

    повторюсь если в коде основной программы то все работает на ура

  3. Всем привет накидал тут пару простых компонентов, сильно не ругайте сами компоненты, это просто для примера самой задачи

    Дальше вопрос, как к "типа табличному" компоненту прицепить чтото чтоб его в "bind visualy" было видно и оно заполнялось как таблица

    вот из моего примера как задать колонкам например поля таблицы а строкам значения...

    вот листинг

    unit RR.TextPanel;
    
    interface
    
    uses
      System.Classes,
      System.SysUtils,
    
      FMX.Objects,
      FMX.Types,
      FMX.Graphics;
    type
    
      TCustomTextPanel=class(TRectangle)
      protected
        FTextOutline  : TText;
        procedure SetText(value:string);
        function GetText:string;
        procedure SetSettings(value:TTextSettings);
        function GetSettings:TTextSettings;
        function GetTextMargins:TBounds;
      public
        constructor Create(AOwner:TComponent);override;
        property Text:string read GetText write SetText;
        property TextSettings:TTextSettings read GetSettings write SetSettings;
        property TextMargins:TBounds read GetTextMargins;
        destructor Destroy;override;
      end;
    
      TTextPanel = class (TCustomTextPanel)
      published
        property Text;
        property TextSettings;
        property TextMargins;
      end;
    
    implementation
    
    constructor TCustomTextPanel.Create(AOwner:TComponent);
    begin
      inherited Create(AOwner);
      Parent:=TFmxObject(AOwner);
      Stroke.Kind:=TBrushKind.None;
      FTextOutline:=TText.Create(Self);
      FTextOutline.Parent:=Self;
      FTextOutline.Align:=TAlignLayout.Client;
      FTextOutline.Text:='text';
      FTextOutline.TextSettings.WordWrap:=True;
      FTextOutline.TextSettings.Font.Family:='Arial';
      FTextOutline.HitTest:=False;
    end;
    
    procedure TCustomTextPanel.SetText(value:string);
    begin
      FTextOutline.Text:=value;
    end;
    
    function TCustomTextPanel.GetText:string;
    begin
      Result:=FTextOutline.Text;
    end;
    
    procedure TCustomTextPanel.SetSettings(value:TTextSettings);
    begin
      FTextOutline.TextSettings.Assign(value);
    end;
    
    function TCustomTextPanel.GetSettings:TTextSettings;
    begin
      Result:=FTextOutline.TextSettings;
    end;
    
    function TCustomTextPanel.GetTextMargins:TBounds;
    begin
      Result:=FTextOutline.Margins;
    end;
    
    destructor TCustomTextPanel.Destroy;
    begin
      FreeAndNil(FTextOutline);
      inherited Destroy;
    end;
    
    end.
    unit RR.SimpleGrid;
    
    interface
    
    uses
      System.Classes,
      System.SysUtils,
      System.UITypes,
    
      FMX.Objects,
      FMX.Types,
      FMX.Graphics,
    
      RR.TextPanel;
    
    type
      TColScaleMode=(csmNone,csmDominant,csmEqual);
    
      TCustomSimpleGrid = class;
    
      TSimpleGridCustomRow = class(TRectangle)
      protected
        FCells        : array of TTextPanel;
        FGrid         : TCustomSimpleGrid;
        function GetCellItem(Index: Integer):TTextPanel;
        procedure SetColCount(AColCount:integer);
      public
        constructor Create(AOwner:TComponent); override;
        property Cell[Index: Integer]: TTextPanel read GetCellItem;
        destructor Destroy; override;
      end;
    
      TCustomSimpleGrid = class(TRectangle)
      protected
        FRows             : array of TSimpleGridCustomRow;
        FColCount         : Integer;
        FScaledCol        : Integer;
        FColScaleMode     : TColScaleMode;
        FGridColor        : TAlphaColor;
        FDefaultRowHeight : integer;
        function GetCell(X,Y:integer):TTextPanel;
        procedure Resize; override;
        procedure SetColCount(Value:integer);
        procedure SetColScaleMode(Value:TColScaleMode);
        function GetCellValue(X,Y:integer):string;
        procedure SetCellValue(X,Y:integer;Value:string);
        function GetRowCount:integer;
        procedure SetRowCount(Value:integer);
        procedure SetDefaultRowHeight(Value:integer);
        procedure SetGridColor(Value:TAlphaColor);
      public
        constructor Create(AOwner:TComponent);override;
        property Cell[X,Y:integer]:TTextPanel read GetCell;
        property CellValues[X,Y:integer]:string read GetCellValue write SetCellValue;
        property ColCount:integer read FColCount write SetColCount;
        property RowCount:integer read GetRowCount write SetRowCount;
        property ColScaleMode:TColScaleMode read FColScaleMode write SetColScaleMode;
        property ScaledCow:integer read FScaledCol write FScaledCol;
        property GridColor:TAlphaColor read FGridColor write SetGridColor;
        property DefaultRowHeight:integer read FDefaultRowHeight write SetDefaultRowHeight;
        destructor Destroy; override;
      end;
    
      TSimpleGrid = class(TCustomSimpleGrid)
      published
        property RowCount default 2;
        property ColCount default 2;
        property ColScaleMode;
        property ScaledCow;
        property GridColor default TAlphaColorRec.Gray;
        property DefaultRowHeight default 22;
      end;
    
    implementation
    
    constructor TSimpleGridCustomRow.Create(AOwner:TComponent);
    begin
      inherited Create(AOwner);
      Parent:=TFmxObject(AOwner);
      ClipChildren:=True;
      Fill.Kind:=TBrushKind.None;
    end;
    
    procedure TSimpleGridCustomRow.SetColCount(AColCount:integer);
    var
      OldColCount,i:integer;
      X:single;
    begin
      OldColCount:=Length(FCells);
      X:=0;
      if AColCount>OldColCount then
      begin
        SetLength(FCells,AColCount);
        for i := OldColCount to High(FCells) do
        begin
          FCells[i]:=TTextPanel.Create(Self);
          if i>0 then
          begin
            X:=FCells[i-1].Width+FCells[i-1].Position.X+1;
            FCells[i].Margins.Left:=1;
          end;
          FCells[i].Position.X:=X;
          FCells[i].Align:=TAlignLayout.Left;
          FCells[i].Fill.Color:=FGrid.FGridColor;
        end
      end else
      if AColCount<OldColCount then
      begin
        for i := High(FCells) downto AColCount do
        begin
          FCells[i].Parent:=nil;
          FreeAndNil(FCells[i]);
        end;
        SetLength(FCells,AColCount);
      end;
    end;
    
    function TSimpleGridCustomRow.GetCellItem(Index: Integer):TTextPanel;
    begin
      if (Index>=0) and (Index < Length(FCells)) then
        Result:=FCells[Index]
      else
        Result := nil;
    end;
    
    destructor TSimpleGridCustomRow.Destroy;
    begin
      SetColCount(0);
      inherited;
    end;
    
    constructor TCustomSimpleGrid.Create(AOwner:TComponent);
    begin
      inherited Create(AOwner);
      Parent:=TFmxObject(AOwner);
      Stroke.Kind:=TBrushKind.None;
      ClipChildren:=True;
      Fill.Color:=TAlphaColorRec.Black;
      FColScaleMode:=csmDominant;
      FScaledCol:=0;
      FDefaultRowHeight:=22;
      FGridColor:=TAlphaColorRec.White;
      Resize;
    end;
    
    function TCustomSimpleGrid.GetCell(X,Y:integer):TTextPanel;
    begin
      Result:=FRows[Y].GetCellItem(X);
    end;
    
    function TCustomSimpleGrid.GetCellValue(X,Y:integer):string;
    begin
      Result:=FRows[Y].GetCellItem(X).Text;
    end;
    
    procedure TCustomSimpleGrid.SetCellValue(X,Y:integer;Value:string);
    begin
      FRows[Y].GetCellItem(X).Text:=Value;
    end;
    
    procedure TCustomSimpleGrid.SetColCount(Value:integer);
    var
      Ri:integer;
    begin
      if Length(FRows)>0 then
        for Ri := 0 to High(FRows) do
          FRows[Ri].SetColCount(Value);
      FColCount:=Value;
      Resize;
    end;
    
    function TCustomSimpleGrid.GetRowCount:integer;
    begin
      Result:=Length(FRows);
    end;
    
    procedure TCustomSimpleGrid.SetRowCount(Value:integer);
    var
      OldRowCount,i:integer;
    begin
      OldRowCount:=Length(FRows);
      if Value>Length(FRows) then
      begin
        SetLength(FRows,Value);
        for i := OldRowCount to High(FRows) do
        begin
          FRows[i]:=TSimpleGridCustomRow.Create(Self);
          FRows[i].FGrid:=Self;
          FRows[i].SetColCount(FColCount);
          FRows[i].Margins.Top:=1;
          FRows[i].Margins.Left:=1;
          FRows[i].Margins.Bottom:=1;
          FRows[i].Margins.Right:=1;
          if i>0 then
            FRows[i].Position.Y:=FRows[i-1].Position.Y+FRows[i-1].Height+3;
          FRows[i].Align:=TAlignLayout.Top;
        end;
      end;
      Resize;
    end;
    
    procedure TCustomSimpleGrid.SetDefaultRowHeight(Value:integer);
    begin
      FDefaultRowHeight:=Value;
      Resize;
    end;
    
    procedure TCustomSimpleGrid.Resize;
      function GetDomColW:single;
      var
        i:integer;
      begin
        Result:=0;
        for i := 0 to FColCount-1 do
          if i<>FScaledCol then
            Result:=Result+FRows[0].FCells[i].Width;
        Result:=FRows[0].Width-Result-1;
      end;
    var
      Y,X:integer;
      mW,eW,gH:single;
    begin
      gH:=FDefaultRowHeight;
      if (Length(FRows)>0) and (FColCount>0) then
      begin
        gH:=0;
        mW:=GetDomColW;
        eW:=(Width-FColCount-1)/FColCount;
        for Y :=0 to High(FRows) do
        begin
          if FColCount=1 then
            FRows[Y].FCells[X].Width:=FRows[y].Width else
          case FColScaleMode of
            csmDominant:
              FRows[Y].FCells[FScaledCol].Width:=mW;
            csmEqual:
              for x := 0 to High(FRows[Y].FCells) do
                FRows[Y].FCells[x].Width:=eW;
          end;
          FRows[Y].Height:=FDefaultRowHeight;
          gH:=gH+FRows[Y].Height+2;
        end;
      end;
      Height:=gH;
      inherited Resize;
    end;
    
    procedure TCustomSimpleGrid.SetColScaleMode(Value:TColScaleMode);
    begin
      FColScaleMode:=Value;
      Resize;
    end;
    
    procedure TCustomSimpleGrid.SetGridColor(Value:TAlphaColor);
    var
      X,Y:integer;
    begin
      for Y := 0 to High(FRows) do
        for X := 0 to FColCount-1 do
          FRows[Y].FCells[X].Fill.Color:=Value;
      FGridColor:=Value;
    end;
    
    destructor TCustomSimpleGrid.Destroy;
    begin
      SetRowCount(0);
      inherited;
    end;
    
    end.

    в общем было б интересно

    src.zip

  4. да конечно убрал dylib

    на устройстве приложение не запускается это я имел ввиду под "эффекта 0"

    при этом без всяких проблем работает на адроиде и вин32 и iosSimulator 

    ошибка не таже, просто черный экран

  5. первый вариант не пойдет там Header/Footer разная высота с основным Item, к сожалению и количество Header чтоб посчитать надо перелапатить получается весь source

    FindItemByPosition такого или подобного свойства не нашел у себя. видимо никак
  6. вопрос снят.

    видимо оно когда апдейтит проходит отдельно Header,Footer и т.д. надо проверять что апдетится то что надо  

      if ListView1.Items[AItem.Index].Objects.Count=4 then
      begin
        A:=TListItemImage(ListView1.Items[AItem.Index].Objects.FindDrawable('imChecked'));
        A.ImageIndex:=0;
      end;

  7. Всем привет, проблема в следующем

    отредактировал ItemAppearance, сделал ImageObject,

     

    теперь в как и куда в событие

    ListView1UpdateObjects(const Sender: TObject;
      const AItem: TListViewItem);

    begin

      пробовал:

      AItem.Bitmap.Assign(image1.bitmap); -не рабоает 

      TListItemImage(AItem.View.FindDrawable('imChecked')) значение = nil

    end;

    в общем что куда чтоб прицепить картину?

    Screenshot_0001.jpg

  8. у меня приложение использует midas подскажите что куда деплоить, или что я делаю не так, я добавил вручную libmidas из папки 

    c:\Program Files (x86)\Embarcadero\Studio\18.0\Redist\iossimulator\

    но при попытке опубликовать в аппсторе выдало ошибку

    что делать

    добавлял вручную так как не нашел в стандартном списке

    Screenshot_5.png

    Screenshot_6.png

  9. вроде все сделал правильно, получил сертификаты т.д. сделал build, deploy родился файлик *.ipa

    далее запустил application loader

    http://prntscr.com/eua3ai

    имеем вот такую беду

    все бандлы я прописал в project-options все профили оно видит в provisions что не так то?

  10. В 23.03.2017 в 20:38, ENRGY сказал:

    Можно и без устройства, на симуляторе.

    Step 1: Install the Platform Assistant

    The Platform Assistant must be running on the Mac

    толи я безнадежно туп толи всетаки надо иметь устройство - работающий мак

  11. В 12.01.2017 в 20:11, krapotkin сказал:

    но за недельку абсолютно реально

    да с делфи последнее врем все так, приходится недельку на то недельку на се а вот не хочется тратить столько времени на очевидно вещи которые должны бы в комплекте идти... особенно в контексте стоимости.

     

    В 12.01.2017 в 22:36, Равиль Зарипов (ZuBy) сказал:

    В будущих версиях, в роадмэп все написано

    ну да наверно может быть спустя еще 5-6 версий мы получим продукт востребованный сегодня...

  12. удивляет конечно ембаркадеро, что за нехорошие люди, ну если вы на каждом углу кричите что у вас мульти-платформенная система то где виндовс в TMapView 

  13. uses

      Androidapi.JNI.App, Androidapi.JNI.JavaTypes, AndroidApi.JniBridge;

    procedure GetNotificationManager(var NfMn: JNotificationManager);

    var

      NotManObj : JObject;

    begin

      NotManObj:=SharedActivity.getSystemService(TJActivity.JavaClass.NOTIFICATION_SERVICE);
      NfMn:=TJNotificationManager.Wrap((NotManObj as ILocalObject).GetObjectID);

    end;

     

    для андроидов до 5.0 все ок

    начиная с 5.0 вылетает - "в приложении произошла ошибка" и досвиданья

    причем это происходит на многих вариантах getSystemService

    может кто знает в чем дело, я гуглил гдето встречал обсуждение но сечас найти чтото не могу, может знаете как быть

    путем  разбиения на части выявил что проблема в

    (NotManObj as ILocalObject).GetObjectID 

    этом куске - аксесс виолатион имеем

  14. в общем вышел из положения, очередным костылем к FMX, если кому понадобиться вот полный текст, работает сносно

    procedure JBLoadFromFile(FileName:string; const ABitmap : TBitmap;W,H:integer);
    
      procedure SwapRB(var src:TJavaArray<Integer>);
      var
        i:integer;
      begin
    	  for i:= 0 to src.Length-1 do
          src.Items[i]:=(src.Items[i] and $FF00FF00) or ((src.Items[i] and $000000FF) shl 16) or
            ((src.Items[i] and $00FF0000) shr 16);
      end;
    
      procedure JBitmapToBitmap(const AImage: JBitmap; const ResBitmap: TBitmap);
      var
        ImageData: TJavaArray<Integer>;
        BitmapData: TBitmapData;
        Width, Height: Integer;
      begin
        Width := AImage.getWidth;
        Height := AImage.getHeight;
        try
          ResBitmap.SetSize(Width,Height);
          ImageData := TJavaArray<Integer>.Create(Width * Height);
          AImage.getPixels(ImageData, 0, Width, 0, 0, Width, Height);
          SwapRB(ImageData);
          if ResBitmap.Map(TMapAccess.maWrite, BitmapData) then
          try
            Move(ImageData.Data^, BitmapData.Data^, Width * Height * SizeOf(Integer));
          finally
            ResBitmap.Unmap(BitmapData);
          end else
            ResBitmap.Clear(TAlphaColorRec.Green);
        except
          ResBitmap.Clear(TAlphaColorRec.Green);
        end;
      end;
    
      function calculateInSampleSize(options:JBitmapFactory_Options; reqWidth, reqHeight:integer):integer;
      var
        nh,nw:integer;
        heightRatio,widthRatio:integer;
      begin
        nh:=options.outHeight;
        nw:=options.outWidth;
        result:=1;
        if (nh> reqHeight) or (nw > reqWidth) then
        begin
          heightRatio:=round( nh / reqHeight);
          widthRatio:= round(nw /reqWidth);
          if heightRatio<widthRatio then
            Result:=heightRatio else
            Result:=widthRatio;
        end;
      end;
    
    var
      bmf_options:JBitmapFactory_Options;
      cbm:JBitmap;
    begin
      bmf_options:=TJBitmapFactory_Options.JavaClass.init;
      bmf_options.inJustDecodeBounds := true;
      TJBitmapFactory.JavaClass.decodeFile(StringToJString(FileName),bmf_options);
      bmf_options.inSampleSize := calculateInSampleSize(bmf_options, W, H);
      bmf_options.inJustDecodeBounds := false;
      try
        cbm:=TJBitmapFactory.JavaClass.decodeFile(StringToJString( FileName),bmf_options);
      except
        cbm:=nil;
      end;
      if Assigned(cbm) then
        try
          JBitmapToBitmap(cbm,ABitmap)
        except
          ABitmap.Clear(TAlphaColorRec.Blue);
        end else
          ABitmap.Clear(TAlphaColorRec.Green);
    end;

    может кто улучшит, подскажет чтото новое

     

×
×
  • Создать...