Skip to content

Commit 402cafa

Browse files
author
piclabsstudio
committed
Example
1 parent 3af3045 commit 402cafa

24 files changed

+541
-38
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
import android.view.Menu;
1313
import android.view.MenuItem;
1414

15+
import com.dvinfosys.WidgetsExample.Fragments.ButtonFragment;
16+
import com.dvinfosys.WidgetsExample.Fragments.CheckBoxFragment;
1517
import com.dvinfosys.WidgetsExample.Fragments.EditTextFragment;
18+
import com.dvinfosys.WidgetsExample.Fragments.RadioButtonFragment;
1619
import com.dvinfosys.WidgetsExample.Fragments.TextViewFragment;
1720
import com.dvinfosys.WidgetsExample.R;
1821

@@ -54,12 +57,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
5457

5558
@Override
5659
public boolean onOptionsItemSelected(MenuItem item) {
57-
// Handle action bar item clicks here. The action bar will
58-
// automatically handle clicks on the Home/Up button, so long
59-
// as you specify a parent activity in AndroidManifest.xml.
6060
int id = item.getItemId();
61-
62-
//noinspection SimplifiableIfStatement
6361
if (id == R.id.action_settings) {
6462
return true;
6563
}
@@ -80,7 +78,11 @@ public boolean onNavigationItemSelected(MenuItem item) {
8078
} else if (id == R.id.nav_edittext) {
8179
fragment = new EditTextFragment();
8280
} else if (id == R.id.nav_checkbox) {
83-
81+
fragment = new CheckBoxFragment();
82+
} else if (id == R.id.nav_button) {
83+
fragment = new ButtonFragment();
84+
} else if (id == R.id.nav_radiobutton) {
85+
fragment = new RadioButtonFragment();
8486
} else if (id == R.id.nav_share) {
8587

8688
} else if (id == R.id.nav_send) {
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+
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+
11+
import com.dvinfosys.WidgetsExample.R;
12+
13+
public class ButtonFragment extends Fragment {
14+
15+
@Override
16+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
17+
Bundle savedInstanceState) {
18+
19+
return inflater.inflate(R.layout.fragment_button, container, false);
20+
}
21+
@Override
22+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
23+
super.onViewCreated(view, savedInstanceState);
24+
getActivity().setTitle("Button Example");
25+
}
26+
27+
}
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 CheckBoxFragment extends Fragment {
15+
16+
@Override
17+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
18+
return inflater.inflate(R.layout.fragment_check_box, container, false);
19+
}
20+
21+
@Override
22+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
23+
super.onViewCreated(view, savedInstanceState);
24+
getActivity().setTitle("CheckBox");
25+
}
26+
27+
}
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.content.Context;
4+
import android.net.Uri;
5+
import android.os.Bundle;
6+
import android.support.annotation.NonNull;
7+
import android.support.annotation.Nullable;
8+
import android.support.v4.app.Fragment;
9+
import android.view.LayoutInflater;
10+
import android.view.View;
11+
import android.view.ViewGroup;
12+
13+
import com.dvinfosys.WidgetsExample.R;
14+
15+
public class RadioButtonFragment extends Fragment {
16+
17+
@Override
18+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
19+
Bundle savedInstanceState) {
20+
return inflater.inflate(R.layout.fragment_radio_button, container, false);
21+
}
22+
23+
@Override
24+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
25+
super.onViewCreated(view, savedInstanceState);
26+
getActivity().setTitle("RadioButton Example");
27+
}
28+
29+
30+
}

app/src/main/res/drawable-v21/ic_menu_gallery.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/src/main/res/drawable-v21/ic_menu_slideshow.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.
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="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
9+
</vector>
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="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
9+
</vector>
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="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
9+
</vector>
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="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
9+
</vector>

0 commit comments

Comments
 (0)