Skip to content

Commit 4b70f14

Browse files
author
piclabsstudio
committed
Update Widgets
1 parent ade42be commit 4b70f14

21 files changed

+708
-14
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.dvinfosys.WidgetsExample">
44

5+
<uses-permission android:name="android.permission.INTERNET" />
6+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7+
58
<application
69
android:allowBackup="true"
710
android:icon="@mipmap/ic_launcher"
@@ -11,12 +14,12 @@
1114
android:theme="@style/AppTheme">
1215
<activity
1316
android:name=".MainActivity"
14-
android:label="@string/title_activity_home"/>
17+
android:label="@string/title_activity_home" />
1518
<activity
1619
android:name=".Activity.HomeActivity"
17-
android:theme="@style/AppTheme.NoActionBar"
1820
android:configChanges="orientation|screenSize|keyboardHidden"
1921
android:screenOrientation="portrait"
22+
android:theme="@style/AppTheme.NoActionBar"
2023
android:windowSoftInputMode="stateAlwaysHidden">
2124
<intent-filter>
2225
<action android:name="android.intent.action.MAIN" />

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.dvinfosys.WidgetsExample.Activity;
22

3+
import android.content.Intent;
34
import android.os.Bundle;
45
import android.support.design.widget.NavigationView;
56
import android.support.v4.app.Fragment;
@@ -14,13 +15,18 @@
1415

1516
import com.dvinfosys.WidgetsExample.Fragments.ButtonFragment;
1617
import com.dvinfosys.WidgetsExample.Fragments.CheckBoxFragment;
18+
import com.dvinfosys.WidgetsExample.Fragments.ColorPickerFragment;
19+
import com.dvinfosys.WidgetsExample.Fragments.CountdownViewFragment;
1720
import com.dvinfosys.WidgetsExample.Fragments.EditTextFragment;
21+
import com.dvinfosys.WidgetsExample.Fragments.ImageviewFragment;
22+
import com.dvinfosys.WidgetsExample.Fragments.NumberCounterFragment;
1823
import com.dvinfosys.WidgetsExample.Fragments.ProgressViewFragment;
1924
import com.dvinfosys.WidgetsExample.Fragments.RadioButtonFragment;
2025
import com.dvinfosys.WidgetsExample.Fragments.SeekbarFragment;
2126
import com.dvinfosys.WidgetsExample.Fragments.TextViewFragment;
2227
import com.dvinfosys.WidgetsExample.Fragments.ToastViewFragment;
2328
import com.dvinfosys.WidgetsExample.Fragments.VPVideoPlayerFragment;
29+
import com.dvinfosys.WidgetsExample.MainActivity;
2430
import com.dvinfosys.WidgetsExample.R;
2531
import com.dvinfosys.widgets.VideoPlayer.VPVideoPlayer;
2632

@@ -80,7 +86,7 @@ public boolean onNavigationItemSelected(MenuItem item) {
8086
Fragment fragment = null;
8187

8288
if (id == R.id.nav_home) {
83-
89+
startActivity(new Intent(HomeActivity.this, MainActivity.class));
8490
} else if (id == R.id.nav_textview) {
8591
fragment = new TextViewFragment();
8692
} else if (id == R.id.nav_edittext) {
@@ -99,6 +105,14 @@ public boolean onNavigationItemSelected(MenuItem item) {
99105
fragment = new SeekbarFragment();
100106
} else if (id == R.id.nav_toastview) {
101107
fragment = new ToastViewFragment();
108+
} else if (id == R.id.nav_imageview) {
109+
fragment = new ImageviewFragment();
110+
} else if (id == R.id.nav_countdownview) {
111+
fragment = new CountdownViewFragment();
112+
} else if (id == R.id.nav_number_counter) {
113+
fragment = new NumberCounterFragment();
114+
} else if (id == R.id.nav_color_picker) {
115+
fragment = new ColorPickerFragment();
102116
} else if (id == R.id.nav_share) {
103117

104118
} else if (id == R.id.nav_send) {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.graphics.Color;
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+
import android.widget.Button;
10+
11+
import com.dvinfosys.WidgetsExample.R;
12+
import com.dvinfosys.widgets.ColorPicker.ColorPanelView;
13+
import com.dvinfosys.widgets.ColorPicker.ColorPickerView;
14+
15+
public class ColorPickerFragment extends Fragment implements ColorPickerView.OnColorChangedListener{
16+
17+
private ColorPickerView colorPickerView;
18+
private ColorPanelView newColorPanelView;
19+
20+
@Override
21+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
22+
View view = inflater.inflate(R.layout.fragment_color_picker, container, false);
23+
colorPickerView = view.findViewById(R.id.cpv_color_picker_view);
24+
ColorPanelView colorPanelView = view.findViewById(R.id.cpv_color_panel_old);
25+
newColorPanelView = view.findViewById(R.id.cpv_color_panel_new);
26+
27+
colorPickerView.setOnColorChangedListener(this);
28+
colorPickerView.setColor(Color.BLUE, true);
29+
colorPanelView.setColor(Color.RED);
30+
31+
return view;
32+
}
33+
34+
@Override
35+
public void onColorChanged(int newColor) {
36+
newColorPanelView.setColor(colorPickerView.getColor());
37+
}
38+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.os.AsyncTask;
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.CountdownView.CountdownView;
14+
15+
public class CountdownViewFragment extends Fragment {
16+
17+
@Override
18+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
19+
View v = inflater.inflate(R.layout.fragment_countdown_view, container, false);
20+
21+
CountdownView mCvCountdownViewTest1 = v.findViewById(R.id.cv_countdownViewTest1);
22+
mCvCountdownViewTest1.setTag("test1");
23+
long time1 = (long) 5 * 60 * 60 * 1000;
24+
mCvCountdownViewTest1.start(time1);
25+
26+
CountdownView mCvCountdownViewTest2 = v.findViewById(R.id.cv_countdownViewTest2);
27+
mCvCountdownViewTest2.setTag("test2");
28+
long time2 = (long) 30 * 60 * 1000;
29+
mCvCountdownViewTest2.start(time2);
30+
31+
CountdownView cvCountdownViewTest211 = v.findViewById(R.id.cv_countdownViewTest211);
32+
cvCountdownViewTest211.setTag("test21");
33+
long time211 = (long) 30 * 60 * 1000;
34+
cvCountdownViewTest211.start(time211);
35+
36+
CountdownView mCvCountdownViewTest21 = v.findViewById(R.id.cv_countdownViewTest21);
37+
mCvCountdownViewTest21.setTag("test21");
38+
long time21 = (long) 24 * 60 * 60 * 1000;
39+
mCvCountdownViewTest21.start(time21);
40+
41+
CountdownView mCvCountdownViewTest22 = v.findViewById(R.id.cv_countdownViewTest22);
42+
mCvCountdownViewTest22.setTag("test22");
43+
long time22 = (long) 30 * 60 * 1000;
44+
mCvCountdownViewTest22.start(time22);
45+
46+
CountdownView mCvCountdownViewTest3 = v.findViewById(R.id.cv_countdownViewTest3);
47+
long time3 = (long) 9 * 60 * 60 * 1000;
48+
mCvCountdownViewTest3.start(time3);
49+
50+
CountdownView mCvCountdownViewTest4 = v.findViewById(R.id.cv_countdownViewTest4);
51+
long time4 = (long) 150 * 24 * 60 * 60 * 1000;
52+
mCvCountdownViewTest4.start(time4);
53+
54+
CountdownView cv_convertDaysToHours = v.findViewById(R.id.cv_convertDaysToHours);
55+
// long timeConvertDaysToHours = (long) 150 * 24 * 60 * 60 * 1000;
56+
cv_convertDaysToHours.start(time4);
57+
58+
CountdownView mCvCountdownViewTest6 = v.findViewById(R.id.cv_countdownViewTest6);
59+
long time6 = (long) 2 * 60 * 60 * 1000;
60+
mCvCountdownViewTest6.start(time6);
61+
62+
final CountdownView mCvCountdownViewTest5 = v.findViewById(R.id.cv_countdownViewTest5);
63+
new AsyncTask<Void, Long, Void>() {
64+
@Override
65+
protected Void doInBackground(Void... params) {
66+
long time = 0;
67+
while (true) {
68+
try {
69+
Thread.sleep(1000);
70+
time += 1000;
71+
publishProgress(time);
72+
} catch (InterruptedException e) {
73+
e.printStackTrace();
74+
}
75+
}
76+
}
77+
78+
@Override
79+
protected void onProgressUpdate(Long... values) {
80+
super.onProgressUpdate(values);
81+
mCvCountdownViewTest5.updateShow(values[0]);
82+
}
83+
}.execute();
84+
85+
return v;
86+
}
87+
88+
@Override
89+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
90+
super.onViewCreated(view, savedInstanceState);
91+
getActivity().setTitle("CountdownView Example");
92+
}
93+
94+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
14+
public class ImageviewFragment extends Fragment {
15+
16+
@Override
17+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
18+
return inflater.inflate(R.layout.fragment_imageview, container, false);
19+
}
20+
21+
@Override
22+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
23+
super.onViewCreated(view, savedInstanceState);
24+
getActivity().setTitle("ImageView Example");
25+
}
26+
27+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.graphics.Color;
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.NumberCounter.Counter;
14+
15+
public class NumberCounterFragment extends Fragment {
16+
17+
private Counter counter;
18+
19+
@Override
20+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
21+
View v = inflater.inflate(R.layout.fragment_number_counter, container, false);
22+
counter = v.findViewById(R.id.number_counter);
23+
return v;
24+
}
25+
26+
@Override
27+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
28+
super.onViewCreated(view, savedInstanceState);
29+
getActivity().setTitle("NumberCounter Example");
30+
}
31+
32+
}

app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/VPVideoPlayerFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public class VPVideoPlayerFragment extends Fragment {
1717
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
1818
View view = inflater.inflate(R.layout.fragment_vpvideo_player, container, false);
1919
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"));
20+
videoPlayerStandard.setUp("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", VPVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, "Elephant Dream");
21+
videoPlayerStandard.thumbImageView.setImageURI(Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg"));
2222
return view;
2323
}
2424

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

515 Bytes
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:state_pressed="true">
4+
<shape android:shape="rectangle">
5+
<corners android:radius="3dp" />
6+
<solid android:color="#F44336" />
7+
<stroke android:color="#000000" android:width="0.5dp" />
8+
</shape>
9+
</item>
10+
11+
<item>
12+
<shape android:shape="rectangle">
13+
<corners android:radius="3dp" />
14+
<solid android:color="#F44336" />
15+
<stroke android:color="#000000" android:width="0.5dp" />
16+
</shape>
17+
</item>
18+
</selector>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="#FF000000"
8+
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
9+
</vector>

0 commit comments

Comments
 (0)