DO NOT USE - Bug 1289242 - Add button to activate AS detail view draft
authorAndrzej Hunt <ahunt@mozilla.com>
Thu, 28 Jul 2016 11:11:09 -0700
changeset 398727 ae8808d88d1026106678605a694d5c1001a1d17b
parent 398726 99cfad19f7966ca455c4167a3acb03b8e93c5146
child 398728 29cc400893b7283ff948f5c7be4a69aaccbdbdda
push id25610
push userahunt@mozilla.com
push dateTue, 09 Aug 2016 17:01:51 +0000
bugs1289242
milestone51.0a1
DO NOT USE - Bug 1289242 - Add button to activate AS detail view Until we have content in the AS panel we can use this button to launch the detail view. MozReview-Commit-ID: F6e0y4CBwZb
mobile/android/base/java/org/mozilla/gecko/home/activitystream/ActivityStream.java
mobile/android/base/resources/layout/activity_stream.xml
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/ActivityStream.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/ActivityStream.java
@@ -1,28 +1,50 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  package org.mozilla.gecko.home.activitystream;
 
 import android.content.Context;
+import android.content.Intent;
 import android.os.Bundle;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.LoaderManager;
 import android.util.AttributeSet;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
+import android.view.View;
+import android.widget.Button;
+import android.widget.RelativeLayout;
 
+import org.mozilla.gecko.R;
 import org.mozilla.gecko.animation.PropertyAnimator;
 import org.mozilla.gecko.home.HomeBanner;
 import org.mozilla.gecko.home.HomeFragment;
 import org.mozilla.gecko.home.HomeScreen;
 
-public class ActivityStream extends FrameLayout implements HomeScreen {
+public class ActivityStream extends RelativeLayout implements HomeScreen {
+
+    public ActivityStream(Context context) {
+        this(context, null);
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        super.onLayout(changed, l, t, r, b);
+
+        Button detailButton = (Button) findViewById(R.id.detail_button);
+
+        detailButton.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Intent i = new Intent(getContext(), ASDetailActivity.class);
+                getContext().startActivity(i);
+            }
+        });
+    }
 
     public ActivityStream(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
 
     @Override
     public boolean isVisible() {
         // This is dependent on the loading state - currently we're a dumb panel so we're always
--- a/mobile/android/base/resources/layout/activity_stream.xml
+++ b/mobile/android/base/resources/layout/activity_stream.xml
@@ -1,16 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <org.mozilla.gecko.home.activitystream.ActivityStream xmlns:android="http://schemas.android.com/apk/res/android"
-                                                      xmlns:tools="http://schemas.android.com/tools"
-                                                      android:orientation="vertical"
-                                                      android:layout_width="match_parent"
-                                                      android:layout_height="match_parent"
-                                                      android:background="@android:color/white">
+                xmlns:tools="http://schemas.android.com/tools"
+                android:orientation="vertical"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@android:color/white">
 
-    <TextView
-        tools:ignore="HardcodedText"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="Activity Stream \\o/"
-        android:id="@+id/textView"
-        android:layout_gravity="center_horizontal"/>
+    <Button android:id="@+id/detail_button"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"
+            tools:ignore="HardcodedText"
+            android:text="Press here for detail view"/>
+
 </org.mozilla.gecko.home.activitystream.ActivityStream>
\ No newline at end of file