This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* simple handler and runnable | |
*/ | |
final Handler myHandler = new Handler(); | |
myHandler.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
myHandler.postDelayed(this, 5000); // The interval time | |
// what we want to do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import android.support.v7.widget.Toolbar; | |
public void all_about_toolbar(){ | |
/** | |
* create Toolbar and set Title, subTitle, textColor | |
*/ | |
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar_id); | |
toolbar.setTitle("app_title"); | |
setSupportActionBar(toolbar); | |
toolbar.setTitleTextColor(Color.COLOR_NAME); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
MenuInflater inflater = getMenuInflater(); | |
inflater.inflate(R.menu.search_menu, menu); | |
MenuItem searchViewItem = menu.findItem(R.id.app_bar_search_id); | |
final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchViewItem); | |
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { | |
@Override | |
public boolean onQueryTextSubmit(String query) { | |
searchView.clearFocus(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentPagerAdapter; | |
public class PagerAdapter extends FragmentPagerAdapter { | |
public PagerAdapter(FragmentManager fragmentManager) { | |
super(fragmentManager); | |
} | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// system current second | |
public int the_current_second(){ | |
int the_second = new Time(System.currentTimeMillis()).getSeconds(); | |
return the_second; | |
} | |
// return current day of week | |
public String current_day(){ | |
Date date = new Date(); | |
CharSequence this_day = DateFormat.format("EEEE", date.getTime()); // gives like (Wednesday) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item > | |
<shape | |
android:shape="rectangle"> | |
<solid android:color="@color/color_name" /> | |
<corners android:radius="7dp"/> | |
</shape> | |
</item> | |
<item android:right="1dp" android:left="1dp" android:bottom="1dp" android:top="1dp"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle" > | |
<!-- View background color --> | |
<solid | |
android:color="@color/color_name" > | |
</solid> | |
<!-- View border color and width --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<gradient | |
android:angle="135" | |
android:centerColor="#009688" | |
android:endColor="#00695C" | |
android:startColor="#4DB6AC" | |
android:type="linear" /> | |
</shape> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Transparency 0% to 100% --> | |
<?xml version="1.0" encoding="utf-8"?> | |
<set xmlns:android="http://schemas.android.com/apk/res/android" | |
android:fillAfter="true"> | |
<alpha | |
android:duration="@android:integer/config_longAnimTime" | |
android:fromAlpha="0.0" | |
android:toAlpha="1.0" |