Skip to content

Commit c01885f

Browse files
committed
This is third commit
1 parent b18d74f commit c01885f

40 files changed

+1015
-0
lines changed

app/src/main/assets/c_intro.pdf

165 KB
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.james.programminglover;
2+
3+
import androidx.appcompat.app.AppCompatActivity;
4+
5+
import android.os.Bundle;
6+
7+
import com.github.barteksc.pdfviewer.PDFView;
8+
9+
public class CIntroActivity extends AppCompatActivity {
10+
11+
PDFView pdfView;
12+
13+
@Override
14+
protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
setContentView(R.layout.activity_c_intro);
17+
18+
pdfView=findViewById(R.id.pdfView);
19+
20+
int c_position = getIntent().getIntExtra("key_position",0);
21+
if (c_position==0){
22+
pdfView.fromAsset("c_intro.pdf").load();
23+
}
24+
}
25+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.james.programminglover;
2+
3+
import android.os.Bundle;
4+
import android.view.View;
5+
import android.view.Menu;
6+
7+
import com.google.android.material.floatingactionbutton.FloatingActionButton;
8+
import com.google.android.material.snackbar.Snackbar;
9+
import com.google.android.material.navigation.NavigationView;
10+
11+
import androidx.navigation.NavController;
12+
import androidx.navigation.Navigation;
13+
import androidx.navigation.ui.AppBarConfiguration;
14+
import androidx.navigation.ui.NavigationUI;
15+
import androidx.drawerlayout.widget.DrawerLayout;
16+
import androidx.appcompat.app.AppCompatActivity;
17+
import androidx.appcompat.widget.Toolbar;
18+
19+
public class NavigationDrawerActivity extends AppCompatActivity {
20+
21+
private AppBarConfiguration mAppBarConfiguration;
22+
23+
@Override
24+
protected void onCreate(Bundle savedInstanceState) {
25+
super.onCreate(savedInstanceState);
26+
setContentView(R.layout.activity_navigation_drawer);
27+
Toolbar toolbar = findViewById(R.id.toolbar);
28+
setSupportActionBar(toolbar);
29+
30+
DrawerLayout drawer = findViewById(R.id.drawer_layout);
31+
NavigationView navigationView = findViewById(R.id.nav_view);
32+
// Passing each menu ID as a set of Ids because each
33+
// menu should be considered as top level destinations.
34+
mAppBarConfiguration = new AppBarConfiguration.Builder(
35+
R.id.nav_home, R.id.nav_ascii, R.id.nav_share, R.id.nav_rate,R.id.nav_feedback,R.id.nav_about)
36+
.setDrawerLayout(drawer)
37+
.build();
38+
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
39+
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
40+
NavigationUI.setupWithNavController(navigationView, navController);
41+
}
42+
43+
@Override
44+
public boolean onCreateOptionsMenu(Menu menu) {
45+
// Inflate the menu; this adds items to the action bar if it is present.
46+
getMenuInflater().inflate(R.menu.navigation_drawer, menu);
47+
return true;
48+
}
49+
50+
@Override
51+
public boolean onSupportNavigateUp() {
52+
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
53+
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
54+
|| super.onSupportNavigateUp();
55+
}
56+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.james.programminglover.fragment;
2+
3+
import android.os.Bundle;
4+
5+
import androidx.fragment.app.Fragment;
6+
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
11+
import com.james.programminglover.R;
12+
13+
/**
14+
* A simple {@link Fragment} subclass.
15+
* Use the {@link AboutFragment#newInstance} factory method to
16+
* create an instance of this fragment.
17+
*/
18+
public class AboutFragment extends Fragment {
19+
20+
// TODO: Rename parameter arguments, choose names that match
21+
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
22+
private static final String ARG_PARAM1 = "param1";
23+
private static final String ARG_PARAM2 = "param2";
24+
25+
// TODO: Rename and change types of parameters
26+
private String mParam1;
27+
private String mParam2;
28+
29+
public AboutFragment() {
30+
// Required empty public constructor
31+
}
32+
33+
/**
34+
* Use this factory method to create a new instance of
35+
* this fragment using the provided parameters.
36+
*
37+
* @param param1 Parameter 1.
38+
* @param param2 Parameter 2.
39+
* @return A new instance of fragment AboutFragment.
40+
*/
41+
// TODO: Rename and change types and number of parameters
42+
public static AboutFragment newInstance(String param1, String param2) {
43+
AboutFragment fragment = new AboutFragment();
44+
Bundle args = new Bundle();
45+
args.putString(ARG_PARAM1, param1);
46+
args.putString(ARG_PARAM2, param2);
47+
fragment.setArguments(args);
48+
return fragment;
49+
}
50+
51+
@Override
52+
public void onCreate(Bundle savedInstanceState) {
53+
super.onCreate(savedInstanceState);
54+
if (getArguments() != null) {
55+
mParam1 = getArguments().getString(ARG_PARAM1);
56+
mParam2 = getArguments().getString(ARG_PARAM2);
57+
}
58+
}
59+
60+
@Override
61+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
62+
Bundle savedInstanceState) {
63+
// Inflate the layout for this fragment
64+
return inflater.inflate(R.layout.fragment_about, container, false);
65+
}
66+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.james.programminglover.fragment;
2+
3+
import android.os.Bundle;
4+
5+
import androidx.fragment.app.Fragment;
6+
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
11+
import com.james.programminglover.R;
12+
13+
/**
14+
* A simple {@link Fragment} subclass.
15+
* Use the {@link FeedbackFragment#newInstance} factory method to
16+
* create an instance of this fragment.
17+
*/
18+
public class FeedbackFragment extends Fragment {
19+
20+
// TODO: Rename parameter arguments, choose names that match
21+
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
22+
private static final String ARG_PARAM1 = "param1";
23+
private static final String ARG_PARAM2 = "param2";
24+
25+
// TODO: Rename and change types of parameters
26+
private String mParam1;
27+
private String mParam2;
28+
29+
public FeedbackFragment() {
30+
// Required empty public constructor
31+
}
32+
33+
/**
34+
* Use this factory method to create a new instance of
35+
* this fragment using the provided parameters.
36+
*
37+
* @param param1 Parameter 1.
38+
* @param param2 Parameter 2.
39+
* @return A new instance of fragment FeedbackFragment.
40+
*/
41+
// TODO: Rename and change types and number of parameters
42+
public static FeedbackFragment newInstance(String param1, String param2) {
43+
FeedbackFragment fragment = new FeedbackFragment();
44+
Bundle args = new Bundle();
45+
args.putString(ARG_PARAM1, param1);
46+
args.putString(ARG_PARAM2, param2);
47+
fragment.setArguments(args);
48+
return fragment;
49+
}
50+
51+
@Override
52+
public void onCreate(Bundle savedInstanceState) {
53+
super.onCreate(savedInstanceState);
54+
if (getArguments() != null) {
55+
mParam1 = getArguments().getString(ARG_PARAM1);
56+
mParam2 = getArguments().getString(ARG_PARAM2);
57+
}
58+
}
59+
60+
@Override
61+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
62+
Bundle savedInstanceState) {
63+
// Inflate the layout for this fragment
64+
return inflater.inflate(R.layout.fragment_feedback, container, false);
65+
}
66+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.james.programminglover.fragment;
2+
3+
import android.os.Bundle;
4+
5+
import androidx.fragment.app.Fragment;
6+
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
11+
import com.james.programminglover.R;
12+
13+
/**
14+
* A simple {@link Fragment} subclass.
15+
* Use the {@link RateFragment#newInstance} factory method to
16+
* create an instance of this fragment.
17+
*/
18+
public class RateFragment extends Fragment {
19+
20+
// TODO: Rename parameter arguments, choose names that match
21+
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
22+
private static final String ARG_PARAM1 = "param1";
23+
private static final String ARG_PARAM2 = "param2";
24+
25+
// TODO: Rename and change types of parameters
26+
private String mParam1;
27+
private String mParam2;
28+
29+
public RateFragment() {
30+
// Required empty public constructor
31+
}
32+
33+
/**
34+
* Use this factory method to create a new instance of
35+
* this fragment using the provided parameters.
36+
*
37+
* @param param1 Parameter 1.
38+
* @param param2 Parameter 2.
39+
* @return A new instance of fragment RateFragment.
40+
*/
41+
// TODO: Rename and change types and number of parameters
42+
public static RateFragment newInstance(String param1, String param2) {
43+
RateFragment fragment = new RateFragment();
44+
Bundle args = new Bundle();
45+
args.putString(ARG_PARAM1, param1);
46+
args.putString(ARG_PARAM2, param2);
47+
fragment.setArguments(args);
48+
return fragment;
49+
}
50+
51+
@Override
52+
public void onCreate(Bundle savedInstanceState) {
53+
super.onCreate(savedInstanceState);
54+
if (getArguments() != null) {
55+
mParam1 = getArguments().getString(ARG_PARAM1);
56+
mParam2 = getArguments().getString(ARG_PARAM2);
57+
}
58+
}
59+
60+
@Override
61+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
62+
Bundle savedInstanceState) {
63+
// Inflate the layout for this fragment
64+
return inflater.inflate(R.layout.fragment_rate, container, false);
65+
}
66+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.james.programminglover.ui.gallery;
2+
3+
import android.os.Bundle;
4+
import android.view.LayoutInflater;
5+
import android.view.View;
6+
import android.view.ViewGroup;
7+
import android.widget.TextView;
8+
9+
import androidx.annotation.NonNull;
10+
import androidx.annotation.Nullable;
11+
import androidx.fragment.app.Fragment;
12+
import androidx.lifecycle.Observer;
13+
import androidx.lifecycle.ViewModelProvider;
14+
15+
import com.james.programminglover.R;
16+
17+
public class GalleryFragment extends Fragment {
18+
19+
private GalleryViewModel galleryViewModel;
20+
21+
public View onCreateView(@NonNull LayoutInflater inflater,
22+
ViewGroup container, Bundle savedInstanceState) {
23+
galleryViewModel =
24+
new ViewModelProvider(this).get(GalleryViewModel.class);
25+
View root = inflater.inflate(R.layout.fragment_gallery, container, false);
26+
final TextView textView = root.findViewById(R.id.text_gallery);
27+
galleryViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
28+
@Override
29+
public void onChanged(@Nullable String s) {
30+
textView.setText(s);
31+
}
32+
});
33+
return root;
34+
}
35+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.james.programminglover.ui.gallery;
2+
3+
import androidx.lifecycle.LiveData;
4+
import androidx.lifecycle.MutableLiveData;
5+
import androidx.lifecycle.ViewModel;
6+
7+
public class GalleryViewModel extends ViewModel {
8+
9+
private MutableLiveData<String> mText;
10+
11+
public GalleryViewModel() {
12+
mText = new MutableLiveData<>();
13+
mText.setValue("This is gallery fragment");
14+
}
15+
16+
public LiveData<String> getText() {
17+
return mText;
18+
}
19+
}

0 commit comments

Comments
 (0)