1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2025-12-15 00:31:11 +01:00

Fixed a ton of lint issues

This commit is contained in:
vanitasvitae 2016-11-08 20:41:53 +01:00
parent 72a41a0b8a
commit 527912e49b
Signed by: vanitasvitae
GPG key ID: DCCFB3302C9E4615
49 changed files with 29 additions and 313 deletions

View file

@ -24,7 +24,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
@ -69,11 +68,8 @@ import butterknife.OnClick;
public class AboutActivity extends ThemedActivity
implements IntellihideToolbarActivityListener {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@BindView(R.id.about__appbar)
AppBarLayout appBarLayout;
protected AppBarLayout appBarLayout;
@BindView(R.id.main__topbar)
protected Toolbar toolbar;
@ -100,10 +96,10 @@ public class AboutActivity extends ThemedActivity
});
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = ButterKnife.findById(this, R.id.container);
ViewPager mViewPager = ButterKnife.findById(this, R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
tabLayout.setupWithViewPager(mViewPager);
@ -289,9 +285,8 @@ public class AboutActivity extends ThemedActivity
}
public String getContributorsHtml(Context context) {
String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors,
return Helpers.readTextfileFromRawRessource(context, R.raw.contributors,
"<font color='" + accentColor + "'><b>*</b></font> ", "<br>");
return text;
}
public String getMaintainersHtml(Context context) {
@ -390,7 +385,6 @@ public class AboutActivity extends ThemedActivity
try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
AppSettings appSettings = ((App) getActivity().getApplication()).getSettings();
DiasporaUrlHelper urls = new DiasporaUrlHelper(appSettings);
packageName.setText(pInfo.packageName);
appVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName + " (" + pInfo.versionCode + ")"));

View file

@ -113,10 +113,10 @@ public class AspectListFragment extends ThemedFragment implements OnSomethingCli
}
public static class AspectAdapter extends RecyclerView.Adapter<AspectAdapter.ViewHolder> {
private AppSettings appSettings;
private DiasporaAspect[] aspectList;
private List<String> aspectFavsList;
private OnSomethingClickListener<Object> aspectClickedListener;
private final AppSettings appSettings;
private final DiasporaAspect[] aspectList;
private final List<String> aspectFavsList;
private final OnSomethingClickListener<Object> aspectClickedListener;
static class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.recycler_view__list_item__text)

View file

@ -34,7 +34,6 @@ import android.support.customtabs.CustomTabsSession;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.GravityCompat;
@ -762,7 +761,7 @@ public class MainActivity extends ThemedActivity
if (WebHelper.isOnline(MainActivity.this)) {
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
View layout = getLayoutInflater().inflate(R.layout.ui__dialog_search__people_tags, null, false);
@SuppressLint("InflateParams") View layout = getLayoutInflater().inflate(R.layout.ui__dialog_search__people_tags, null, false);
final EditText input = (EditText) layout.findViewById(R.id.dialog_search__input);
ThemeHelper.updateEditTextColor(input);
final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
@ -896,7 +895,7 @@ public class MainActivity extends ThemedActivity
AppLog.v(this, "Set shared text; Subject: \"" + escapedSubject + "\" Body: \"" + escapedBody + "\"");
textToBeShared = "**" + escapedSubject + "** " + escapedBody;
} else {
AppLog.v(this, "Set shared text; Subject: \"" + sharedSubject + "\" Body: \"" + sharedBody + "\"");
AppLog.v(this, "Set shared text; Subject: \"null\" Body: \"" + sharedBody + "\"");
textToBeShared = escapedBody;
}
}
@ -1112,7 +1111,7 @@ public class MainActivity extends ThemedActivity
/**
* Set the string that will be shared into the new-post-editor
*
* @param textToBeShared
* @param textToBeShared text that will be shared into the post-editor
*/
public void setTextToBeShared(String textToBeShared) {
this.textToBeShared = textToBeShared;

View file

@ -330,9 +330,7 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
}
public DiasporaPod appendMainLangs(String... values) {
for (String mainLang : values) {
this.mainLangs.add(mainLang);
}
Collections.addAll(this.mainLangs, values);
return this;
}
@ -347,9 +345,7 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
}
public DiasporaPod appendPodUrls(DiasporaPodUrl... values) {
for (DiasporaPodUrl value : values) {
this.podUrls.add(value);
}
Collections.addAll(this.podUrls, values);
return this;
}
@ -411,7 +407,7 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
/**
* Get the base url
*
* @return
* @return base url with port
*/
public String getBaseUrl() {
return protocol + "://" + host + (isPortNeeded() ? port : "");

View file

@ -53,7 +53,7 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
Uri url = null;
Uri url;
try {
String sUrl = receiveIntent.getStringExtra(MainActivity.EXTRA_URL);
url = Uri.parse(sUrl);

View file

@ -1,95 +0,0 @@
/*
This file is part of the Diaspora for Android.
Diaspora for Android 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.
Diaspora for Android 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 the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.dfa.diaspora_android.service;
import android.content.Context;
import android.os.AsyncTask;
import android.webkit.CookieManager;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher;
/**
* AsyncTask to fetch a users profile
*/
public class StatisticsFetchTask extends AsyncTask<Void, Void, Void> {
// Code for getting the profile async without any UI/WebView
// TODO: This is an early version,needs to be converted to Service
private final App app;
private final Context context;
private final DiasporaUrlHelper urls;
public StatisticsFetchTask(final App app) {
this.context = app.getApplicationContext();
this.app = app;
this.urls = new DiasporaUrlHelper(app.getSettings());
}
@Override
protected Void doInBackground(Void... params) {
String extractedProfileData = null;
final CookieManager cookieManager = app.getCookieManager();
String cookies = cookieManager.getCookie(urls.getPodUrl());
HttpsURLConnection connection;
InputStream inStream;
try {
URL url = new URL(urls.getStatisticsUrl());
connection = NetCipher.getHttpsURLConnection(url);
connection.setReadTimeout(10000);
connection.setConnectTimeout(15000);
connection.setRequestMethod("GET");
if (cookies != null) {
connection.setRequestProperty("Cookie", cookies);
}
connection.connect();
inStream = connection.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inStream));
String line;
while ((line = br.readLine()) != null) {
AppLog.d(this, "STATS: " + line);
}
try {
br.close();
inStream.close();
} catch (IOException e) {/*Nothing*/}
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -36,12 +36,13 @@ import butterknife.OnClick;
import butterknife.OnItemSelected;
/**
* Dialog that helps the user configure a pod
* Created by gsantner (https://gsantner.github.io) on 06.10.16.
*/
public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
public static final String TAG = "com.github.dfa.diaspora_android.ui.PodSelectionDialog";
public static interface PodSelectionDialogResultListener {
public interface PodSelectionDialogResultListener {
void onPodSelectionDialogResult(DiasporaPod pod, boolean accepted);
}
@ -127,7 +128,7 @@ public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
spinnerProfile.setVisibility(View.VISIBLE);
String[] podUrlss = new String[podUrls.size()];
for (int i = 0; i < podUrls.size(); podUrlss[i] = podUrls.get(i++).getBaseUrl()) ;
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, podUrlss);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, podUrlss);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerProfile.setAdapter(spinnerAdapter);
}

View file

@ -8,6 +8,7 @@ import android.support.v4.graphics.ColorUtils;
import com.github.dfa.diaspora_android.R;
/**
* Class that handles Colors
* Created by dnld on 24/02/16.
*/
public class ColorPalette {

View file

@ -40,7 +40,6 @@ import android.widget.RadioGroup;
import android.widget.TextView;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings;
/**

View file

@ -22,7 +22,6 @@ import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import com.github.dfa.diaspora_android.App;

View file

@ -10,6 +10,7 @@ import android.widget.CheckBox;
import com.github.dfa.diaspora_android.util.AppSettings;
/**
* CheckboxPreference that colors its checkbox with accent color
* Created by vanitas on 24.10.16.
*/

View file

@ -10,6 +10,7 @@ import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.util.AppSettings;
/**
* PreferenceFragment with a colored status bar
* Created by vanitas on 24.10.16.
*/

View file

@ -129,9 +129,9 @@ public class AppLog {
public static Log instance;
private AppSettings appSettings;
private DateFormat dateFormat;
private ArrayList<String> logBuffer;
private ArrayList<Observer> observers;
private final DateFormat dateFormat;
private final ArrayList<String> logBuffer;
private final ArrayList<Observer> observers;
private Log() {
this(null);

View file

@ -172,7 +172,7 @@ public class AppSettings {
// TODO: Remove legacy at some time ;)
public void upgradeLegacyPoddomain() {
private void upgradeLegacyPoddomain() {
String legacy = getString(prefPod, R.string.pref_key__poddomain_legacy, "");
if (!legacy.equals("")) {
DiasporaPod pod = new DiasporaPod();

View file

@ -86,7 +86,7 @@ public class Helpers {
public static String readTextfileFromRawRessource(Context context, int rawRessourceId, String linePrefix, String linePostfix) {
StringBuilder sb = new StringBuilder();
String line = "";
String line;
BufferedReader br = null;
linePrefix = linePrefix == null ? "" : linePrefix;
linePostfix = linePostfix == null ? "" : linePostfix;

View file

@ -29,11 +29,9 @@ import com.github.dfa.diaspora_android.activity.MainActivity;
public class CustomWebViewClient extends WebViewClient {
private final App app;
private WebView webView;
public CustomWebViewClient(App app, WebView webView) {
this.app = app;
this.webView = webView;
}
//Open non-diaspora links in customtab/external browser

View file

@ -24,6 +24,7 @@ import android.widget.ProgressBar;
import com.github.dfa.diaspora_android.util.AppLog;
/**
* WebChromeClient that handles sharing text to diaspora*
* Created by vanitas on 26.09.16.
*/

View file

@ -24,6 +24,7 @@ import android.webkit.WebView;
import android.widget.ProgressBar;
/**
* WebChromeClient that allows uploading images
* Created by vanitas on 26.09.16.
*/
@ -35,11 +36,6 @@ public class FileUploadWebChromeClient extends ProgressBarWebChromeClient {
this.fileUploadCallback = fileUploadCallback;
}
@Override
public void onProgressChanged(WebView wv, int progress) {
super.onProgressChanged(wv, progress);
}
//For Android 4.1/4.2 only. DO NOT REMOVE!
@SuppressWarnings("unused")
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {

View file

@ -94,7 +94,7 @@ public class CustomTabActivityHelper {
/**
* Register a Callback to be called when connected or disconnected from the Custom Tabs Service
*
* @param connectionCallback
* @param connectionCallback callback
*/
public void setConnectionCallback(ConnectionCallback connectionCallback) {
this.mConnectionCallback = connectionCallback;