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 399218 85ad47d084db51ee4676791c2491457ad14fa1e2
parent 399217 5352c8aadc736de1cfdb71dc1f611f2b310e6fd3
child 399219 08937b69d747b7da0592ec7115f5bfc3667dd577
push id25764
push userahunt@mozilla.com
push dateWed, 10 Aug 2016 17:18:33 +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
@@ -5,29 +5,46 @@
  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 org.mozilla.gecko.BrowserApp;
 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;
 
+import android.view.View;
+import android.widget.Button;
+import android.widget.RelativeLayout;
+
 import java.lang.ref.WeakReference;
 
-public class ActivityStream extends FrameLayout implements HomeScreen {
+public class ActivityStream extends RelativeLayout implements HomeScreen {
+
+    @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);
     }
 
     private WeakReference<BrowserApp> browserAppWeakReference = new WeakReference<BrowserApp>(null);
 
     public void setBrowserApp(final BrowserApp browserApp) {
--- 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