Skip to content

Instantly share code, notes, and snippets.

View sharifulislam52's full-sized avatar

Shariful Islam sharifulislam52

View GitHub Profile
<!-- Rotation 0 to 180 degree -->
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<rotate
android:duration="150"
android:fromDegrees="0"
android:toDegrees="180"
<!-- View size 100% to 0% with time duration and alpha (transparency) -->
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="150"
android:fromXScale="1.0"
android:fromYScale="1.0"
<!-- 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"
<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>
<?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 -->
<?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">
// 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)
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
public class your_activity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private DrawerLayout myDrawerLayout;
private ActionBarDrawerToggle myToggle;
NavigationView navigationView;
DrawerLayout mydrawer;
//-----> into onCreate method
navigationView = (NavigationView) findViewById(R.id.nav_view_id);
navigationView.setNavigationItemSelectedListener(this);
@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();