1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12:08 +01:00

Reformat java files

This commit is contained in:
Gregor Santner 2016-12-18 15:07:23 +01:00
parent 4f3eac9977
commit 175125996e
No known key found for this signature in database
GPG key ID: 2AEB822A5CF48C9F
12 changed files with 26 additions and 30 deletions

View file

@ -28,7 +28,6 @@ import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.design.widget.Snackbar; import android.support.design.widget.Snackbar;
import android.view.Menu; import android.view.Menu;
@ -232,7 +231,7 @@ public class DiasporaStreamFragment extends BrowserFragment {
protected DiasporaStreamWebChromeClient.SharedTextCallback sharedTextCallback = new DiasporaStreamWebChromeClient.SharedTextCallback() { protected DiasporaStreamWebChromeClient.SharedTextCallback sharedTextCallback = new DiasporaStreamWebChromeClient.SharedTextCallback() {
@Override @Override
public String getSharedText() { public String getSharedText() {
if(getActivity() != null) { if (getActivity() != null) {
return ((MainActivity) getActivity()).getTextToBeShared(); return ((MainActivity) getActivity()).getTextToBeShared();
} }
return ""; return "";

View file

@ -311,8 +311,8 @@ public class MainActivity extends ThemedActivity
streamFragment.loadUrl(url); streamFragment.loadUrl(url);
} }
public void showLastVisitedTimestampMessageIfNeeded(String url){ public void showLastVisitedTimestampMessageIfNeeded(String url) {
if (url.equals(urls.getStreamUrl()) && diasporaUserProfile.hasLastVisitedTimestampInStream()){ if (url.equals(urls.getStreamUrl()) && diasporaUserProfile.hasLastVisitedTimestampInStream()) {
snackbarLastVisitedTimestampInStream.show(); snackbarLastVisitedTimestampInStream.show();
diasporaUserProfile.resetLastVisitedPositionInStream(); diasporaUserProfile.resetLastVisitedPositionInStream();
} }

View file

@ -153,7 +153,7 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
if(s.equals(getString(R.string.pref_key__screen_rotation))) { if (s.equals(getString(R.string.pref_key__screen_rotation))) {
this.updateScreenRotation(); this.updateScreenRotation();
} }
} }

View file

@ -18,7 +18,6 @@
*/ */
package com.github.dfa.diaspora_android.data; package com.github.dfa.diaspora_android.data;
import android.net.ParseException;
import android.os.Handler; import android.os.Handler;
import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.App;

View file

@ -93,6 +93,7 @@ public class UpdateTitleReceiver extends BroadcastReceiver {
public interface TitleCallback { public interface TitleCallback {
void setTitle(String url, int resId); void setTitle(String url, int resId);
void setTitle(String url, String title); void setTitle(String url, String title);
} }
} }

View file

@ -158,13 +158,13 @@ public class ThemeHelper {
} }
public static void updateAlertDialogColor(AlertDialog alertDialog) { public static void updateAlertDialogColor(AlertDialog alertDialog) {
if(alertDialog != null) { if (alertDialog != null) {
for(int i : new int[]{ for (int i : new int[]{
DialogInterface.BUTTON_POSITIVE, DialogInterface.BUTTON_POSITIVE,
DialogInterface.BUTTON_NEUTRAL, DialogInterface.BUTTON_NEUTRAL,
DialogInterface.BUTTON_NEGATIVE}) { DialogInterface.BUTTON_NEGATIVE}) {
Button b = alertDialog.getButton(i); Button b = alertDialog.getButton(i);
if(b != null) { if (b != null) {
b.setTextColor(getAccentColor()); b.setTextColor(getAccentColor());
} }
} }

View file

@ -61,7 +61,7 @@ public class AppLog {
*/ */
public static void v(Object source, String _text) { public static void v(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
if(source != null) { if (source != null) {
Log.v(getLogPrefix(source), _text); Log.v(getLogPrefix(source), _text);
} else { } else {
Log.v("null", _text); Log.v("null", _text);
@ -71,7 +71,7 @@ public class AppLog {
public static void i(Object source, String _text) { public static void i(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
if(source != null) { if (source != null) {
Log.i(getLogPrefix(source), _text); Log.i(getLogPrefix(source), _text);
} else { } else {
Log.i("null", _text); Log.i("null", _text);
@ -81,7 +81,7 @@ public class AppLog {
public static void d(Object source, String _text) { public static void d(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
if(source != null) { if (source != null) {
Log.d(getLogPrefix(source), _text); Log.d(getLogPrefix(source), _text);
} else { } else {
Log.d("null", _text); Log.d("null", _text);
@ -91,7 +91,7 @@ public class AppLog {
public static void e(Object source, String _text) { public static void e(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
if(source != null) { if (source != null) {
Log.e(getLogPrefix(source), _text); Log.e(getLogPrefix(source), _text);
} else { } else {
Log.e("null", _text); Log.e("null", _text);
@ -101,7 +101,7 @@ public class AppLog {
public static void w(Object source, String _text) { public static void w(Object source, String _text) {
if (isLoggingEnabled()) { if (isLoggingEnabled()) {
if(source != null) { if (source != null) {
Log.w(getLogPrefix(source), _text); Log.w(getLogPrefix(source), _text);
} else { } else {
Log.w("null", _text); Log.w("null", _text);
@ -111,7 +111,7 @@ public class AppLog {
public static void spam(Object source, String _text) { public static void spam(Object source, String _text) {
if (isLoggingEnabled() && isLoggingSpamEnabled()) { if (isLoggingEnabled() && isLoggingSpamEnabled()) {
if(source != null) { if (source != null) {
Log.v(getLogPrefix(source), _text); Log.v(getLogPrefix(source), _text);
} else { } else {
Log.v("null", _text); Log.v("null", _text);

View file

@ -21,7 +21,6 @@ import android.content.SharedPreferences;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaAspect; import com.github.dfa.diaspora_android.data.DiasporaAspect;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod; import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod.DiasporaPodUrl;
import com.github.dfa.diaspora_android.web.ProxyHandler; import com.github.dfa.diaspora_android.web.ProxyHandler;
import org.json.JSONException; import org.json.JSONException;
@ -127,6 +126,7 @@ public class AppSettings {
private int getInt(SharedPreferences pref, int ressourceId, int defaultValue) { private int getInt(SharedPreferences pref, int ressourceId, int defaultValue) {
return pref.getInt(context.getString(ressourceId), defaultValue); return pref.getInt(context.getString(ressourceId), defaultValue);
} }
private long getLong(SharedPreferences pref, int ressourceId, long defaultValue) { private long getLong(SharedPreferences pref, int ressourceId, long defaultValue) {
return pref.getLong(context.getString(ressourceId), defaultValue); return pref.getLong(context.getString(ressourceId), defaultValue);
} }
@ -413,10 +413,11 @@ public class AppSettings {
} }
public long getLastVisitedPositionInStream(){ public long getLastVisitedPositionInStream() {
return getLong(prefPod, R.string.pref_key__podprofile_last_stream_position, -1); return getLong(prefPod, R.string.pref_key__podprofile_last_stream_position, -1);
} }
public void setLastVisitedPositionInStream(long timestamp){
public void setLastVisitedPositionInStream(long timestamp) {
setLong(prefPod, R.string.pref_key__podprofile_last_stream_position, timestamp); setLong(prefPod, R.string.pref_key__podprofile_last_stream_position, timestamp);
} }

View file

@ -34,7 +34,7 @@ public class DiasporaUrlHelper {
public static final String SUBURL_NOTIFICATIONS = "/notifications"; public static final String SUBURL_NOTIFICATIONS = "/notifications";
public static final String SUBURL_POSTS = "/posts/"; public static final String SUBURL_POSTS = "/posts/";
public static final String SUBURL_STREAM = "/stream"; public static final String SUBURL_STREAM = "/stream";
public static final String SUBURL_STREAM_WITH_TIMESTAMP = SUBURL_STREAM+"?max_time="; public static final String SUBURL_STREAM_WITH_TIMESTAMP = SUBURL_STREAM + "?max_time=";
public static final String SUBURL_CONVERSATIONS = "/conversations"; public static final String SUBURL_CONVERSATIONS = "/conversations";
public static final String SUBURL_NEW_POST = "/status_messages/new"; public static final String SUBURL_NEW_POST = "/status_messages/new";
public static final String SUBURL_PEOPLE = "/people/"; public static final String SUBURL_PEOPLE = "/people/";

View file

@ -153,8 +153,9 @@ public class Helpers {
/** /**
* Send an Intent that opens url in any browser * Send an Intent that opens url in any browser
*
* @param context context * @param context context
* @param url url * @param url url
*/ */
public static void openInExternalBrowser(Context context, String url) { public static void openInExternalBrowser(Context context, String url) {
Intent openBrowserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); Intent openBrowserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));

View file

@ -260,7 +260,7 @@ public class BrowserFragment extends ThemedFragment {
@Override @Override
public void onAttach(Context context) { public void onAttach(Context context) {
super.onAttach(context); super.onAttach(context);
if(webView != null && webView.getContext() instanceof MutableContextWrapper) { if (webView != null && webView.getContext() instanceof MutableContextWrapper) {
((MutableContextWrapper) webView.getContext()).setBaseContext(context); ((MutableContextWrapper) webView.getContext()).setBaseContext(context);
} }
} }

View file

@ -19,7 +19,6 @@
package com.github.dfa.diaspora_android.web; package com.github.dfa.diaspora_android.web;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.webkit.JsResult; import android.webkit.JsResult;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -66,18 +65,14 @@ public class DiasporaStreamWebChromeClient extends FileUploadWebChromeClient {
builder.setTitle(view.getContext().getString(R.string.confirmation)) builder.setTitle(view.getContext().getString(R.string.confirmation))
.setMessage(message) .setMessage(message)
.setPositiveButton(android.R.string.ok, .setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() new DialogInterface.OnClickListener() {
{ public void onClick(DialogInterface dialog, int which) {
public void onClick(DialogInterface dialog, int which)
{
result.confirm(); result.confirm();
} }
}) })
.setNegativeButton(android.R.string.cancel, .setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() new DialogInterface.OnClickListener() {
{ public void onClick(DialogInterface dialog, int which) {
public void onClick(DialogInterface dialog, int which)
{
result.cancel(); result.cancel();
} }
}) })