Skip to content

Commit

Permalink
DAlert Dialog Widgets
Browse files Browse the repository at this point in the history
Remove Video Player
  • Loading branch information
Appyown committed Nov 13, 2019
1 parent 82aac01 commit 374b770
Show file tree
Hide file tree
Showing 104 changed files with 2,524 additions and 3,233 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ you could customize following UI controls in your Android application
* [Seekbar](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/SeekbarFragment.java)
* [ProgressView](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/ProgressViewFragment.java)
* [AutoSelect](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/AutoSelectFragment.java)

* [DAlert Dialog](https://github.com/dvinfosys/CustomWidgets/blob/master/app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/DalertFragment.java)

## Author

Expand Down
Binary file added Screenshort/DlertDialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.dvinfosys.WidgetsExample.Fragments.CheckBoxFragment;
import com.dvinfosys.WidgetsExample.Fragments.ColorPickerFragment;
import com.dvinfosys.WidgetsExample.Fragments.CountdownViewFragment;
import com.dvinfosys.WidgetsExample.Fragments.DAlertFragment;
import com.dvinfosys.WidgetsExample.Fragments.EditTextFragment;
import com.dvinfosys.WidgetsExample.Fragments.ExpandingCollectionFragment;
import com.dvinfosys.WidgetsExample.Fragments.FoldingCellFragment;
Expand All @@ -33,10 +34,8 @@
import com.dvinfosys.WidgetsExample.Fragments.TextViewFragment;
import com.dvinfosys.WidgetsExample.Fragments.ToastViewFragment;
import com.dvinfosys.WidgetsExample.Fragments.ToggleButtonFragment;
import com.dvinfosys.WidgetsExample.Fragments.VPVideoPlayerFragment;
import com.dvinfosys.WidgetsExample.MainActivity;
import com.dvinfosys.WidgetsExample.R;
import com.dvinfosys.widgets.VideoPlayer.VPVideoPlayer;

public class HomeActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {

Expand All @@ -58,9 +57,6 @@ protected void onCreate(Bundle savedInstanceState) {

@Override
public void onBackPressed() {
if (VPVideoPlayer.backPress()) {
return;
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
Expand Down Expand Up @@ -106,8 +102,6 @@ public boolean onNavigationItemSelected(MenuItem item) {
fragment = new RadioButtonFragment();
} else if (id == R.id.nav_progressview) {
fragment = new ProgressViewFragment();
} else if (id == R.id.nav_video_player) {
fragment = new VPVideoPlayerFragment();
} else if (id == R.id.nav_seekbar) {
fragment = new SeekbarFragment();
} else if (id == R.id.nav_toastview) {
Expand All @@ -134,8 +128,10 @@ public boolean onNavigationItemSelected(MenuItem item) {
fragment = new PaperOnboardingFragment();
} else if (id == R.id.nav_expanding_collection) {
fragment = new ExpandingCollectionFragment();
}else if (id==R.id.nav_auto_select){
fragment=new AutoSelectFragment();
} else if (id == R.id.nav_auto_select) {
fragment = new AutoSelectFragment();
} else if (id == R.id.nav_alert_dialog) {
fragment = new DAlertFragment();
}
if (fragment != null) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
package com.dvinfosys.WidgetsExample.Fragments;

import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;

import com.dvinfosys.WidgetsExample.R;
import com.dvinfosys.widgets.AlertDialog.DAlertDialog;

public class DAlertFragment extends Fragment implements View.OnClickListener {

private int i = -1;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_dalert, container, false);

v.findViewById(R.id.basic_test).setOnClickListener(this);
v.findViewById(R.id.under_text_test).setOnClickListener(this);
v.findViewById(R.id.error_text_test).setOnClickListener(this);
v.findViewById(R.id.success_text_test).setOnClickListener(this);
v.findViewById(R.id.warning_confirm_test).setOnClickListener(this);
v.findViewById(R.id.warning_cancel_test).setOnClickListener(this);
v.findViewById(R.id.custom_img_test).setOnClickListener(this);
v.findViewById(R.id.progress_dialog).setOnClickListener(this);
v.findViewById(R.id.checkbox1).setOnClickListener(this);

return v;
}

@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.basic_test:
DAlertDialog sd = new DAlertDialog(getContext());
sd.setTitleText("Title");
sd.setContentText("Content");
sd.setCancelable(true);
sd.setCanceledOnTouchOutside(true);
sd.show();
break;
case R.id.under_text_test:
new DAlertDialog(getContext())
.setTitleText("Title Text")
.setContentText("It's pretty, isn't it?")
//.setContentTextSize(50)
.show();

break;
case R.id.error_text_test:
new DAlertDialog(getContext(), DAlertDialog.ERROR_TYPE)
.setTitleText("Opps.")
.setContentText("Something went wrong!")
.show();
break;
case R.id.success_text_test:
new DAlertDialog(getContext(), DAlertDialog.SUCCESS_TYPE)
.setTitleText("Good job!")
.setContentText("You clicked the button!")
.show();

break;
case R.id.warning_confirm_test:
new DAlertDialog(getContext(), DAlertDialog.WARNING_TYPE)
.setTitleText("Are you sure?")
.setContentText("Won't be able to recover this file!")
.setConfirmText("Yes,delete it!")
.setConfirmClickListener(new DAlertDialog.DAlertClickListener() {
@Override
public void onClick(DAlertDialog sDialog) {
sDialog.setTitleText("Deleted!")
.setContentText("Your imaginary file has been deleted!")
.setConfirmText("OK")
.setConfirmClickListener(null)
.changeAlertType(DAlertDialog.SUCCESS_TYPE);
}
})
.show();
break;
case R.id.warning_cancel_test:
new DAlertDialog(getContext(), DAlertDialog.WARNING_TYPE)
.setTitleText("Are you sure?")
.setContentText("Won't be able to recover this file!")
.setCancelText("No,cancel plx!")
.setConfirmText("Yes,delete it!")
.showCancelButton(true)
.setCancelClickListener(new DAlertDialog.DAlertClickListener() {
@Override
public void onClick(DAlertDialog sDialog) {
sDialog.setTitleText("Cancelled!")
.setContentText("Your imaginary file is safe :)")
.setConfirmText("OK")
.showCancelButton(false)
.setCancelClickListener(null)
.setConfirmClickListener(null)
.changeAlertType(DAlertDialog.ERROR_TYPE);
}
})
.setConfirmClickListener(new DAlertDialog.DAlertClickListener() {
@Override
public void onClick(DAlertDialog sDialog) {
sDialog
.setConfirmText("OK")
.showCancelButton(false)
.setCancelClickListener(null)
.setConfirmClickListener(null)
.changeAlertType(DAlertDialog.SUCCESS_TYPE);
}
})
.show();
break;
case R.id.custom_img_test:
new DAlertDialog(getContext(), DAlertDialog.CUSTOM_IMAGE_TYPE)
.setTitleText("DAlertDialog")
.setContentText("Here's a custom image.")
.setCustomImage(R.mipmap.ic_launcher)
.show();
break;
case R.id.progress_dialog:
final DAlertDialog pDialog = new DAlertDialog(getContext(), DAlertDialog.PROGRESS_TYPE)
.setTitleText("Loading");
pDialog.show();
pDialog.setCancelable(false);
new CountDownTimer(800 * 7, 800) {
public void onTick(long millisUntilFinished) {
i++;
switch (i) {
case 0:
pDialog.getProgressHelper().setBarColor(ContextCompat.getColor
(getContext(), R.color.blue_btn_bg_color));
break;
case 1:
pDialog.getProgressHelper().setBarColor(ContextCompat.getColor
(getContext(), R.color.material_deep_teal_50));
break;
case 2:
case 6:
pDialog.getProgressHelper().setBarColor(ContextCompat.getColor
(getContext(), R.color.success_stroke_color));
break;
case 3:
pDialog.getProgressHelper().setBarColor(ContextCompat.getColor
(getContext(), R.color.material_deep_teal_20));
break;
case 4:
pDialog.getProgressHelper().setBarColor(ContextCompat.getColor
(getContext(), R.color.material_blue_grey_80));
break;
case 5:
pDialog.getProgressHelper().setBarColor(ContextCompat.getColor
(getContext(), R.color.warning_stroke_color));
break;
}
}

public void onFinish() {
i = -1;
pDialog.setTitleText("Success!")
.setConfirmText("OK")
.changeAlertType(DAlertDialog.SUCCESS_TYPE);
}
}.start();
break;
case R.id.checkbox1:
DAlertDialog.DARK_STYLE = ((CheckBox) v).isChecked();
break;
}
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("DAlert Dialog Example");
}
}

This file was deleted.

16 changes: 3 additions & 13 deletions app/src/main/java/com/dvinfosys/WidgetsExample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Spannable;
Expand All @@ -21,8 +20,6 @@
import com.dvinfosys.widgets.CountdownView.CountdownView;
import com.dvinfosys.widgets.NumberCounter.Counter;
import com.dvinfosys.widgets.ToastView.ToastView;
import com.dvinfosys.widgets.VideoPlayer.VPVideoPlayer;
import com.dvinfosys.widgets.VideoPlayer.VPVideoPlayerStandard;

import static android.graphics.Typeface.BOLD_ITALIC;

Expand All @@ -49,15 +46,11 @@ protected void onCreate(Bundle savedInstanceState) {
numberCounter.setPlusButtonColor(Color.parseColor("#4CAF50"));
numberCounter.setMinusButtonColor(Color.parseColor("#D50000"));

CountdownView mCvCountdownViewTest1 = (CountdownView)findViewById(R.id.countdown_view);
CountdownView mCvCountdownViewTest1 = findViewById(R.id.countdown_view);
mCvCountdownViewTest1.setTag("test1");
long time1 = (long)5 * 60 * 60 * 1000;
long time1 = (long) 5 * 60 * 60 * 1000;
mCvCountdownViewTest1.start(time1);

VPVideoPlayerStandard videoPlayerStandard = findViewById(R.id.vp_videoplayer);
videoPlayerStandard.setUp("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", VPVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "Elephant Dream");
videoPlayerStandard.thumbImageView.setImageURI(Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/ElephantsDream.jpg"));

btnErrorToastView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -143,16 +136,13 @@ private CharSequence getFormattedMessage() {

@Override
public void onBackPressed() {
if (VPVideoPlayer.backPress()) {
return;
}

super.onBackPressed();
}

@Override
protected void onPause() {
super.onPause();
VPVideoPlayer.releaseAllVideos();
}

@Override
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@
app:isSquare="true"
app:radius="6dp" />


<com.dvinfosys.widgets.VideoPlayer.VPVideoPlayerStandard
android:id="@+id/vp_videoplayer"
android:layout_width="match_parent"
android:layout_height="250dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
Loading

0 comments on commit 374b770

Please sign in to comment.