a/app/src/main/java/com/codesys/forge/MainActivity.java | b/app/src/main/java/com/codesys/forge/MainActivity.java | ||
---|---|---|---|
... |
... |
||
56 | import java.util.Date; |
56 | import java.util.Date; |
57 | 57 | ||
58 | import android.os.AsyncTask; |
58 | import android.os.AsyncTask; |
59 | import android.net.ConnectivityManager; |
59 | import android.net.ConnectivityManager; |
60 | import android.net.NetworkInfo; |
60 | import android.net.NetworkInfo; |
61 | import android.widget.TextView; |
||
61 | import android.widget.Toast; |
62 | import android.widget.Toast; |
62 | 63 | ||
63 | 64 | ||
64 | import com.google.android.material.bottomnavigation.BottomNavigationView; |
65 | import com.google.android.material.bottomnavigation.BottomNavigationView; |
66 | import com.google.android.material.bottomnavigation.LabelVisibilityMode; |
||
65 | 67 | ||
66 | 68 | ||
67 | public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener { |
69 | public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener { |
68 | private Context myContext; |
70 | private Context myContext; |
69 | private WebView myWebView; |
71 | private WebView myWebView; |
... |
... |
||
236 | id = 2; |
238 | id = 2; |
237 | } |
239 | } |
238 | else if (currentURL.contains("forge/talk")) { |
240 | else if (currentURL.contains("forge/talk")) { |
239 | id = 3; |
241 | id = 3; |
240 | } |
242 | } |
243 | else if (currentURL.contains("forge/product-news")) { |
||
244 | id = 4; |
||
245 | } |
||
241 | NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); |
246 | NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); |
242 | notificationManager.cancel(id); |
247 | notificationManager.cancel(id); |
243 | } |
248 | } |
244 | 249 | ||
245 | private void UpdateBottomNavigation() { |
250 | private void UpdateBottomNavigation() { |
... |
... |
||
253 | menuItem = (MenuItem) menuNav.findItem(R.id.news); |
258 | menuItem = (MenuItem) menuNav.findItem(R.id.news); |
254 | } |
259 | } |
255 | else if (currentURL.contains("forge/talk")) { |
260 | else if (currentURL.contains("forge/talk")) { |
256 | menuItem = (MenuItem) menuNav.findItem(R.id.talk); |
261 | menuItem = (MenuItem) menuNav.findItem(R.id.talk); |
257 | } |
262 | } |
263 | else if (currentURL.contains("forge/product-news")) { |
||
264 | menuItem = (MenuItem) menuNav.findItem(R.id.productnews); |
||
265 | } |
||
258 | if (menuItem != null) |
266 | if (menuItem != null) |
259 | menuItem.setChecked(true); |
267 | menuItem.setChecked(true); |
260 | } |
268 | } |
261 | 269 | ||
262 | private void CreateNotification(int id) { |
270 | private void CreateNotification(int id) { |
... |
... |
||
576 | // |
584 | // |
577 | // Add navigation bar |
585 | // Add navigation bar |
578 | // |
586 | // |
579 | bottomnav = findViewById(R.id.bottomNavigationView); |
587 | bottomnav = findViewById(R.id.bottomNavigationView); |
580 | bottomnav.setOnNavigationItemSelectedListener(navListener); |
588 | bottomnav.setOnNavigationItemSelectedListener(navListener); |
589 | bottomnav.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED); |
||
590 | TextView textView; |
||
591 | textView = ((TextView) bottomnav.findViewById(R.id.community).findViewById(R.id.largeLabel)); |
||
592 | textView.setTextSize(12); |
||
593 | textView = ((TextView) bottomnav.findViewById(R.id.news).findViewById(R.id.largeLabel)); |
||
594 | textView.setTextSize(12); |
||
595 | textView = ((TextView) bottomnav.findViewById(R.id.talk).findViewById(R.id.largeLabel)); |
||
596 | textView.setTextSize(12); |
||
597 | textView = ((TextView) bottomnav.findViewById(R.id.productnews).findViewById(R.id.largeLabel)); |
||
598 | textView.setTextSize(12); |
||
581 | ReLoadWebView(currentURL); |
599 | ReLoadWebView(currentURL); |
582 | } |
600 | } |
583 | 601 | ||
584 | // back button |
602 | // back button |
585 | @Override |
603 | @Override |
... |
... |
||
649 | loadUrl("https://forge.codesys.com/forge/news", "News"); |
667 | loadUrl("https://forge.codesys.com/forge/news", "News"); |
650 | break; |
668 | break; |
651 | case R.id.talk: |
669 | case R.id.talk: |
652 | loadUrl("https://forge.codesys.com/forge/talk", "Talk"); |
670 | loadUrl("https://forge.codesys.com/forge/talk", "Talk"); |
653 | break; |
671 | break; |
672 | case R.id.productnews: |
||
673 | loadUrl("https://forge.codesys.com/forge/product-news", "Talk"); |
||
674 | break; |
||
654 | } |
675 | } |
655 | menuItem.setChecked(true); |
676 | menuItem.setChecked(true); |
656 | 677 | ||
657 | return true; |
678 | return true; |
658 | } |
679 | } |