Merge "Open Help forum in browser when click \'Forum\' button." into nyc-mr1-dev am: dd2797d3ef

am: ac42fbcfec

* commit 'ac42fbcfec708562060fd9befa729825fe400948':
  Open Help forum in browser when click 'Forum' button.

Change-Id: If2efcafb649f105a0ac9f95e7d466c552f3a5149
This commit is contained in:
Fan Zhang
2016-04-21 18:50:34 +00:00
committed by android-build-merger
2 changed files with 47 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.dashboard;
import android.annotation.DrawableRes; import android.annotation.DrawableRes;
import android.annotation.IdRes; import android.annotation.IdRes;
import android.annotation.StringRes; import android.annotation.StringRes;
import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -28,19 +29,31 @@ import android.widget.TextView;
import com.android.settings.InstrumentedFragment; import com.android.settings.InstrumentedFragment;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.overlay.SupportFeatureProvider;
/** /**
* Fragment for support tab in SettingsGoogle. * Fragment for support tab in SettingsGoogle.
*/ */
public final class SupportFragment extends InstrumentedFragment { public final class SupportFragment extends InstrumentedFragment implements View.OnClickListener {
private Activity mActivity;
private View mContent; private View mContent;
private SupportFeatureProvider mSupportFeatureProvider;
@Override @Override
protected int getMetricsCategory() { protected int getMetricsCategory() {
return SUPPORT_FRAGMENT; return SUPPORT_FRAGMENT;
} }
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = getActivity();
mSupportFeatureProvider =
FeatureFactory.getFactory(getContext()).getSupportFeatureProvider();
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
@@ -67,5 +80,15 @@ public final class SupportFragment extends InstrumentedFragment {
final View tile = mContent.findViewById(tileId); final View tile = mContent.findViewById(tileId);
((ImageView) tile.findViewById(android.R.id.icon)).setImageResource(icon); ((ImageView) tile.findViewById(android.R.id.icon)).setImageResource(icon);
((TextView) tile.findViewById(android.R.id.title)).setText(title); ((TextView) tile.findViewById(android.R.id.title)).setText(title);
tile.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.forum_tile:
mActivity.startActivity(mSupportFeatureProvider.getForumIntent());
break;
}
} }
} }

View File

@@ -1,8 +1,31 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.overlay; package com.android.settings.overlay;
import android.content.Intent;
/** /**
* Feature provider for support tab. * Feature provider for support tab.
*/ */
public interface SupportFeatureProvider { public interface SupportFeatureProvider {
/**
* Returns a intent that will open help forum.
*/
Intent getForumIntent();
} }