mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Remove AddFollow activity from register workflow (#499)
This commit is contained in:
parent
8b8e854111
commit
b81938a88c
7 changed files with 4 additions and 279 deletions
|
@ -39,10 +39,6 @@
|
|||
android:noHistory="true"
|
||||
android:label="@string/get_started" />
|
||||
|
||||
<activity
|
||||
android:name=".activity.AddFollow"
|
||||
android:label="@string/add_follow" />
|
||||
|
||||
<activity
|
||||
android:name=".activity.AddTwitter"
|
||||
android:label="@string/add_twitter" />
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/item_background" >
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/addfollow_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:padding="30dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/addfollow_button_bar"
|
||||
android:gravity="right"
|
||||
android:padding="10dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/login_addfollow_startreading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="Start Reading"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -25,7 +25,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="Skip this step"
|
||||
android:text="Start Reading"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addfollow_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="30dp"
|
||||
android:text="@string/wonderful_things"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/addfollow_newsblur"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/addfollow_text"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addfollow_newsblur_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/addfollow_add_newsblur"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/addfollow_newsblur_checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/addfollow_popular"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/addfollow_newsblur"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/addfollow_popular_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/addfollow_add_popular"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/addfollow_popular_checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,44 +0,0 @@
|
|||
package com.newsblur.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.fragment.AddFollowFragment;
|
||||
|
||||
public class AddFollow extends NbActivity {
|
||||
|
||||
private FragmentManager fragmentManager;
|
||||
private String currentTag = "addFollowFragment";
|
||||
private AddFollowFragment addFollowFragment;
|
||||
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.activity_addfollow);
|
||||
|
||||
fragmentManager = getFragmentManager();
|
||||
|
||||
if (fragmentManager.findFragmentByTag(currentTag ) == null) {
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
addFollowFragment = new AddFollowFragment();
|
||||
transaction.add(R.id.addfollow_container, addFollowFragment, currentTag);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
Button startReading = (Button) findViewById(R.id.login_addfollow_startreading);
|
||||
startReading.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(AddFollow.this, Main.class);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}
|
|
@ -35,8 +35,9 @@ public class AddSocial extends NbActivity {
|
|||
nextStep.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
Intent i = new Intent(AddSocial.this, AddFollow.class);
|
||||
startActivity(i);
|
||||
Intent i = new Intent(AddSocial.this, Main.class);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,123 +0,0 @@
|
|||
package com.newsblur.fragment;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.network.APIManager;
|
||||
|
||||
public class AddFollowFragment extends Fragment {
|
||||
|
||||
boolean followingNewsblur, followingPopular;
|
||||
private View parentView;
|
||||
private LinearLayout followingNewsblurLayout, followingPopularLayout;
|
||||
private APIManager apiManager;
|
||||
private TextView followingNewsblurText;
|
||||
private CheckBox followingNewsblurCheckbox;
|
||||
private TextView followingPopularText;
|
||||
private CheckBox followingPopularCheckbox;
|
||||
private String TAG = "addFollowFragment";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
apiManager = new APIManager(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
parentView = inflater.inflate(R.layout.fragment_addfollow, null);
|
||||
followingNewsblurLayout = (LinearLayout) parentView.findViewById(R.id.addfollow_newsblur);
|
||||
followingNewsblurText = (TextView) parentView.findViewById(R.id.addfollow_newsblur_text);
|
||||
followingNewsblurCheckbox = (CheckBox) parentView.findViewById(R.id.addfollow_newsblur_checkbox);
|
||||
|
||||
followingPopularLayout = (LinearLayout) parentView.findViewById(R.id.addfollow_popular);
|
||||
followingPopularText = (TextView) parentView.findViewById(R.id.addfollow_popular_text);
|
||||
followingPopularCheckbox = (CheckBox) parentView.findViewById(R.id.addfollow_popular_checkbox);
|
||||
|
||||
followingPopularLayout.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
followingPopularCheckbox.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
followingNewsblurLayout.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
followingNewsblurCheckbox.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
setupUI();
|
||||
|
||||
followingNewsblurCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
followingNewsblurCheckbox.setEnabled(false);
|
||||
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... arg0) {
|
||||
boolean addedOkay = apiManager.addFeed("http://blog.newsblur.com", null);
|
||||
followingNewsblur = true;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
setupUI();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
});
|
||||
|
||||
followingPopularCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
followingPopularCheckbox.setEnabled(false);
|
||||
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... arg0) {
|
||||
boolean addedOkay = apiManager.followUser("popular");
|
||||
followingPopular = true;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
setupUI();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
});
|
||||
|
||||
return parentView;
|
||||
}
|
||||
|
||||
private void setupUI() {
|
||||
if (followingNewsblur) {
|
||||
followingNewsblurText.setText("Following Newsblur");
|
||||
followingNewsblurCheckbox.setEnabled(false);
|
||||
}
|
||||
|
||||
if (followingPopular) {
|
||||
followingPopularText.setText("Following Popular");
|
||||
followingPopularCheckbox.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue