Merged in develop (pull request #11)
This commit is contained in:
commit
76075bced1
|
@ -7,8 +7,8 @@ android {
|
|||
applicationId "fr.gouv.etalab.mastodon"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 13
|
||||
versionName "1.1.6"
|
||||
versionCode 14
|
||||
versionName "1.1.7"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -80,6 +80,11 @@
|
|||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
/>
|
||||
<activity android:name="fr.gouv.etalab.mastodon.activities.PrivacyActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
/>
|
||||
<activity android:name="fr.gouv.etalab.mastodon.activities.TootActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:fitsSystemWindows="true"
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.content.Intent;
|
|||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
|
@ -25,6 +26,13 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveDeveloperAccountsAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearcAccountshInterface;
|
||||
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||
|
||||
|
||||
|
@ -33,7 +41,10 @@ import mastodon.etalab.gouv.fr.mastodon.R;
|
|||
* About activity
|
||||
*/
|
||||
|
||||
public class AboutActivity extends AppCompatActivity {
|
||||
public class AboutActivity extends AppCompatActivity implements OnRetrieveSearcAccountshInterface {
|
||||
|
||||
private Button about_developer;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -48,7 +59,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||
about_version.setText(getResources().getString(R.string.about_vesrion, version));
|
||||
} catch (PackageManager.NameNotFoundException ignored) {}
|
||||
|
||||
Button about_developer = (Button) findViewById(R.id.about_developer);
|
||||
about_developer = (Button) findViewById(R.id.about_developer);
|
||||
Button about_code = (Button) findViewById(R.id.about_code);
|
||||
Button about_license = (Button) findViewById(R.id.about_license);
|
||||
|
||||
|
@ -59,14 +70,15 @@ public class AboutActivity extends AppCompatActivity {
|
|||
startActivity(browserIntent);
|
||||
}
|
||||
});
|
||||
if(Helper.isLoggedIn(getApplicationContext())) {
|
||||
about_developer.setEnabled(false);
|
||||
new RetrieveDeveloperAccountsAsyncTask(getApplicationContext(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
about_developer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(AboutActivity.this, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", "2416");
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://mastodon.etalab.gouv.fr/@tschneider"));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
});
|
||||
about_license.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -89,4 +101,23 @@ public class AboutActivity extends AppCompatActivity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveSearchAccounts(APIResponse apiResponse) {
|
||||
about_developer.setEnabled(true);
|
||||
final List<Account> accounts = apiResponse.getAccounts();
|
||||
if( accounts != null && accounts.size() > 0 && accounts.get(0) != null) {
|
||||
about_developer.setOnClickListener(null);
|
||||
about_developer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(AboutActivity.this, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("accountId", accounts.get(0).getId());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.os.AsyncTask;
|
|||
import android.os.Bundle;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
|
@ -33,7 +32,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
|
@ -139,17 +138,18 @@ public class HashTagActivity extends AppCompatActivity implements OnRetrieveFeed
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveFeeds(List<Status> statuses, Error error) {
|
||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if( error != null){
|
||||
if( apiResponse.getError() != null){
|
||||
final SharedPreferences sharedpreferences = 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(getApplicationContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getApplicationContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Status> statuses = apiResponse.getStatuses();
|
||||
if( firstLoad && (statuses == null || statuses.size() == 0))
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
else
|
||||
|
|
|
@ -14,20 +14,18 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Paint;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -87,6 +85,19 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
//For other instances
|
||||
TextView other_instance = (TextView) findViewById(R.id.other_instance);
|
||||
other_instance.setPaintFlags(other_instance.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
other_instance.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(LoginActivity.this, LoginActivity.class);
|
||||
intent.putExtra("addAccount", true);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
Bundle b = getIntent().getExtras();
|
||||
if(b != null)
|
||||
addAccount = b.getBoolean("addAccount", false);
|
||||
|
@ -106,6 +117,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
}
|
||||
if( addAccount)
|
||||
other_instance.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -199,7 +212,9 @@ public class LoginActivity extends AppCompatActivity {
|
|||
requestParams.add("scope"," read write follow");
|
||||
client.setUserAgent(USER_AGENT);
|
||||
try {
|
||||
client.setSSLSocketFactory(new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore()));
|
||||
MastalabSSLSocketFactory mastalabSSLSocketFactory = new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore());
|
||||
mastalabSSLSocketFactory.setHostnameVerifier(MastalabSSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
client.setSSLSocketFactory(mastalabSSLSocketFactory);
|
||||
client.post("https://" + instance+ "/oauth/token", requestParams, new AsyncHttpResponseHandler() {
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
|
||||
|
@ -236,6 +251,29 @@ public class LoginActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main_login, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_about) {
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
startActivity(intent);
|
||||
}else if(id == R.id.action_privacy){
|
||||
Intent intent = new Intent(getApplicationContext(), PrivacyActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
|
@ -282,6 +282,9 @@ public class MainActivity extends AppCompatActivity
|
|||
}else if(id == R.id.action_about){
|
||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||
startActivity(intent);
|
||||
}else if(id == R.id.action_privacy){
|
||||
Intent intent = new Intent(getApplicationContext(), PrivacyActivity.class);
|
||||
startActivity(intent);
|
||||
}else if(id == R.id.action_search){
|
||||
|
||||
if( toolbar.getChildCount() > 0){
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* Copyright 2017 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Mastodon Etalab for mastodon.etalab.gouv.fr
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Mastodon Etalab 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 Thomas Schneider; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.activities;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 03/06/2017.
|
||||
* Privacy activity
|
||||
*/
|
||||
|
||||
public class PrivacyActivity extends AppCompatActivity {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if( getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.activity_privacy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -105,9 +105,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_show_account);
|
||||
|
||||
|
||||
|
||||
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
statuses = new ArrayList<>();
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveContextAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Context;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
|
@ -80,14 +81,15 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveFeeds(List<Status> statuses, Error error) {
|
||||
if( error != null){
|
||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||
if( apiResponse.getError() != null){
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
boolean show_error_messages = sharedpreferences.getBoolean(Helper.SET_SHOW_ERROR_MESSAGES, true);
|
||||
if( show_error_messages)
|
||||
Toast.makeText(getApplicationContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getApplicationContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Status> statuses = apiResponse.getStatuses();
|
||||
if( statuses != null && statuses.size() > 0 ){
|
||||
initialStatus = statuses.get(0);
|
||||
new RetrieveContextAsyncTask(getApplicationContext(), initialStatus.getId(), ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
|
|
@ -61,6 +61,7 @@ import fr.gouv.etalab.mastodon.asynctasks.PostActionAsyncTask;
|
|||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveSearchAccountsAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.UploadActionAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Attachment;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
|
@ -539,14 +540,15 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
|||
|
||||
|
||||
@Override
|
||||
public void onRetrieveSearchAccounts(List<Account> accounts, Error error) {
|
||||
if( error != null){
|
||||
public void onRetrieveSearchAccounts(APIResponse apiResponse) {
|
||||
if( apiResponse.getError() != null){
|
||||
final SharedPreferences sharedpreferences = 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(getApplicationContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getApplicationContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Account> accounts = apiResponse.getAccounts();
|
||||
if( accounts != null && accounts.size() > 0){
|
||||
AccountsSearchAdapter accountsListAdapter = new AccountsSearchAdapter(TootActivity.this, accounts);
|
||||
toot_lv_accounts.setAdapter(accountsListAdapter);
|
||||
|
|
|
@ -16,11 +16,8 @@ package fr.gouv.etalab.mastodon.asynctasks;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAccountsInterface;
|
||||
|
||||
|
||||
|
@ -33,11 +30,10 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
private Context context;
|
||||
private Type action;
|
||||
private List<Account> accounts;
|
||||
private APIResponse apiResponse;
|
||||
private String max_id;
|
||||
private OnRetrieveAccountsInterface listener;
|
||||
private String targetedId;
|
||||
private API api;
|
||||
|
||||
public enum Type{
|
||||
BLOCKED,
|
||||
|
@ -64,19 +60,19 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
|
||||
api = new API(context);
|
||||
API api = new API(context);
|
||||
switch (action){
|
||||
case BLOCKED:
|
||||
accounts = api.getBlocks(max_id);
|
||||
apiResponse = api.getBlocks(max_id);
|
||||
break;
|
||||
case MUTED:
|
||||
accounts = api.getMuted(max_id);
|
||||
apiResponse = api.getMuted(max_id);
|
||||
break;
|
||||
case FOLLOWING:
|
||||
accounts = api.getFollowing(targetedId, max_id);
|
||||
apiResponse = api.getFollowing(targetedId, max_id);
|
||||
break;
|
||||
case FOLLOWERS:
|
||||
accounts = api.getFollowers(targetedId, max_id);
|
||||
apiResponse = api.getFollowers(targetedId, max_id);
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
|
@ -84,7 +80,7 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onRetrieveAccounts(accounts, api.getError());
|
||||
listener.onRetrieveAccounts(apiResponse);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* Copyright 2017 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Mastodon Etalab for mastodon.etalab.gouv.fr
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Mastodon Etalab 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 Thomas Schneider; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.asynctasks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearcAccountshInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 03/06/2017.
|
||||
* Retrieves developer from search (ie: starting with @ when writing a toot)
|
||||
*/
|
||||
|
||||
public class RetrieveDeveloperAccountsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private Context context;
|
||||
private APIResponse apiResponse;
|
||||
private OnRetrieveSearcAccountshInterface listener;
|
||||
private API api;
|
||||
|
||||
public RetrieveDeveloperAccountsAsyncTask(Context context, OnRetrieveSearcAccountshInterface onRetrieveSearcAccountshInterface){
|
||||
this.context = context;
|
||||
this.listener = onRetrieveSearcAccountshInterface;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
api = new API(context);
|
||||
apiResponse = api.searchDeveloper();
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onRetrieveSearchAccounts(apiResponse);
|
||||
}
|
||||
|
||||
}
|
|
@ -16,12 +16,8 @@ package fr.gouv.etalab.mastodon.asynctasks;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
|
||||
|
||||
|
||||
|
@ -34,13 +30,11 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
private Context context;
|
||||
private Type action;
|
||||
private List<fr.gouv.etalab.mastodon.client.Entities.Status> statuses;
|
||||
private APIResponse apiResponse;
|
||||
private String max_id;
|
||||
private OnRetrieveFeedsInterface listener;
|
||||
private String targetedID;
|
||||
private fr.gouv.etalab.mastodon.client.Entities.Status status;
|
||||
private String tag;
|
||||
private API api;
|
||||
|
||||
public enum Type{
|
||||
HOME,
|
||||
|
@ -79,28 +73,28 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
|
||||
api = new API(context);
|
||||
API api = new API(context);
|
||||
switch (action){
|
||||
case HOME:
|
||||
statuses = api.getHomeTimeline(max_id);
|
||||
apiResponse = api.getHomeTimeline(max_id);
|
||||
break;
|
||||
case LOCAL:
|
||||
statuses = api.getPublicTimeline(true, max_id);
|
||||
apiResponse = api.getPublicTimeline(true, max_id);
|
||||
break;
|
||||
case PUBLIC:
|
||||
statuses = api.getPublicTimeline(false, max_id);
|
||||
apiResponse = api.getPublicTimeline(false, max_id);
|
||||
break;
|
||||
case FAVOURITES:
|
||||
statuses = api.getFavourites(max_id);
|
||||
apiResponse = api.getFavourites(max_id);
|
||||
break;
|
||||
case USER:
|
||||
statuses = api.getStatus(targetedID, max_id);
|
||||
apiResponse = api.getStatus(targetedID, max_id);
|
||||
break;
|
||||
case ONESTATUS:
|
||||
statuses = api.getStatusbyId(targetedID);
|
||||
apiResponse = api.getStatusbyId(targetedID);
|
||||
break;
|
||||
case TAG:
|
||||
statuses = api.getPublicTimelineTag(tag, false, max_id);
|
||||
apiResponse = api.getPublicTimelineTag(tag, false, max_id);
|
||||
break;
|
||||
case HASHTAG:
|
||||
break;
|
||||
|
@ -110,7 +104,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onRetrieveFeeds(statuses, api.getError());
|
||||
listener.onRetrieveFeeds(apiResponse);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,10 +16,8 @@ package fr.gouv.etalab.mastodon.asynctasks;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveHomeTimelineServiceInterface;
|
||||
|
||||
/**
|
||||
|
@ -30,13 +28,12 @@ import fr.gouv.etalab.mastodon.interfaces.OnRetrieveHomeTimelineServiceInterface
|
|||
public class RetrieveHomeTimelineServiceAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private Context context;
|
||||
private List<fr.gouv.etalab.mastodon.client.Entities.Status> statuses;
|
||||
private APIResponse apiResponse;
|
||||
private String since_id;
|
||||
private String acct, userId;
|
||||
private OnRetrieveHomeTimelineServiceInterface listener;
|
||||
private String instance;
|
||||
private String token;
|
||||
private API api;
|
||||
|
||||
public RetrieveHomeTimelineServiceAsyncTask(Context context, String instance, String token, String since_id, String acct, String userId, OnRetrieveHomeTimelineServiceInterface onRetrieveHomeTimelineServiceInterface){
|
||||
this.context = context;
|
||||
|
@ -50,14 +47,14 @@ public class RetrieveHomeTimelineServiceAsyncTask extends AsyncTask<Void, Void,
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
api = new API(context, instance, token);
|
||||
statuses = api.getHomeTimelineSinceId(since_id);
|
||||
API api = new API(context, instance, token);
|
||||
apiResponse = api.getHomeTimelineSinceId(since_id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onRetrieveHomeTimelineService(statuses, acct, userId, api.getError());
|
||||
listener.onRetrieveHomeTimelineService(apiResponse, acct, userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,13 +16,9 @@ package fr.gouv.etalab.mastodon.asynctasks;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveNotificationsInterface;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Notification;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -33,13 +29,12 @@ import fr.gouv.etalab.mastodon.client.Entities.Notification;
|
|||
public class RetrieveNotificationsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private Context context;
|
||||
private List<Notification> notifications;
|
||||
private APIResponse apiResponse;
|
||||
private String max_id;
|
||||
private String acct, userId;
|
||||
private OnRetrieveNotificationsInterface listener;
|
||||
private String instance;
|
||||
private String token;
|
||||
private API api;
|
||||
|
||||
|
||||
public RetrieveNotificationsAsyncTask(Context context, String instance, String token, String max_id, String acct, String userId, OnRetrieveNotificationsInterface onRetrieveNotificationsInterface){
|
||||
|
@ -55,17 +50,17 @@ public class RetrieveNotificationsAsyncTask extends AsyncTask<Void, Void, Void>
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
|
||||
api = new API(context, instance, token);
|
||||
API api = new API(context, instance, token);
|
||||
if( acct == null)
|
||||
notifications = api.getNotifications(max_id);
|
||||
apiResponse = api.getNotifications(max_id);
|
||||
else
|
||||
notifications = api.getNotificationsSince(max_id);
|
||||
apiResponse = api.getNotificationsSince(max_id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onRetrieveNotifications(notifications, acct, userId, api.getError());
|
||||
listener.onRetrieveNotifications(apiResponse, acct, userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,8 @@ package fr.gouv.etalab.mastodon.asynctasks;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearcAccountshInterface;
|
||||
|
||||
|
||||
|
@ -33,9 +30,8 @@ public class RetrieveSearchAccountsAsyncTask extends AsyncTask<Void, Void, Void>
|
|||
|
||||
private Context context;
|
||||
private String query;
|
||||
private List<Account> accounts;
|
||||
private APIResponse apiResponse;
|
||||
private OnRetrieveSearcAccountshInterface listener;
|
||||
private API api;
|
||||
|
||||
public RetrieveSearchAccountsAsyncTask(Context context, String query, OnRetrieveSearcAccountshInterface onRetrieveSearcAccountshInterface){
|
||||
this.context = context;
|
||||
|
@ -46,14 +42,14 @@ public class RetrieveSearchAccountsAsyncTask extends AsyncTask<Void, Void, Void>
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
api = new API(context);
|
||||
accounts = api.searchAccounts(query);
|
||||
API api = new API(context);
|
||||
apiResponse = api.searchAccounts(query);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onRetrieveSearchAccounts(accounts, api.getError());
|
||||
listener.onRetrieveSearchAccounts(apiResponse);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
|
|
|
@ -35,7 +35,6 @@ public class UploadActionAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
private OnRetrieveAttachmentInterface listener;
|
||||
private Attachment attachment;
|
||||
private InputStream inputStream;
|
||||
private fr.gouv.etalab.mastodon.client.Entities.Status status;
|
||||
private API api;
|
||||
|
||||
public UploadActionAsyncTask(Context context, InputStream inputStream, OnRetrieveAttachmentInterface onRetrieveAttachmentInterface){
|
||||
|
|
|
@ -35,6 +35,8 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.security.UnrecoverableKeyException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import cz.msebera.android.httpclient.Header;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.*;
|
||||
|
@ -70,7 +72,8 @@ public class API {
|
|||
private int actionCode;
|
||||
private String instance;
|
||||
private String prefKeyOauthTokenT;
|
||||
private Error errorApi = null;
|
||||
private APIResponse apiResponse;
|
||||
private Error APIError;
|
||||
|
||||
public enum StatusAction{
|
||||
FAVOURITE,
|
||||
|
@ -96,6 +99,8 @@ public class API {
|
|||
notificationPerPage = sharedpreferences.getInt(Helper.SET_NOTIFICATIONS_PER_PAGE, 40);
|
||||
this.instance = Helper.getLiveInstance(context);
|
||||
this.prefKeyOauthTokenT = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||
apiResponse = new APIResponse();
|
||||
APIError = null;
|
||||
}
|
||||
|
||||
public API(Context context, String instance, String token) {
|
||||
|
@ -113,7 +118,8 @@ public class API {
|
|||
this.prefKeyOauthTokenT = token;
|
||||
else
|
||||
this.prefKeyOauthTokenT = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||
|
||||
apiResponse = new APIResponse();
|
||||
APIError = null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,7 +217,7 @@ public class API {
|
|||
* @param accountId String Id of the account
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getStatus(String accountId) {
|
||||
public APIResponse getStatus(String accountId) {
|
||||
return getStatus(accountId, false, false, null, null, tootPerPage);
|
||||
}
|
||||
|
||||
|
@ -222,7 +228,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getStatus(String accountId, String max_id) {
|
||||
public APIResponse getStatus(String accountId, String max_id) {
|
||||
return getStatus(accountId, false, false, max_id, null, tootPerPage);
|
||||
}
|
||||
|
||||
|
@ -237,7 +243,7 @@ public class API {
|
|||
* @param limit int limit - max value 40
|
||||
* @return List<Status>
|
||||
*/
|
||||
private List<Status> getStatus(String accountId, boolean onlyMedia,
|
||||
private APIResponse getStatus(String accountId, boolean onlyMedia,
|
||||
boolean exclude_replies, String max_id, String since_id, int limit) {
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
|
@ -258,9 +264,13 @@ public class API {
|
|||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
Status status = parseStatuses(response);
|
||||
statuses.add(status);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
statuses = parseStatuses(response);
|
||||
|
||||
}
|
||||
|
@ -269,7 +279,8 @@ public class API {
|
|||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return statuses;
|
||||
apiResponse.setStatuses(statuses);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
|
||||
|
@ -279,16 +290,20 @@ public class API {
|
|||
* @param statusId String Id of the status
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getStatusbyId(String statusId) {
|
||||
public APIResponse getStatusbyId(String statusId) {
|
||||
statuses = new ArrayList<>();
|
||||
get(String.format("/statuses/%s", statusId), null, new JsonHttpResponseHandler() {
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
Status status = parseStatuses(response);
|
||||
statuses.add(status);
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
statuses = parseStatuses(response);
|
||||
}
|
||||
@Override
|
||||
|
@ -296,7 +311,8 @@ public class API {
|
|||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return statuses;
|
||||
apiResponse.setStatuses(statuses);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -327,7 +343,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getHomeTimeline( String max_id) {
|
||||
public APIResponse getHomeTimeline( String max_id) {
|
||||
return getHomeTimeline(max_id, null, tootPerPage);
|
||||
}
|
||||
|
||||
|
@ -335,7 +351,7 @@ public class API {
|
|||
* Retrieves home timeline for the account since an Id value *synchronously*
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getHomeTimelineSinceId(String since_id) {
|
||||
public APIResponse getHomeTimelineSinceId(String since_id) {
|
||||
return getHomeTimeline(null, since_id, tootPerPage);
|
||||
}
|
||||
|
||||
|
@ -346,7 +362,7 @@ public class API {
|
|||
* @param limit int limit - max value 40
|
||||
* @return List<Status>
|
||||
*/
|
||||
private List<Status> getHomeTimeline(String max_id, String since_id, int limit) {
|
||||
private APIResponse getHomeTimeline(String max_id, String since_id, int limit) {
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
if (max_id != null)
|
||||
|
@ -363,17 +379,22 @@ public class API {
|
|||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
Status status = parseStatuses(response);
|
||||
statuses.add(status);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
statuses = parseStatuses(response);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
|
||||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return statuses;
|
||||
apiResponse.setStatuses(statuses);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
|
||||
|
@ -383,7 +404,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getPublicTimeline(boolean local, String max_id){
|
||||
public APIResponse getPublicTimeline(boolean local, String max_id){
|
||||
return getPublicTimeline(local, max_id, null, tootPerPage);
|
||||
}
|
||||
/**
|
||||
|
@ -394,7 +415,7 @@ public class API {
|
|||
* @param limit int limit - max value 40
|
||||
* @return List<Status>
|
||||
*/
|
||||
private List<Status> getPublicTimeline(boolean local, String max_id, String since_id, int limit){
|
||||
private APIResponse getPublicTimeline(boolean local, String max_id, String since_id, int limit){
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
if( local)
|
||||
|
@ -413,17 +434,22 @@ public class API {
|
|||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
Status status = parseStatuses(response);
|
||||
statuses.add(status);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
statuses = parseStatuses(response);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
|
||||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return statuses;
|
||||
apiResponse.setStatuses(statuses);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -433,7 +459,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getPublicTimelineTag(String tag, boolean local, String max_id){
|
||||
public APIResponse getPublicTimelineTag(String tag, boolean local, String max_id){
|
||||
return getPublicTimelineTag(tag, local, max_id, null, tootPerPage);
|
||||
}
|
||||
/**
|
||||
|
@ -445,7 +471,7 @@ public class API {
|
|||
* @param limit int limit - max value 40
|
||||
* @return List<Status>
|
||||
*/
|
||||
private List<Status> getPublicTimelineTag(String tag, boolean local, String max_id, String since_id, int limit){
|
||||
private APIResponse getPublicTimelineTag(String tag, boolean local, String max_id, String since_id, int limit){
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
if( local)
|
||||
|
@ -465,17 +491,22 @@ public class API {
|
|||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
Status status = parseStatuses(response);
|
||||
statuses.add(status);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
statuses = parseStatuses(response);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
|
||||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return statuses;
|
||||
apiResponse.setStatuses(statuses);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
|
||||
|
@ -484,7 +515,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Account> getMuted(String max_id){
|
||||
public APIResponse getMuted(String max_id){
|
||||
return getAccounts("/mutes", max_id, null, accountPerPage);
|
||||
}
|
||||
|
||||
|
@ -493,7 +524,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Account> getBlocks(String max_id){
|
||||
public APIResponse getBlocks(String max_id){
|
||||
return getAccounts("/blocks", max_id, null, accountPerPage);
|
||||
}
|
||||
|
||||
|
@ -504,7 +535,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Account> getFollowing(String targetedId, String max_id){
|
||||
public APIResponse getFollowing(String targetedId, String max_id){
|
||||
return getAccounts(String.format("/accounts/%s/following",targetedId),max_id, null, accountPerPage);
|
||||
}
|
||||
|
||||
|
@ -514,7 +545,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Account> getFollowers(String targetedId, String max_id){
|
||||
public APIResponse getFollowers(String targetedId, String max_id){
|
||||
return getAccounts(String.format("/accounts/%s/followers",targetedId),max_id, null, accountPerPage);
|
||||
}
|
||||
|
||||
|
@ -525,7 +556,7 @@ public class API {
|
|||
* @param limit int limit - max value 40
|
||||
* @return List<Status>
|
||||
*/
|
||||
private List<Account> getAccounts(String action, String max_id, String since_id, int limit){
|
||||
private APIResponse getAccounts(String action, String max_id, String since_id, int limit){
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
if( max_id != null )
|
||||
|
@ -540,11 +571,15 @@ public class API {
|
|||
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
Account account = parseAccountResponse(response);
|
||||
accounts.add(account);
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
accounts = parseAccountResponse(response);
|
||||
}
|
||||
@Override
|
||||
|
@ -552,7 +587,8 @@ public class API {
|
|||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return accounts;
|
||||
apiResponse.setAccounts(accounts);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
|
||||
|
@ -561,7 +597,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Status>
|
||||
*/
|
||||
public List<Status> getFavourites(String max_id){
|
||||
public APIResponse getFavourites(String max_id){
|
||||
return getFavourites(max_id, null, tootPerPage);
|
||||
}
|
||||
/**
|
||||
|
@ -571,7 +607,7 @@ public class API {
|
|||
* @param limit int limit - max value 40
|
||||
* @return List<Status>
|
||||
*/
|
||||
private List<Status> getFavourites(String max_id, String since_id, int limit){
|
||||
private APIResponse getFavourites(String max_id, String since_id, int limit){
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
if( max_id != null )
|
||||
|
@ -588,17 +624,22 @@ public class API {
|
|||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
Status status = parseStatuses(response);
|
||||
statuses.add(status);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
statuses = parseStatuses(response);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
|
||||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return statuses;
|
||||
apiResponse.setStatuses(statuses);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
|
||||
|
@ -749,7 +790,7 @@ public class API {
|
|||
* @param since_id String since max
|
||||
* @return List<Notification>
|
||||
*/
|
||||
public List<Notification> getNotificationsSince(String since_id){
|
||||
public APIResponse getNotificationsSince(String since_id){
|
||||
return getNotifications(null, since_id, notificationPerPage);
|
||||
}
|
||||
|
||||
|
@ -758,7 +799,7 @@ public class API {
|
|||
* @param max_id String id max
|
||||
* @return List<Notification>
|
||||
*/
|
||||
public List<Notification> getNotifications(String max_id){
|
||||
public APIResponse getNotifications(String max_id){
|
||||
return getNotifications(max_id, null, notificationPerPage);
|
||||
}
|
||||
/**
|
||||
|
@ -768,7 +809,7 @@ public class API {
|
|||
* @param limit int limit - max value 40
|
||||
* @return List<Notification>
|
||||
*/
|
||||
private List<Notification> getNotifications(String max_id, String since_id, int limit){
|
||||
private APIResponse getNotifications(String max_id, String since_id, int limit){
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
if( max_id != null )
|
||||
|
@ -785,17 +826,22 @@ public class API {
|
|||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
Notification notification = parseNotificationResponse(response);
|
||||
notifications.add(notification);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
notifications = parseNotificationResponse(response);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
|
||||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return notifications;
|
||||
apiResponse.setNotifications(notifications);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
public Attachment uploadMedia(InputStream inputStream){
|
||||
|
@ -850,13 +896,44 @@ public class API {
|
|||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves Developer account when searching (ie: via @...) *synchronously*
|
||||
*
|
||||
* @return List<Account>
|
||||
*/
|
||||
public APIResponse searchDeveloper() {
|
||||
RequestParams params = new RequestParams();
|
||||
params.add("q", "tschneider");
|
||||
get("/accounts/search", params, new JsonHttpResponseHandler() {
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
|
||||
accounts = new ArrayList<>();
|
||||
account = parseAccountResponse(response);
|
||||
accounts.add(account);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
accounts = parseDeveloperResponse(response);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
|
||||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
apiResponse.setAccounts(accounts);
|
||||
return apiResponse;
|
||||
}
|
||||
/**
|
||||
* Retrieves Accounts when searching (ie: via @...) *synchronously*
|
||||
*
|
||||
* @param query String search
|
||||
* @return List<Account>
|
||||
*/
|
||||
public List<Account> searchAccounts(String query) {
|
||||
public APIResponse searchAccounts(String query) {
|
||||
|
||||
RequestParams params = new RequestParams();
|
||||
params.add("q", query);
|
||||
|
@ -869,18 +946,23 @@ public class API {
|
|||
accounts = new ArrayList<>();
|
||||
account = parseAccountResponse(response);
|
||||
accounts.add(account);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
|
||||
accounts = parseAccountResponse(response);
|
||||
apiResponse.setSince_id(findSinceId(headers));
|
||||
apiResponse.setMax_id(findMaxId(headers));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, Throwable error, JSONObject response){
|
||||
setError(statusCode, error);
|
||||
}
|
||||
});
|
||||
return accounts;
|
||||
apiResponse.setAccounts(accounts);
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -926,60 +1008,10 @@ public class API {
|
|||
try {
|
||||
int i = 0;
|
||||
while (i < jsonArray.length() ){
|
||||
Status status = new Status();
|
||||
|
||||
JSONObject resobj = jsonArray.getJSONObject(i);
|
||||
status.setId(resobj.get("id").toString());
|
||||
status.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString()));
|
||||
status.setIn_reply_to_id(resobj.get("in_reply_to_id").toString());
|
||||
status.setIn_reply_to_account_id(resobj.get("in_reply_to_account_id").toString());
|
||||
status.setSensitive(Boolean.getBoolean(resobj.get("sensitive").toString()));
|
||||
status.setSpoiler_text(resobj.get("spoiler_text").toString());
|
||||
status.setVisibility(resobj.get("visibility").toString());
|
||||
|
||||
//TODO: replace by the value
|
||||
status.setApplication(new Application());
|
||||
|
||||
JSONArray arrayAttachement = resobj.getJSONArray("media_attachments");
|
||||
List<Attachment> attachments = new ArrayList<>();
|
||||
if( arrayAttachement != null){
|
||||
for(int j = 0 ; j < arrayAttachement.length() ; j++){
|
||||
JSONObject attObj = arrayAttachement.getJSONObject(j);
|
||||
Attachment attachment = new Attachment();
|
||||
attachment.setId(attObj.get("id").toString());
|
||||
attachment.setPreview_url(attObj.get("preview_url").toString());
|
||||
attachment.setRemote_url(attObj.get("remote_url").toString());
|
||||
attachment.setType(attObj.get("type").toString());
|
||||
attachment.setText_url(attObj.get("text_url").toString());
|
||||
attachment.setUrl(attObj.get("url").toString());
|
||||
attachments.add(attachment);
|
||||
}
|
||||
}
|
||||
List<Mention> mentions = new ArrayList<>();
|
||||
JSONArray arrayMention = resobj.getJSONArray("mentions");
|
||||
if( arrayMention != null){
|
||||
for(int j = 0 ; j < arrayMention.length() ; j++){
|
||||
JSONObject menObj = arrayMention.getJSONObject(j);
|
||||
Mention mention = new Mention();
|
||||
mention.setId(menObj.get("id").toString());
|
||||
mention.setUrl(menObj.get("url").toString());
|
||||
mention.setAcct(menObj.get("acct").toString());
|
||||
mention.setUsername(menObj.get("username").toString());
|
||||
mentions.add(mention);
|
||||
}
|
||||
}
|
||||
status.setMedia_attachments(attachments);
|
||||
status.setMentions(mentions);
|
||||
status.setAccount(parseAccountResponse(resobj.getJSONObject("account")));
|
||||
status.setContent(resobj.get("content").toString());
|
||||
status.setFavourites_count(Integer.valueOf(resobj.get("favourites_count").toString()));
|
||||
status.setReblogs_count(Integer.valueOf(resobj.get("reblogs_count").toString()));
|
||||
status.setReblogged(Boolean.valueOf(resobj.get("reblogged").toString()));
|
||||
status.setFavourited(Boolean.valueOf(resobj.get("favourited").toString()));
|
||||
try{
|
||||
status.setReblog(parseStatuses(resobj.getJSONObject("reblog")));
|
||||
}catch (Exception ignored){}
|
||||
Status status = parseStatuses(resobj);
|
||||
i++;
|
||||
|
||||
statuses.add(status);
|
||||
}
|
||||
|
||||
|
@ -1025,6 +1057,20 @@ public class API {
|
|||
}
|
||||
}
|
||||
status.setMedia_attachments(attachments);
|
||||
List<Mention> mentions = new ArrayList<>();
|
||||
JSONArray arrayMention = resobj.getJSONArray("mentions");
|
||||
if( arrayMention != null){
|
||||
for(int j = 0 ; j < arrayMention.length() ; j++){
|
||||
JSONObject menObj = arrayMention.getJSONObject(j);
|
||||
Mention mention = new Mention();
|
||||
mention.setId(menObj.get("id").toString());
|
||||
mention.setUrl(menObj.get("url").toString());
|
||||
mention.setAcct(menObj.get("acct").toString());
|
||||
mention.setUsername(menObj.get("username").toString());
|
||||
mentions.add(mention);
|
||||
}
|
||||
}
|
||||
status.setMentions(mentions);
|
||||
status.setAccount(parseAccountResponse(resobj.getJSONObject("account")));
|
||||
status.setContent(resobj.get("content").toString());
|
||||
status.setFavourites_count(Integer.valueOf(resobj.get("favourites_count").toString()));
|
||||
|
@ -1082,23 +1128,8 @@ public class API {
|
|||
try {
|
||||
int i = 0;
|
||||
while (i < jsonArray.length() ) {
|
||||
Account account = new Account();
|
||||
JSONObject resobj = jsonArray.getJSONObject(i);
|
||||
account.setId(resobj.get("id").toString());
|
||||
account.setUsername(resobj.get("username").toString());
|
||||
account.setAcct(resobj.get("acct").toString());
|
||||
account.setDisplay_name(resobj.get("display_name").toString());
|
||||
account.setLocked(Boolean.parseBoolean(resobj.get("locked").toString()));
|
||||
account.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString()));
|
||||
account.setFollowers_count(Integer.valueOf(resobj.get("followers_count").toString()));
|
||||
account.setFollowing_count(Integer.valueOf(resobj.get("following_count").toString()));
|
||||
account.setStatuses_count(Integer.valueOf(resobj.get("statuses_count").toString()));
|
||||
account.setNote(resobj.get("note").toString());
|
||||
account.setUrl(resobj.get("url").toString());
|
||||
account.setAvatar(resobj.get("avatar").toString());
|
||||
account.setAvatar_static(resobj.get("avatar_static").toString());
|
||||
account.setHeader(resobj.get("header").toString());
|
||||
account.setHeader_static(resobj.get("header_static").toString());
|
||||
Account account = parseAccountResponse(resobj);
|
||||
accounts.add(account);
|
||||
i++;
|
||||
}
|
||||
|
@ -1108,6 +1139,33 @@ public class API {
|
|||
return accounts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse json response for list of accounts which could contain the developer name
|
||||
* @param jsonArray JSONArray
|
||||
* @return List<Account>
|
||||
*/
|
||||
private List<Account> parseDeveloperResponse(JSONArray jsonArray){
|
||||
|
||||
List<Account> accounts = new ArrayList<>();
|
||||
try {
|
||||
int i = 0;
|
||||
Account account = null;
|
||||
while (i < jsonArray.length() ) {
|
||||
JSONObject resobj = jsonArray.getJSONObject(i);
|
||||
account = parseAccountResponse(resobj);
|
||||
if( account.getAcct().contains(Helper.INSTANCE))
|
||||
accounts.add(account);
|
||||
i++;
|
||||
}
|
||||
if( accounts.size() == 0)
|
||||
accounts.add(account);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return accounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse json response for the context
|
||||
* @param jsonObject JSONObject
|
||||
|
@ -1208,16 +1266,9 @@ public class API {
|
|||
try {
|
||||
int i = 0;
|
||||
while (i < jsonArray.length() ) {
|
||||
Notification notification = new Notification();
|
||||
|
||||
JSONObject resobj = jsonArray.getJSONObject(i);
|
||||
notification.setId(resobj.get("id").toString());
|
||||
notification.setType(resobj.get("type").toString());
|
||||
notification.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString()));
|
||||
notification.setAccount(parseAccountResponse(resobj.getJSONObject("account")));
|
||||
try{
|
||||
notification.setStatus(parseStatuses(resobj.getJSONObject("status")));
|
||||
}catch (Exception ignored){}
|
||||
notification.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString()));
|
||||
Notification notification = parseNotificationResponse(resobj);
|
||||
notifications.add(notification);
|
||||
i++;
|
||||
}
|
||||
|
@ -1236,8 +1287,9 @@ public class API {
|
|||
* @param error Throwable error
|
||||
*/
|
||||
private void setError(int statusCode, Throwable error){
|
||||
errorApi = new Error();
|
||||
errorApi.setError(statusCode + " - " + error.getMessage());
|
||||
APIError = new Error();
|
||||
APIError.setError(statusCode + " - " + error.getMessage());
|
||||
apiResponse.setError(APIError);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1246,7 +1298,9 @@ public class API {
|
|||
client.setConnectTimeout(10000); //10s timeout
|
||||
client.setUserAgent(USER_AGENT);
|
||||
client.addHeader("Authorization", "Bearer "+prefKeyOauthTokenT);
|
||||
client.setSSLSocketFactory(new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore()));
|
||||
MastalabSSLSocketFactory mastalabSSLSocketFactory = new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore());
|
||||
mastalabSSLSocketFactory.setHostnameVerifier(MastalabSSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
client.setSSLSocketFactory(mastalabSSLSocketFactory);
|
||||
client.get(getAbsoluteUrl(action), params, responseHandler);
|
||||
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException | UnrecoverableKeyException e) {
|
||||
|
@ -1261,7 +1315,9 @@ public class API {
|
|||
client.setConnectTimeout(10000); //10s timeout
|
||||
client.setUserAgent(USER_AGENT);
|
||||
client.addHeader("Authorization", "Bearer "+prefKeyOauthTokenT);
|
||||
client.setSSLSocketFactory(new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore()));
|
||||
MastalabSSLSocketFactory mastalabSSLSocketFactory = new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore());
|
||||
mastalabSSLSocketFactory.setHostnameVerifier(MastalabSSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
client.setSSLSocketFactory(mastalabSSLSocketFactory);
|
||||
client.post(getAbsoluteUrl(action), params, responseHandler);
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException | UnrecoverableKeyException e) {
|
||||
Toast.makeText(context, R.string.toast_error,Toast.LENGTH_LONG).show();
|
||||
|
@ -1274,7 +1330,9 @@ public class API {
|
|||
client.setConnectTimeout(10000); //10s timeout
|
||||
client.setUserAgent(USER_AGENT);
|
||||
client.addHeader("Authorization", "Bearer "+prefKeyOauthTokenT);
|
||||
client.setSSLSocketFactory(new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore()));
|
||||
MastalabSSLSocketFactory mastalabSSLSocketFactory = new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore());
|
||||
mastalabSSLSocketFactory.setHostnameVerifier(MastalabSSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
client.setSSLSocketFactory(mastalabSSLSocketFactory);
|
||||
client.delete(getAbsoluteUrl(action), params, responseHandler);
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException | UnrecoverableKeyException e) {
|
||||
Toast.makeText(context, R.string.toast_error,Toast.LENGTH_LONG).show();
|
||||
|
@ -1283,7 +1341,7 @@ public class API {
|
|||
}
|
||||
|
||||
public Error getError(){
|
||||
return errorApi;
|
||||
return APIError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1291,5 +1349,44 @@ public class API {
|
|||
return "https://" + this.instance + "/api/v1" + action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find max_id in header
|
||||
* @param headers Header[]
|
||||
* @return String max_id if presents
|
||||
*/
|
||||
private String findMaxId(Header[] headers){
|
||||
if( headers == null)
|
||||
return null;
|
||||
for(Header header: headers){
|
||||
if( header.toString().startsWith("Link: ")){
|
||||
Pattern pattern = Pattern.compile("max_id=([0-9]{1,}).*");
|
||||
Matcher matcher = pattern.matcher(header.toString());
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find since_id in header
|
||||
* @param headers Header[]
|
||||
* @return String since_id if presents
|
||||
*/
|
||||
private String findSinceId(Header[] headers){
|
||||
if( headers == null)
|
||||
return null;
|
||||
for(Header header: headers){
|
||||
if( header.toString().startsWith("Link: ")){
|
||||
Pattern pattern = Pattern.compile("since_id=([0-9]{1,}).*");
|
||||
Matcher matcher = pattern.matcher(header.toString());
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
package fr.gouv.etalab.mastodon.client;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.Entities.*;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 03/06/2017.
|
||||
* Hydrate response from the API
|
||||
*/
|
||||
|
||||
public class APIResponse {
|
||||
|
||||
private List<Account> accounts = null;
|
||||
private List<Status> statuses = null;
|
||||
private List<Context> contexts = null;
|
||||
private List<Notification> notifications = null;
|
||||
private fr.gouv.etalab.mastodon.client.Entities.Error error = null;
|
||||
private String since_id, max_id;
|
||||
|
||||
public List<Account> getAccounts() {
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public void setAccounts(List<Account> accounts) {
|
||||
this.accounts = accounts;
|
||||
}
|
||||
|
||||
public List<Status> getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
public void setStatuses(List<Status> statuses) {
|
||||
this.statuses = statuses;
|
||||
}
|
||||
|
||||
public List<Context> getContexts() {
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public void setContexts(List<Context> contexts) {
|
||||
this.contexts = contexts;
|
||||
}
|
||||
|
||||
public List<Notification> getNotifications() {
|
||||
return notifications;
|
||||
}
|
||||
|
||||
public void setNotifications(List<Notification> notifications) {
|
||||
this.notifications = notifications;
|
||||
}
|
||||
|
||||
public Error getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(Error error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public String getMax_id() {
|
||||
return max_id;
|
||||
}
|
||||
|
||||
public void setMax_id(String max_id) {
|
||||
this.max_id = max_id;
|
||||
}
|
||||
|
||||
public String getSince_id() {
|
||||
return since_id;
|
||||
}
|
||||
|
||||
public void setSince_id(String since_id) {
|
||||
this.since_id = since_id;
|
||||
}
|
||||
}
|
|
@ -47,7 +47,9 @@ public class OauthClient {
|
|||
try {
|
||||
client.setConnectTimeout(10000); //10s timeout
|
||||
client.setUserAgent(USER_AGENT);
|
||||
client.setSSLSocketFactory(new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore()));
|
||||
MastalabSSLSocketFactory mastalabSSLSocketFactory = new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore());
|
||||
mastalabSSLSocketFactory.setHostnameVerifier(MastalabSSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
client.setSSLSocketFactory(mastalabSSLSocketFactory);
|
||||
client.get(getAbsoluteUrl(action), params, responseHandler);
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException | UnrecoverableKeyException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -58,7 +60,9 @@ public class OauthClient {
|
|||
try {
|
||||
client.setConnectTimeout(10000); //10s timeout
|
||||
client.setUserAgent(USER_AGENT);
|
||||
client.setSSLSocketFactory(new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore()));
|
||||
MastalabSSLSocketFactory mastalabSSLSocketFactory = new MastalabSSLSocketFactory(MastalabSSLSocketFactory.getKeystore());
|
||||
mastalabSSLSocketFactory.setHostnameVerifier(MastalabSSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
client.setSSLSocketFactory(mastalabSSLSocketFactory);
|
||||
client.post(getAbsoluteUrl(action), params, responseHandler);
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException | UnrecoverableKeyException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -131,11 +131,15 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
holder.status_toot_date = (TextView) v.findViewById(R.id.status_toot_date);
|
||||
holder.status_reblog_user = (TextView) v.findViewById(R.id.status_reblog_user);
|
||||
holder.main_container = (LinearLayout) v.findViewById(R.id.main_container);
|
||||
holder.status_search_title = (TextView) v.findViewById(R.id.status_search_title);
|
||||
v.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolderStatus) v.getTag();
|
||||
}
|
||||
|
||||
if( isFirstTypeItem(type, position) )
|
||||
holder.status_search_title.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.status_search_title.setVisibility(View.GONE);
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
if( !status.getIn_reply_to_account_id().equals("null") || !status.getIn_reply_to_id().equals("null") ){
|
||||
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_reply);
|
||||
|
@ -220,12 +224,16 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
holder.account_sc = (TextView) v.findViewById(R.id.account_sc);
|
||||
holder.account_fgc = (TextView) v.findViewById(R.id.account_fgc);
|
||||
holder.account_frc = (TextView) v.findViewById(R.id.account_frc);
|
||||
|
||||
holder.account_search_title = (TextView) v.findViewById(R.id.account_search_title);
|
||||
v.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolderAccounts) v.getTag();
|
||||
}
|
||||
|
||||
if( isFirstTypeItem(type, position) )
|
||||
holder.account_search_title.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.account_search_title.setVisibility(View.GONE);
|
||||
|
||||
holder.account_dn.setText(account.getDisplay_name());
|
||||
holder.account_un.setText(String.format("@%s",account.getUsername()));
|
||||
|
@ -260,10 +268,15 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
v = layoutInflater.inflate(R.layout.drawer_tag, parent, false);
|
||||
holder = new ViewHolderTag();
|
||||
holder.tag_name = (TextView) v.findViewById(R.id.tag_name);
|
||||
holder.tag_search_title = (TextView) v.findViewById(R.id.tag_search_title);
|
||||
v.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolderTag) v.getTag();
|
||||
}
|
||||
if( isFirstTypeItem(type, position) )
|
||||
holder.tag_search_title.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.tag_search_title.setVisibility(View.GONE);
|
||||
holder.tag_name.setText(String.format("#%s",tag));
|
||||
holder.tag_name.setPaintFlags(holder.tag_name.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
holder.tag_name.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -280,6 +293,15 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isFirstTypeItem(int type, int position){
|
||||
if( position == 0 && type == STATUS_TYPE)
|
||||
return true;
|
||||
else if( position == statuses.size() && type == ACCOUNT_TYPE )
|
||||
return true;
|
||||
else if( position == (statuses.size() + accounts.size()) && type == TAG_TYPE )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private class ViewHolderStatus {
|
||||
TextView status_content;
|
||||
|
@ -289,6 +311,7 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
TextView status_toot_date;
|
||||
TextView status_reblog_user;
|
||||
LinearLayout main_container;
|
||||
TextView status_search_title;
|
||||
}
|
||||
|
||||
|
||||
|
@ -300,9 +323,11 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
TextView account_sc;
|
||||
TextView account_fgc;
|
||||
TextView account_frc;
|
||||
TextView account_search_title;
|
||||
}
|
||||
|
||||
private class ViewHolderTag {
|
||||
TextView tag_name;
|
||||
TextView tag_search_title;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,8 @@ package fr.gouv.etalab.mastodon.drawers;
|
|||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -32,6 +34,7 @@ import android.support.v4.app.ActivityCompat;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Html;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -437,7 +440,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
final RelativeLayout loader = (RelativeLayout) view.findViewById(R.id.loader);
|
||||
switch (attachment.getType()){
|
||||
case "image": {
|
||||
String url = attachment.getRemote_url();
|
||||
String url = attachment.getPreview_url();
|
||||
if(url == null || url.trim().equals(""))
|
||||
url = attachment.getUrl();
|
||||
final ImageView imageView = (ImageView) view.findViewById(R.id.dialog_imageview);
|
||||
|
@ -666,20 +669,48 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
AlertDialog.Builder builderInner = new AlertDialog.Builder(context);
|
||||
builderInner.setTitle(stringArrayConf[which]);
|
||||
if( isOwner) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_COMPACT));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
}else {
|
||||
if( which < 2 ){
|
||||
builderInner.setMessage(status.getAccount().getAcct());
|
||||
}else {
|
||||
if( which == 0) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_COMPACT));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
}else{
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_COMPACT).toString();
|
||||
else
|
||||
//noinspection deprecation
|
||||
content = Html.fromHtml(status.getContent()).toString();
|
||||
ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
if( which < 2 ){
|
||||
builderInner.setMessage(status.getAccount().getAcct());
|
||||
}else if( which < 3) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_COMPACT));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
}else{
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_COMPACT).toString();
|
||||
else
|
||||
//noinspection deprecation
|
||||
content = Html.fromHtml(status.getContent()).toString();
|
||||
ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Text for report
|
||||
|
|
|
@ -35,6 +35,8 @@ import android.widget.Toast;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
|
@ -107,28 +109,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
lv_accounts.setAdapter(accountsListAdapter);
|
||||
|
||||
if( !comesFromSearch) {
|
||||
lv_accounts.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
|
||||
}
|
||||
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
|
||||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||
if (!flag_loading) {
|
||||
flag_loading = true;
|
||||
if (type != RetrieveAccountsAsyncTask.Type.FOLLOWERS && type != RetrieveAccountsAsyncTask.Type.FOLLOWING)
|
||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, targetedId, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Hide account header when scrolling for ShowAccountActivity
|
||||
if (hideHeader) {
|
||||
|
@ -160,6 +141,41 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
}
|
||||
lastFirstVisibleItem = currentFirstVisibleItem;
|
||||
}
|
||||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||
if (!flag_loading) {
|
||||
flag_loading = true;
|
||||
if (type != RetrieveAccountsAsyncTask.Type.FOLLOWERS && type != RetrieveAccountsAsyncTask.Type.FOLLOWING)
|
||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, targetedId, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
lv_accounts.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
|
||||
}
|
||||
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
|
||||
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||
if (!flag_loading) {
|
||||
flag_loading = true;
|
||||
if (type != RetrieveAccountsAsyncTask.Type.FOLLOWERS && type != RetrieveAccountsAsyncTask.Type.FOLLOWING)
|
||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
asyncTask = new RetrieveAccountsAsyncTask(context, type, targetedId, max_id, DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -220,26 +236,23 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
|
||||
|
||||
@Override
|
||||
public void onRetrieveAccounts(List<Account> accounts, Error error) {
|
||||
public void onRetrieveAccounts(APIResponse apiResponse) {
|
||||
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if( error != null){
|
||||
if( apiResponse.getError() != 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(getContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Account> accounts = apiResponse.getAccounts();
|
||||
if( firstLoad && (accounts == null || accounts.size() == 0))
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
if( accounts != null && accounts.size() > 1)
|
||||
max_id =accounts.get(accounts.size()-1).getId();
|
||||
else
|
||||
max_id = null;
|
||||
|
||||
max_id = apiResponse.getMax_id();
|
||||
if( accounts != null) {
|
||||
for(Account tmpAccount: accounts){
|
||||
this.accounts.add(tmpAccount);
|
||||
|
|
|
@ -31,8 +31,8 @@ import android.widget.Toast;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.drawers.NotificationsListAdapter;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||
|
@ -55,7 +55,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
private Context context;
|
||||
private AsyncTask<Void, Void, Void> asyncTask;
|
||||
private NotificationsListAdapter notificationsListAdapter;
|
||||
private String max_id = null;
|
||||
private String max_id;
|
||||
private List<Notification> notifications;
|
||||
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
||||
private boolean firstLoad;
|
||||
|
@ -66,7 +66,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
View rootView = inflater.inflate(R.layout.fragment_notifications, container, false);
|
||||
|
||||
max_id = null;
|
||||
context = getContext();
|
||||
firstLoad = true;
|
||||
flag_loading = true;
|
||||
|
@ -147,26 +147,23 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
|
||||
|
||||
@Override
|
||||
public void onRetrieveNotifications(List<Notification> notifications, String acct, String userId, Error error) {
|
||||
public void onRetrieveNotifications(APIResponse apiResponse, String acct, String userId) {
|
||||
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if( error != null){
|
||||
if( apiResponse.getError() != 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(getContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Notification> notifications = apiResponse.getNotifications();
|
||||
if( firstLoad && (notifications == null || notifications.size() == 0))
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
if( notifications != null && notifications.size() > 1)
|
||||
max_id =notifications.get(notifications.size()-1).getId();
|
||||
else
|
||||
max_id = null;
|
||||
|
||||
max_id = apiResponse.getMax_id();
|
||||
|
||||
if( notifications != null) {
|
||||
for(Notification tmpNotification: notifications){
|
||||
|
|
|
@ -30,14 +30,10 @@ import android.widget.AbsListView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.drawers.StatusListAdapter;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||
|
@ -112,29 +108,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
lv_status.setAdapter(statusListAdapter);
|
||||
|
||||
if( !comesFromSearch){
|
||||
lv_status.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
|
||||
}
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
if(firstVisibleItem + visibleItemCount == totalItemCount ) {
|
||||
if(!flag_loading ) {
|
||||
flag_loading = true;
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.TAG)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Hide account header when scrolling for ShowAccountActivity
|
||||
if( hideHeader ) {
|
||||
|
@ -165,6 +138,45 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
}
|
||||
lastFirstVisibleItem = currentFirstVisibleItem;
|
||||
}
|
||||
if(firstVisibleItem + visibleItemCount == totalItemCount ) {
|
||||
if(!flag_loading ) {
|
||||
flag_loading = true;
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.TAG)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
lv_status.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
|
||||
}
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
if(firstVisibleItem + visibleItemCount == totalItemCount ) {
|
||||
if(!flag_loading ) {
|
||||
flag_loading = true;
|
||||
if( type == RetrieveFeedsAsyncTask.Type.USER)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.TAG)
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, tag, targetedId, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
else
|
||||
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
nextElementLoader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -232,26 +244,23 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
|
||||
|
||||
@Override
|
||||
public void onRetrieveFeeds(List<Status> statuses, Error error) {
|
||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if( error != null){
|
||||
if( apiResponse.getError() != 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(getContext(), error.getError(),Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(getContext(), apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Status> statuses = apiResponse.getStatuses();
|
||||
if( firstLoad && (statuses == null || statuses.size() == 0))
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
else
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
if( statuses != null && statuses.size() > 1)
|
||||
max_id =statuses.get(statuses.size()-1).getId();
|
||||
else
|
||||
max_id = null;
|
||||
|
||||
max_id = apiResponse.getMax_id();
|
||||
if( statuses != null) {
|
||||
for(Status tmpStatus: statuses){
|
||||
this.statuses.add(tmpStatus);
|
||||
|
|
|
@ -110,6 +110,7 @@ public class Helper {
|
|||
public static final String WEBSITE = "website";
|
||||
public static final String LAST_NOTIFICATION_MAX_ID = "last_notification_max_id";
|
||||
public static final String LAST_HOMETIMELINE_MAX_ID = "last_hometimeline_max_id";
|
||||
public static final String CLIP_BOARD = "clipboard";
|
||||
//Notifications
|
||||
public static final int NOTIFICATION_INTENT = 1;
|
||||
public static final int HOME_TIMELINE_INTENT = 2;
|
||||
|
@ -418,6 +419,7 @@ public class Helper {
|
|||
// prepare intent which is triggered if the user click on the notification
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
PendingIntent pIntent = PendingIntent.getActivity(context, notificationId, intent, PendingIntent.FLAG_ONE_SHOT);
|
||||
|
||||
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
// build notification
|
||||
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
|
||||
|
|
|
@ -15,15 +15,12 @@
|
|||
package fr.gouv.etalab.mastodon.interfaces;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 27/04/2017.
|
||||
* Interface when accounts have been retrieved
|
||||
*/
|
||||
public interface OnRetrieveAccountsInterface {
|
||||
void onRetrieveAccounts(List<Account> accounts, Error error);
|
||||
void onRetrieveAccounts(APIResponse apiResponse);
|
||||
}
|
||||
|
|
|
@ -14,16 +14,12 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.interfaces;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 24/04/2017.
|
||||
* Interface when status have been retrieved
|
||||
*/
|
||||
public interface OnRetrieveFeedsInterface {
|
||||
void onRetrieveFeeds(List<Status> statuses, Error error);
|
||||
void onRetrieveFeeds(APIResponse apiResponse);
|
||||
}
|
||||
|
|
|
@ -15,15 +15,12 @@
|
|||
package fr.gouv.etalab.mastodon.interfaces;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 20/05/2017.
|
||||
* Interface when home timeline toots have been retrieved
|
||||
*/
|
||||
public interface OnRetrieveHomeTimelineServiceInterface {
|
||||
void onRetrieveHomeTimelineService(List<Status> statuses, String acct, String userId, Error error);
|
||||
void onRetrieveHomeTimelineService(APIResponse apiResponse, String acct, String userId);
|
||||
}
|
||||
|
|
|
@ -14,16 +14,12 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.interfaces;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Notification;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 28/04/2017.
|
||||
* Interface when notifications have been retrieved
|
||||
*/
|
||||
public interface OnRetrieveNotificationsInterface {
|
||||
void onRetrieveNotifications(List<Notification> notifications, String acct, String userId, Error error);
|
||||
void onRetrieveNotifications(APIResponse apiResponse, String acct, String userId);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,7 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -25,5 +22,5 @@ import fr.gouv.etalab.mastodon.client.Entities.Error;
|
|||
* Interface for search accounts
|
||||
*/
|
||||
public interface OnRetrieveSearcAccountshInterface {
|
||||
void onRetrieveSearchAccounts(List<Account> accounts, Error error);
|
||||
void onRetrieveSearchAccounts(APIResponse apiResponse);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import android.graphics.Bitmap;
|
|||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.widget.Toast;
|
||||
import android.util.Log;
|
||||
|
||||
import com.evernote.android.job.Job;
|
||||
import com.evernote.android.job.JobManager;
|
||||
|
@ -38,8 +38,8 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||
import fr.gouv.etalab.mastodon.asynctasks.RetrieveHomeTimelineServiceAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Status;
|
||||
import fr.gouv.etalab.mastodon.client.PatchBaseImageDownloader;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
|
@ -64,6 +64,7 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
|||
static final String HOME_TIMELINE = "home_timeline";
|
||||
private int notificationId;
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected Result onRunJob(Params params) {
|
||||
|
@ -93,11 +94,16 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
|||
* Task in background starts here.
|
||||
*/
|
||||
private void callAsynchronousTask() {
|
||||
|
||||
|
||||
final SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean notif_hometimeline = sharedpreferences.getBoolean(Helper.SET_NOTIF_HOMETIMELINE, true);
|
||||
//User disagree with home timeline refresh
|
||||
if( !notif_hometimeline)
|
||||
return; //Nothing is done
|
||||
//No account connected, the service is stopped
|
||||
if(!Helper.isLoggedIn(getContext()))
|
||||
return;
|
||||
SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
//If an Internet connection and user agrees with notification refresh
|
||||
//If WIFI only and on WIFI OR user defined any connections to use the service.
|
||||
|
@ -109,7 +115,8 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
|||
//Retrieve users in db that owner has.
|
||||
for (Account account: accounts) {
|
||||
String since_id = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + account.getId(), null);
|
||||
notificationId = (int) Math.round(Double.parseDouble(account.getId())/100) + 2;
|
||||
long notif_id = Long.parseLong(account.getId());
|
||||
notificationId = ((notif_id + 2) > 2147483647 )?(int)(2147483647 - notif_id -2):(int)(notif_id + 2);
|
||||
new RetrieveHomeTimelineServiceAsyncTask(getContext(), account.getInstance(), account.getToken(), since_id, account.getAcct(), account.getId(), HomeTimelineSyncJob.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
}
|
||||
|
@ -118,8 +125,9 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
|||
|
||||
|
||||
@Override
|
||||
public void onRetrieveHomeTimelineService(List<Status> statuses, String acct, String userId, Error error) {
|
||||
if( error != null || statuses == null || statuses.size() == 0)
|
||||
public void onRetrieveHomeTimelineService(APIResponse apiResponse, String acct, String userId) {
|
||||
List<Status> statuses = apiResponse.getStatuses();
|
||||
if( apiResponse.getError() != null || statuses == null || statuses.size() == 0)
|
||||
return;
|
||||
Bitmap icon_notification = null;
|
||||
final SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
@ -128,6 +136,7 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
|||
//No previous notifications in cache, so no notification will be sent
|
||||
String message;
|
||||
String title = null;
|
||||
|
||||
for(Status status: statuses){
|
||||
//The notification associated to max_id is discarded as it is supposed to have already been sent
|
||||
//Also, if the toot comes from the owner, we will avoid to warn him/her...
|
||||
|
@ -162,9 +171,10 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe
|
|||
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
intent.putExtra(INTENT_ACTION, HOME_TIMELINE_INTENT);
|
||||
intent.putExtra(PREF_KEY_ID, userId);
|
||||
notify_user(getContext(), intent, notificationId, icon_notification,title,message);
|
||||
if( max_id != null)
|
||||
notify_user(getContext(), intent, notificationId, icon_notification,title,message);
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId());
|
||||
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, apiResponse.getMax_id());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.os.AsyncTask;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
import com.evernote.android.job.Job;
|
||||
import com.evernote.android.job.JobManager;
|
||||
import com.evernote.android.job.JobRequest;
|
||||
|
@ -39,7 +38,7 @@ import java.util.Set;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||
import fr.gouv.etalab.mastodon.client.APIResponse;
|
||||
import fr.gouv.etalab.mastodon.client.PatchBaseImageDownloader;
|
||||
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||
import mastodon.etalab.gouv.fr.mastodon.R;
|
||||
|
@ -110,6 +109,9 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
//User disagree with all notifications
|
||||
if( !notif_follow && !notif_add && !notif_ask && !notif_mention && !notif_share)
|
||||
return; //Nothing is done
|
||||
//No account connected, the service is stopped
|
||||
if(!Helper.isLoggedIn(getContext()))
|
||||
return;
|
||||
//If WIFI only and on WIFI OR user defined any connections to use the service.
|
||||
if(!sharedpreferences.getBoolean(Helper.SET_WIFI_ONLY, false) || Helper.isOnWIFI(getContext())) {
|
||||
List<Account> accounts = new AccountDAO(getContext(),db).getAllAccount();
|
||||
|
@ -119,7 +121,8 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
//Retrieve users in db that owner has.
|
||||
for (Account account: accounts) {
|
||||
String max_id = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + account.getId(), null);
|
||||
notificationId = (int) Math.round(Double.parseDouble(account.getId())/100) + 1;
|
||||
long notif_id = Long.parseLong(account.getId());
|
||||
notificationId = ((notif_id + 1) > 2147483647 )?(int)(2147483647 - notif_id - 1):(int)(notif_id + 1);
|
||||
new RetrieveNotificationsAsyncTask(getContext(), account.getInstance(), account.getToken(), max_id, account.getAcct(), account.getId(), NotificationsSyncJob.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
@ -128,8 +131,10 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
|
||||
|
||||
@Override
|
||||
public void onRetrieveNotifications(List<Notification> notifications, String acct, String userId, Error error) {
|
||||
if( error != null || notifications == null || notifications.size() == 0)
|
||||
public void onRetrieveNotifications(APIResponse apiResponse, String acct, String userId) {
|
||||
|
||||
List<Notification> notifications = apiResponse.getNotifications();
|
||||
if( apiResponse.getError() != null || notifications == null || notifications.size() == 0)
|
||||
return;
|
||||
Bitmap icon_notification = null;
|
||||
final SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
@ -221,11 +226,12 @@ public class NotificationsSyncJob extends Job implements OnRetrieveNotifications
|
|||
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
intent.putExtra(INTENT_ACTION, NOTIFICATION_INTENT);
|
||||
intent.putExtra(PREF_KEY_ID, userId);
|
||||
notify_user(getContext(), intent, notificationId, icon_notification,title,message);
|
||||
if( max_id != null)
|
||||
notify_user(getContext(), intent, notificationId, icon_notification,title,message);
|
||||
}
|
||||
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, notifications.get(0).getId());
|
||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + userId, apiResponse.getMax_id());
|
||||
editor.apply();
|
||||
|
||||
}
|
||||
|
|
|
@ -15,88 +15,96 @@
|
|||
You should have received a copy of the GNU General Public License along with Thomas Schneider; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
<ScrollView android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="#fff"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/mastodonlogo"
|
||||
android:layout_height="100dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<EditText
|
||||
android:visibility="gone"
|
||||
android:id="@+id/login_instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textWebEmailAddress"
|
||||
android:hint="@string/instance"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/login_uid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
android:hint="@string/email"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id = "@+id/login_passwd"
|
||||
android:inputType="textPassword"
|
||||
android:hint="@string/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/login_button"
|
||||
android:textAllCaps="false"
|
||||
android:drawableLeft="@drawable/mastodon_icon"
|
||||
android:drawableStart="@drawable/mastodon_icon"
|
||||
android:gravity="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_marginTop="20dp"
|
||||
android:drawablePadding="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/login" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_two_step"
|
||||
android:textAllCaps="false"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="20dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/mastodonlogo"
|
||||
android:layout_height="100dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:text="@string/two_factor_authentification" />
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:visibility="gone"
|
||||
android:id="@+id/login_instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textWebEmailAddress"
|
||||
android:hint="@string/instance"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/login_uid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
android:hint="@string/email"
|
||||
/>
|
||||
<EditText
|
||||
android:id = "@+id/login_passwd"
|
||||
android:inputType="textPassword"
|
||||
android:hint="@string/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/login_button"
|
||||
android:textAllCaps="false"
|
||||
android:drawableLeft="@drawable/mastodon_icon"
|
||||
android:drawableStart="@drawable/mastodon_icon"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:drawablePadding="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/login" />
|
||||
<TextView
|
||||
android:id="@+id/login_two_step"
|
||||
android:textAllCaps="false"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:text="@string/two_factor_authentification" />
|
||||
<TextView
|
||||
android:id="@+id/other_instance"
|
||||
android:textAllCaps="false"
|
||||
android:gravity="center"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:text="@string/other_instance" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017 Thomas Schneider
|
||||
|
||||
This file is a part of Mastodon Etalab for mastodon.etalab.gouv.fr
|
||||
|
||||
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.
|
||||
|
||||
Mastodon Etalab 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 Thomas Schneider; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<ScrollView android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
<!-- App authorizations -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<!-- APPS AUTHORIZATIONS TITLE -->
|
||||
<TextView
|
||||
android:text="@string/privacy_authorizations_title"
|
||||
android:background="@drawable/shape_border_bottom_settings"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- APPS AUTHORIZATIONS CONTENT -->
|
||||
<TextView
|
||||
android:text="@string/privacy_authorizations"
|
||||
android:autoLink="web"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- API authorizations -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<!-- API AUTHORIZATIONS TITLE -->
|
||||
<TextView
|
||||
android:text="@string/privacy_API_authorizations_title"
|
||||
android:background="@drawable/shape_border_bottom_settings"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- API AUTHORIZATIONS CONTENT -->
|
||||
<TextView
|
||||
android:text="@string/privacy_API_authorizations"
|
||||
android:autoLink="web"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -17,7 +17,6 @@
|
|||
-->
|
||||
<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:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -26,103 +25,126 @@
|
|||
android:id="@+id/main_container"
|
||||
android:paddingLeft="@dimen/drawer_padding"
|
||||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/account_search_title"
|
||||
android:visibility="gone"
|
||||
android:textSize="18sp"
|
||||
android:background="@color/blue_light"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/accounts"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/account_search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:id="@+id/account_pp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/account_container"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:maxLines="1"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:id="@+id/account_pp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/account_container"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<TextView
|
||||
android:id="@+id/account_un"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/account_un"
|
||||
android:layout_marginTop="10dp"
|
||||
android:visibility="gone"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:id="@+id/account_ac"
|
||||
android:textSize="16sp"
|
||||
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"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:visibility="gone"
|
||||
android:maxLines="1"
|
||||
android:id="@+id/account_ac"
|
||||
android:textSize="16sp"
|
||||
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/status"
|
||||
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" />
|
||||
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/status"
|
||||
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>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -25,65 +25,87 @@
|
|||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/main_container"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/status_account_profile"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="50dp"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:gravity="center_horizontal|top"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/status_search_title"
|
||||
android:visibility="gone"
|
||||
android:text="@string/status"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp"
|
||||
android:background="@color/blue_light"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/statuts_search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/status_account_profile"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="50dp"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:gravity="center_horizontal|top"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/status_account_displayname"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:drawablePadding="2dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/status_account_displayname"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:drawablePadding="2dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:id="@+id/status_account_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:id="@+id/status_account_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/status_reblog_user"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textSize="14sp"
|
||||
android:maxLines="1"
|
||||
android:id="@+id/status_reblog_user"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/status_toot_date"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="end"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/status_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:autoLink="web"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/status_toot_date"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="end"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/status_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:autoLink="web"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -18,12 +18,30 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp"
|
||||
android:paddingLeft="@dimen/drawer_padding"
|
||||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:id="@+id/account_container"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tag_search_title"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:visibility="gone"
|
||||
android:textSize="18sp"
|
||||
android:background="@color/blue_light"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/tags"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:padding="20dp"
|
||||
android:id="@+id/tag_name"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
android:id="@+id/action_about"
|
||||
android:title="@string/action_about"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_privacy"
|
||||
android:title="@string/action_privacy"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_logout"
|
||||
android:title="@string/action_logout"
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_about"
|
||||
android:title="@string/action_about"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_privacy"
|
||||
android:title="@string/action_privacy"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<string name="action_settings">Paramètres</string>
|
||||
<string name="action_about">A propos</string>
|
||||
<string name="action_privacy">Confidentialité</string>
|
||||
<string name="action_logout">Déconnexion</string>
|
||||
|
||||
<string name="login">Connexion</string>
|
||||
|
@ -21,12 +22,15 @@
|
|||
<string name="email">Email</string>
|
||||
<string name="accounts">Comptes</string>
|
||||
<string name="toots">Pouets</string>
|
||||
<string name="tags">Tags</string>
|
||||
<string name="token">Jeton</string>
|
||||
<string name="two_factor_authentification">Authentification en deux étapes ?</string>
|
||||
<string name="other_instance">Autre instance que mastodon.etalab.gouv.fr ?</string>
|
||||
<string name="no_result">Aucun résultat !</string>
|
||||
<string name="instance">Instance</string>
|
||||
<string name="toast_account_changed">Utilisation du compte %1$s</string>
|
||||
<string name="add_account">Ajouter un compte</string>
|
||||
<string name="clipboard">Le contenu du pouet a été copié dans le presse-papier</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="home_timeline">Accueil</string>
|
||||
|
@ -61,15 +65,18 @@
|
|||
<item>Masquer</item>
|
||||
<item>Bloquer</item>
|
||||
<item>Signaler</item>
|
||||
<item>Copier</item>
|
||||
</string-array>
|
||||
<string-array name="more_action_owner">
|
||||
<item>Supprimer</item>
|
||||
<item>Copier</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="more_action_confirm">
|
||||
<item>Masquer ce compte ?</item>
|
||||
<item>Bloquer ce compte ?</item>
|
||||
<item>Signaler ce pouet ?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
</string-array>
|
||||
|
||||
|
||||
|
@ -218,6 +225,26 @@
|
|||
<string name="request_sent">Demande envoyée</string>
|
||||
<string name="followed_by">Vous suit</string>
|
||||
|
||||
|
||||
<string name="action_search">Recherche</string>
|
||||
|
||||
|
||||
|
||||
<!-- PRIVACY -->
|
||||
<string name="privacy_authorizations_title">Autorisations de l\'application</string>
|
||||
<string name="privacy_authorizations">
|
||||
- <b>ACCESS_NETWORK_STATE</b> : Utilisée pour savoir si l\'appareil est connecté au WIFI.\n
|
||||
- <b>INTERNET</b> : Utilisée pour les requêtes vers l\'instance.\n
|
||||
- <b>WRITE_EXTERNAL_STORAGE</b> : Utilisée pour télécharger les médias / déplacer sur la carte SD.\n
|
||||
- <b>READ_EXTERNAL_STORAGE</b> : Utilisée pour ajouter des médias aux pouets.\n
|
||||
- <b>BOOT_COMPLETED</b> : Utilisée pour lancer le service de notifications quand l\'appareil démarre.\n
|
||||
- <b>WAKE_LOCK</b> : Utilisée lors du service de notifications.\n
|
||||
</string>
|
||||
|
||||
<string name="privacy_API_authorizations_title">Autorisations de l\'API</string>
|
||||
<string name="privacy_API_authorizations">
|
||||
- <b>Read</b> : Lire les données du compte.\n
|
||||
- <b>Write</b> : Envoyer des messages et attacher des médias aux messages.\n
|
||||
- <b>Follow</b> : S\'abonner, se désabonner, bloquer, débloquer.\n\n
|
||||
<b>⚠ Ces actions ne sont réalisées qu\'à la demande de l\'utilisateur.</b>
|
||||
</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue