Some improvements
This commit is contained in:
parent
2957cc6c61
commit
350e26d64f
|
@ -77,7 +77,6 @@
|
||||||
<activity android:name="fr.gouv.etalab.mastodon.activities.ShowConversationActivity"
|
<activity android:name="fr.gouv.etalab.mastodon.activities.ShowConversationActivity"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:noHistory="true"
|
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
/>
|
/>
|
||||||
<activity android:name="fr.gouv.etalab.mastodon.activities.AboutActivity"
|
<activity android:name="fr.gouv.etalab.mastodon.activities.AboutActivity"
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class HashTagActivity extends AppCompatActivity implements OnRetrieveFeed
|
||||||
nextElementLoader.setVisibility(View.GONE);
|
nextElementLoader.setVisibility(View.GONE);
|
||||||
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, isOnWifi, behaviorWithAttachments, this.statuses);
|
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, isOnWifi, behaviorWithAttachments, this.statuses);
|
||||||
lv_status.setAdapter(statusListAdapter);
|
lv_status.setAdapter(statusListAdapter);
|
||||||
setTitle(tag);
|
setTitle(String.format("#%s", tag));
|
||||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
|
|
@ -89,7 +89,8 @@ public class MainActivity extends AppCompatActivity
|
||||||
|
|
||||||
private enum actionSwipe{
|
private enum actionSwipe{
|
||||||
RIGHT_TO_LEFT,
|
RIGHT_TO_LEFT,
|
||||||
LEFT_TO_RIGHT
|
LEFT_TO_RIGHT,
|
||||||
|
POP
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -120,7 +121,7 @@ public class MainActivity extends AppCompatActivity
|
||||||
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||||
drawer.setDrawerListener(toggle);
|
drawer.addDrawerListener(toggle);
|
||||||
toggle.syncState();
|
toggle.syncState();
|
||||||
|
|
||||||
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||||
|
@ -428,16 +429,22 @@ public class MainActivity extends AppCompatActivity
|
||||||
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
else
|
else if( currentAction == actionSwipe.LEFT_TO_RIGHT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
|
else
|
||||||
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.fadein, R.anim.fadeout)
|
||||||
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
}else{
|
}else{
|
||||||
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
||||||
else
|
else if( currentAction == actionSwipe.LEFT_TO_RIGHT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
||||||
|
else
|
||||||
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.fadein, R.anim.fadeout)
|
||||||
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
} else if (id == R.id.nav_local) {
|
} else if (id == R.id.nav_local) {
|
||||||
|
@ -450,10 +457,12 @@ public class MainActivity extends AppCompatActivity
|
||||||
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
else
|
else if( currentAction == actionSwipe.LEFT_TO_RIGHT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
|
else
|
||||||
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.fadein, R.anim.fadeout)
|
||||||
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
} else if (id == R.id.nav_global) {
|
} else if (id == R.id.nav_global) {
|
||||||
toot.setVisibility(View.VISIBLE);
|
toot.setVisibility(View.VISIBLE);
|
||||||
statusFragment = new DisplayStatusFragment();
|
statusFragment = new DisplayStatusFragment();
|
||||||
|
@ -464,9 +473,12 @@ public class MainActivity extends AppCompatActivity
|
||||||
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
if( currentAction == actionSwipe.RIGHT_TO_LEFT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
else
|
else if( currentAction == actionSwipe.LEFT_TO_RIGHT)
|
||||||
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left)
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
|
else
|
||||||
|
fragmentManager.beginTransaction().setCustomAnimations(R.anim.fadein, R.anim.fadeout)
|
||||||
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).addToBackStack(fragmentTag).commit();
|
||||||
} else if (id == R.id.nav_settings) {
|
} else if (id == R.id.nav_settings) {
|
||||||
toot.setVisibility(View.GONE);
|
toot.setVisibility(View.GONE);
|
||||||
TabLayoutSettingsFragment tabLayoutSettingsFragment= new TabLayoutSettingsFragment();
|
TabLayoutSettingsFragment tabLayoutSettingsFragment= new TabLayoutSettingsFragment();
|
||||||
|
@ -551,11 +563,23 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage touch event
|
||||||
|
* Allows to swipe from timelines
|
||||||
|
* @param event MotionEvent
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
//Default dispatchTouchEvent is returned when not in timeline page
|
//Default dispatchTouchEvent is returned when not in timeline page
|
||||||
|
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
|
//Menu is opened returns default action
|
||||||
|
if( drawer.isDrawerOpen(GravityCompat.START))
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
//Current screen is not one of the timelines
|
||||||
if( currentScreen >3 || currentScreen < 1)
|
if( currentScreen >3 || currentScreen < 1)
|
||||||
return super.dispatchTouchEvent(event);
|
return super.dispatchTouchEvent(event);
|
||||||
|
|
||||||
switch(event.getAction()){
|
switch(event.getAction()){
|
||||||
case MotionEvent.ACTION_DOWN: {
|
case MotionEvent.ACTION_DOWN: {
|
||||||
downX = event.getX();
|
downX = event.getX();
|
||||||
|
@ -568,12 +592,12 @@ public class MainActivity extends AppCompatActivity
|
||||||
float deltaX = downX - upX;
|
float deltaX = downX - upX;
|
||||||
float deltaY = downY - upY;
|
float deltaY = downY - upY;
|
||||||
// swipe horizontal
|
// swipe horizontal
|
||||||
|
if( downX > MIN_DISTANCE & (Math.abs(deltaX) > MIN_DISTANCE && Math.abs(deltaY) < MIN_DISTANCE)){
|
||||||
if(Math.abs(deltaX) > MIN_DISTANCE && Math.abs(deltaY) < MIN_DISTANCE){
|
|
||||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
|
||||||
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||||
if(deltaX < 0) { switchOnSwipe(actionSwipe.LEFT_TO_RIGHT); drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);return true; }
|
if(deltaX < 0) { switchOnSwipe(actionSwipe.LEFT_TO_RIGHT); drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);return true; }
|
||||||
if(deltaX > 0) { switchOnSwipe(actionSwipe.RIGHT_TO_LEFT); drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);return true; }
|
if(deltaX > 0) { switchOnSwipe(actionSwipe.RIGHT_TO_LEFT); drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);return true; }
|
||||||
|
}else{
|
||||||
|
currentAction = actionSwipe.POP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
@ -64,6 +65,7 @@ import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
||||||
|
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask;
|
||||||
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||||
|
@ -578,7 +580,17 @@ public class Helper {
|
||||||
arrow.setImageResource(R.drawable.ic_arrow_drop_down);
|
arrow.setImageResource(R.drawable.ic_arrow_drop_down);
|
||||||
navigationView.getMenu().clear();
|
navigationView.getMenu().clear();
|
||||||
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
||||||
|
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
Account account = new AccountDAO(activity, db).getAccountByID(userId);
|
||||||
|
if( account != null) {
|
||||||
|
if (account.isLocked()) {
|
||||||
|
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(true);
|
||||||
|
} else {
|
||||||
|
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
menuAccountsOpened = !menuAccountsOpened;
|
menuAccountsOpened = !menuAccountsOpened;
|
||||||
|
|
||||||
|
@ -626,7 +638,7 @@ public class Helper {
|
||||||
* @param imageLoader ImageLoader - instance of ImageLoader
|
* @param imageLoader ImageLoader - instance of ImageLoader
|
||||||
* @param options DisplayImageOptions - current configuration of ImageLoader
|
* @param options DisplayImageOptions - current configuration of ImageLoader
|
||||||
*/
|
*/
|
||||||
public static void updateHeaderAccountInfo(Activity activity, Account account, View headerLayout, ImageLoader imageLoader, DisplayImageOptions options){
|
public static void updateHeaderAccountInfo(final Activity activity, final Account account, View headerLayout, ImageLoader imageLoader, DisplayImageOptions options){
|
||||||
ImageView profilePicture = (ImageView) headerLayout.findViewById(R.id.profilePicture);
|
ImageView profilePicture = (ImageView) headerLayout.findViewById(R.id.profilePicture);
|
||||||
TextView username = (TextView) headerLayout.findViewById(R.id.username);
|
TextView username = (TextView) headerLayout.findViewById(R.id.username);
|
||||||
TextView displayedName = (TextView) headerLayout.findViewById(R.id.displayedName);
|
TextView displayedName = (TextView) headerLayout.findViewById(R.id.displayedName);
|
||||||
|
@ -647,5 +659,18 @@ public class Helper {
|
||||||
displayedName.setText(account.getDisplay_name());
|
displayedName.setText(account.getDisplay_name());
|
||||||
imageLoader.displayImage(account.getAvatar(), profilePicture, options);
|
imageLoader.displayImage(account.getAvatar(), profilePicture, options);
|
||||||
}
|
}
|
||||||
|
profilePicture.setOnClickListener(null);
|
||||||
|
profilePicture.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (account != null) {
|
||||||
|
Intent intent = new Intent(activity, ShowAccountActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putString("accountId", account.getId());
|
||||||
|
intent.putExtras(b);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="0.0"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:duration="1000"
|
||||||
|
/>
|
||||||
|
</set>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="0.0"
|
||||||
|
android:duration="1000"
|
||||||
|
/>
|
||||||
|
</set>
|
|
@ -51,6 +51,32 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- data -->
|
||||||
|
<LinearLayout
|
||||||
|
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">
|
||||||
|
|
||||||
|
<!-- DATA PRIVACY TITLE -->
|
||||||
|
<TextView
|
||||||
|
android:text="@string/privacy_data_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" />
|
||||||
|
<!-- DATA PRIVACY CONTENT -->
|
||||||
|
<TextView
|
||||||
|
android:text="@string/privacy_data"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- App authorizations -->
|
<!-- App authorizations -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -256,6 +256,14 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- PRIVACY -->
|
<!-- PRIVACY -->
|
||||||
|
<string name="privacy_data_title">Données enregistrées</string>
|
||||||
|
<string name="privacy_data">
|
||||||
|
Seules les informations de base des comptes connectés sont enregistrées sur l\'appareil.
|
||||||
|
Ces données sont strictement confidentielles et ne sont utilisables que par l\'application. La suppression de l\'application entraîne immédiatement la suppression de ces données.\n
|
||||||
|
⚠ Les identifiants et les mots de passe ne sont jamais enregistrés, ils ne sont utilisés que lors de l\'authentification sécurisée (SSL) vers l\'instance.
|
||||||
|
|
||||||
|
</string>
|
||||||
|
|
||||||
<string name="privacy_authorizations_title">Autorisations de l\'application</string>
|
<string name="privacy_authorizations_title">Autorisations de l\'application</string>
|
||||||
<string name="privacy_authorizations">
|
<string name="privacy_authorizations">
|
||||||
- <b>ACCESS_NETWORK_STATE</b> : Utilisée pour savoir si l\'appareil est connecté au WIFI.\n
|
- <b>ACCESS_NETWORK_STATE</b> : Utilisée pour savoir si l\'appareil est connecté au WIFI.\n
|
||||||
|
|
Loading…
Reference in New Issue