Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/Chromoting.java

Issue 2381543003: [Remoting Android] Separate help and feedback in navigation drawer (Closed)
Patch Set: Reviewer's Feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.ProgressDialog; 8 import android.app.ProgressDialog;
9 import android.content.DialogInterface; 9 import android.content.DialogInterface;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 15 matching lines...) Expand all
26 import android.view.MenuItem; 26 import android.view.MenuItem;
27 import android.view.View; 27 import android.view.View;
28 import android.widget.AdapterView; 28 import android.widget.AdapterView;
29 import android.widget.ArrayAdapter; 29 import android.widget.ArrayAdapter;
30 import android.widget.LinearLayout; 30 import android.widget.LinearLayout;
31 import android.widget.ListView; 31 import android.widget.ListView;
32 import android.widget.Toast; 32 import android.widget.Toast;
33 33
34 import org.chromium.base.ApiCompatibilityUtils; 34 import org.chromium.base.ApiCompatibilityUtils;
35 import org.chromium.base.Log; 35 import org.chromium.base.Log;
36 import org.chromium.chromoting.NavigationMenuAdapter.NavigationMenuItem;
37 import org.chromium.chromoting.accountswitcher.AccountSwitcher; 36 import org.chromium.chromoting.accountswitcher.AccountSwitcher;
38 import org.chromium.chromoting.accountswitcher.AccountSwitcherFactory; 37 import org.chromium.chromoting.accountswitcher.AccountSwitcherFactory;
39 import org.chromium.chromoting.base.OAuthTokenFetcher; 38 import org.chromium.chromoting.base.OAuthTokenFetcher;
40 import org.chromium.chromoting.help.CreditsActivity;
41 import org.chromium.chromoting.help.HelpContext; 39 import org.chromium.chromoting.help.HelpContext;
42 import org.chromium.chromoting.help.HelpSingleton; 40 import org.chromium.chromoting.help.HelpSingleton;
43 import org.chromium.chromoting.jni.Client; 41 import org.chromium.chromoting.jni.Client;
44 import org.chromium.chromoting.jni.ConnectionListener; 42 import org.chromium.chromoting.jni.ConnectionListener;
45 import org.chromium.chromoting.jni.JniInterface; 43 import org.chromium.chromoting.jni.JniInterface;
46 44
47 import java.util.ArrayList; 45 import java.util.ArrayList;
48 import java.util.Arrays; 46 import java.util.Arrays;
49 47
50 /** 48 /**
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 * Shows the appropriate view for the host list and hides the loading indica tor. Shows either 160 * Shows the appropriate view for the host list and hides the loading indica tor. Shows either
163 * the host list chooser or the host list empty view, depending on whether m Hosts contains any 161 * the host list chooser or the host list empty view, depending on whether m Hosts contains any
164 * hosts. 162 * hosts.
165 */ 163 */
166 private void updateHostListView() { 164 private void updateHostListView() {
167 mHostListView.setVisibility(mHosts.length == 0 ? View.GONE : View.VISIBL E); 165 mHostListView.setVisibility(mHosts.length == 0 ? View.GONE : View.VISIBL E);
168 mEmptyView.setVisibility(mHosts.length == 0 ? View.VISIBLE : View.GONE); 166 mEmptyView.setVisibility(mHosts.length == 0 ? View.VISIBLE : View.GONE);
169 mProgressView.setVisibility(View.GONE); 167 mProgressView.setVisibility(View.GONE);
170 } 168 }
171 169
172 private ListView createNavigationMenu() {
173 ListView navigationMenu = (ListView) getLayoutInflater()
174 .inflate(R.layout.navigation_list, null);
175
176 NavigationMenuItem helpItem = new NavigationMenuItem(R.menu.help_list_it em,
177 new Runnable() {
178 @Override
179 public void run() {
180 HelpSingleton.getInstance().launchHelp(Chromoting.this,
181 HelpContext.HOST_LIST);
182 }
183 });
184
185 NavigationMenuItem creditsItem = new NavigationMenuItem(R.menu.credits_l ist_item,
186 new Runnable() {
187 @Override
188 public void run() {
189 startActivity(new Intent(Chromoting.this, CreditsActivit y.class));
190 }
191 });
192
193 NavigationMenuItem[] navigationMenuItems = { helpItem, creditsItem };
194 NavigationMenuAdapter adapter = new NavigationMenuAdapter(this, navigati onMenuItems);
195 navigationMenu.setAdapter(adapter);
196 navigationMenu.setOnItemClickListener(adapter);
197 return navigationMenu;
198 }
199
200 /** 170 /**
201 * Called when the activity is first created. Loads the native library and r equests an 171 * Called when the activity is first created. Loads the native library and r equests an
202 * authentication token from the system. 172 * authentication token from the system.
203 */ 173 */
204 @Override 174 @Override
205 public void onCreate(Bundle savedInstanceState) { 175 public void onCreate(Bundle savedInstanceState) {
206 super.onCreate(savedInstanceState); 176 super.onCreate(savedInstanceState);
207 setContentView(R.layout.main); 177 setContentView(R.layout.main);
208 178
209 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 179 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 }); 231 });
262 232
263 // Set the three-line icon instead of the default which is a tinted arro w icon. 233 // Set the three-line icon instead of the default which is a tinted arro w icon.
264 getSupportActionBar().setDisplayHomeAsUpEnabled(true); 234 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
265 Drawable menuIcon = ApiCompatibilityUtils.getDrawable(getResources(), R. drawable.ic_menu); 235 Drawable menuIcon = ApiCompatibilityUtils.getDrawable(getResources(), R. drawable.ic_menu);
266 DrawableCompat.setTint(menuIcon.mutate(), 236 DrawableCompat.setTint(menuIcon.mutate(),
267 ChromotingUtil.getColorAttribute(this, R.attr.colorControlNormal )); 237 ChromotingUtil.getColorAttribute(this, R.attr.colorControlNormal ));
268 getSupportActionBar().setHomeAsUpIndicator(menuIcon); 238 getSupportActionBar().setHomeAsUpIndicator(menuIcon);
269 239
270 mAccountSwitcher = AccountSwitcherFactory.getInstance().createAccountSwi tcher(this, this); 240 mAccountSwitcher = AccountSwitcherFactory.getInstance().createAccountSwi tcher(this, this);
271 mAccountSwitcher.setNavigation(createNavigationMenu()); 241 mAccountSwitcher.setNavigation(NavigationMenuAdapter.createNavigationMen u(this));
272 LinearLayout navigationDrawer = (LinearLayout) findViewById(R.id.navigat ion_drawer); 242 LinearLayout navigationDrawer = (LinearLayout) findViewById(R.id.navigat ion_drawer);
273 mAccountSwitcher.setDrawer(navigationDrawer); 243 mAccountSwitcher.setDrawer(navigationDrawer);
274 View switcherView = mAccountSwitcher.getView(); 244 View switcherView = mAccountSwitcher.getView();
275 switcherView.setLayoutParams(new LinearLayout.LayoutParams( 245 switcherView.setLayoutParams(new LinearLayout.LayoutParams(
276 LinearLayout.LayoutParams.MATCH_PARENT, 246 LinearLayout.LayoutParams.MATCH_PARENT,
277 LinearLayout.LayoutParams.WRAP_CONTENT)); 247 LinearLayout.LayoutParams.WRAP_CONTENT));
278 navigationDrawer.addView(switcherView, 0); 248 navigationDrawer.addView(switcherView, 0);
279 249
280 mHostConnectingConsumer = new OAuthTokenConsumer(this, TOKEN_SCOPE); 250 mHostConnectingConsumer = new OAuthTokenConsumer(this, TOKEN_SCOPE);
281 mHostListRetrievingConsumer = new OAuthTokenConsumer(this, TOKEN_SCOPE); 251 mHostListRetrievingConsumer = new OAuthTokenConsumer(this, TOKEN_SCOPE);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 // Unreachable, but required by Google Java style and findbugs. 675 // Unreachable, but required by Google Java style and findbugs.
706 assert false : "Unreached"; 676 assert false : "Unreached";
707 } 677 }
708 678
709 if (dismissProgress && mProgressIndicator != null) { 679 if (dismissProgress && mProgressIndicator != null) {
710 mProgressIndicator.dismiss(); 680 mProgressIndicator.dismiss();
711 mProgressIndicator = null; 681 mProgressIndicator = null;
712 } 682 }
713 } 683 }
714 } 684 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698