diff --git a/app/build.gradle b/app/build.gradle index 3acbcdbec..97e9dbf83 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "fr.gouv.etalab.mastodon" minSdkVersion 15 targetSdkVersion 27 - versionCode 84 - versionName "1.6.4.1" + versionCode 86 + versionName "1.6.5.1" } flavorDimensions "default" buildTypes { @@ -21,7 +21,7 @@ android { productFlavors { fdroid { } - safetynet { + playstore { } } } @@ -44,6 +44,5 @@ dependencies { implementation 'org.jsoup:jsoup:1.10.3' implementation 'com.github.stom79:country-picker-android:1.2.0' implementation 'com.github.stom79:mytransl:1.2' - safetynetImplementation 'com.google.android.gms:play-services-safetynet:11.6.2' - safetynetImplementation 'io.github.kobakei:ratethisapp:1.2.0' + playstoreImplementation 'io.github.kobakei:ratethisapp:1.2.0' } diff --git a/app/fdroid/release/app-fdroid-release-bookmark-5.apk b/app/fdroid/release/app-fdroid-release-bookmark-5.apk new file mode 100644 index 000000000..4dc988b3f Binary files /dev/null and b/app/fdroid/release/app-fdroid-release-bookmark-5.apk differ diff --git a/app/safetynet/release/app-safetynet-release-1.4.9-beta-6.apk b/app/safetynet/release/app-safetynet-release-1.4.9-beta-6.apk deleted file mode 100644 index b9945c41b..000000000 Binary files a/app/safetynet/release/app-safetynet-release-1.4.9-beta-6.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-1.4.9-beta-7.apk b/app/safetynet/release/app-safetynet-release-1.4.9-beta-7.apk deleted file mode 100644 index f03e8d181..000000000 Binary files a/app/safetynet/release/app-safetynet-release-1.4.9-beta-7.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-1.6.0-rc-1.apk b/app/safetynet/release/app-safetynet-release-1.6.0-rc-1.apk deleted file mode 100644 index a2d68f82c..000000000 Binary files a/app/safetynet/release/app-safetynet-release-1.6.0-rc-1.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-1.6.1-fix-test.apk b/app/safetynet/release/app-safetynet-release-1.6.1-fix-test.apk deleted file mode 100644 index 857aea78d..000000000 Binary files a/app/safetynet/release/app-safetynet-release-1.6.1-fix-test.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-1.6.3-fix-cross_actions.apk b/app/safetynet/release/app-safetynet-release-1.6.3-fix-cross_actions.apk deleted file mode 100644 index 0bed43b05..000000000 Binary files a/app/safetynet/release/app-safetynet-release-1.6.3-fix-cross_actions.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-filters.apk b/app/safetynet/release/app-safetynet-release-filters.apk deleted file mode 100644 index 131195686..000000000 Binary files a/app/safetynet/release/app-safetynet-release-filters.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-for-tests.apk b/app/safetynet/release/app-safetynet-release-for-tests.apk new file mode 100644 index 000000000..cedbd01cd Binary files /dev/null and b/app/safetynet/release/app-safetynet-release-for-tests.apk differ diff --git a/app/safetynet/release/app-safetynet-release-test-1.apk b/app/safetynet/release/app-safetynet-release-test-1.apk deleted file mode 100644 index 2b7078007..000000000 Binary files a/app/safetynet/release/app-safetynet-release-test-1.apk and /dev/null differ diff --git a/app/safetynet/release/app-safetynet-release-test-2.apk b/app/safetynet/release/app-safetynet-release-test-2.apk deleted file mode 100644 index d3d5352b0..000000000 Binary files a/app/safetynet/release/app-safetynet-release-test-2.apk and /dev/null differ diff --git a/app/src/fdroid/java/fr.gouv.etalab.mastodon/activities/MainActivity.java b/app/src/fdroid/java/fr.gouv.etalab.mastodon/activities/MainActivity.java index b706ac1cb..fcd637a97 100644 --- a/app/src/fdroid/java/fr.gouv.etalab.mastodon/activities/MainActivity.java +++ b/app/src/fdroid/java/fr.gouv.etalab.mastodon/activities/MainActivity.java @@ -16,10 +16,6 @@ package fr.gouv.etalab.mastodon.activities; public class MainActivity extends BaseMainActivity { - @Override - protected void installProviders() { - // do nothing - } @Override protected void rateThisApp() { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java index 50434d397..d1a61f6c8 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java @@ -151,7 +151,6 @@ public abstract class BaseMainActivity extends AppCompatActivity final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); - installProviders(); final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); if( theme == Helper.THEME_LIGHT){ @@ -576,7 +575,9 @@ public abstract class BaseMainActivity extends AppCompatActivity String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); //Get the previous bookmark value - bookmark = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, null); + //If null try to use the LAST_HOMETIMELINE_MAX_ID + String lastHomeTimeline = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, null); + bookmark = sharedpreferences.getString(Helper.BOOKMARK_ID + userId, lastHomeTimeline); Account account = new AccountDAO(getApplicationContext(), db).getAccountByID(userId); if( account == null){ Helper.logout(getApplicationContext()); @@ -851,7 +852,6 @@ public abstract class BaseMainActivity extends AppCompatActivity new RetrieveInstanceAsyncTask(getApplicationContext(), BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } - protected abstract void installProviders(); protected abstract void rateThisApp(); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java index ff783a4e1..e6956f594 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java @@ -35,7 +35,6 @@ import fr.gouv.etalab.mastodon.R; import fr.gouv.etalab.mastodon.asynctasks.RetrieveInstanceAsyncTask; import fr.gouv.etalab.mastodon.client.APIResponse; import fr.gouv.etalab.mastodon.client.Entities.Instance; -import fr.gouv.etalab.mastodon.client.Entities.InstanceSocial; import fr.gouv.etalab.mastodon.helper.Helper; import fr.gouv.etalab.mastodon.interfaces.OnRetrieveInstanceInterface; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceHealthActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceHealthActivity.java index 00bd71694..93e04b081 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceHealthActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceHealthActivity.java @@ -39,7 +39,6 @@ import android.view.ViewGroup; import android.view.Window; import android.widget.Button; import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseLoginActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java similarity index 96% rename from app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseLoginActivity.java rename to app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java index 7f8fc59e0..b420385c7 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseLoginActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java @@ -56,7 +56,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor; * Login activity class which handles the connection */ -public abstract class BaseLoginActivity extends AppCompatActivity { +public class LoginActivity extends AppCompatActivity { private String client_id; private String client_secret; @@ -71,7 +71,6 @@ public abstract class BaseLoginActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - installProviders(); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); if( theme == Helper.THEME_LIGHT){ @@ -133,9 +132,9 @@ public abstract class BaseLoginActivity extends AppCompatActivity { } login_instance.setAdapter(null); ArrayAdapter adapter = - new ArrayAdapter<>(BaseLoginActivity.this, android.R.layout.simple_list_item_1, instances); + new ArrayAdapter<>(LoginActivity.this, android.R.layout.simple_list_item_1, instances); login_instance.setAdapter(adapter); - if( login_instance.hasFocus() && !BaseLoginActivity.this.isFinishing()) + if( login_instance.hasFocus() && !LoginActivity.this.isFinishing()) login_instance.showDropDown(); } catch (JSONException ignored) {isLoadingInstance = false;} @@ -178,7 +177,6 @@ public abstract class BaseLoginActivity extends AppCompatActivity { }); } - protected abstract void installProviders(); @Override protected void onResume(){ @@ -196,7 +194,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity { try { instance = URLEncoder.encode(login_instance.getText().toString().trim(), "utf-8"); } catch (UnsupportedEncodingException e) { - Toast.makeText(BaseLoginActivity.this,R.string.client_error, Toast.LENGTH_LONG).show(); + Toast.makeText(LoginActivity.this,R.string.client_error, Toast.LENGTH_LONG).show(); } final String action = "/api/v1/apps"; final HashMap parameters = new HashMap<>(); @@ -227,7 +225,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity { connectionButton.setEnabled(true); login_two_step.setVisibility(View.VISIBLE); if( client_id_for_webview){ - Intent i = new Intent(BaseLoginActivity.this, WebviewConnectActivity.class); + Intent i = new Intent(LoginActivity.this, WebviewConnectActivity.class); i.putExtra("instance", instance); startActivity(i); } @@ -278,7 +276,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity { editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token); editor.apply(); //Update the account with the token; - new UpdateAccountInfoAsyncTask(BaseLoginActivity.this, token, instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + new UpdateAccountInfoAsyncTask(LoginActivity.this, token, instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } catch (JSONException ignored) {} } }); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java index b677ccbe6..ae1c8bd06 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java @@ -62,6 +62,7 @@ import android.widget.Toast; import com.bumptech.glide.Glide; +import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; @@ -619,17 +620,22 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi } - Glide.with(getApplicationContext()) - .asBitmap() - .load(account.getAvatar()) - .into(new SimpleTarget() { - @Override - public void onResourceReady(Bitmap resource, Transition transition) { - RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), Helper.addBorder(resource, account_pp.getContext())); - circularBitmapDrawable.setCircular(true); - account_pp.setImageDrawable(circularBitmapDrawable); - } - }); + boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false); + if( !disableGif) + Glide.with(getApplicationContext()).load(account.getAvatar()).apply(RequestOptions.circleCropTransform()).into(account_pp); + else + Glide.with(getApplicationContext()) + .asBitmap() + .load(account.getAvatar()) + .into(new SimpleTarget() { + @Override + public void onResourceReady(Bitmap resource, Transition transition) { + RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), Helper.addBorder(resource, account_pp.getContext())); + circularBitmapDrawable.setCircular(true); + account_pp.setImageDrawable(circularBitmapDrawable); + } + }); + } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java index 0f8d554a5..4126498a8 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/AccountsListAdapter.java @@ -32,8 +32,6 @@ import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; -import com.bumptech.glide.Glide; - import java.util.ArrayList; import java.util.List; @@ -149,10 +147,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA holder.account_fgc.setText(withSuffix(account.getFollowing_count())); holder.account_frc.setText(withSuffix(account.getFollowers_count())); //Profile picture - Glide.with(holder.account_pp.getContext()) - .load(account.getAvatar()) - .into(holder.account_pp); - + Helper.loadGiF(context, account.getAvatar(), holder.account_pp); if( account.isMakingAction()){ holder.account_follow.setEnabled(false); }else { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index ff5ba50e9..4a7b4d812 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -375,9 +375,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct imParams.height = (int) Helper.convertDpToPixel(30, context); imParams.width = (int) Helper.convertDpToPixel(30, context); holder.status_replies_profile_pictures.addView(imageView, imParams); - Glide.with(imageView.getContext()) - .load(replies.getAccount().getAvatar()) - .into(imageView); + Helper.loadGiF(context, replies.getAccount().getAvatar(), imageView); i++; addedPictures.add(replies.getAccount().getAcct()); } @@ -602,19 +600,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct Helper.absoluteDateTimeReveal(context, holder.status_toot_date, status.getCreated_at()); if( status.getReblog() != null) { - Glide.with(holder.status_account_profile_boost.getContext()) - .load(ppurl) - .into(holder.status_account_profile_boost); - Glide.with(holder.status_account_profile_boost_by.getContext()) - .load(status.getAccount().getAvatar()) - .into(holder.status_account_profile_boost_by); + Helper.loadGiF(context, ppurl, holder.status_account_profile_boost); + Helper.loadGiF(context, status.getAccount().getAvatar(), holder.status_account_profile_boost_by); holder.status_account_profile_boost.setVisibility(View.VISIBLE); holder.status_account_profile_boost_by.setVisibility(View.VISIBLE); holder.status_account_profile.setVisibility(View.GONE); }else{ - Glide.with(holder.status_account_profile.getContext()) - .load(ppurl) - .into(holder.status_account_profile); + Helper.loadGiF(context, ppurl, holder.status_account_profile); holder.status_account_profile_boost.setVisibility(View.GONE); holder.status_account_profile_boost_by.setVisibility(View.GONE); holder.status_account_profile.setVisibility(View.VISIBLE); @@ -911,7 +903,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct holder.status_favorite_count.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { - CrossActions.doCrossAction(context, status, (status.isFavourited()|| (status.getReblog() != null && status.getReblog().isFavourited()))? API.StatusAction.UNFAVOURITE:API.StatusAction.FAVOURITE, statusListAdapter, StatusListAdapter.this, false); + CrossActions.doCrossAction(context, status, API.StatusAction.FAVOURITE, statusListAdapter, StatusListAdapter.this, false); return true; } }); @@ -919,19 +911,12 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct holder.status_reblog_count.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { - CrossActions.doCrossAction(context, status, (status.isReblogged()|| (status.getReblog() != null && status.getReblog().isReblogged()))? API.StatusAction.UNREBLOG:API.StatusAction.REBLOG, statusListAdapter, StatusListAdapter.this, false); + CrossActions.doCrossAction(context, status, API.StatusAction.REBLOG, statusListAdapter, StatusListAdapter.this, false); return true; } }); - holder.status_pin.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View view) { - CrossActions.doCrossAction(context, status, (status.isPinned()|| (status.getReblog() != null && status.getReblog().isPinned()))? API.StatusAction.UNPIN:API.StatusAction.PIN, statusListAdapter, StatusListAdapter.this, true); - return false; - } - }); - + holder.yandex_translate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java index aef80a33e..c39579b33 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayStatusFragment.java @@ -72,6 +72,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn private boolean showMediaOnly, showPinned; private Intent streamingFederatedIntent, streamingLocalIntent; LinearLayoutManager mLayoutManager; + boolean firstTootsLoaded; public DisplayStatusFragment(){ } @@ -83,6 +84,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn context = getContext(); Bundle bundle = this.getArguments(); showMediaOnly = false; + //Will allow to load first toots if bookmark != null + firstTootsLoaded = true; showPinned = false; if (bundle != null) { type = (RetrieveFeedsAsyncTask.Type) bundle.get("type"); @@ -95,7 +98,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn flag_loading = true; firstLoad = true; swiped = false; - assert context != null; final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); boolean isOnWifi = Helper.isOnWIFI(context); @@ -117,10 +119,10 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { public void onScrolled(RecyclerView recyclerView, int dx, int dy) { + int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); if(dy > 0){ int visibleItemCount = mLayoutManager.getChildCount(); int totalItemCount = mLayoutManager.getItemCount(); - int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); if(firstVisibleItem + visibleItemCount == totalItemCount && context != null) { if(!flag_loading ) { flag_loading = true; @@ -137,6 +139,14 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn nextElementLoader.setVisibility(View.GONE); } } + if(statuses != null && statuses.size() > firstVisibleItem ) + if( context instanceof BaseMainActivity){ + SharedPreferences.Editor editor = sharedpreferences.edit(); + String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); + Long bookmarkL = Long.parseLong(statuses.get(firstVisibleItem).getId()) + 1; + editor.putString(Helper.BOOKMARK_ID + userId, String.valueOf(bookmarkL)); + editor.apply(); + } } }); @@ -169,16 +179,17 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn 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); if( type == RetrieveFeedsAsyncTask.Type.HOME ){ String bookmark; if( context instanceof BaseMainActivity){ bookmark = ((BaseMainActivity) context).getBookmark(); if( bookmark != null) { - new RetrieveFeedsAsyncTask(context, RetrieveFeedsAsyncTask.Type.ONESTATUS, bookmark,null, false,false, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, bookmark, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + firstTootsLoaded = false; } } + }else { + asyncTask = new RetrieveFeedsAsyncTask(context, type, null, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } }else { @@ -191,16 +202,17 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn 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); if( type == RetrieveFeedsAsyncTask.Type.HOME ){ String bookmark; if( context instanceof BaseMainActivity){ bookmark = ((BaseMainActivity) context).getBookmark(); if( bookmark != null) { - new RetrieveFeedsAsyncTask(context, RetrieveFeedsAsyncTask.Type.ONESTATUS, bookmark,null, false,false, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrieveFeedsAsyncTask(context, type, bookmark, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + firstTootsLoaded = false; } } + }else { + asyncTask = new RetrieveFeedsAsyncTask(context, type, null, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } } @@ -252,8 +264,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn } int previousPosition = this.statuses.size(); List statuses = apiResponse.getStatuses(); - max_id = apiResponse.getMax_id(); - + if( type == RetrieveFeedsAsyncTask.Type.HOME) { + if (max_id == null || (apiResponse.getMax_id() != null && Long.parseLong(max_id) > Long.parseLong(apiResponse.getMax_id()))) + max_id = apiResponse.getMax_id(); + }else { + max_id = apiResponse.getMax_id(); + } flag_loading = (max_id == null ); if( !swiped && firstLoad && (statuses == null || statuses.size() == 0)) textviewNoAction.setVisibility(View.VISIBLE); @@ -269,50 +285,48 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn } swiped = false; } - + //First toot are loaded as soon as the bookmark has been retrieved + if( type == RetrieveFeedsAsyncTask.Type.HOME && !firstTootsLoaded){ + asyncTask = new RetrieveFeedsAsyncTask(context, type, null, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + firstTootsLoaded = true; + } if( statuses != null && statuses.size() > 0) { if (type == RetrieveFeedsAsyncTask.Type.HOME) { String bookmark = null; if( context instanceof BaseMainActivity){ bookmark = ((BaseMainActivity) context).getBookmark(); } - //Toots are older than the bookmark -> no special treatment with them - if( bookmark == null || Long.parseLong(statuses.get(0).getId()) < Long.parseLong(bookmark)){ + if( bookmark == null || Long.parseLong(statuses.get(0).getId())+1 < Long.parseLong(bookmark)){ this.statuses.addAll(statuses); statusListAdapter.notifyItemRangeInserted(previousPosition, statuses.size()); }else { //Toots are younger than the bookmark - int lastLoop = 0; + String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); + String currentMaxId = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, null); + int position = 0; + while (position < this.statuses.size() && Long.parseLong(statuses.get(0).getId()) < Long.parseLong(this.statuses.get(position).getId())) { + position++; + } + ArrayList tmpStatuses = new ArrayList<>(); for (Status tmpStatus : statuses) { //Mark status at new ones when their id is greater than the bookmark id / Also increments counter - if (Long.parseLong(tmpStatus.getId()) > Long.parseLong(bookmark)) { + if (currentMaxId != null && Long.parseLong(tmpStatus.getId()) > Long.parseLong(currentMaxId)) { tmpStatus.setNew(true); MainActivity.countNewStatus++; } //Put the toot at its place in the list (id desc) - if (this.statuses != null) { - int loop = 0; - while (loop < this.statuses.size() && Long.parseLong(tmpStatus.getId()) < Long.parseLong(this.statuses.get(loop).getId())) { - loop++; - } - if(Long.parseLong(statuses.get(0).getId()) != Long.parseLong(bookmark) ) { - if( !this.statuses.contains(tmpStatus) ) { //Element not already addeds - this.statuses.add(loop, tmpStatus); - statusListAdapter.notifyItemInserted(loop); - - if (Long.parseLong(tmpStatus.getId()) > Long.parseLong(bookmark) && loop > lastLoop) - lastLoop = loop; //Record the last position of the inserted toot in this.statuses - - } - } + if( !this.statuses.contains(tmpStatus) ) { //Element not already addeds + tmpStatuses.add(tmpStatus); } + } + if (tmpStatuses.size() > 0 && Long.parseLong(tmpStatuses.get(tmpStatuses.size()-1).getId()) > Long.parseLong(bookmark)) { + tmpStatuses.get(tmpStatuses.size()-1).setFetchMore(true); } - if (Long.parseLong(statuses.get((statuses.size() - 1)).getId()) > Long.parseLong(bookmark)) { - statuses.get(statuses.size() - 1).setFetchMore(true); - } - if( lastLoop > 0 ) //Moves to the bookmark - lv_status.scrollToPosition((lastLoop)); + this.statuses.addAll(position, tmpStatuses); + statusListAdapter.notifyItemRangeInserted(position, tmpStatuses.size()); + + lv_status.scrollToPosition(position+tmpStatuses.size()); } }else { @@ -322,12 +336,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME && statuses.size() > 0) { //Update the id of the last toot retrieved MainActivity.lastHomeId = statuses.get(0).getId(); - SharedPreferences.Editor editor = sharedpreferences.edit(); - String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); - editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId()); - editor.apply(); + updateMaxId(statuses.get(0).getId()); } - if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME) + if( type == RetrieveFeedsAsyncTask.Type.HOME) //Display new value in counter try { ((MainActivity) context).updateHomeCounter(); @@ -442,11 +453,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn return; //Store last toot id for home timeline to avoid to notify for those that have been already seen if (type == RetrieveFeedsAsyncTask.Type.HOME && visible && statuses != null && statuses.size() > 0) { - SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); - editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId()); - editor.apply(); + updateMaxId(statuses.get(0).getId()); } else if( type == RetrieveFeedsAsyncTask.Type.PUBLIC ){ if (visible) { SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); @@ -517,11 +524,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn lv_status.setAdapter(statusListAdapter); //Store last toot id for home timeline to avoid to notify for those that have been already seen if (type == RetrieveFeedsAsyncTask.Type.HOME && statuses != null && statuses.size() > 0) { - SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = sharedpreferences.edit(); - String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); - editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId()); - editor.apply(); + updateMaxId(statuses.get(0).getId()); } } } @@ -557,4 +560,17 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn public void fetchMore(String max_id){ asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } + + private void updateMaxId(String max_id){ + if( max_id == null) + return; + SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); + String currentMaxId = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, null); + if( currentMaxId == null || Long.parseLong(max_id) > Long.parseLong(currentMaxId)) { + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, max_id); + editor.apply(); + } + } } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java index 33c571375..b40414a14 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java @@ -216,6 +216,19 @@ public class SettingsFragment extends Fragment { } }); + boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false); + final CheckBox set_disable_gif = rootView.findViewById(R.id.set_disable_gif); + set_disable_gif.setChecked(disableGif); + set_disable_gif.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putBoolean(Helper.SET_DISABLE_GIF, set_disable_gif.isChecked()); + editor.apply(); + } + }); + + boolean livenotif = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true); final CheckBox set_live_notif = rootView.findViewById(R.id.set_live_notify); set_live_notif.setChecked(livenotif); @@ -235,6 +248,7 @@ public class SettingsFragment extends Fragment { }); + boolean display_global = sharedpreferences.getBoolean(Helper.SET_DISPLAY_GLOBAL, true); final CheckBox set_display_global = rootView.findViewById(R.id.set_display_global); set_display_global.setChecked(display_global); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index f55a3247d..16fd272a5 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -180,6 +180,8 @@ public class Helper { public static final String SHOW_BATTERY_SAVER_MESSAGE = "show_battery_saver_message"; 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 BOOKMARK_ID = "bookmark_id"; + public static final String LAST_HOMETIMELINE_NOTIFICATION_MAX_ID = "last_hometimeline_notification_max_id"; public static final String SHOULD_CONTINUE_STREAMING = "should_continue_streaming"; public static final String SHOULD_CONTINUE_STREAMING_FEDERATED = "should_continue_streaming_federated"; public static final String SHOULD_CONTINUE_STREAMING_LOCAL = "should_continue_streaming_local"; @@ -214,6 +216,7 @@ public class Helper { public static final String INSTANCE_VERSION = "instance_version"; public static final String SET_LIVE_NOTIFICATIONS = "set_show_replies"; public static final String SET_PICTURE_URL = "set_picture_url"; + public static final String SET_DISABLE_GIF = "set_disable_gif"; public static final int ATTACHMENT_ALWAYS = 1; public static final int ATTACHMENT_WIFI = 2; public static final int ATTACHMENT_ASK = 3; @@ -574,8 +577,11 @@ public class Helper { return context.getResources().getQuantityString(R.plurals.date_hours, (int)hours, (int)hours); else if(minutes > 0) return context.getResources().getQuantityString(R.plurals.date_minutes, (int)minutes, (int)minutes); - else - return context.getResources().getQuantityString(R.plurals.date_seconds, (int)seconds, (int)seconds); + else { + if (seconds < 0) + seconds = 0; + return context.getResources().getQuantityString(R.plurals.date_seconds, (int) seconds, (int) seconds); + } } /*** @@ -1669,4 +1675,26 @@ public class Helper { return output; } + + public static void loadGiF(final Context context, String url, final ImageView imageView){ + SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false); + + if( !disableGif) + Glide.with(imageView.getContext()) + .load(url) + .into(imageView); + else + Glide.with(context) + .asBitmap() + .load(url) + .into(new SimpleTarget() { + @Override + public void onResourceReady(Bitmap resource, Transition transition) { + imageView.setImageBitmap(resource); + } + }); + } + + } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/jobs/HomeTimelineSyncJob.java b/app/src/main/java/fr/gouv/etalab/mastodon/jobs/HomeTimelineSyncJob.java index 04836469f..dd5b4a044 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/jobs/HomeTimelineSyncJob.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/jobs/HomeTimelineSyncJob.java @@ -69,7 +69,7 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe @NonNull @Override - protected Result onRunJob(Params params) { + protected Result onRunJob(@NonNull Params params) { callAsynchronousTask(); return Result.SUCCESS; } @@ -117,8 +117,17 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe return; //Retrieve users in db that owner has. for (Account account: accounts) { - String since_id = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + account.getId(), null); - new RetrieveHomeTimelineServiceAsyncTask(getContext(), account.getInstance(), account.getToken(), since_id, account.getAcct(), account.getId(), HomeTimelineSyncJob.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + String max_id = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_NOTIFICATION_MAX_ID + account.getId(), null); + String lastHomeSeen = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + account.getId(), null); + if( lastHomeSeen != null && max_id != null){ + if( Long.parseLong(lastHomeSeen) > Long.parseLong(max_id)){ + max_id = lastHomeSeen; + SharedPreferences.Editor editor = sharedpreferences.edit(); + editor.putString(Helper.LAST_HOMETIMELINE_NOTIFICATION_MAX_ID + account.getId(), max_id); + editor.apply(); + } + } + new RetrieveHomeTimelineServiceAsyncTask(getContext(), account.getInstance(), account.getToken(), max_id, account.getAcct(), account.getId(), HomeTimelineSyncJob.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } @@ -132,7 +141,7 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe return; final SharedPreferences sharedpreferences = getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - final String max_id = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, null); + final String max_id = sharedpreferences.getString(Helper.LAST_HOMETIMELINE_NOTIFICATION_MAX_ID + userId, null); //No previous notifications in cache, so no notification will be sent String message; @@ -179,7 +188,7 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe notify_user(getContext(), intent, notificationId, BitmapFactory.decodeResource(getContext().getResources(), R.drawable.mastodonlogo), finalTitle, finalMessage); SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId()); + editor.putString(Helper.LAST_HOMETIMELINE_NOTIFICATION_MAX_ID + userId, statuses.get(0).getId()); editor.apply(); return false; } @@ -189,7 +198,7 @@ public class HomeTimelineSyncJob extends Job implements OnRetrieveHomeTimelineSe public void onResourceReady(Bitmap resource, Transition transition) { notify_user(getContext(), intent, notificationId, resource, finalTitle, finalMessage); SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId()); + editor.putString(Helper.LAST_HOMETIMELINE_NOTIFICATION_MAX_ID + userId, statuses.get(0).getId()); editor.apply(); } }); diff --git a/app/src/main/res/drawable-anydpi/ic_g_translate.xml b/app/src/main/res/drawable-anydpi/ic_g_translate.xml deleted file mode 100644 index 9bce8cfab..000000000 --- a/app/src/main/res/drawable-anydpi/ic_g_translate.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable-anydpi/ic_translate.xml b/app/src/main/res/drawable-anydpi/ic_translate.xml new file mode 100644 index 000000000..f686f7ef3 --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_translate.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable-hdpi/ic_g_translate.png b/app/src/main/res/drawable-hdpi/ic_g_translate.png deleted file mode 100644 index 857418ff8..000000000 Binary files a/app/src/main/res/drawable-hdpi/ic_g_translate.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_translate.png b/app/src/main/res/drawable-hdpi/ic_translate.png index f1cc55bb2..363760b83 100644 Binary files a/app/src/main/res/drawable-hdpi/ic_translate.png and b/app/src/main/res/drawable-hdpi/ic_translate.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_g_translate.png b/app/src/main/res/drawable-ldpi/ic_g_translate.png deleted file mode 100644 index e19363c59..000000000 Binary files a/app/src/main/res/drawable-ldpi/ic_g_translate.png and /dev/null differ diff --git a/app/src/main/res/drawable-ldpi/ic_translate.png b/app/src/main/res/drawable-ldpi/ic_translate.png index b7c0d7465..df3dc8a16 100644 Binary files a/app/src/main/res/drawable-ldpi/ic_translate.png and b/app/src/main/res/drawable-ldpi/ic_translate.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_g_translate.png b/app/src/main/res/drawable-mdpi/ic_g_translate.png deleted file mode 100644 index cea69475c..000000000 Binary files a/app/src/main/res/drawable-mdpi/ic_g_translate.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_translate.png b/app/src/main/res/drawable-mdpi/ic_translate.png index e41e622fd..039c74444 100644 Binary files a/app/src/main/res/drawable-mdpi/ic_translate.png and b/app/src/main/res/drawable-mdpi/ic_translate.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_g_translate.png b/app/src/main/res/drawable-xhdpi/ic_g_translate.png deleted file mode 100644 index e5bb40459..000000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_g_translate.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_translate.png b/app/src/main/res/drawable-xhdpi/ic_translate.png index 998c7e231..4c61d28af 100644 Binary files a/app/src/main/res/drawable-xhdpi/ic_translate.png and b/app/src/main/res/drawable-xhdpi/ic_translate.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_g_translate.png b/app/src/main/res/drawable-xxhdpi/ic_g_translate.png deleted file mode 100644 index 75328d007..000000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_g_translate.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_translate.png b/app/src/main/res/drawable-xxhdpi/ic_translate.png index 74de2cd97..0954d8b3f 100644 Binary files a/app/src/main/res/drawable-xxhdpi/ic_translate.png and b/app/src/main/res/drawable-xxhdpi/ic_translate.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_g_translate.png b/app/src/main/res/drawable-xxxhdpi/ic_g_translate.png deleted file mode 100644 index 69ba150df..000000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_g_translate.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_translate.png b/app/src/main/res/drawable-xxxhdpi/ic_translate.png index ec887d74b..8406ba55e 100644 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_translate.png and b/app/src/main/res/drawable-xxxhdpi/ic_translate.png differ diff --git a/app/src/main/res/drawable/circle_background_white.xml b/app/src/main/res/drawable/circle_background_white.xml new file mode 100644 index 000000000..c0b807990 --- /dev/null +++ b/app/src/main/res/drawable/circle_background_white.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/activity_show_account.xml b/app/src/main/res/layout-sw600dp/activity_show_account.xml index 66413d3b0..cebf63edd 100644 --- a/app/src/main/res/layout-sw600dp/activity_show_account.xml +++ b/app/src/main/res/layout-sw600dp/activity_show_account.xml @@ -53,11 +53,13 @@ app:layout_collapseMode="parallax" tools:ignore="ContentDescription" /> + + + + + + + + Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index e2787a023..7f6f22b5a 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -444,4 +444,5 @@ البحث حذف تحميل المزيد من التبويقات ... + Disable GIF avatars diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 70b26fb5d..54fdc7400 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -422,4 +422,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f6b5e21e3..c05b2a00a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -403,4 +403,5 @@ Suche Löschen Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 30391ddb6..e817ca434 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -413,4 +413,5 @@ Rechercher Supprimer Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index 1aae7f1af..03ce02287 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -430,4 +430,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index cb04b2c0a..760b23546 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -407,4 +407,5 @@ https://yandex.ru/legal/confidential/?lang=en Cari Hapus Ambil lebih banyak kutipan… + Disable GIF avatars diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index cc7d54d4a..55ceb38b7 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -406,4 +406,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index cc7d54d4a..55ceb38b7 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -406,4 +406,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index c592079cb..160ec0b33 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -414,4 +414,5 @@ Zoeken Verwijderen Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index d5f5161ea..284719d7b 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 70b26fb5d..54fdc7400 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -422,4 +422,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index ebe42afbb..1be3029b1 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -414,4 +414,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 7a89af2fa..6d3010f60 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -417,5 +417,6 @@ Vă mulțumesc: Filtrează expresii usuale Căutare Șterge - Fetch more toots… +Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 70b26fb5d..c00891b97 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -421,5 +421,6 @@ Filter out by regular expressions Search Delete - Fetch more toots… +Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 70b26fb5d..c00891b97 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -421,5 +421,6 @@ Filter out by regular expressions Search Delete - Fetch more toots… +Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index d5f5161ea..cc4ff60a3 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -413,5 +413,6 @@ Filter out by regular expressions Search Delete - Fetch more toots… +Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 64118b43e..742dd1f7c 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -405,5 +405,6 @@ Teşekkürler: Düzenli ifadelerle filtreleme Search Delete - Fetch more toots… +Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 70b26fb5d..c00891b97 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -421,5 +421,6 @@ Filter out by regular expressions Search Delete - Fetch more toots… +Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index ab37a23e0..f58a82eb8 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -405,4 +405,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index aad0de2e7..ad139742f 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -398,4 +398,5 @@ Search Delete Fetch more toots… + Disable GIF avatars diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 24c17eec5..e74902015 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -300,6 +300,7 @@ Display previous message in responses Display local timeline Display federated timeline + Disable GIF avatars Path: Save drafts automatically Display counters diff --git a/app/src/fdroid/java/fr.gouv.etalab.mastodon/activities/LoginActivity.java b/app/src/playstore/java/fr.gouv.etalab.mastodon/activities/MainActivity.java similarity index 77% rename from app/src/fdroid/java/fr.gouv.etalab.mastodon/activities/LoginActivity.java rename to app/src/playstore/java/fr.gouv.etalab.mastodon/activities/MainActivity.java index 613d225ba..eca35c05f 100644 --- a/app/src/fdroid/java/fr.gouv.etalab.mastodon/activities/LoginActivity.java +++ b/app/src/playstore/java/fr.gouv.etalab.mastodon/activities/MainActivity.java @@ -14,14 +14,16 @@ * see . */ package fr.gouv.etalab.mastodon.activities; -/** - * Created by Thomas on 23/04/2017. - * Login activity class which handles the connection - */ -public class LoginActivity extends BaseLoginActivity { +import com.kobakei.ratethisapp.RateThisApp; + + +public class MainActivity extends BaseMainActivity { + @Override - protected void installProviders() { - // do nothing + protected void rateThisApp() { + RateThisApp.onCreate(this); + RateThisApp.showRateDialogIfNeeded(this); } -} \ No newline at end of file + +} diff --git a/app/src/safetynet/java/fr.gouv.etalab.mastodon/activities/LoginActivity.java b/app/src/safetynet/java/fr.gouv.etalab.mastodon/activities/LoginActivity.java deleted file mode 100644 index dd0897d91..000000000 --- a/app/src/safetynet/java/fr.gouv.etalab.mastodon/activities/LoginActivity.java +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2017 Thomas Schneider - * - * This file is a part of Mastalab - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. - * - * Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Mastalab; if not, - * see . */ -package fr.gouv.etalab.mastodon.activities; - -import android.content.DialogInterface; -import android.content.Intent; - -import com.google.android.gms.common.GooglePlayServicesUtil; -import com.google.android.gms.security.ProviderInstaller; - - -/** - * Created by Thomas on 23/04/2017. - * Login activity class which handles the connection - */ - -public class LoginActivity extends BaseLoginActivity implements ProviderInstaller.ProviderInstallListener { - - private static final int ERROR_DIALOG_REQUEST_CODE = 97; - - @Override - protected void installProviders() { - ProviderInstaller.installIfNeededAsync(this, this); - } - - @Override - public void onProviderInstalled() { - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, - Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == ERROR_DIALOG_REQUEST_CODE) { - // Adding a fragment via GooglePlayServicesUtil.showErrorDialogFragment - // before the instance state is restored throws an error. So instead, - // set a flag here, which will cause the fragment to delay until - // onPostResume. - } - } - - - @Override - public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) { - if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) { - // Recoverable error. Show a dialog prompting the user to - // install/update/enable Google Play services. - GooglePlayServicesUtil.showErrorDialogFragment( - errorCode, - this, - ERROR_DIALOG_REQUEST_CODE, - new DialogInterface.OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - // The user chose not to take the recovery action - onProviderInstallerNotAvailable(); - } - }); - } else { - // Google Play services is not available. - onProviderInstallerNotAvailable(); - } - } - - private void onProviderInstallerNotAvailable() { - // This is reached if the provider cannot be updated for some reason. - // App should consider all HTTP communication to be vulnerable, and take - // appropriate action. - } -} \ No newline at end of file diff --git a/app/src/safetynet/java/fr.gouv.etalab.mastodon/activities/MainActivity.java b/app/src/safetynet/java/fr.gouv.etalab.mastodon/activities/MainActivity.java deleted file mode 100644 index 5254030ee..000000000 --- a/app/src/safetynet/java/fr.gouv.etalab.mastodon/activities/MainActivity.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2017 Thomas Schneider - * - * This file is a part of Mastalab - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. - * - * Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Mastalab; if not, - * see . */ -package fr.gouv.etalab.mastodon.activities; - -import android.content.DialogInterface; -import android.content.Intent; - -import com.google.android.gms.common.GooglePlayServicesUtil; -import com.google.android.gms.security.ProviderInstaller; -import com.kobakei.ratethisapp.RateThisApp; - - -public class MainActivity extends BaseMainActivity - implements ProviderInstaller.ProviderInstallListener { - private static final int ERROR_DIALOG_REQUEST_CODE = 97; - - @Override - protected void rateThisApp() { - RateThisApp.onCreate(this); - RateThisApp.showRateDialogIfNeeded(this); - } - - @Override - protected void installProviders() { - ProviderInstaller.installIfNeededAsync(this, this); - } - - @Override - public void onProviderInstalled() { - - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, - Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == ERROR_DIALOG_REQUEST_CODE) { - // Adding a fragment via GooglePlayServicesUtil.showErrorDialogFragment - // before the instance state is restored throws an error. So instead, - // set a flag here, which will cause the fragment to delay until - // onPostResume. - } - } - - - @Override - public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) { - if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) { - // Recoverable error. Show a dialog prompting the user to - // install/update/enable Google Play services. - GooglePlayServicesUtil.showErrorDialogFragment( - errorCode, - this, - ERROR_DIALOG_REQUEST_CODE, - new DialogInterface.OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - // The user chose not to take the recovery action - onProviderInstallerNotAvailable(); - } - }); - } else { - // Google Play services is not available. - onProviderInstallerNotAvailable(); - } - } - - private void onProviderInstallerNotAvailable() { - // This is reached if the provider cannot be updated for some reason. - // App should consider all HTTP communication to be vulnerable, and take - // appropriate action. - } -}