Skip to content

Commit 14c38d7

Browse files
author
piclabsstudio
committed
Update Widgets
1 parent 402cafa commit 14c38d7

33 files changed

+2033
-24
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
android:allowBackup="true"
77
android:icon="@mipmap/ic_launcher"
88
android:label="@string/app_name"
9-
android:roundIcon="@mipmap/ic_launcher_round"
9+
android:roundIcon="@mipmap/ic_launcher"
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme">
1212
<activity

app/src/main/java/com/dvinfosys/WidgetsExample/Activity/HomeActivity.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
import com.dvinfosys.WidgetsExample.Fragments.ButtonFragment;
1616
import com.dvinfosys.WidgetsExample.Fragments.CheckBoxFragment;
1717
import com.dvinfosys.WidgetsExample.Fragments.EditTextFragment;
18+
import com.dvinfosys.WidgetsExample.Fragments.ProgressViewFragment;
1819
import com.dvinfosys.WidgetsExample.Fragments.RadioButtonFragment;
20+
import com.dvinfosys.WidgetsExample.Fragments.SeekbarFragment;
1921
import com.dvinfosys.WidgetsExample.Fragments.TextViewFragment;
22+
import com.dvinfosys.WidgetsExample.Fragments.ToastViewFragment;
23+
import com.dvinfosys.WidgetsExample.Fragments.VPVideoPlayerFragment;
2024
import com.dvinfosys.WidgetsExample.R;
25+
import com.dvinfosys.widgets.VideoPlayer.VPVideoPlayer;
2126

2227
public class HomeActivity extends AppCompatActivity
2328
implements NavigationView.OnNavigationItemSelectedListener {
@@ -40,6 +45,9 @@ protected void onCreate(Bundle savedInstanceState) {
4045

4146
@Override
4247
public void onBackPressed() {
48+
if (VPVideoPlayer.backPress()) {
49+
return;
50+
}
4351
DrawerLayout drawer = findViewById(R.id.drawer_layout);
4452
if (drawer.isDrawerOpen(GravityCompat.START)) {
4553
drawer.closeDrawer(GravityCompat.START);
@@ -83,6 +91,14 @@ public boolean onNavigationItemSelected(MenuItem item) {
8391
fragment = new ButtonFragment();
8492
} else if (id == R.id.nav_radiobutton) {
8593
fragment = new RadioButtonFragment();
94+
} else if (id == R.id.nav_progressview) {
95+
fragment = new ProgressViewFragment();
96+
} else if (id == R.id.nav_video_player) {
97+
fragment = new VPVideoPlayerFragment();
98+
} else if (id == R.id.nav_seekbar) {
99+
fragment = new SeekbarFragment();
100+
} else if (id == R.id.nav_toastview) {
101+
fragment = new ToastViewFragment();
86102
} else if (id == R.id.nav_share) {
87103

88104
} else if (id == R.id.nav_send) {
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.NonNull;
5+
import android.support.annotation.Nullable;
6+
import android.support.v4.app.Fragment;
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
import android.widget.TextView;
11+
12+
import com.dvinfosys.WidgetsExample.R;
13+
import com.dvinfosys.widgets.ProgressView.CircleProgressView;
14+
import com.dvinfosys.widgets.ProgressView.HorizontalProgressView;
15+
16+
public class ProgressViewFragment extends Fragment implements HorizontalProgressView.HorizontalProgressUpdateListener {
17+
18+
private CircleProgressView circleProgressView;
19+
private HorizontalProgressView hpv_language, hpv_math, hpv_history, hpv_english;
20+
private TextView tv_language, tv_math, tv_history, tv_english, tv_main;
21+
22+
@Override
23+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
24+
View view = inflater.inflate(R.layout.fragment_progress_view, container, false);
25+
init(view);
26+
return view;
27+
}
28+
29+
private void init(View view) {
30+
circleProgressView = view.findViewById(R.id.circle_progressview);
31+
circleProgressView.startProgressAnimation();
32+
hpv_language = view.findViewById(R.id.hpv_language);
33+
hpv_math = view.findViewById(R.id.hpv_math);
34+
hpv_history = view.findViewById(R.id.hpv_history);
35+
hpv_english = view.findViewById(R.id.hpv_english);
36+
tv_language = view.findViewById(R.id.progress_text_language);
37+
tv_english = view.findViewById(R.id.progress_text_english);
38+
tv_history = view.findViewById(R.id.progress_text_history);
39+
tv_math = view.findViewById(R.id.progress_text_math);
40+
hpv_language.setProgressViewUpdateListener(this);
41+
hpv_english.setProgressViewUpdateListener(this);
42+
hpv_history.setProgressViewUpdateListener(this);
43+
hpv_math.setProgressViewUpdateListener(this);
44+
hpv_language.startProgressAnimation();
45+
hpv_math.startProgressAnimation();
46+
hpv_history.startProgressAnimation();
47+
hpv_english.startProgressAnimation();
48+
}
49+
50+
@Override
51+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
52+
super.onViewCreated(view, savedInstanceState);
53+
getActivity().setTitle("ProgressView");
54+
}
55+
56+
@Override
57+
public void onHorizontalProgressStart(View view) {
58+
59+
}
60+
61+
@Override
62+
public void onHorizontalProgressUpdate(View view, float progress) {
63+
int progressInt = (int) progress;
64+
switch (view.getId()){
65+
case R.id.hpv_language:
66+
tv_language.setText(progressInt + "%");
67+
break;
68+
69+
case R.id.hpv_english:
70+
tv_english.setText(progressInt + "%");
71+
break;
72+
73+
case R.id.hpv_history:
74+
tv_history.setText(progressInt + "%");
75+
break;
76+
77+
case R.id.hpv_math:
78+
tv_math.setText(progressInt + "%");
79+
break;
80+
}
81+
}
82+
83+
@Override
84+
public void onHorizontalProgressFinished(View view) {
85+
86+
}
87+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
4+
import android.os.Bundle;
5+
import android.support.annotation.NonNull;
6+
import android.support.annotation.Nullable;
7+
import android.support.v4.app.Fragment;
8+
import android.view.LayoutInflater;
9+
import android.view.View;
10+
import android.view.ViewGroup;
11+
12+
import com.dvinfosys.WidgetsExample.R;
13+
import com.dvinfosys.widgets.SeekBar.CustomSeekBar;
14+
import com.dvinfosys.widgets.SeekBar.OnSeekChangeListener;
15+
import com.dvinfosys.widgets.SeekBar.SeekParams;
16+
import com.dvinfosys.widgets.TextView.NormalTextView;
17+
18+
public class SeekbarFragment extends Fragment {
19+
20+
CustomSeekBar seekBar;
21+
22+
@Override
23+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
24+
View view = inflater.inflate(R.layout.fragment_seekbar, container, false);
25+
seekBar = view.findViewById(R.id.percent_indicator);
26+
seekBar.setIndicatorTextFormat("${PROGRESS} %");
27+
28+
CustomSeekBar scale = view.findViewById(R.id.scale);
29+
scale.setDecimalScale(4);
30+
View contentView = scale.getIndicator().getContentView();
31+
32+
CustomSeekBar thumb_drawable = view.findViewById(R.id.thumb_drawable);
33+
thumb_drawable.setThumbDrawable(getResources().getDrawable(R.mipmap.ic_launcher));
34+
35+
CustomSeekBar listenerSeekBar = view.findViewById(R.id.listener);
36+
final NormalTextView states = view.findViewById(R.id.states);
37+
states.setText("states: ");
38+
final NormalTextView progress = view.findViewById(R.id.progress);
39+
progress.setText("progress: " + listenerSeekBar.getProgress());
40+
final NormalTextView progress_float = view.findViewById(R.id.progress_float);
41+
progress_float.setText("progress_float: " + listenerSeekBar.getProgressFloat());
42+
final NormalTextView from_user = view.findViewById(R.id.from_user);
43+
from_user.setText("from_user: ");
44+
listenerSeekBar.setOnSeekChangeListener(new OnSeekChangeListener() {
45+
@Override
46+
public void onSeeking(SeekParams seekParams) {
47+
states.setText("states: onSeeking");
48+
progress.setText("progress: " + seekParams.progress);
49+
progress_float.setText("progress_float: " + seekParams.progressFloat);
50+
from_user.setText("from_user: " + seekParams.fromUser);
51+
}
52+
53+
@Override
54+
public void onStartTrackingTouch(CustomSeekBar seekBar) {
55+
states.setText("states: onStart");
56+
progress.setText("progress: " + seekBar.getProgress());
57+
progress_float.setText("progress_float: " + seekBar.getProgressFloat());
58+
from_user.setText("from_user: true");
59+
}
60+
61+
@Override
62+
public void onStopTrackingTouch(CustomSeekBar seekBar) {
63+
states.setText("states: onStop");
64+
progress.setText("progress: " + seekBar.getProgress());
65+
progress_float.setText("progress_float: " + seekBar.getProgressFloat());
66+
from_user.setText("from_user: false");
67+
}
68+
});
69+
70+
return view;
71+
}
72+
73+
@Override
74+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
75+
super.onViewCreated(view, savedInstanceState);
76+
getActivity().setTitle("SeekBar Example");
77+
}
78+
79+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.graphics.Typeface;
4+
import android.graphics.drawable.Drawable;
5+
import android.os.Bundle;
6+
import android.support.v4.app.Fragment;
7+
import android.text.Spannable;
8+
import android.text.SpannableStringBuilder;
9+
import android.text.style.StyleSpan;
10+
import android.view.LayoutInflater;
11+
import android.view.View;
12+
import android.view.ViewGroup;
13+
import android.widget.Button;
14+
15+
import com.dvinfosys.WidgetsExample.R;
16+
import com.dvinfosys.widgets.ToastView.ToastView;
17+
18+
import static android.graphics.Typeface.BOLD_ITALIC;
19+
20+
public class ToastViewFragment extends Fragment {
21+
22+
private Button btnErrorToastView, btnSuccessToastView, btnInfoToastView, btnWarringToastView;
23+
24+
@Override
25+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
26+
View view = inflater.inflate(R.layout.fragment_toast_view, container, false);
27+
28+
btnErrorToastView = view.findViewById(R.id.button_error_toast);
29+
btnSuccessToastView = view.findViewById(R.id.button_success_toast);
30+
btnInfoToastView = view.findViewById(R.id.button_info_toast);
31+
btnWarringToastView = view.findViewById(R.id.button_warning_toast);
32+
33+
btnErrorToastView.setOnClickListener(new View.OnClickListener() {
34+
@Override
35+
public void onClick(View v) {
36+
ToastView.error(getContext(), "This is error ToastView", ToastView.LENGTH_SHORT).show();
37+
}
38+
});
39+
btnWarringToastView.setOnClickListener(new View.OnClickListener() {
40+
@Override
41+
public void onClick(View v) {
42+
ToastView.warning(getContext(), "This is warring ToastView", ToastView.LENGTH_SHORT).show();
43+
}
44+
});
45+
btnInfoToastView.setOnClickListener(new View.OnClickListener() {
46+
@Override
47+
public void onClick(View v) {
48+
ToastView.info(getContext(), "This is info ToastView", ToastView.LENGTH_SHORT).show();
49+
}
50+
});
51+
52+
btnSuccessToastView.setOnClickListener(new View.OnClickListener() {
53+
@Override
54+
public void onClick(View v) {
55+
ToastView.success(getContext(), "This is success ToastView", ToastView.LENGTH_SHORT).show();
56+
}
57+
});
58+
59+
view.findViewById(R.id.button_normal_toast_wo_icon).setOnClickListener(new View.OnClickListener() {
60+
@Override
61+
public void onClick(View view) {
62+
ToastView.normal(getContext(), "normal message without icon").show();
63+
}
64+
});
65+
view.findViewById(R.id.button_normal_toast_w_icon).setOnClickListener(new View.OnClickListener() {
66+
@Override
67+
public void onClick(View view) {
68+
Drawable icon = getResources().getDrawable(R.drawable.menu);
69+
ToastView.normal(getContext(), "normal message with icon", icon).show();
70+
}
71+
});
72+
view.findViewById(R.id.button_info_toast_with_formatting).setOnClickListener(new View.OnClickListener() {
73+
@Override
74+
public void onClick(View view) {
75+
ToastView.info(getContext(), getFormattedMessage()).show();
76+
}
77+
});
78+
view.findViewById(R.id.button_custom_config).setOnClickListener(new View.OnClickListener() {
79+
@Override
80+
public void onClick(View view) {
81+
ToastView.Config.getInstance()
82+
.setToastTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/Smoothy.otf"))
83+
.allowQueue(false)
84+
.apply();
85+
ToastView.custom(getContext(), R.string.custom_message, getResources().getDrawable(R.drawable.menu),
86+
android.R.color.black, android.R.color.holo_green_light, ToastView.LENGTH_SHORT, true, true).show();
87+
ToastView.Config.reset(); // Use this if you want to use the configuration above only once
88+
}
89+
});
90+
91+
return view;
92+
}
93+
94+
private CharSequence getFormattedMessage() {
95+
final String prefix = "Formatted ";
96+
final String highlight = "bold italic";
97+
final String suffix = " text";
98+
SpannableStringBuilder ssb = new SpannableStringBuilder(prefix).append(highlight).append(suffix);
99+
int prefixLen = prefix.length();
100+
ssb.setSpan(new StyleSpan(BOLD_ITALIC),
101+
prefixLen, prefixLen + highlight.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
102+
return ssb;
103+
}
104+
105+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.net.Uri;
4+
import android.os.Bundle;
5+
import android.support.v4.app.Fragment;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
10+
import com.dvinfosys.WidgetsExample.R;
11+
import com.dvinfosys.widgets.VideoPlayer.VPVideoPlayer;
12+
import com.dvinfosys.widgets.VideoPlayer.VPVideoPlayerStandard;
13+
14+
public class VPVideoPlayerFragment extends Fragment {
15+
16+
@Override
17+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
18+
View view = inflater.inflate(R.layout.fragment_vpvideo_player, container, false);
19+
VPVideoPlayerStandard videoPlayerStandard = view.findViewById(R.id.vp_videoplayer);
20+
videoPlayerStandard.setUp("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", VPVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "Elephant Dream");
21+
videoPlayerStandard.thumbImageView.setImageURI(Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/ElephantsDream.jpg"));
22+
return view;
23+
}
24+
25+
@Override
26+
public void onPause() {
27+
super.onPause();
28+
VPVideoPlayer.releaseAllVideos();
29+
}
30+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="oval">
4+
5+
<solid android:color="#FF7E00"/>
6+
<stroke android:width="8dp" android:color="#55FF7E00"/>
7+
8+
<size
9+
android:width="26dp"
10+
android:height="26dp"/>
11+
</shape>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="oval">
4+
5+
<solid android:color="#FF7E00"/>
6+
7+
<size
8+
android:width="12dp"
9+
android:height="12dp"/>
10+
</shape>
958 Bytes
Loading

app/src/main/res/drawable/logo.png

46.6 KB
Loading

0 commit comments

Comments
 (0)