How to delay, offset Pulsator4Droid animation in android? - android

I am using Pulsator4Droid library for putting multiple pulsators on a single layout. Everything works fine but I need to modify it.
The problem is I want them to execute one after the other. Stopping one and then executing the next.
But I don't know which property I should manipulate to achieve this. How do I delay or offset their time?
LAYOUT FILE:
<pl.bclogic.pulsator4droid.library.PulsatorLayout
android:id="#+id/pulsator_1"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="144dp"
android:layout_marginTop="176dp"
app:pulse_count="5"
app:pulse_duration="3000"
app:pulse_repeat="0"
app:pulse_color="#FF8F00"
app:pulse_startFromScratch="false"
app:pulse_interpolator="Decelerate">
</pl.bclogic.pulsator4droid.library.PulsatorLayout>
<pl.bclogic.pulsator4droid.library.PulsatorLayout
android:id="#+id/pulsator_2"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginTop="232dp"
android:layout_marginLeft="12dp"
app:pulse_count="5"
app:pulse_duration="3000"
app:pulse_repeat="0"
app:pulse_color="#FF8F00"
app:pulse_startFromScratch="false"
app:pulse_interpolator="Decelerate">
</pl.bclogic.pulsator4droid.library.PulsatorLayout>
If anyone knows the answer. Please help:(

Related

Edit .xml using simple requests

What I need to do is, give the app into hands of a non-programmer and make it simple for him to edit the xml and java files. To do that I thought maybe sending a simple request (such as, add product(name, description, price)) through some portal could edit the xml file and java file. For example, I need to repeat the similar code every time a new product request is posted:
activity_main.xml
<LinearLayout
android:id="#+id/hw5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="10dp"
android:clickable="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="#mipmap/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hardware 5"
android:textColor="#000000"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="$-"/>
</LinearLayout>
MainActivity.java
LinearLayout hw5;
hw5 = (LinearLayout) findViewById(R.id.hw5);
hw5.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent hw5 = new Intent(MainActivity.this, Hw5.class);
startActivity(hw5);
}
});
Thanks!
What you might be looking for here is a domain-specific XML file paired with an appropriate XSL transformation. The XML file that the non-technical person would be editing would define the business entities, relationships with them and potential actions performed on them. The XSL transformation would convert this into application code at build time.
While this is not a common approach, it is rather robust. Keep in mind tho, that such an approach is difficult to maintain and requires that your business logic is mature enough before implementation.

Android custom fonts (nunito) not set properly in TextView

I am using custom fonts in my android TextView.
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
txt2= (TextView) findViewById(R.id.txt2);
txt2.setTypeface(tf);
But padding between lines are not properly show.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Here is my output :
I also tried with following code :
android:includeFontPadding="false"
but still same issue. Not sure but I also tried to use justifyTextView from Here but same issue. Does anybody faced same issue before?
Thanks in advance.
EDIT :
If i use android:lineSpacingExtra 1st line have more space then other lines. Here is my code and output.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:lineSpacingExtra="#dimen/_5sdp" <<<<<<<
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Late to the party on this - we had exactly the same issue, was fixed completely by replacing the .ttf font file with the latest from Google Fonts - there's a bad early version of this font doing the rounds. Don't forget to remove any android:lineSpacingMultiplier fudges you've put in place int he meanwhile.
Add linespacingMultiplier in your XML
<TextView
android:id="#+id/textview_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#android:color/black"
android:lineSpacingMultiplier="3"
android:textSize="#dimen/_15sdp" />
Or
Add these line in your code:-
mTextViewFont=(TextView)findViewById(R.id.textview_font);
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mTextViewFont.setLineSpacing((float) 5.5,(float) 1.2);
}
mTextViewFont.setTypeface(tf);
There was issue in the font file that is because of the site from where you downloaded it. I download the file from
dafontfree.net/download-nunito-f92263.htm
and then replace your file from asset folder.
and this is the output of it.

Algolia Android initial search is really slow

I recently implemented Algolia on my app successfully just like the examples.
But the initial search takes about 5 to 7 seconds and I couldn't find a way to make it faster after checking the whole library code and documentation. After the initial search, search becomes very fast.
There is nothing unusual in my implementation but maybe you can see something that I don't. The following code is from the activity where I initialize Algolia:
Searcher searcher = new Searcher(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME);
searcher.setQuery(new Query("word").setExactOnSingleWordQuery(Query.ExactOnSingleWordQuery.ATTRIBUTE));
searcher.addNumericRefinement(new NumericRefinement("CountryId", NumericRefinement.OPERATOR_EQ, 1));
InstantSearch helper = new InstantSearch(this, searcher);
helper.setSearchOnEmptyString(false);
helper.search();
And this is the related xml layout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingRight="10dp"
android:paddingLeft="1dp"
android:paddingTop="6dp">
<com.algolia.instantsearch.ui.views.SearchBox
android:id="#+id/searchBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:queryHint="#string/search_text_hint"
algolia:searchIcon="#drawable/icn_search_big"
algolia:closeIcon="#drawable/icn_clear_filled_big"
android:queryBackground="#drawable/sarch_query_shape"
android:background="#drawable/search_shape"
algolia:autofocus="true"
algolia:submitButtonEnabled="false" />
</FrameLayout>`
<com.algolia.instantsearch.ui.views.Hits
android:id="#+id/hits"
android:layout_width="match_parent"
android:layout_height="match_parent"
algolia:autoHideKeyboard="true"
algolia:hitsPerPage="6"
android:layout_below="#+id/searchBarParentLayout"
algolia:infiniteScroll="false"
algolia:itemLayout="#layout/search_item_algolia_row"/>
Do you have any idea what can be the issue here?
I'm glad that the issue disappeared when you switched to another wifi.
For future readers that may encounter network issues with InstantSearch Android:
First of all, build and run one of our demo applications
If you see no problem running the example application, you can try using a proxy like Charles to investigate what's happening between your app and the network
If your problem persists when running the examples, or if you are following the documentation, send an email to support#algolia.com describing the issue with a sample of your code!

Android studio throws "Too much output to process error" on debug

Android studio throws "Too much output to process error" on debug.
I just started working on android development and trying to debug using my nexus 5 as a connected device.
Being a novice, I thought it was a memory issue and even closed all the background applications. In my single activity I am just displaying a background image and a button.
Please have a look at the layout xml...
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/backgroundimage"
android:weightSum="5"
android:orientation="vertical">
<LinearLayout
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:background="#C9BDBD"
android:padding="5dp">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
</LinearLayout>
your Button's android:onClick should be a method in the Java code.
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:background="#6C7B8B"
android:textColor="#000000"
android:text="Become An Android Developer"
android:onClick="Congratulations!!! You are now initiated.."/>
something like
android:onClick="doSomthing"/>
and in the Java code:
public void doSomthing(View v){
...
...
...
}
As far as "too much output..." issue is concerned, you can mostly ignore it. Still it would make sense if you remove some of the really unnecessary Log lines from your code, especially from methods that are called repeatedly and frequently.
Another thing, i believe you want to show a text "Congratulations!!! You are now initiated.." when user clicks on button.
So change your xml's android:onClick to android:onClick= "myButtonClicked"
In the activity, implement this function
public void myButtonClicked(){
}
Finally, show the text "Congratulations!!! You are now initiated.." either via dialog (e.g. alertDialog) or in some textView
You may have selected "No Filters" in android monitor which causes "Too much output to process error", Change it to "Show only selected Application" then all other Log line are filtered and will not show in Logcat.

Appium locators don't work with saucelabs Android

I have UI component:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fire Event"
android:id="#+id/fireEvent"
android:layout_below="#+id/buttonViewKruxWebPage"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="43dp" />
And I want to find it using Appium ID locator:
driver.findElement(By.id("fireEvent")). It works fine locally but Appium cannot find it on Saucelabs. Locally and Remotely on Sauselabs both cases I have Appium 1.4.0.
Also i have tried variant of lacator:
driver.findElement(By.id("com.example.package:id/txtLogin"))
How long do you wait for element to appear in findElement method? It is possible that Saucelabs has bigger delays so I would suggest to increase time-outs and see what happens.

Categories

Resources