Merged in develop (pull request #17)
This commit is contained in:
commit
227c23649d
|
@ -7,8 +7,8 @@ android {
|
|||
applicationId "fr.gouv.etalab.mastodon"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 19
|
||||
versionName "1.2.2"
|
||||
versionCode 20
|
||||
versionName "1.2.3"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -15,6 +15,7 @@
|
|||
package fr.gouv.etalab.mastodon.activities;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
@ -23,6 +24,7 @@ import android.os.Bundle;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -37,6 +39,7 @@ import android.view.MenuItem;
|
|||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
|
@ -46,6 +49,7 @@ import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import fr.gouv.etalab.mastodon.asynctasks.UpdateAccountInfoByIDAsyncTask;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||
|
@ -92,6 +96,7 @@ public class MainActivity extends AppCompatActivity
|
|||
LEFT_TO_RIGHT,
|
||||
POP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -105,6 +110,7 @@ public class MainActivity extends AppCompatActivity
|
|||
finish();
|
||||
return;
|
||||
}
|
||||
Helper.fillMapEmoji(getApplicationContext());
|
||||
//Here, the user is authenticated
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
@ -318,6 +324,39 @@ public class MainActivity extends AppCompatActivity
|
|||
}else if(id == R.id.action_about_instance){
|
||||
Intent intent = new Intent(getApplicationContext(), InstanceActivity.class);
|
||||
startActivity(intent);
|
||||
} else if( id == R.id.action_cache){ //Cache clear feature
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
builder.setTitle(R.string.cache_title);
|
||||
long sizeCache = Helper.cacheSize(getCacheDir());
|
||||
float cacheSize = 0;
|
||||
if( sizeCache > 0 ) {
|
||||
if (sizeCache > 0) {
|
||||
cacheSize = (float) sizeCache / 1000000.0f;
|
||||
}
|
||||
}
|
||||
final float finalCacheSize = cacheSize;
|
||||
builder.setMessage(getString(R.string.cache_message, String.format("%s Mo", String.format(Locale.getDefault(), "%.2f", cacheSize))))
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// continue with delete
|
||||
try {
|
||||
String path = getCacheDir().getPath();
|
||||
File dir = new File(path);
|
||||
if (dir.isDirectory()) {
|
||||
Helper.deleteDir(dir);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
Toast.makeText(MainActivity.this, getString(R.string.toast_cache_clear,String.format("%s Mo", String.format(Locale.getDefault(), "%.2f", finalCacheSize))), Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.show();
|
||||
} else if(id == R.id.action_search){
|
||||
|
||||
if( toolbar.getChildCount() > 0){
|
||||
|
|
|
@ -41,7 +41,6 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.emojione.Emojione;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||
|
@ -283,7 +282,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
|
||||
if( account != null){
|
||||
setTitle(account.getAcct());
|
||||
account_dn.setText(Emojione.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
account_un.setText(String.format("@%s", account.getUsername()));
|
||||
if( account.getAcct() != null && account.getAcct().equals(account.getUsername()))
|
||||
account_ac.setVisibility(View.GONE);
|
||||
|
|
|
@ -34,7 +34,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.emojione.Emojione;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||
|
@ -152,7 +151,7 @@ public class AccountsListAdapter extends BaseAdapter implements OnPostActionInte
|
|||
holder.account_ds.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
holder.account_dn.setText(Emojione.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
holder.account_un.setText(String.format("@%s",account.getUsername()));
|
||||
holder.account_ac.setText(account.getAcct());
|
||||
if( account.getDisplay_name().equals(account.getAcct()))
|
||||
|
|
|
@ -26,7 +26,6 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.emojione.Emojione;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||
|
@ -91,7 +90,7 @@ public class AccountsSearchAdapter extends BaseAdapter {
|
|||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
holder.account_dn.setText(Emojione.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
|
||||
holder.account_un.setText(String.format("@%s",account.getUsername()));
|
||||
//Profile picture
|
||||
imageLoader.displayImage(account.getAvatar(), holder.account_pp, options);
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.emojione.Emojione;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||
|
@ -210,7 +209,7 @@ public class NotificationsListAdapter extends BaseAdapter {
|
|||
}
|
||||
});
|
||||
|
||||
holder.notification_account_displayname.setText(Emojione.shortnameToUnicode(notification.getAccount().getDisplay_name(), true));
|
||||
holder.notification_account_displayname.setText(Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true));
|
||||
holder.notification_account_username.setText( String.format("@%s",notification.getAccount().getUsername()));
|
||||
//Profile picture
|
||||
imageLoader.displayImage(notification.getAccount().getAvatar(), holder.notification_account_profile, options);
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.emojione.Emojione;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||
|
@ -168,7 +167,7 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
final String content, displayName, username, ppurl;
|
||||
if( status.getReblog() != null){
|
||||
content = status.getReblog().getContent();
|
||||
displayName = Emojione.shortnameToUnicode(status.getReblog().getAccount().getDisplay_name(), true);
|
||||
displayName = Helper.shortnameToUnicode(status.getReblog().getAccount().getDisplay_name(), true);
|
||||
username = status.getReblog().getAccount().getUsername();
|
||||
holder.status_reblog_user.setText(displayName + " " +String.format("@%s",username));
|
||||
ppurl = status.getReblog().getAccount().getAvatar();
|
||||
|
@ -178,7 +177,7 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
}else {
|
||||
ppurl = status.getAccount().getAvatar();
|
||||
content = status.getContent();
|
||||
displayName = Emojione.shortnameToUnicode(status.getAccount().getDisplay_name(), true);
|
||||
displayName = Helper.shortnameToUnicode(status.getAccount().getDisplay_name(), true);
|
||||
username = status.getAccount().getUsername();
|
||||
holder.status_reblog_user.setVisibility(View.GONE);
|
||||
holder.status_account_displayname.setText(displayName);
|
||||
|
|
|
@ -50,7 +50,6 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import com.emojione.Emojione;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
|
@ -233,7 +232,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
final String content, displayName, username, ppurl;
|
||||
if( status.getReblog() != null){
|
||||
content = status.getReblog().getContent();
|
||||
displayName = status.getReblog().getAccount().getDisplay_name();
|
||||
displayName = Helper.shortnameToUnicode(status.getReblog().getAccount().getDisplay_name(), true);
|
||||
username = status.getReblog().getAccount().getUsername();
|
||||
holder.status_reblog_user.setText(displayName + " " +String.format("@%s",username));
|
||||
ppurl = status.getReblog().getAccount().getAvatar();
|
||||
|
@ -243,7 +242,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
}else {
|
||||
ppurl = status.getAccount().getAvatar();
|
||||
content = status.getContent();
|
||||
displayName = Emojione.shortnameToUnicode(status.getAccount().getDisplay_name(), true);
|
||||
displayName = Helper.shortnameToUnicode(status.getAccount().getDisplay_name(), true);
|
||||
username = status.getAccount().getUsername();
|
||||
holder.status_reblog_user.setVisibility(View.GONE);
|
||||
holder.status_account_displayname.setText(displayName);
|
||||
|
@ -316,7 +315,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
//Text depending if toots is sensitive or not
|
||||
String textShowMore = (status.getReblog().isSensitive()) ? context.getString(R.string.load_sensitive_attachment) : context.getString(R.string.load_attachment);
|
||||
holder.status_show_more.setText(textShowMore);
|
||||
if (!status.getReblog().isAttachmentShown()) {
|
||||
if (!status.isAttachmentShown()) {
|
||||
holder.status_show_more.setVisibility(View.VISIBLE);
|
||||
holder.status_document_container.setVisibility(View.GONE);
|
||||
} else {
|
||||
|
|
|
@ -256,7 +256,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
lv_accounts.setAdapter(accountsListAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
if( accounts != null) {
|
||||
if( accounts != null && accounts.size() > 0) {
|
||||
for(Account tmpAccount: accounts){
|
||||
this.accounts.add(tmpAccount);
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
|
|||
lv_accounts.setAdapter(accountsFollowRequestAdapter);
|
||||
swiped = false;
|
||||
}
|
||||
if( accounts != null) {
|
||||
if( accounts != null && accounts.size() > 0) {
|
||||
for(Account tmpAccount: accounts){
|
||||
this.accounts.add(tmpAccount);
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
}
|
||||
max_id = apiResponse.getMax_id();
|
||||
|
||||
if( notifications != null) {
|
||||
if( notifications != null && notifications.size() > 0) {
|
||||
for(Notification tmpNotification: notifications){
|
||||
this.notifications.add(tmpNotification);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
private StatusListAdapter statusListAdapter;
|
||||
private String max_id;
|
||||
private List<Status> statuses;
|
||||
private static RetrieveFeedsAsyncTask.Type type;
|
||||
private RetrieveFeedsAsyncTask.Type type;
|
||||
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
|
||||
private boolean firstLoad;
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
|
@ -265,6 +265,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
swipeRefreshLayout.setRefreshing(false);
|
||||
swiped = false;
|
||||
return;
|
||||
}else if( apiResponse.getError() != null && apiResponse.getError().getError().startsWith("404 -")) {
|
||||
flag_loading = false;
|
||||
}
|
||||
List<Status> statuses = apiResponse.getStatuses();
|
||||
if( !swiped && firstLoad && (statuses == null || statuses.size() == 0))
|
||||
|
@ -277,7 +279,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
swiped = false;
|
||||
}
|
||||
max_id = apiResponse.getMax_id();
|
||||
if( statuses != null) {
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
for(Status tmpStatus: statuses){
|
||||
this.statuses.add(tmpStatus);
|
||||
}
|
||||
|
@ -285,7 +287,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
firstLoad = false;
|
||||
flag_loading = statuses != null && statuses.size() < tootsPerPage;
|
||||
if( flag_loading )
|
||||
flag_loading = statuses != null && statuses.size() < tootsPerPage;
|
||||
//Store last toot id for home timeline to avoid to notify for those that have been already seen
|
||||
if(statuses != null && statuses.size() > 0 && type == RetrieveFeedsAsyncTask.Type.HOME ){
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
|
|
@ -55,14 +55,21 @@ import com.nostra13.universalimageloader.core.assist.FailReason;
|
|||
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.InetAddress;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||
|
@ -159,6 +166,58 @@ public class Helper {
|
|||
|
||||
private static boolean menuAccountsOpened = false;
|
||||
|
||||
|
||||
private static final Pattern SHORTNAME_PATTERN = Pattern.compile(":([-+\\w]+):");
|
||||
|
||||
/**
|
||||
* Converts emojis in input to unicode
|
||||
* @param input String
|
||||
* @param removeIfUnsupported boolean
|
||||
* @return String
|
||||
*/
|
||||
public static String shortnameToUnicode(String input, boolean removeIfUnsupported) {
|
||||
Matcher matcher = SHORTNAME_PATTERN.matcher(input);
|
||||
boolean supported = Build.VERSION.SDK_INT >= 16;
|
||||
while (matcher.find()) {
|
||||
String unicode = emoji.get(matcher.group(1));
|
||||
if (unicode == null) {
|
||||
continue;
|
||||
}
|
||||
if (supported) {
|
||||
input = input.replace(":" + matcher.group(1) + ":", unicode);
|
||||
} else if (removeIfUnsupported) {
|
||||
input = input.replace(":" + matcher.group(1) + ":", "");
|
||||
}
|
||||
}
|
||||
return input;
|
||||
}
|
||||
//Emoji manager
|
||||
private static Map<String, String> emoji = new HashMap<>();
|
||||
|
||||
public static void fillMapEmoji(Context context) {
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(context.getAssets().open("emoji.csv")));
|
||||
String line;
|
||||
while( (line = br.readLine()) != null) {
|
||||
String str[] = line.split(",");
|
||||
String unicode = null;
|
||||
if(str.length == 2)
|
||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16)}, 0, 1);
|
||||
else if(str.length == 3)
|
||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16), Integer.parseInt(str[2].replace("0x","").trim(), 16)}, 0, 2);
|
||||
else if(str.length == 4)
|
||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16), Integer.parseInt(str[2].replace("0x","").trim(), 16), Integer.parseInt(str[3].replace("0x","").trim(), 16)}, 0, 3);
|
||||
else if(str.length == 5)
|
||||
unicode = new String(new int[] {Integer.parseInt(str[1].replace("0x","").trim(), 16), Integer.parseInt(str[2].replace("0x","").trim(), 16), Integer.parseInt(str[3].replace("0x","").trim(), 16), Integer.parseInt(str[4].replace("0x","").trim(), 16)}, 0, 4);
|
||||
if( unicode != null)
|
||||
emoji.put(str[0],unicode);
|
||||
}
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Check if the user is connected to Internet
|
||||
* @return boolean
|
||||
|
@ -673,4 +732,44 @@ public class Helper {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the cache size
|
||||
* @param directory File
|
||||
* @return long value in Mo
|
||||
*/
|
||||
public static long cacheSize(File directory) {
|
||||
long length = 0;
|
||||
if( directory == null || directory.length() == 0 )
|
||||
return -1;
|
||||
for (File file : directory.listFiles()) {
|
||||
if (file.isFile())
|
||||
try {
|
||||
length += file.length();
|
||||
}catch (NullPointerException e){
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
length += cacheSize(file);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
public static boolean deleteDir(File dir) {
|
||||
if (dir != null && dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (String aChildren : children) {
|
||||
boolean success = deleteDir(new File(dir, aChildren));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return dir.delete();
|
||||
} else{
|
||||
return dir != null && dir.isFile() && dir.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<?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>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<!-- About app name -->
|
||||
<TextView
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="22sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- About version -->
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/about_version"
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- About developer -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:layout_width="200dp"
|
||||
android:text="@string/about_developer"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/about_developer"
|
||||
android:text="@string/about_developer_action"
|
||||
android:layout_width="150dp"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- About license -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="20dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/about_license"
|
||||
android:textSize="18sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/about_license"
|
||||
android:text="@string/about_license_action"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- About license -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="18sp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/about_code"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/about_code"
|
||||
android:text="@string/about_code_action"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,110 @@
|
|||
<?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"
|
||||
android:background="#fff"
|
||||
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_height="wrap_content"
|
||||
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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:visibility="gone"
|
||||
android:id="@+id/login_instance"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textWebEmailAddress"
|
||||
android:hint="@string/instance"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/login_uid"
|
||||
android:layout_width="300dp"
|
||||
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="300dp"
|
||||
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>
|
||||
</ScrollView>
|
|
@ -0,0 +1,136 @@
|
|||
<?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>.
|
||||
-->
|
||||
<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_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="400dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<ImageView
|
||||
android:padding="10dp"
|
||||
android:id="@+id/account_pp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
tools:ignore="ContentDescription" />
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/account_dn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<TextView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:id="@+id/account_un"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/account_followed_by"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:text="@string/followed_by"
|
||||
android:maxLines="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/account_ac"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/account_follow"
|
||||
android:textAllCaps="false"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginBottom="10dp"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:text="@string/action_follow" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/account_note"
|
||||
android:padding="5dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:maxLines="3"
|
||||
android:autoLink="web"
|
||||
android:layout_height="wrap_content" />
|
||||
<android.support.design.widget.AppBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@android:color/white"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/account_tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white"
|
||||
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
|
||||
app:tabMode="fixed"
|
||||
app:tabGravity="fill"
|
||||
/>
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/account_viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/white"
|
||||
/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</LinearLayout>
|
|
@ -17,10 +17,9 @@
|
|||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:maxWidth="500dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- Listview status -->
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -30,7 +32,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
@ -56,7 +57,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
@ -82,7 +82,6 @@
|
|||
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">
|
||||
|
||||
|
@ -107,7 +106,6 @@
|
|||
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">
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
android:id="@+id/main_app_container"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
|
|
@ -17,10 +17,9 @@
|
|||
-->
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:maxWidth="500dp"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<!-- Listview status -->
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
android:id="@+id/action_about_instance"
|
||||
android:title="@string/action_about_instance"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_cache"
|
||||
android:title="@string/action_cache"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_logout"
|
||||
android:title="@string/action_logout"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="drawer_padding">100dp</dimen>
|
||||
<dimen name="drawer_padding">5dp</dimen>
|
||||
<dimen name="toot_padding">200dp</dimen>
|
||||
<dimen name="fab_margin">100dp</dimen>
|
||||
<dimen name="activity_vertical_margin">20dp</dimen>
|
||||
</resources>
|
|
@ -8,6 +8,7 @@
|
|||
<string name="action_about">A propos</string>
|
||||
<string name="action_about_instance">A propos de l\'instance</string>
|
||||
<string name="action_privacy">Confidentialité</string>
|
||||
<string name="action_cache">Cache</string>
|
||||
<string name="action_logout">Déconnexion</string>
|
||||
|
||||
<string name="login">Connexion</string>
|
||||
|
@ -35,6 +36,8 @@
|
|||
<string name="clipboard">Le contenu du pouet a été copié dans le presse-papier</string>
|
||||
<string name="change">Changer</string>
|
||||
<string name="choose_picture">Changer l\'image…</string>
|
||||
<string name="clear">Nettoyer</string>
|
||||
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="home_timeline">Accueil</string>
|
||||
|
@ -254,7 +257,10 @@
|
|||
|
||||
<string name="action_search">Recherche</string>
|
||||
|
||||
|
||||
<!-- CACHE -->
|
||||
<string name="cache_title">Nettoyage du cache</string>
|
||||
<string name="cache_message">Il y a %1$s de données en cache.\n\nSouhaitez-vous les supprimer ?</string>
|
||||
<string name="toast_cache_clear">Le cache a été nettoyé ! %1$s ont été libérés</string>
|
||||
|
||||
<!-- PRIVACY -->
|
||||
<string name="privacy_data_title">Données enregistrées</string>
|
||||
|
|
Loading…
Reference in New Issue