Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 525344c

Browse files
committed
final changes for release 1.2.4
improved timetable Added timetable at front improved bottom navigation improved todo card
1 parent 7973e5f commit 525344c

22 files changed

+347
-149
lines changed

.idea/navEditor.xml

+18-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
<category android:name="android.intent.category.LAUNCHER" />
8787
</intent-filter>
8888
</activity>
89-
<activity android:name=".timetable.EditTimetableActivity" />
9089

9190
<service
9291
android:name=".notifications.FcmService"

app/src/main/java/com/grobo/notifications/Mess/CancelMealAdapter.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.view.LayoutInflater;
55
import android.view.View;
66
import android.view.ViewGroup;
7-
import android.widget.ImageView;
87
import android.widget.TextView;
98

109
import androidx.annotation.NonNull;
@@ -27,7 +26,6 @@ public CancelMealAdapter(Context context) {
2726
@Override
2827
public CancelMealAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
2928
View view = LayoutInflater.from( parent.getContext() ).inflate( R.layout.card_cancel_meal, parent, false );
30-
3129
return new CancelMealAdapter.ViewHolder( view );
3230
}
3331

@@ -38,8 +36,6 @@ public void onBindViewHolder(@NonNull final CancelMealAdapter.ViewHolder holder,
3836
SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, MMM d, ''yy", Locale.getDefault());
3937
String s = dateFormat.format( mess );
4038
holder.date_cancelled.setText( s );
41-
42-
4339
}
4440

4541
@Override
@@ -52,19 +48,14 @@ public int getItemCount() {
5248
class ViewHolder extends RecyclerView.ViewHolder {
5349

5450
TextView date_cancelled;
55-
TextView type_of_meal;
56-
ImageView cancel;
57-
5851

5952
ViewHolder(@NonNull View itemView) {
60-
super( itemView );
61-
date_cancelled = itemView.findViewById( R.id.date_cancelled );
62-
type_of_meal = itemView.findViewById( R.id.type );
63-
cancel = itemView.findViewById( R.id.cancel );
53+
super(itemView);
54+
date_cancelled = itemView.findViewById(R.id.date_cancelled);
6455
}
6556
}
6657

67-
public void ItemList(List<Long> feeds) {
58+
public void setItemList(List<Long> feeds) {
6859
itemList = feeds;
6960
notifyDataSetChanged();
7061
}

app/src/main/java/com/grobo/notifications/Mess/DetailFragment.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import androidx.annotation.Nullable;
1212
import androidx.fragment.app.Fragment;
1313
import androidx.preference.PreferenceManager;
14+
import androidx.recyclerview.widget.DividerItemDecoration;
1415
import androidx.recyclerview.widget.LinearLayoutManager;
1516
import androidx.recyclerview.widget.RecyclerView;
1617

@@ -65,6 +66,9 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
6566
cancelMealAdapter = new CancelMealAdapter(requireContext());
6667
recyclerView.setAdapter(cancelMealAdapter);
6768

69+
DividerItemDecoration decoration = new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL);
70+
recyclerView.addItemDecoration(decoration);
71+
6872
empty = view.findViewById(R.id.meal_empty_view);
6973

7074
populateData();
@@ -104,7 +108,7 @@ public void onResponse(@NonNull Call<MessModel> call, @NonNull Response<MessMode
104108
} else {
105109
empty.setVisibility(View.GONE);
106110
recyclerView.setVisibility(View.VISIBLE);
107-
cancelMealAdapter.ItemList(time);
111+
cancelMealAdapter.setItemList(time);
108112
}
109113
}
110114
} else

app/src/main/java/com/grobo/notifications/clubs/ClubsFragment.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,18 @@ public void onResponse(@NonNull Call<ClubItem.Clubs> call, @NonNull Response<Clu
109109
}
110110

111111
}
112-
Toast.makeText(getContext(), "Clubs updated.", Toast.LENGTH_SHORT).show();
113-
prefs.edit().putLong("last_club_update_time", System.currentTimeMillis()).apply();
112+
if (getContext() != null) {
113+
Toast.makeText(getContext(), "Clubs updated.", Toast.LENGTH_SHORT).show();
114+
prefs.edit().putLong("last_club_update_time", System.currentTimeMillis()).apply();
115+
}
114116
}
115117
swipeRefreshLayout.setRefreshing(false);
116118
}
117119

118120
@Override
119121
public void onFailure(@NonNull Call<ClubItem.Clubs> call, @NonNull Throwable t) {
120-
Log.e("failure", t.getMessage());
122+
if (t.getMessage() != null)
123+
Log.e("failure", t.getMessage());
121124
swipeRefreshLayout.setRefreshing(false);
122125
Toast.makeText(getContext(), "Update failed!!", Toast.LENGTH_SHORT).show();
123126
}

app/src/main/java/com/grobo/notifications/feed/FeedFragment.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,20 @@ public void onResponse(@NonNull Call<FeedItem.FeedItemSuper1> call, @NonNull Res
146146
feedViewModel.insert(newItem);
147147
}
148148
}
149-
Toast.makeText(getContext(), "Feeds updated.", Toast.LENGTH_SHORT).show();
150-
prefs.edit().putLong("last_feed_update_time", System.currentTimeMillis()).apply();
149+
if (getContext() != null) {
150+
Toast.makeText(getContext(), "Feeds updated.", Toast.LENGTH_SHORT).show();
151+
prefs.edit().putLong("last_feed_update_time", System.currentTimeMillis()).apply();
152+
}
151153
}
152154
swipeRefreshLayout.setRefreshing(false);
153155
}
154156

155157
@Override
156158
public void onFailure(@NonNull Call<FeedItem.FeedItemSuper1> call, @NonNull Throwable t) {
157-
Log.e("failure", t.getMessage());
159+
if (t.getMessage() != null)
160+
Log.e("failure", t.getMessage());
158161
swipeRefreshLayout.setRefreshing(false);
162+
Toast.makeText(getContext(), "Update failed!!", Toast.LENGTH_SHORT).show();
159163
}
160164
});
161165

app/src/main/java/com/grobo/notifications/main/HomeFragment.java

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.grobo.notifications.main;
22

3+
import android.content.SharedPreferences;
34
import android.os.Bundle;
45
import android.view.LayoutInflater;
56
import android.view.View;
@@ -10,12 +11,14 @@
1011
import androidx.fragment.app.Fragment;
1112
import androidx.fragment.app.FragmentManager;
1213
import androidx.fragment.app.FragmentTransaction;
14+
import androidx.preference.PreferenceManager;
1315
import androidx.transition.TransitionInflater;
1416

1517
import com.google.android.material.bottomnavigation.BottomNavigationView;
1618
import com.grobo.notifications.Mess.MessFragment;
1719
import com.grobo.notifications.R;
1820
import com.grobo.notifications.notifications.NotificationsFragment;
21+
import com.grobo.notifications.timetable.TimetableFragment;
1922
import com.grobo.notifications.todolist.TodoFragment;
2023

2124
public class HomeFragment extends Fragment {
@@ -24,21 +27,27 @@ public HomeFragment() {
2427
}
2528

2629
private FragmentManager manager;
30+
private SharedPreferences preferences;
2731

2832
@Override
2933
public void onCreate(@Nullable Bundle savedInstanceState) {
3034
super.onCreate(savedInstanceState);
3135
manager = requireActivity().getSupportFragmentManager();
36+
preferences = PreferenceManager.getDefaultSharedPreferences(requireContext());
3237
}
3338

3439
@Override
35-
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
36-
Bundle savedInstanceState) {
37-
View rootView = inflater.inflate(R.layout.fragment_home, container, false);
40+
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
41+
return inflater.inflate(R.layout.fragment_home, container, false);
42+
}
43+
44+
@Override
45+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
3846

39-
BottomNavigationView bottomNavigationView = rootView.findViewById(R.id.bottom_nav_home);
47+
BottomNavigationView bottomNavigationView = view.findViewById(R.id.bottom_nav_home);
4048
bottomNavigationView.setOnNavigationItemSelectedListener(menuItem -> {
4149
int id = menuItem.getItemId();
50+
preferences.edit().putInt("selected_item_id_home", id).apply();
4251

4352
switch (id){
4453
case R.id.navigation_today:
@@ -50,13 +59,17 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
5059
case R.id.navigation_notifications:
5160
transactFragment(new NotificationsFragment());
5261
return true;
62+
case R.id.navigation_timetable:
63+
transactFragment(new TimetableFragment());
64+
return true;
5365
}
5466

5567
return false;
5668
});
57-
bottomNavigationView.setSelectedItemId(R.id.navigation_today);
5869

59-
return rootView;
70+
bottomNavigationView.setSelectedItemId(preferences.getInt("selected_item_id_home", R.id.navigation_today));
71+
72+
super.onViewCreated(view, savedInstanceState);
6073
}
6174

6275
private void transactFragment(Fragment frag) {

app/src/main/java/com/grobo/notifications/timetable/DayFragment.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
6565

6666
@Override
6767
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
68-
return inflater.inflate(R.layout.fragment_timetable, container, false);
68+
return inflater.inflate(R.layout.fragment_timetable_day, container, false);
6969
}
7070

7171
@Override
@@ -96,7 +96,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
9696
super.onViewCreated(view, savedInstanceState);
9797
}
9898

99-
10099
private void showDialogueBox(String message) {
101100
new AlertDialog.Builder(requireContext())
102101
.setMessage(message)

app/src/main/java/com/grobo/notifications/timetable/EditTimetableActivity.java

-15
This file was deleted.

0 commit comments

Comments
 (0)