Customizing ViewPagerIndicator style - android-fragments

In my app, I am trying to style ViewPagerIndicator. The pager consists of several fragments. I want something exactly like the picture attached - the CirclePageIndicator at the bottom right & a title at the bottom left. However, the CirclePageIndicator is positioned centered by default & if I customize indicator's "centered" value false, then it goes to the left. I haven't found any option to move that to the right side as shown in the picture.
Another concern is the title of the pager. I have tried with PagerTitleStrip but this is not actually what I am looking for, this PagerTitleStrip shows the previous & next page's title at the left & right side of the title, but I want only this page's title - exactly in the same format like the picture.
BTW, I am using Jake Wharton's library for the ViewpagerIndicator.
I am stuck in this issue for several days. I hope someone comes out with his wise thinking & helps me out of this?
Regards. & Thanks in advance.

In src / com / viewpagerindicator / CirclePageIndicator.java
add this
//at line 236
if (mRight) {
longOffset = longSize - ((count * threeRadius) / 2.0f);
}
//at about line 116
public void setRight(boolean right) {
mRight = right;
invalidate();
}
//line 58
private boolean mRight;
you could also add some padding if you wanted

Related

Is this ListView bug?

if create WC_LISTVIEW with LVS_REPORT style and set both LVSIL_SMALL and LVSIL_STATE (or with LVS_EX_CHECKBOXES) image lists and heigth of small images is less than heigth of state images - list incorrectly displayed: small images not centered by Y, but on same line with state images, and bottom lines (exactly CY_state - CY_small) is filled by trash. for example on high DPI display, ListView with LVS_EX_CHECKBOXES use 20 pixel heigth for CY_state, if use 15 pixel small icons - will be ~next picture (left side of image). if change state images heigh to <= CY_small will be normal displayed (right side of image)
this is known bug ? or exist ways resolve this ?
yes, this is ListView bug - present in all windows versions, including latest win10 builds.
bug in function
int CLVView::ComputeCYItemSize()
here exist next code:
int CLVView::ComputeCYItemSize() // this -> CLVReportView
{
// CListView* _pListView;
CLVImageListManager* p = _pListView->_pImageListManager;
...
if (p->_himlState)
{
p->_cySmall = max(p->_cyState, p->_cySmall);// bug !! need remove this line
...
}
...
}
if 'nop'
p->_cySmall = max(p->_cyState, p->_cySmall)
under debugger - all begin working ok and have next view:

How to position the GWT dialog to the bottom right corner of the browser?

int browserHeight=Window.getClientHeight();
int browserWidth=Window.getClientWidth();
dialog.setPopupPosition(browserWidth-dialog.getElement().getClientWidth(), browserHeight-dialog.getElement().getClientHeight());
dialog.show();
The above code will make the position starts from the very last pixel of the browser (ie bottom=0), which is not what i expect. I don't like css cos browser incompatible problem.
Also there a footer in my website (height=50px) if u can make the dialog to not to lay on the footer like the following pic
so, How to position the GWT dialog to the bottom right corner of the browser?
This is the right way
dialogBox.setPopupPositionAndShow(new PositionCallback(){
#Override
public void setPosition(int offsetWidth, int offsetHeight) {
// TODO Auto-generated method stub
dialogBox.setPopupPosition(parentDockLayoutPanel().getOffsetWidth()- dialogBox.getOffsetWidth(),
parentDockLayoutPanel().getOffsetHeight() - dialogBox.getOffsetHeight()-50);
}
});
It will be simple if we know the exact width & height of dialogbox. We also need to to know the parentPanel / parentLayoutPanel of dialogbox
This code will work but it is not the optimum code
dialogBox.setWidth("300px");
dialogBox.setHeight("300px");
dialogBox.setPopupPosition(parentLayoutPanel.getOffsetWidth()-300,parentLayoutPanel.getOffsetHeight()-300-50);
but how to know the width + height of dialogbox dynamically is another question

Make two QDockWidgets mutual execlusive at the same position

I have two QDockWidget's, only one of them is visible at the time, I manage that by toggleViewAction().
What I need to do is that I want the two QDockWidget's to be in the same location, with the same size and docked at the same dockWidgetArea with the same orientation and order relative to other QDockWidgets.
I did most of the that by this code:
void myMainWindow::slotToggleDocks(QAction* action) {
if(action == viewDock1) {
Dock1->setFloating(Dock2->isFloating());
Dock1->resize(Dock2->size());
Dock1->restoreGeometry(Dock2->saveGeometry());
Dock1->move(Dock2->pos());
addDockWidget(dockWidgetArea(Dock2), Dock1);
...
Dock2->hide();
} else if(action == viewDock2) {
Dock2->setFloating(Dock1->isFloating());
Dock2->resize(Dock1->size());
Dock2->restoreGeometry(Dock1->saveGeometry());
Dock2->move(Dock1->pos());
addDockWidget(dockWidgetArea(Dock2), Dock1);
...
Dock1->hide();
}
}
this code make the two have the same location and size and docked to the same area (left, right, ...) but it doesn't guarantee that the Docks will have the same layout with the other QDockWidget's in the same dockWidgetArea.
Meaning if this was the before layout:
Layout before http://holmez.net/qdockwidget/1.png
This is after toggling:
Layout after toggling http://holmez.net/qdockwidget/2.png
This is what I want:
Expected result http://holmez.net/qdockwidget/3.png
I managed to do that by a simple trick, add this line of code:
splitDockWidget(Dock1,Dock2,Qt::Horizontal);
before hiding Dock1, and this line:
splitDockWidget(Dock2,Dock1,Qt::Horizontal);
before hiding Dock2.
This fixed the problem of the arrangement of docked widgets, not sure if this is the best way but it works for me.
What about only using 2 QDockWidgets, but having QStackedWidgets INSIDE of them which you can use to swap views? That's what I'm currently doing, and it works great.
Another advantage is that swapping views is as simple as:
stackedWidget->setCurrentIndex(index);
What about using QTabWidget?
The 2 widgets will have to be in the same Qt::DockWidgetAreas

CSS: overflow-y: scroll; overflow-x: visible

See the following post for a picture highlighting my question and a potential solution:
CSS overflow-y:visible, overflow-x:scroll
However, this strategy breaks when you actually move the scrollbar. In the suggested implementation (position: fixed;), the tooltips display next to child div in its position pre-scroll. So, as you scroll new child-divs into view, the tooltips begin falling off the bottom of the page.
See here for a demo of the bug: http://jsfiddle.net/narcV/4/
Any ideas how I can make the tooltips display next to the child div at all times?
I ended up implementing this using javascript, using the getPos function from this question.
The end product looks like:
var scrollPanel = ...;
var tooltip = ...;
function nodeHovered(e) {
var hovered = e.srcElement;
var pos = getPos(hovered);
pos.x += hovered.offsetWidth;
pos.y -= scrollPanel.scrollTop;
tooltip.style.setProperty('left', pos.x);
tooltip.style.setProperty('top', pos.y);
}
Basically, I calculate where on the page the node is currently displayed (taking into account the scrollbar position), and manually place the tooltip in the right spot on the page.
Too bad there's no elegant/CSS way to do this, but at least this works.

Flex 3 - Change box border colors

I have a question that might seem "basic" but I just cannot figure out how to do it...
I have a box and I'd like to change the borderColor. Till there, nothing special. Just a box.bordercolor = xxxxxx...
BUT, I'd like to have the top and bottom border with one color, and the left and right border with another color... And that's the part where I'm stuck.
Any tips? Suggestions?
Thanks for your help and time! ;)
Regards,
BS_C3
#Senz
Hi!
Unfortunately, I won't be able to share the code without making it "incomprehensible"...
But this is the idea... We have 2 main components: ArrowButton and Navigator.
ArrowButton is a hbox containing a label and an image (this image is the arrow tip and it changes depeding on the state of the ArrowButton).
Navigator is a hbox containing a series of ArrowButton. An ArrowButton overlaps the arrowButton on its right in order to create the pointed end of the button.
And then you just create a whole bunch of functionnalities around these components.
I hope this helps... Do not hesitate if you have some more questions =)
Regards.
I noticed you are asking about the Flex 3 SDK. Skins are a good approach. They have changed somewhat in Flex 4(for the better IMHO). If you are wanting to use the Flex Drawing API, then just extend the Box class into a custom class that would look something like this:
public class MultiColorBorderBox extends Box
{
// You could add getters/setters or constructor parameters to be able to change these values.
private var topColor:uint = 0xFF0000;
private var rightColor:uint = 0x00FF00;
private var bottomColor:uint = 0x0000FF;
private var leftColor:uint = 0xFF00FF;
private var borderWidth:Number = 20;
public function MultiColorBorderBox()
{
super();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
// This just ensures you dont have content under your border
this.setStyle("paddingLeft", borderWidth);
this.setStyle("paddingRight", borderWidth);
this.setStyle("paddingTop", borderWidth);
this.setStyle("paddingBottom", borderWidth);
var g:Graphics = this.graphics; // This creates a new Graphics object and sets it to the MultiColorBorderBox graphics object. Since Box (superclass) descends from a Sprite object, it has a graphics object automatically.
g.clear();
g.moveTo(0,0); // Moves the position to the top left corner
g.lineStyle(borderWidth, topColor); // Sets the line style with the width and color
g.lineTo(unscaledWidth, 0); // Draws the top border from top left to top right corners
g.lineStyle(borderWidth, rightColor); // Changes the line style
g.lineTo(unscaledWidth, unscaledHeight); // Draws the line from top right to bottom right
g.lineStyle(borderWidth, bottomColor); //Changes the bottom border style
g.lineTo(0, unscaledHeight); // Draws the line from bottom right to bottom left
g.lineStyle(borderWidth, leftColor); // Changes the border color
g.lineTo(0,0); // Closes the box by drawing from bottom left to top left
}
I'm pretty sure you're going to have to create a borderSkin to accomplish this. I believe these are created in an external program, such as Flash Professional; but more info is in the docs.
I don't think that Flex makes any distinction between top/bottom borders and left/right borders. Creating a skin would certainly be the nifty-slick way to do it. A programmatic way might be to use box.graphics to draw your border by hand. I'd start by trying to override the updateDisplayList() function to draw your border...
I finally did a pretty simple thing.
I guess I wasn't detailed enough regarding the specifications.
The actual aim was to create a navigator with arrow shaped buttons.
Each button had to be highlighted when it was selected. And this http://www.freeimagehosting.net/uploads/bcd0d762d7.jpg is how the navigator looked like.
Each button is actually an HBox containing a Box (with a label) and an Image (for the arrow tip), with a horizontalGap = 0.
I didn't think about adding a glowfilter to the button. So I was trying to just change the colors of the top and bottom part of the Box...
So, the glowfilter in the button worked pretty well.
Sorry for the lack of explanations about the context >_< And thanks for your answers!!
Regards.

Resources