Some cleaning

This commit is contained in:
stom79 2017-12-17 14:20:04 +01:00
parent 35b5bd770e
commit bff106561b
11 changed files with 20 additions and 27 deletions

View File

@ -18,6 +18,7 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.DividerItemDecoration;
@ -62,7 +63,7 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
private boolean swiped; private boolean swiped;
private RecyclerView lv_accounts; private RecyclerView lv_accounts;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//View for fragment is the same that fragment accounts //View for fragment is the same that fragment accounts
View rootView = inflater.inflate(R.layout.fragment_accounts, container, false); View rootView = inflater.inflate(R.layout.fragment_accounts, container, false);

View File

@ -48,9 +48,6 @@ import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.drawers.ListAdapter; import fr.gouv.etalab.mastodon.drawers.ListAdapter;
import fr.gouv.etalab.mastodon.helper.Helper; import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnListActionInterface; import fr.gouv.etalab.mastodon.interfaces.OnListActionInterface;
import fr.gouv.etalab.mastodon.sqlite.SearchDAO;
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
/** /**
@ -65,8 +62,6 @@ public class DisplayListsFragment extends Fragment implements OnListActionInterf
private List<fr.gouv.etalab.mastodon.client.Entities.List> lists; private List<fr.gouv.etalab.mastodon.client.Entities.List> lists;
private TextView no_action_text; private TextView no_action_text;
private RelativeLayout mainLoader; private RelativeLayout mainLoader;
private ListView lv_lists;
private RelativeLayout textviewNoAction;
private FloatingActionButton add_new; private FloatingActionButton add_new;
private ListAdapter listAdapter; private ListAdapter listAdapter;
@ -80,8 +75,8 @@ public class DisplayListsFragment extends Fragment implements OnListActionInterf
lists = new ArrayList<>(); lists = new ArrayList<>();
lv_lists = rootView.findViewById(R.id.lv_lists); ListView lv_lists = rootView.findViewById(R.id.lv_lists);
textviewNoAction = rootView.findViewById(R.id.no_action); RelativeLayout textviewNoAction = rootView.findViewById(R.id.no_action);
no_action_text = rootView.findViewById(R.id.no_action_text); no_action_text = rootView.findViewById(R.id.no_action_text);
mainLoader = rootView.findViewById(R.id.loader); mainLoader = rootView.findViewById(R.id.loader);
RelativeLayout nextElementLoader = rootView.findViewById(R.id.loading_next_items); RelativeLayout nextElementLoader = rootView.findViewById(R.id.loading_next_items);

View File

@ -26,6 +26,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.PowerManager; import android.os.PowerManager;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -60,7 +61,7 @@ public class DisplayScheduledTootsFragment extends Fragment implements OnRetriev
private TextView warning_battery_message; private TextView warning_battery_message;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_scheduled_toots, container, false); View rootView = inflater.inflate(R.layout.fragment_scheduled_toots, container, false);
context = getContext(); context = getContext();

View File

@ -16,6 +16,7 @@ package fr.gouv.etalab.mastodon.fragments;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -38,10 +39,11 @@ public class SettingsOptimizationFragment extends Fragment {
private Context context; private Context context;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_settings_optimization, container, false); View rootView = inflater.inflate(R.layout.fragment_settings_optimization, container, false);
context = getContext(); context = getContext();
assert context != null;
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);

View File

@ -57,7 +57,7 @@ public class ExpandableHeightListView extends ListView
} }
} }
public void setExpanded(boolean expanded) public void setExpanded(@SuppressWarnings("SameParameterValue") boolean expanded)
{ {
this.expanded = expanded; this.expanded = expanded;
} }

View File

@ -13,6 +13,8 @@ package fr.gouv.etalab.mastodon.jobs;
* *
* You should have received a copy of the GNU General Public License along with Mastalab; if not, * You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.support.annotation.NonNull;
import com.evernote.android.job.Job; import com.evernote.android.job.Job;
import com.evernote.android.job.JobCreator; import com.evernote.android.job.JobCreator;
import com.evernote.android.job.JobManager; import com.evernote.android.job.JobManager;
@ -24,7 +26,7 @@ import com.evernote.android.job.JobManager;
public class ApplicationJob implements JobCreator { public class ApplicationJob implements JobCreator {
@Override @Override
public Job create(String tag) { public Job create(@NonNull String tag) {
switch (tag) { switch (tag) {
case NotificationsSyncJob.NOTIFICATION_REFRESH: case NotificationsSyncJob.NOTIFICATION_REFRESH:
return new NotificationsSyncJob(); return new NotificationsSyncJob();

View File

@ -35,10 +35,6 @@ import com.evernote.android.job.Job;
import com.evernote.android.job.JobManager; import com.evernote.android.job.JobManager;
import com.evernote.android.job.JobRequest; import com.evernote.android.job.JobRequest;
import org.conscrypt.Conscrypt;
import java.security.Provider;
import java.security.Security;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

View File

@ -35,10 +35,6 @@ import com.evernote.android.job.Job;
import com.evernote.android.job.JobManager; import com.evernote.android.job.JobManager;
import com.evernote.android.job.JobRequest; import com.evernote.android.job.JobRequest;
import org.conscrypt.Conscrypt;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;

View File

@ -52,7 +52,7 @@ public class ScheduledTootsSyncJob extends Job {
@NonNull @NonNull
@Override @Override
protected Result onRunJob(Params params) { protected Result onRunJob(@NonNull Params params) {
//Code refresh here //Code refresh here
int jobId = params.getId(); int jobId = params.getId();
SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); SQLiteDatabase db = Sqlite.getInstance(getContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();

View File

@ -1,23 +1,23 @@
package fr.gouv.etalab.mastodon.services; package fr.gouv.etalab.mastodon.services;
import android.annotation.SuppressLint;
import android.app.IntentService; import android.app.IntentService;
import android.content.Intent; import android.content.Intent;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import org.conscrypt.Conscrypt;
import java.security.Security; import fr.gouv.etalab.mastodon.helper.Helper;
/** /**
* Created by Thomas on 13/12/2017. * Created by Thomas on 13/12/2017.
* BaseService class to install provider
*/ */
@SuppressLint("Registered")
public class BaseService extends IntentService { public class BaseService extends IntentService {
static { static {
Security.insertProviderAt(Conscrypt.newProvider("GmsCore_OpenSSL"), 2); Helper.installProvider();
Security.addProvider(Conscrypt.newProvider());
} }
public BaseService(String name) { public BaseService(String name) {

View File

@ -13,7 +13,7 @@ package fr.gouv.etalab.mastodon.services;
* *
* You should have received a copy of the GNU General Public License along with Mastalab; if not, * You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.app.IntentService;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;