Last active
March 30, 2021 01:35
-
-
Save marc0x71/061f53453152d0a68c20 to your computer and use it in GitHub Desktop.
Revisions
-
marc0x71 revised this gist
Mar 22, 2016 . 2 changed files with 64 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,35 @@ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openDialog(); } }); } private void openDialog() { View view = getLayoutInflater().inflate(R.layout.sheet_main, null); dialog = new BottomSheetDialog(this); dialog.setContentView(view); TextView camera_sel = (TextView) view.findViewById(R.id.camera); TextView gallery_sel = (TextView) view.findViewById(R.id.gallery); camera_sel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { takePhotoFromCamera(); dialog.dismiss(); } }); gallery_sel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { takePhotoFromGallery(); dialog.dismiss(); } }); dialog.show(); } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:padding="4dp"> <TextView android:id="@+id/camera" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:drawablePadding="8dp" android:drawableTop="@drawable/ic_camera" android:gravity="center_horizontal" android:padding="16dp" android:text="Camera" android:textSize="18sp" /> <TextView android:id="@+id/gallery" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="?attr/selectableItemBackgroundBorderless" android:clickable="true" android:drawablePadding="8dp" android:drawableTop="@drawable/ic_panorama" android:gravity="center_horizontal" android:padding="16dp" android:text="Gallery" android:textSize="18sp" /> </LinearLayout> -
marc0x71 created this gist
Mar 22, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openDialog(); } });