I have a problem with MSAA setup on Android. On any desktop machine tested (Intel, NVIDIA) I get a correct resolve framebuffer and renderpass (I currently have an empty renderpass where I only clear the back color) and the screen renders simply grey (desired) but on android the screen is black.
I do not get any validation errors. The code just "works" but it does not seem right to me.
Here is my Renderpass code:
VkSampleCountFlagBits sampleCount = GetMaxUsableSampleCount();
VkAttachmentDescription colorResolveAttachment = {};
colorResolveAttachment.format = mSwapchainImageFormat;
colorResolveAttachment.samples = sampleCount;
colorResolveAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
colorResolveAttachment.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
colorResolveAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
colorResolveAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
colorResolveAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
colorResolveAttachment.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
VkAttachmentDescription colorAttachment = {};
colorAttachment.format = mSwapchainImageFormat;
colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
colorAttachment.loadOp = (mSamples != 0) ? VK_ATTACHMENT_LOAD_OP_DONT_CARE : VK_ATTACHMENT_LOAD_OP_CLEAR;
colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
VkAttachmentDescription depthResolveAttachment = {};
depthResolveAttachment.format = mDepthImageFormat;
depthResolveAttachment.samples = sampleCount;
depthResolveAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
depthResolveAttachment.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
depthResolveAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
depthResolveAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
depthResolveAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
depthResolveAttachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
VkAttachmentDescription depthAttachment = {};
depthAttachment.format = mDepthImageFormat;
depthAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
depthAttachment.loadOp = (mSamples != 0) ? VK_ATTACHMENT_LOAD_OP_DONT_CARE : VK_ATTACHMENT_LOAD_OP_CLEAR;
depthAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
depthAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
depthAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
depthAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
depthAttachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
VkAttachmentReference colorAttachmentRef = {};
colorAttachmentRef.attachment = 0;
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
VkAttachmentReference depthAttachmentRef = {};
depthAttachmentRef.attachment = (mSamples != 0) ? 2 : 1;
depthAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
VkAttachmentReference colorAttachmentResolveRef = {};
colorAttachmentResolveRef.attachment = 1;
colorAttachmentResolveRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
VkSubpassDescription subpass = {};
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass.colorAttachmentCount = 1;
subpass.pColorAttachments = &colorAttachmentRef;
subpass.pDepthStencilAttachment = &depthAttachmentRef;
if(mSamples != 0)
{
subpass.pResolveAttachments = &colorAttachmentResolveRef;
}
std::vector<VkSubpassDependency> dependencies;
if(mSamples != 0)
{
std::array<VkSubpassDependency, 2> dependency;
dependency[0].srcSubpass = VK_SUBPASS_EXTERNAL;
dependency[0].dstSubpass = 0;
dependency[0].srcStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
dependency[0].dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
dependency[0].srcAccessMask = VK_ACCESS_MEMORY_READ_BIT;
dependency[0].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
dependency[0].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT;
dependency[1].srcSubpass = 0;
dependency[1].dstSubpass = VK_SUBPASS_EXTERNAL;
dependency[1].srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
dependency[1].dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
dependency[1].srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
dependency[1].dstAccessMask = VK_ACCESS_MEMORY_READ_BIT;
dependency[1].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT;
dependencies.push_back(dependency[0]);
dependencies.push_back(dependency[1]);
}
else
{
VkSubpassDependency dependency = {};
dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
dependency.dstSubpass = 0;
dependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
dependency.srcAccessMask = 0;
dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
dependencies.push_back(dependency);
}
std::vector<VkAttachmentDescription> attachments;
if(mSamples != 0)
{
attachments.push_back(colorResolveAttachment);
attachments.push_back(colorAttachment);
attachments.push_back(depthResolveAttachment);
attachments.push_back(depthAttachment);
}
else
{
attachments.push_back(colorAttachment);
attachments.push_back(depthAttachment);
}
VkRenderPassCreateInfo renderPassInfo = {};
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
renderPassInfo.attachmentCount = static_cast<uint32_t>(attachments.size());
renderPassInfo.pAttachments = attachments.data();
renderPassInfo.subpassCount = 1;
renderPassInfo.pSubpasses = &subpass;
renderPassInfo.dependencyCount = static_cast<uint32_t>(dependencies.size());
renderPassInfo.pDependencies = dependencies.data();
if(vkCreateRenderPass(mDevice, &renderPassInfo, nullptr, &mRenderPass) != VK_SUCCESS)
{
Console::FatalError("Failed to create render pass!");
return false;
}
return true;
Here is my Freambuffer code:
if(!CreateMultiSampleTargets())
return false;
mSwapchainFramebuffers.resize(mSwapchainImageViews.size());
for(size_t i = 0u; i < mSwapchainImageViews.size(); i++)
{
std::vector<VkImageView> attachments;
if(mSamples != 0)
{
attachments.push_back(mMultiSampleColorImageView);
attachments.push_back(mSwapchainImageViews[i]);
attachments.push_back(mMultiSampleDepthImageView);
attachments.push_back(mDepthImageView);
}
else
{
attachments.push_back(mSwapchainImageViews[i]);
attachments.push_back(mDepthImageView);
}
VkFramebufferCreateInfo framebufferInfo = {};
framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
framebufferInfo.renderPass = mRenderPass;
framebufferInfo.attachmentCount = static_cast<uint32_t>(attachments.size());
framebufferInfo.pAttachments = attachments.data();
framebufferInfo.width = mSwapchainExtent.width;
framebufferInfo.height = mSwapchainExtent.height;
framebufferInfo.layers = 1;
if(vkCreateFramebuffer(mDevice, &framebufferInfo, nullptr, &mSwapchainFramebuffers[i]) != VK_SUCCESS)
{
Console::FatalError("Failed to create framebuffer!");
return false;
}
}
I should mention that my code is heavily based on this: https://github.com/SaschaWillems/Vulkan/blob/master/multisampling/multisampling.cpp
The solution was to upgrade my Oneplus 3 to android 8 to get a newer driver version where this issue does not occur. I guess this was a driver bug.
Related
On rooted device(by Magisk), my Android app failed root detection when using the below frida code. The app contains root detection module and obfuscation.
Anything I can do to prevent bypass? Is Protect the app from bypassing the root detection (Frida Server) also would work for the case?
Thanks in advance.
Java.perform(function() {
var RootPackages = ["com.topjohnwu.magisk"
];
var RootBinaries = ["su", "busybox", "magisk"];
var RootProperties = {
"ro.build.selinux": "1",
"ro.debuggable": "0",
"service.adb.root": "0",
"ro.secure": "1"
};
var RootPropertiesKeys = [];
for (var k in RootProperties) RootPropertiesKeys.push(k);
var NativeFile = Java.use('java.io.File');
var ProcessBuilder = Java.use('java.lang.ProcessBuilder');
var useProcessManager = false;
NativeFile.exists.implementation = function() {
var name = NativeFile.getName.call(this);
var shouldFakeReturn = (RootBinaries.indexOf(name) > -1);
if (shouldFakeReturn) {
return false;
} else {
return this.exists.call(this);
}
};
ProcessBuilder.start.implementation = function() {
var cmd = this.command.call(this);
var shouldModifyCommand = false;
for (var i = 0; i < cmd.size(); i = i + 1) {
var tmp_cmd = cmd.get(i).toString();
if (tmp_cmd.indexOf("getprop") != -1 || tmp_cmd.indexOf("mount") != -1 || tmp_cmd.indexOf("build.prop") != -1 || tmp_cmd.indexOf("id") != -1) {
shouldModifyCommand = true;
}
}
if (shouldModifyCommand) {
this.command.call(this, ["grep"]);
return this.start.call(this);
}
if (cmd.indexOf("su") != -1) {
this.command.call(this, ["SOMEFAKECMD"]);
return this.start.call(this);
}
return this.start.call(this);
};
if (useProcessManager) {
var ProcManExec = ProcessManager.exec.overload('[Ljava.lang.String;', '[Ljava.lang.String;', 'java.io.File', 'boolean');
ProcManExec.implementation = function(cmd, env, workdir, redirectstderr) {
var fake_cmd = cmd;
for (var i = 0; i < cmd.length; i = i + 1) {
var tmp_cmd = cmd[i];
if (tmp_cmd.indexOf("getprop") != -1 || tmp_cmd == "mount" || tmp_cmd.indexOf("build.prop") != -1 || tmp_cmd == "id") {
var fake_cmd = ["grep"];
}
if (tmp_cmd == "su") {
var fake_cmd = ["SOMEFAKECMD"];
}
}
return ProcManExec.call(this, fake_cmd, env, workdir, redirectstderr);
};
}
});
(the code originally from https://codeshare.frida.re/#dzonerzy/fridantiroot/ , removed unnecessary parts)
I'm developing an android app with Xamarin that uploads file to the server. My server is asp.net based and is hosted by azure. Xamarin throws this error when the code tries to write the file to the server directory. The code I'm using to post the file to the server is as follows:
public async Task<HttpResponseMessage> UploadFile(byte[] file)
{
videoThumbName = Guid.NewGuid().ToString();
var progress = new System.Net.Http.Handlers.ProgressMessageHandler();
progress.HttpSendProgress += progress_HttpSendProgress;
using (var client = HttpClientFactory.Create(progress))
{
client.BaseAddress = new Uri(GlobalVariables.host);
// Set the Accept header for BSON.
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/bson"));
var request = new uploadFileModel { data = file, dateCreated = DateTime.Now, fileName = fileName, username = loggedUser, VideoThumbName = videoThumbName};
// POST using the BSON formatter.
MediaTypeFormatter bsonFormatter = new BsonMediaTypeFormatter();
var m = client.MaxResponseContentBufferSize;
var result = await client.PostAsync("api/media/upload", request, bsonFormatter);
return result.EnsureSuccessStatusCode();
}
}
I've tried using a try catch block and the weird thing is that the exception is caught even after the file has been written to the path and I get the 500 internal server error. So far every file I tried to upload was save to the path but I can't figure out why is error occurring.
My server side code looks like the following:
[HttpPost]
[Route("upload")]
public async Task<HttpResponseMessage> Upload(uploadFileModel model)
{
var result = new HttpResponseMessage(HttpStatusCode.OK);
if (ModelState.IsValid)
{
string thumbname = "";
string resizedthumbname = Guid.NewGuid() + "_yt.jpg";
string FfmpegPath = Encoding_Settings.FFMPEGPATH;
string tempFilePath = Path.Combine(HttpContext.Current.Server.MapPath("~/tempuploads"), model.fileName);
string pathToFiles = HttpContext.Current.Server.MapPath("~/tempuploads");
string pathToThumbs = HttpContext.Current.Server.MapPath("~/contents/member/" + model.username + "/thumbs");
string finalPath = HttpContext.Current.Server.MapPath("~/contents/member/" + model.username + "/flv");
string resizedthumb = Path.Combine(pathToThumbs, resizedthumbname);
var outputPathVid = new MediaFile { Filename = Path.Combine(finalPath, model.fileName) };
var inputPathVid = new MediaFile { Filename = Path.Combine(pathToFiles, model.fileName) };
int maxWidth = 380;
int maxHeight = 360;
var namewithoutext = Path.GetFileNameWithoutExtension(Path.Combine(pathToFiles, model.fileName));
thumbname = model.VideoThumbName;
string oldthumbpath = Path.Combine(pathToThumbs, thumbname);
var fileName = model.fileName;
try
{
File.WriteAllBytes(tempFilePath, model.data);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
if (model.fileName.Contains("audio"))
{
File.WriteAllBytes(Path.Combine(finalPath, model.fileName), model.data);
string audio_thumb = "mic_thumb.jpg";
string destination = Path.Combine(pathToThumbs, audio_thumb);
string source = Path.Combine(pathToFiles, audio_thumb);
if (!System.IO.File.Exists(destination))
{
System.IO.File.Copy(source, destination, true);
}
Video_Struct vd = new Video_Struct();
vd.CategoryID = 0; // store categoryname or term instead of category id
vd.Categories = "";
vd.UserName = model.username;
vd.Title = "";
vd.Description = "";
vd.Tags = "";
vd.OriginalVideoFileName = model.fileName;
vd.VideoFileName = model.fileName;
vd.ThumbFileName = "mic_thumb.jpg";
vd.isPrivate = 0;
vd.AuthKey = "";
vd.isEnabled = 1;
vd.Response_VideoID = 0; // video responses
vd.isResponse = 0;
vd.isPublished = 1;
vd.isReviewed = 1;
vd.Thumb_Url = "none";
//vd.FLV_Url = flv_url;
vd.Embed_Script = "";
vd.isExternal = 0; // website own video, 1: embed video
vd.Type = 0;
vd.YoutubeID = "";
vd.isTagsreViewed = 1;
vd.Mode = 0; // filter videos based on website sections
long videoid = VideoBLL.Process_Info(vd, false);
}
The exception doesn't reveal much for me to understand the issue. Strangely I don't get any errors when I'm sending request to the local server. Any idea what might be wrong here?
Edit:
The exception no longer occurring when I get the internal server error at this line of my code using (var engine = new Engine()) This is a library I'm trying to use to encode a media file. If everything works on the local server then why doesn't it on the live server :/
using (var engine = new Engine())
{
engine.GetMetadata(inputPathVid);
// Saves the frame located on the 15th second of the video.
var outputPathThumb = new MediaFile { Filename = Path.Combine(pathToThumbs, thumbname+".jpg") };
var options = new ConversionOptions { Seek = TimeSpan.FromSeconds(0), CustomHeight = 360, CustomWidth = 380 };
engine.GetThumbnail(inputPathVid, outputPathThumb, options);
}
Image image = Image.FromFile(Path.Combine(pathToThumbs, thumbname+".jpg"));
//var ratioX = (double)maxWidth / image.Width;
//var ratioY = (double)maxHeight / image.Height;
//var ratio = Math.Min(ratioX, ratioY);
var newWidth = (int)(maxWidth);
var newHeight = (int)(maxHeight);
var newImage = new Bitmap(newWidth, newHeight);
Graphics.FromImage(newImage).DrawImage(image, 0, 0, newWidth, newHeight);
Bitmap bmp = new Bitmap(newImage);
bmp.Save(Path.Combine(pathToThumbs, thumbname+"_resized.jpg"));
//File.Delete(Path.Combine(pathToThumbs, thumbname));
using (var engine = new Engine())
{
var conversionOptions = new ConversionOptions
{
VideoSize = VideoSize.Hd720,
AudioSampleRate = AudioSampleRate.Hz44100,
VideoAspectRatio = VideoAspectRatio.Default
};
engine.GetMetadata(inputPathVid);
engine.Convert(inputPathVid, outputPathVid, conversionOptions);
}
File.Delete(tempFilePath);
Video_Struct vd = new Video_Struct();
vd.CategoryID = 0; // store categoryname or term instead of category id
vd.Categories = "";
vd.UserName = model.username;
vd.Title = "";
vd.Description = "";
vd.Tags = "";
vd.Duration = inputPathVid.Metadata.Duration.ToString();
vd.Duration_Sec = Convert.ToInt32(inputPathVid.Metadata.Duration.Seconds.ToString());
vd.OriginalVideoFileName = model.fileName;
vd.VideoFileName = model.fileName;
vd.ThumbFileName = thumbname+"_resized.jpg";
vd.isPrivate = 0;
vd.AuthKey = "";
vd.isEnabled = 1;
vd.Response_VideoID = 0; // video responses
vd.isResponse = 0;
vd.isPublished = 1;
vd.isReviewed = 1;
vd.Thumb_Url = "none";
//vd.FLV_Url = flv_url;
vd.Embed_Script = "";
vd.isExternal = 0; // website own video, 1: embed video
vd.Type = 0;
vd.YoutubeID = "";
vd.isTagsreViewed = 1;
vd.Mode = 0; // filter videos based on website sections
//vd.ContentLength = f_contentlength;
vd.GalleryID = 0;
long videoid = VideoBLL.Process_Info(vd, false);
}`enter code here`
I'm developing an app in FlashDevelop, using Haxe and OpenFl
When I test my app in flash target, it works fine. But when I compile for android, it comes up with this error during the compilation:
./src/ReaderView2.cpp: In member function 'virtual Void ReaderView2_obj::setZoom()':
./src/ReaderView2.cpp:653: error: base operand of '->' has non-pointer type 'String'
Build halted with errors (haxelib.exe).
...Which is obviously something to do with cpp, which I'm not really an expert.
Does any body know what the error means?
Here's the setZooom function: (the whole file is quite large)
public function setZoom()
{
hideOptions();
while (numChildren > 0)
{
Main.remove(getChildAt(0));
}
if (image != null) if (image.parent != null) image.parent.removeChild(image);
images = new Array();
field = new TextField();
var fieldFont = Assets.getFont("fonts/Kreon-Regular.ttf");
var format:TextFormat = new TextFormat(fieldFont.fontName, currentZoom, 0x4F4F4F);
format.align = TextFormatAlign.LEFT;
field.defaultTextFormat = format;
field.embedFonts = true;
field.text = fullText;
field.selectable = false;
field.wordWrap = true;
field.border = false;
field.autoSize = TextFieldAutoSize.LEFT;
field.width = displayWidth;
//field.x = 0;
//split string into words
var allParas:Array<String> = fullText.split("\r\n");
var words:Array<String>;
var fields:Array<TextField> = new Array();
var tempField:TextField = null;
var contentHeight:Float = displayHeight;
var wordI:Int;
var paraI:Int = 0;
var tempArr2:Array<String>;
while (paraI < allParas.length)
{
if (false) //check img tag
{
}
else //if para is words
{
wordI = 0;
words = allParas[paraI].split(" ");
while (wordI < words.length)
{
if (tempField == null || tempField.textHeight > contentHeight)
{
if (tempField != null) {
wordI--;
tempArr2 = tempField.text.toString().split(" ");
for (i in 0... tempArr2.length)
{
tempArr2.remove("");
}
tempArr2.pop();
tempField.text = tempArr2.join(" ");
}
tempField = new TextField();
tempField.defaultTextFormat = field.getTextFormat();
tempField.embedFonts = true;
tempField.text = "";
tempField.border = false;
tempField.selectable = false;
tempField.wordWrap = true;
tempField.autoSize = TextFieldAutoSize.LEFT;
tempField.width = displayWidth-2;
tempField.x = 0;
fields.push(tempField);
}
else
{
tempField.appendText(words[wordI] + (wordI == words.length - 1? "\n": " "));
wordI++;
}
}
}
paraI++;
}
var bd:BitmapData;
for (i in 0... fields.length)
{
bd = new BitmapData(Std.int(fields[i].width), Std.int(fields[i].height));
bd.draw(fields[i]);
images.push(new Bitmap(bd, PixelSnapping.AUTO, true));
}
//addChild(fields[0]);
images[0].x = 10;
addChild(images[0]);
currentPageInstance = images[0];
currentPage = 0;
drawScrollBar();
if (optionsBtn!=null)addChild(optionsBtn);
}
So apparently using the toString() funcion gives problems for a cpp target.
I am supposed to add 4 teechart controls at runtime. I am able to bind the values to teechart controls.
The problem is, when I scroll the parent view, all the teecharts disappear. But all other controls are visible (button, textview, etc.).
Note: initially all the controls are visible; they disappear only when I scroll.
void drawRainfallChart()
{
try
{
obj = new csGraphClass();
RainfallGraph[] graphdata = obj.getRainfallData(_cropId.ToString());
if (rainfallChart == null)
rainfallChart = new Steema.TeeChart.TChart(this);
else
{
rainfallChart.RemoveAllViews();
rainfallChart.Dispose();
rainfallChart = new Steema.TeeChart.TChart(this);
}
if (graphdata.Length > 0)
{
rainfallChart.Aspect.View3D = false;
rainfallChart.Chart.Invalidate();
Steema.TeeChart.Styles.Line rline = new Steema.TeeChart.Styles.Line();
Steema.TeeChart.Styles.Line rCrtdayline = new Steema.TeeChart.Styles.Line();
rainfallChart.Series.Add(rline);
rainfallChart.Series.Add(rCrtdayline);
DateTime currentdate = SyncProcess.CalculatedDatetime();
double dc = 0;
foreach (RainfallGraph item in graphdata)
{
dc += Convert.ToDouble(item.yValue);
rline.Add(Convert.ToDateTime(item.xValue), dc);
if (item.xValue == currentdate.ToString("yyyy-MM-dd"))
{
rCrtdayline.Add(Convert.ToDateTime(item.xValue), 0);
rCrtdayline.Add(Convert.ToDateTime(item.xValue), Convert.ToDouble(item.yValue));
}
}
rline.Title = "Rainfall";
rCrtdayline.Title = "Crop Day";
rline.Pointer.Visible = true;
rline.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
rline.Chart.Axes.Left.SetMinMax(0, Convert.ToDouble(dc + 5));
var varMinDate = graphdata.Min(s => s.xValue);
var varMaxDate = graphdata.Max(s => s.xValue);
DateTime minDate = Convert.ToDateTime(varMinDate).AddDays(-1);
DateTime maxDate = Convert.ToDateTime(varMaxDate).AddDays(1);
rline.Chart.Axes.Bottom.SetMinMax(minDate, maxDate);
rainfallChart.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);
rainfallChart.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yyyy";
rainfallChart.Footer.Font.Size = 25;
rainfallChart.Legend.Font.Size = 25;
rainfallChart.Header.Font.Size = 25;
rainfallChart.Axes.Bottom.Labels.Font.Size = 18;
rainfallChart.Axes.Left.Labels.Font.Size = 15;
rainfallChart.Legend.Transparent = true;
rainfallChart.Header.Visible = true;
rainfallChart.Axes.Bottom.Grid.Visible = false;
rainfallChart.Header.Text = "Rain fall";
rainfallChart.Legend.Visible = true;
rainfallChart.Axes.Left.Grid.DrawEvery = 1;
rainfallChart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
rainfallChart.Panning.Allow = Steema.TeeChart.ScrollModes.None;
rainfallChart.Panning.Allow = Steema.TeeChart.ScrollModes.None;
rainfallChart.Zoom.Style = Steema.TeeChart.ZoomStyles.Classic;
rainfallChart.Zoom.Allow = false;
rainfallChart.Panning.Allow = ScrollModes.None;
rainfallChart.SetPadding(0, 50, 0, 50);
Android.Widget.LinearLayout.LayoutParams layoutParams = new Android.Widget.LinearLayout.LayoutParams(graphheight, graphwidth);
layoutParams.TopMargin = 100;
layoutParams.BottomMargin = 100;
rainfallChart.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
rainfallChart.SetScrollContainer(false);
srcgraph.AddView(rainfallChart, layoutParams);
}
}
catch (Exception ex)
{
ErrorHandling.ErrorEntry(ex.Message.ToString(), "TodayGraphViewController - drawRainfallChart");
}
}
Another user recently reported a similar issue (TM63016590) when Zoom.Style is set to ZoomStyles.Classic. We have a fix suggestion for this, which is available in the current evaluation version available at https://www.steema.com/downloads/net_android. Could you please let us know if it solves the problem at your end?
I've tried something like this:
public boolean createTestProject(String projectName, IProject testedProject, int apiLevel){
NewProjectWizardState mValues = new NewProjectWizardState(Mode.TEST);
mValues.projectName = projectName;
if(testedProject != null){
mValues.testedProject = testedProject;
mValues.testingSelf = false;
mValues.useExisting = false;
}
else{
mValues.testingSelf = true;
mValues.useExisting = false;
}
mValues.minSdk = "1.5";
mValues.minSdkModifiedByUser = true;
mValues.useDefaultLocation = true;
mValues.projectLocationModifiedByUser = false;
mValues.createActivity = false;
mValues.activityName = "sf";
mValues.applicationName = "sf";
mValues.packageName = "sf";
NewProjectCreator creator = new NewProjectCreator(mValues, getContainer());
return creator.createAndroidProjects();
}
but it throws NullPointerException at com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator.createEclipseProject(NewProjectCreator.java:561). I've checked that file (maybe older version) and this line is empty. Did i miss something?
EDIT:
ok, I resolved that. I missed few things. Now it's working, it can even create android project (not test):
public IProject createProject(String projectName, IProject testedProject,
boolean testMode, int apiLevel, IWizardContainer container,
Type type, String packName) throws Exception {
NewProjectWizardState mValues;
if (testMode) {
mValues = new NewProjectWizardState(Mode.TEST);
} else {
mValues = new NewProjectWizardState(Mode.ANY);
}
mValues.projectName = projectName;
mValues.projectNameModifiedByUser = true;
mValues.applicationName = capitalize(mValues.projectName);
mValues.testApplicationName = projectName;
mValues.createActivity = false;
mValues.testedProject = testedProject;
mValues.minSdk = apiLevel;
mValues.updateSdkTargetToMatchMinSdkVersion();
String value = Platform.getLocation().append(mValues.projectName)
.toString();
value = TextProcessor.process(value);
mValues.projectLocation = new File(value);
mValues.packageName = "com.example.android.apis.test";
if (testedProject != null) {
mValues.testProjectName = projectName;
mValues.packageName = String.format("%1$s.test",
Helper.getPackageName(testedProject));
mValues.createPairProject = false;
mValues.testTargetPackageName = Helper
.getPackageName(testedProject);
}
if (testedProject == null && testMode) {
mValues.createPairProject = false;
mValues.testProjectName = projectName;
mValues.testTargetPackageName = "com.example.android.apis";
}
if (packName != null && packName.length > 0) {
mValues.packageName = packName;
}
NewProjectCreator creator = new NewProjectCreator(mValues,
container);
creator.createAndroidProjects();
return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
}