| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chromoting; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.view.LayoutInflater; | 10 import android.view.LayoutInflater; |
| 11 import android.view.View; | 11 import android.view.View; |
| 12 import android.view.ViewGroup; | 12 import android.view.ViewGroup; |
| 13 import android.widget.AdapterView; | 13 import android.widget.AdapterView; |
| 14 import android.widget.ArrayAdapter; | 14 import android.widget.ArrayAdapter; |
| 15 import android.widget.ListView; | 15 import android.widget.ListView; |
| 16 | 16 |
| 17 import org.chromium.chromoting.help.CreditsActivity; | 17 import org.chromium.chromoting.help.CreditsActivity; |
| 18 import org.chromium.chromoting.help.FeedbackSender; | |
| 19 import org.chromium.chromoting.help.HelpContext; | 18 import org.chromium.chromoting.help.HelpContext; |
| 20 import org.chromium.chromoting.help.HelpSingleton; | 19 import org.chromium.chromoting.help.HelpSingleton; |
| 21 | 20 |
| 22 /** | 21 /** |
| 23 * Describes the appearance and behavior of the navigation menu. This also imple
ments | 22 * Describes the appearance and behavior of the navigation menu. This also imple
ments |
| 24 * AdapterView.OnItemClickListener so it can be used as the ListView's onItemCli
ckListener. | 23 * AdapterView.OnItemClickListener so it can be used as the ListView's onItemCli
ckListener. |
| 25 */ | 24 */ |
| 26 public class NavigationMenuAdapter extends ArrayAdapter<NavigationMenuAdapter.Na
vigationMenuItem> | 25 public class NavigationMenuAdapter extends ArrayAdapter<NavigationMenuAdapter.Na
vigationMenuItem> |
| 27 implements AdapterView.OnItemClickListener { | 26 implements AdapterView.OnItemClickListener { |
| 28 /** | 27 /** |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 @Override | 45 @Override |
| 47 public void run() { | 46 public void run() { |
| 48 activity.startActivity(new Intent(activity, CreditsActiv
ity.class)); | 47 activity.startActivity(new Intent(activity, CreditsActiv
ity.class)); |
| 49 } | 48 } |
| 50 }); | 49 }); |
| 51 | 50 |
| 52 NavigationMenuItem feedbackItem = new NavigationMenuItem(R.menu.feedback
_list_item, | 51 NavigationMenuItem feedbackItem = new NavigationMenuItem(R.menu.feedback
_list_item, |
| 53 new Runnable() { | 52 new Runnable() { |
| 54 @Override | 53 @Override |
| 55 public void run() { | 54 public void run() { |
| 56 FeedbackSender.sendFeedback(activity); | 55 HelpSingleton.getInstance().launchFeedback(activity); |
| 57 } | 56 } |
| 58 }); | 57 }); |
| 59 | 58 |
| 60 NavigationMenuItem helpItem = new NavigationMenuItem(R.menu.help_list_it
em, | 59 NavigationMenuItem helpItem = new NavigationMenuItem(R.menu.help_list_it
em, |
| 61 new Runnable() { | 60 new Runnable() { |
| 62 @Override | 61 @Override |
| 63 public void run() { | 62 public void run() { |
| 64 HelpSingleton.getInstance().launchHelp(activity, | 63 HelpSingleton.getInstance().launchHelp(activity, |
| 65 HelpContext.HOST_LIST); | 64 HelpContext.HOST_LIST); |
| 66 } | 65 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 89 return convertView; | 88 return convertView; |
| 90 } | 89 } |
| 91 | 90 |
| 92 | 91 |
| 93 /** AdapterView.OnItemClickListener override. */ | 92 /** AdapterView.OnItemClickListener override. */ |
| 94 @Override | 93 @Override |
| 95 public void onItemClick(AdapterView<?> parent, View view, int position, long
id) { | 94 public void onItemClick(AdapterView<?> parent, View view, int position, long
id) { |
| 96 getItem(position).mCallback.run(); | 95 getItem(position).mCallback.run(); |
| 97 } | 96 } |
| 98 } | 97 } |
| OLD | NEW |