Skip to content

Instantly share code, notes, and snippets.

View ameliacv's full-sized avatar

Mujtahidah ameliacv

View GitHub Profile
Intent intent = new Intent(WHAT EVER YOU WANT);
//u can put extra data too
PendingIntent pendingIntent = PendingIntent.getActivity(CONTEXT, 1, intent, 0);
NotificationCompat.Builder mBuilder =
(NotificationCompat.Builder) new NotificationCompat.Builder(CONTEXT)
.setSmallIcon(YOUR ICON)
.setContentTitle(CONTEXT.getString(R.string.alert_success_upload))
.setContentText(BLAH);
mBuilder.setContentIntent(pendingIntent);
Intent intent = new Intent();
final PendingIntent pendingIntent = PendingIntent.getActivity(
CONTEXT, 0, intent, 0);
NotificationCompat.Builder mBuilder =
(NotificationCompat.Builder) new NotificationCompat.Builder(CONTEXT)
.setSmallIcon(YOUR_ICON)
.setContentTitle(mContext.getString(R.string.label_upload_video));
mBuilder.setContentIntent(pendingIntent);
notificationManager =
private static final int OPEN_THING = 99;
public void openGallery() {
int preference = ScanConstants.OPEN_MEDIA;
Intent intent = new Intent(this, ScanActivity.class);
intent.putExtra(ScanConstants.OPEN_INTENT_PREFERENCE, preference);
startActivityForResult(intent, OPEN_THING);
}
public void openCamera() {
int preference = ScanConstants.OPEN_CAMERA;
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_gallery"
android:enabled="true"
android:icon="@drawable/ic_photo_library_black_24dp"
android:title="@string/text_gallery"
app:showAsAction="ifRoom" />
<item
public class MainActivity extends AppCompatActivity {
@BindView(R.id.videoView)
VideoView mVideoView;
@BindView(R.id.progrss)
ProgressBar progressBar;
@BindView(R.id.btn_play)
ImageButton mPlay;
@ameliacv
ameliacv / activity_pip.xml
Created September 23, 2018 09:49
pip layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<android.support.v7.widget.Toolbar
final AlertDialog dialogBuilder = new AlertDialog.Builder(this).create();
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.custom_dialog, null);
final EditText editText = (EditText) dialogView.findViewById(R.id.edt_comment);
Button button1 = (Button) dialogView.findViewById(R.id.buttonSubmit);
Button button2 = (Button) dialogView.findViewById(R.id.buttonCancel);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public class SectionsPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public SectionsPagerAdapter(FragmentManager manager) {
super(manager);
}
@Override
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_edit"
android:title="@string/label_edit"/>
</menu>
@SuppressLint("ValidFragment")
public static class BottomDialogFragment extends BottomSheetDialogFragment {
public static BottomDialogFragment getInstance() {
return new BottomDialogFragment();
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {