1212
1313import butterknife .BindView ;
1414import butterknife .ButterKnife ;
15+ import de .psdev .licensesdialog .LicensesDialog ;
16+ import de .psdev .licensesdialog .licenses .ApacheSoftwareLicense20 ;
17+ import de .psdev .licensesdialog .licenses .BSD2ClauseLicense ;
18+ import de .psdev .licensesdialog .model .Notice ;
19+ import de .psdev .licensesdialog .model .Notices ;
1520import subreddit .android .appstore .BuildConfig ;
1621import subreddit .android .appstore .R ;
1722import subreddit .android .appstore .util .ui .BaseActivity ;
1823
19- public class AboutActivity extends BaseActivity implements View .OnClickListener {
24+ public class AboutActivity extends BaseActivity implements View .OnClickListener , NavigationView . OnNavigationItemSelectedListener {
2025 @ BindView (R .id .app_nav ) NavigationView app_nav ;
2126 @ BindView (R .id .contributor_nav ) NavigationView contributor_nav ;
2227 @ BindView (R .id .about_toolbar ) Toolbar mToolbar ;
2328
2429 protected static final String REDDIT_URL = "https://www.reddit.com" ;
2530 protected static final String BUG_URL = "https://github.com/d4rken/reddit-android-appstore/issues" ;
2631
27- NavigationView .OnNavigationItemSelectedListener aboutListener = new NavigationView .OnNavigationItemSelectedListener () {
28- @ Override
29- public boolean onNavigationItemSelected (@ NonNull MenuItem item ) {
30- switch (item .getItemId ()) {
31- case R .id .reportbug : {
32- openInChrome (BUG_URL );
33- break ;
34- }
35- case R .id .licenses : {
36- //TODO: open a license dialog
37- break ;
38- }
39- }
40- return false ;
41- }
42- };
43-
4432 NavigationView .OnNavigationItemSelectedListener contributorListener = new NavigationView .OnNavigationItemSelectedListener () {
4533 @ Override
4634 public boolean onNavigationItemSelected (@ NonNull MenuItem item ) {
@@ -49,6 +37,39 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
4937 }
5038 };
5139
40+ @ Override
41+ public boolean onNavigationItemSelected (@ NonNull MenuItem item ) {
42+ switch (item .getItemId ()) {
43+ case R .id .reportbug : {
44+ openInChrome (BUG_URL );
45+ break ;
46+ }
47+ case R .id .licenses : {
48+ Notices notices = new Notices ();
49+ notices .addNotice (new Notice ("Fastscroll" ,"https://github.com/FutureMind/recycler-fast-scroll" ,"Copyright 2015 Future Mind" , new ApacheSoftwareLicense20 ()));
50+ notices .addNotice (new Notice ("Glide" ,"https://github.com/bumptech/glide" ,null , new BSD2ClauseLicense ()));
51+ notices .addNotice (new Notice ("RxJava" ,"https://github.com/ReactiveX/RxJava" ,"Copyright 2013 Netflix, Inc." , new ApacheSoftwareLicense20 ()));
52+ notices .addNotice (new Notice ("Tomorrow MVP" ,"https://github.com/michal-luszczuk/tomorrow-mvp" ,null , new ApacheSoftwareLicense20 ()));
53+ notices .addNotice (new Notice ("GSon" ,"https://github.com/google/gson" ,"Copyright 2008 Google Inc." ,new ApacheSoftwareLicense20 ()));
54+ notices .addNotice (new Notice ("Dagger" ,"https://github.com/square/dagger" ,"Copyright 2012 Square, Inc." , new ApacheSoftwareLicense20 ()));
55+ notices .addNotice (new Notice ("Butterknife" ,"https://github.com/JakeWharton/butterknife" ,"Copyright 2013 Jake Wharton" , new ApacheSoftwareLicense20 ()));
56+ notices .addNotice (new Notice ("Timber" ,"https://github.com/JakeWharton/timber" ,"Copyright 2013 Jake Wharton" , new ApacheSoftwareLicense20 ()));
57+ notices .addNotice (new Notice ("Flow Layout" ,"https://github.com/blazsolar/FlowLayout" ,"Copyright 2013 Blaž Šolar" ,new ApacheSoftwareLicense20 ()));
58+ notices .addNotice (new Notice ("OkHttp" , "http://square.github.io/okhttp/" , "Copyright 2016 Square, Inc." , new ApacheSoftwareLicense20 ()));
59+ notices .addNotice (new Notice ("Android Support Libraries" , "https://github.com/android/platform_frameworks_support" , null , new ApacheSoftwareLicense20 ()));
60+ notices .addNotice (new Notice ("LeakCanary" ,"https://github.com/square/leakcanary" ,"Copyright 2015 Square, Inc." , new ApacheSoftwareLicense20 ()));
61+ notices .addNotice (new Notice ("License Dialog" ,"https://github.com/PSDev/LicensesDialog" ,"Copyright 2013-2016 Philip Schiffer" , new ApacheSoftwareLicense20 ()));
62+ new LicensesDialog .Builder (this )
63+ .setNotices (notices )
64+ .setTitle (R .string .licenses )
65+ .build ()
66+ .show ();
67+ break ;
68+ }
69+ }
70+ return false ;
71+ }
72+
5273 @ Override
5374 protected void onCreate (Bundle savedInstanceState ) {
5475 super .onCreate (savedInstanceState );
@@ -60,7 +81,7 @@ protected void onCreate(Bundle savedInstanceState) {
6081 mToolbar .setNavigationOnClickListener (this );
6182
6283 app_nav .getMenu ().findItem (0 ).setTitle (getResources ().getString (R .string .version ) + " " + BuildConfig .VERSION_NAME );
63- app_nav .setNavigationItemSelectedListener (aboutListener );
84+ app_nav .setNavigationItemSelectedListener (this );
6485
6586 contributor_nav .setNavigationItemSelectedListener (contributorListener );
6687 }
0 commit comments