Finds accounts through web page

This commit is contained in:
tom79 2017-08-22 17:34:26 +02:00
parent 19e0460091
commit 6f463ec872
11 changed files with 496 additions and 27 deletions

View File

@ -33,4 +33,5 @@ dependencies {
compile 'com.evernote:android-job:1.1.11'
compile 'com.github.chrisbanes:PhotoView:2.0.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'org.jsoup:jsoup:1.10.3'
}

View File

@ -85,6 +85,11 @@
android:launchMode="singleTask"
android:noHistory="true"
/>
<activity android:name="fr.gouv.etalab.mastodon.activities.RemoteFollowActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
/>
<activity android:name="fr.gouv.etalab.mastodon.activities.SearchResultActivity"
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"

View File

@ -739,6 +739,11 @@ public class MainActivity extends AppCompatActivity
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if( id == R.id.nav_remote_follow){
Intent remoteFollow = new Intent(getApplicationContext(), RemoteFollowActivity.class);
startActivity(remoteFollow);
return false;
}
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
unCheckAllMenuItems(navigationView);
item.setChecked(true);

View File

@ -15,7 +15,7 @@
package fr.gouv.etalab.mastodon.activities;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
@ -26,6 +26,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -55,18 +56,17 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import cz.msebera.android.httpclient.Header;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveAccountsAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveSearchAccountsAsyncTask;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveRemoteAccountsAsyncTask;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.client.KinrarClient;
import fr.gouv.etalab.mastodon.client.PatchBaseImageDownloader;
import fr.gouv.etalab.mastodon.drawers.AccountsListAdapter;
import fr.gouv.etalab.mastodon.drawers.AccountSearchWebAdapter;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearcAccountshInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRemoteAccountInterface;
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
import mastodon.etalab.gouv.fr.mastodon.R;
@ -77,17 +77,18 @@ import mastodon.etalab.gouv.fr.mastodon.R;
* Remote follow activity class
*/
public class RemoteFollowActivity extends AppCompatActivity implements OnRetrieveSearcAccountshInterface {
public class RemoteFollowActivity extends AppCompatActivity implements OnRetrieveRemoteAccountInterface {
private ImageView pp_actionBar;
private AutoCompleteTextView rf_instance;
private EditText rf_username;
private TextView rf_no_result;
private Button rf_search;
private ListView lv_account;
private RelativeLayout loader;
private boolean isLoadingInstance;
private String instance_name, screen_name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -106,6 +107,8 @@ public class RemoteFollowActivity extends AppCompatActivity implements OnRetriev
rf_search = (Button) findViewById(R.id.rf_search);
loader = (RelativeLayout) findViewById(R.id.loader);
lv_account = (ListView) findViewById(R.id.lv_account);
rf_no_result = (TextView) findViewById(R.id.rf_no_result);
isLoadingInstance = false;
ActionBar actionBar = getSupportActionBar();
if( actionBar != null) {
@ -175,7 +178,7 @@ public class RemoteFollowActivity extends AppCompatActivity implements OnRetriev
}
@Override
public void afterTextChanged(Editable s) {
if( s.length() > 2 && !isLoadingInstance){
if( s.length() > 2 && !isLoadingInstance && 1 ==2){
String action = "/instances/search";
RequestParams parameters = new RequestParams();
parameters.add("q", s.toString().trim());
@ -220,15 +223,20 @@ public class RemoteFollowActivity extends AppCompatActivity implements OnRetriev
rf_search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if( rf_instance.getText().toString().trim().equals("") || rf_username.getText().toString().trim().equals("")){
Toast.makeText(getApplicationContext(),R.string.toast_empty_search,Toast.LENGTH_LONG).show();
return;
}
rf_search.setEnabled(false);
String screen_name = rf_username.getText().toString().trim();
String instance_name = rf_instance.getText().toString().trim();
screen_name = rf_username.getText().toString().trim();
instance_name = rf_instance.getText().toString().trim();
lv_account.setVisibility(View.GONE);
loader.setVisibility(View.VISIBLE);
new RetrieveSearchAccountsAsyncTask(getApplicationContext(), screen_name + "@" + instance_name, 1, RemoteFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
rf_no_result.setVisibility(View.GONE);
if( screen_name.startsWith("@"))
screen_name = screen_name.substring(1);
new RetrieveRemoteAccountsAsyncTask(RemoteFollowActivity.this, screen_name, instance_name, RemoteFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
}
@ -244,7 +252,7 @@ public class RemoteFollowActivity extends AppCompatActivity implements OnRetriev
}
}
/*
@Override
public void onRetrieveSearchAccounts(APIResponse apiResponse) {
rf_search.setEnabled(true);
@ -257,10 +265,52 @@ public class RemoteFollowActivity extends AppCompatActivity implements OnRetriev
return;
}
final List<Account> accounts = apiResponse.getAccounts();
Log.v(Helper.TAG,"accounts: " + accounts);
if( accounts != null && accounts.size() > 0 && accounts.get(0) != null) {
AccountsListAdapter accountsListAdapter = new AccountsListAdapter(getApplicationContext(), RetrieveAccountsAsyncTask.Type.FOLLOWERS, null, accounts);
lv_account.setAdapter(accountsListAdapter);
lv_account.setVisibility(View.VISIBLE);
List<Account> selectedAccount = new ArrayList<>();
for(Account account: accounts){
if(account.getAcct().contains("@" + instance_name) || (account.getUsername().equals(account.getAcct()) && account.getUsername().equals(screen_name)))
selectedAccount.add(account);
}
if( selectedAccount.size() > 0) {
AccountsListAdapter accountsListAdapter = new AccountsListAdapter(RemoteFollowActivity.this, RetrieveAccountsAsyncTask.Type.FOLLOWERS, null, selectedAccount);
lv_account.setAdapter(accountsListAdapter);
lv_account.setVisibility(View.VISIBLE);
}else {
rf_no_result.setVisibility(View.VISIBLE);
}
}else if( firstSearch){
firstSearch = false;
new RetrieveSearchAccountsAsyncTask(RemoteFollowActivity.this, screen_name, 50, RemoteFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}else {
rf_no_result.setVisibility(View.VISIBLE);
}
}*/
@Override
public void onRetrieveRemoteAccount(boolean error, String name, String avatar, String bio, int statusCount, int followingCount, int followersCount) {
if( error){
rf_no_result.setVisibility(View.VISIBLE);
Toast.makeText(getApplicationContext(), R.string.toast_error,Toast.LENGTH_LONG).show();
return;
}
loader.setVisibility(View.GONE);
Account account = new Account();
account.setInstance(instance_name);
account.setAcct(screen_name + "@" + instance_name);
account.setAvatar(avatar);
account.setDisplay_name(name);
account.setStatuses_count(statusCount);
account.setFollowers_count(followersCount);
account.setFollowing_count(followingCount);
account.setUsername(name);
account.setNote(bio);
List<Account> selectedAccount = new ArrayList<>();
selectedAccount.add(account);
AccountSearchWebAdapter accountSearchWebAdapter = new AccountSearchWebAdapter(RemoteFollowActivity.this, selectedAccount);
lv_account.setAdapter(accountSearchWebAdapter);
lv_account.setVisibility(View.VISIBLE);
}
}

View File

@ -0,0 +1,79 @@
/* Copyright 2017 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.asynctasks;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.IOException;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRemoteAccountInterface;
/**
* Created by Thomas on 22/07/2017.
* Retrieves a remote account via its webpage
*/
public class RetrieveRemoteAccountsAsyncTask extends AsyncTask<Void, Void, Void> {
private Context context;
private OnRetrieveRemoteAccountInterface listener;
private String url;
private String avatar, name, bio;
private int statusCount, followingCount, followersCount;
private boolean error = false;
private String instance;
public RetrieveRemoteAccountsAsyncTask(Context context, String username, String instance, OnRetrieveRemoteAccountInterface onRetrieveRemoteAccountInterface){
this.context = context;
this.url = "https://" + instance + "/@" + username;
this.listener = onRetrieveRemoteAccountInterface;
this.instance = instance;
}
@Override
protected Void doInBackground(Void... params) {
String userAgent = "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36";
try {
Document document = Jsoup.connect(url).userAgent(userAgent).get();
Elements avatarElement = document.getElementsByClass("avatar");
avatar = avatarElement.get(0).getElementsByClass("u-photo").get(0).attr("src");
avatar = "https://" + instance + avatar;
Elements nameElement = document.getElementsByClass("name");
name = nameElement.get(0).html();
Elements bioElement = document.getElementsByClass("bio");
bio = bioElement.get(0).html();;
Elements countElement = document.getElementsByClass("counter-number");
statusCount = Integer.parseInt(countElement.get(0).html());
followingCount = Integer.parseInt(countElement.get(1).html());
followersCount = Integer.parseInt(countElement.get(2).html());
} catch (IOException e) {
error = true;
}
return null;
}
@Override
protected void onPostExecute(Void result) {
listener.onRetrieveRemoteAccount(error, name, avatar, bio, statusCount, followingCount, followersCount);
}
}

View File

@ -32,27 +32,18 @@ public class RetrieveSearchAccountsAsyncTask extends AsyncTask<Void, Void, Void>
private String query;
private APIResponse apiResponse;
private OnRetrieveSearcAccountshInterface listener;
private int limit;
public RetrieveSearchAccountsAsyncTask(Context context, String query, OnRetrieveSearcAccountshInterface onRetrieveSearcAccountshInterface){
this.context = context;
this.query = query;
this.listener = onRetrieveSearcAccountshInterface;
this.limit = 10;
}
public RetrieveSearchAccountsAsyncTask(Context context, String query, int limit, OnRetrieveSearcAccountshInterface onRetrieveSearcAccountshInterface){
this.context = context;
this.query = query;
this.listener = onRetrieveSearcAccountshInterface;
this.limit = limit;
}
@Override
protected Void doInBackground(Void... params) {
API api = new API(context);
apiResponse = api.searchAccounts(query, limit);
apiResponse = api.searchAccounts(query, 10);
return null;
}

View File

@ -92,7 +92,8 @@ public class API {
UNSTATUS,
AUTHORIZE,
REJECT,
REPORT
REPORT,
REMOTE_FOLLOW
}
public API(Context context) {

View File

@ -0,0 +1,176 @@
package fr.gouv.etalab.mastodon.drawers;
/* Copyright 2017 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.support.design.widget.FloatingActionButton;
import android.text.Html;
import android.text.util.Linkify;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
import java.io.File;
import java.util.List;
import fr.gouv.etalab.mastodon.asynctasks.PostActionAsyncTask;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.client.Entities.Error;
import fr.gouv.etalab.mastodon.client.PatchBaseImageDownloader;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface;
import mastodon.etalab.gouv.fr.mastodon.R;
/**
* Created by Thomas on 22/08/2017.
* Adapter for accounts from web
*/
public class AccountSearchWebAdapter extends BaseAdapter implements OnPostActionInterface {
private List<Account> accounts;
private LayoutInflater layoutInflater;
private Context context;
private ViewHolder holder;
public AccountSearchWebAdapter(Context context, List<Account> accounts){
this.context = context;
this.accounts = accounts;
layoutInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return accounts.size();
}
@Override
public Object getItem(int position) {
return accounts.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ImageLoader imageLoader = ImageLoader.getInstance();
File cacheDir = new File(context.getCacheDir(), context.getString(R.string.app_name));
ImageLoaderConfiguration configImg = new ImageLoaderConfiguration.Builder(context)
.imageDownloader(new PatchBaseImageDownloader(context))
.threadPoolSize(5)
.threadPriority(Thread.MIN_PRIORITY + 3)
.denyCacheImageMultipleSizesInMemory()
.diskCache(new UnlimitedDiskCache(cacheDir))
.build();
if( !imageLoader.isInited())
imageLoader.init(configImg);
DisplayImageOptions options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
final Account account = accounts.get(position);
if (convertView == null) {
convertView = layoutInflater.inflate(R.layout.drawer_account_search_html, parent, false);
holder = new ViewHolder();
holder.account_pp = (ImageView) convertView.findViewById(R.id.account_pp);
holder.account_dn = (TextView) convertView.findViewById(R.id.account_dn);
holder.account_ds = (TextView) convertView.findViewById(R.id.account_ds);
holder.account_sc = (TextView) convertView.findViewById(R.id.account_sc);
holder.account_fgc = (TextView) convertView.findViewById(R.id.account_fgc);
holder.account_frc = (TextView) convertView.findViewById(R.id.account_frc);
holder.account_follow = (FloatingActionButton) convertView.findViewById(R.id.account_follow);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
holder.account_ds.setText(Html.fromHtml(account.getNote(), Html.FROM_HTML_MODE_LEGACY));
holder.account_dn.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getDisplay_name(), true), Html.FROM_HTML_MODE_LEGACY));
}else {
//noinspection deprecation
holder.account_ds.setText(Html.fromHtml(account.getNote()));
holder.account_dn.setText(Html.fromHtml(Helper.shortnameToUnicode(account.getDisplay_name(), true)));
}
holder.account_ds.setAutoLinkMask(Linkify.WEB_URLS);
holder.account_sc.setText(String.valueOf(account.getStatuses_count()));
holder.account_fgc.setText(String.valueOf(account.getFollowing_count()));
holder.account_frc.setText(String.valueOf(account.getFollowers_count()));
//Profile picture
imageLoader.displayImage(account.getAvatar(), holder.account_pp, options);
holder.account_follow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.account_follow.setEnabled(false);
new PostActionAsyncTask(context, API.StatusAction.REMOTE_FOLLOW, null, AccountSearchWebAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
return convertView;
}
@Override
public void onPostAction(int statusCode, API.StatusAction statusAction, String userId, Error error) {
if( error != null){
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
if( show_error_messages)
Toast.makeText(context, error.getError(),Toast.LENGTH_LONG).show();
holder.account_follow.setEnabled(true);
return;
}
holder.account_follow.setVisibility(View.GONE);
Toast.makeText(context, R.string.toast_follow, Toast.LENGTH_LONG).show();
}
private class ViewHolder {
ImageView account_pp;
TextView account_dn;
TextView account_ds;
TextView account_sc;
TextView account_fgc;
TextView account_frc;
FloatingActionButton account_follow;
}
}

View File

@ -0,0 +1,24 @@
/* Copyright 2017 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.interfaces;
/**
* Created by Thomas on 22/08/2017.
* Interface for retrieving a remote account
*/
public interface OnRetrieveRemoteAccountInterface {
void onRetrieveRemoteAccount(boolean error, String name, String avatar, String bio, int statusCount, int followingCount, int followersCount);
}

View File

@ -73,6 +73,19 @@
android:scrollbars="none"
android:divider="@null"
/>
<TextView
android:visibility="gone"
android:layout_marginTop="30dp"
android:id="@+id/rf_no_result"
android:padding="10dp"
android:gravity="center"
android:textSize="25sp"
android:layout_gravity="center"
android:textStyle="italic|bold"
android:typeface="serif"
android:text="@string/no_accounts"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loader"

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 Thomas Schneider
This file is a part of Mastalab
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with Mastalab; if not,
see <http://www.gnu.org/licenses>.
-->
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
style="?attr/cardStyle"
android:layout_marginTop="10dp"
card_view:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/main_container"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_gravity="center_horizontal"
android:id="@+id/account_pp"
android:layout_width="60dp"
android:layout_height="60dp"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/account_dn"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<android.support.design.widget.FloatingActionButton
android:layout_gravity="center"
app:fabSize="mini"
android:id="@+id/account_follow"
android:textAllCaps="false"
android:gravity="center"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_width="40dp"
android:layout_height="40dp"
/>
</LinearLayout>
<TextView
android:animateLayoutChanges="true"
android:id="@+id/account_ds"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:text="@string/toots"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/account_sc"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:maxLines="1"
android:text="@string/following"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/account_fgc"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:maxLines="1"
android:text="@string/followers"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/account_frc"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>