This file contains 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
public class PickPhoneNumberActivity extends ActionBarActivity { | |
final int PICK_CONTACT_REQUEST = 1; | |
//some code | |
..... | |
private void pickContact() { | |
Intent pickContact = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI); |
This file contains 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
public class Widget extends AppWidgetProvider { | |
@Override | |
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { | |
super.onUpdate(context, appWidgetManager, appWidgetIds); | |
final int countWidgets = appWidgetIds.length; | |
for (int i = 0; i < countWidgets; i++) { | |
int appwidgetId = appWidgetIds[i]; |
This file contains 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
public class SampleDialog extends DialogFragment { | |
@NonNull | |
@Override | |
public Dialog onCreateDialog(Bundle savedInstanceState) { | |
View view = getActivity().getLayoutInflater().inflate(R.layout..... , null); | |
return new AlertDialog.Builder(getActivity()) | |
.setView(view) | |
.setTitle(R.string.....) |
This file contains 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
//set statusbar color for API 21+ | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
Window window = getWindow(); | |
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); | |
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); | |
window.setStatusBarColor(getResources().getColor(R.color.primary_dark)); | |
} |
This file contains 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
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | |
if (toolbar != null) { |
This file contains 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
package study.android.coordinatorlayout.adapter; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentPagerAdapter; | |
import java.util.ArrayList; | |
public class ViewPagerAdapter extends FragmentPagerAdapter { |
This file contains 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
.gradle | |
/local.properties | |
.DS_Store | |
/build | |
.idea | |
*.txt | |
*.apk | |
*.iml | |
*.properties |
This file contains 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
/** | |
* Method for getting height of Actionbar | |
* @param context Application context | |
* @return height | |
*/ | |
public static int getActionBarHeight(Context context){ | |
TypedValue tv = new TypedValue(); | |
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) | |
{ |
This file contains 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"?> | |
<android.support.v7.widget.Toolbar | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_height="wrap_content" | |
android:layout_width="match_parent" | |
android:minHeight="?attr/actionBarSize" | |
android:background="?attr/colorPrimary" | |
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | |
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> |
This file contains 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"?> | |
<View | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="@dimen/appbar_elevation" | |
android:background="@drawable/appbar_shadow"/> |
OlderNewer