mirror of
https://github.com/gsantner/dandelion
synced 2024-11-24 21:32:07 +01:00
Fixed lint issues and moved webview related method calls to UI Thread
This commit is contained in:
parent
e79c1d48ea
commit
e3c2e91b70
19 changed files with 117 additions and 70 deletions
|
@ -15,7 +15,8 @@
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="com.github.dfa.diaspora_android.data.HashtagProvider"
|
android:name="com.github.dfa.diaspora_android.data.HashtagProvider"
|
||||||
android:authorities="com.github.dfa.diaspora_android.mainactivity" />
|
android:authorities="com.github.dfa.diaspora_android.mainactivity"
|
||||||
|
android:exported="false"/>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.github.dfa.diaspora_android.task.GetPodsService"
|
android:name="com.github.dfa.diaspora_android.task.GetPodsService"
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class AboutActivity extends ThemedActivity
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
|
|
||||||
@BindView(R.id.about__appbar)
|
@BindView(R.id.about__appbar)
|
||||||
AppBarLayout appBarLayout;
|
protected AppBarLayout appBarLayout;
|
||||||
|
|
||||||
@BindView(R.id.main__topbar)
|
@BindView(R.id.main__topbar)
|
||||||
protected Toolbar toolbar;
|
protected Toolbar toolbar;
|
||||||
|
@ -87,7 +87,11 @@ public class AboutActivity extends ThemedActivity
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
|
if(Build.VERSION.SDK_INT >= 21) {
|
||||||
|
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px, getTheme()));
|
||||||
|
} else {
|
||||||
|
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
|
||||||
|
}
|
||||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -231,9 +235,8 @@ public class AboutActivity extends ThemedActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContributorsHtml(Context context) {
|
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>");
|
"<font color='" + accentColor + "'><b>*</b></font> ", "<br>");
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMaintainersHtml(Context context) {
|
public String getMaintainersHtml(Context context) {
|
||||||
|
@ -245,9 +248,8 @@ public class AboutActivity extends ThemedActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLicenseHtml(Context context) {
|
public String getLicenseHtml(Context context) {
|
||||||
String text = Helpers.readTextfileFromRawRessource(context, R.raw.license,
|
return Helpers.readTextfileFromRawRessource(context, R.raw.license,
|
||||||
"", "").replace("\n\n", "<br><br>");
|
"", "").replace("\n\n", "<br><br>");
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLicense3dPartyHtml(Context context) {
|
public String getLicense3dPartyHtml(Context context) {
|
||||||
|
|
|
@ -442,18 +442,28 @@ public class MainActivity extends ThemedActivity
|
||||||
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
|
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
|
||||||
AppLog.v(this, "Reset pod data and show PodSelectionFragment");
|
AppLog.v(this, "Reset pod data and show PodSelectionFragment");
|
||||||
appSettings.setPod(null);
|
appSettings.setPod(null);
|
||||||
app.resetPodData(((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView());
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
app.resetPodData(((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView());
|
||||||
|
}
|
||||||
|
});
|
||||||
showFragment(getFragment(PodSelectionFragment.TAG));
|
showFragment(getFragment(PodSelectionFragment.TAG));
|
||||||
} else if (ACTION_CLEAR_CACHE.equals(action)) {
|
} else if (ACTION_CLEAR_CACHE.equals(action)) {
|
||||||
AppLog.v(this, "Clear WebView cache");
|
AppLog.v(this, "Clear WebView cache");
|
||||||
showFragment(getFragment(DiasporaStreamFragment.TAG));
|
showFragment(getFragment(DiasporaStreamFragment.TAG));
|
||||||
ContextMenuWebView wv = ((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView();
|
runOnUiThread(new Runnable() {
|
||||||
if(wv != null) {
|
@Override
|
||||||
AppLog.d(this, "clearing...");
|
public void run() {
|
||||||
wv.clearCache(true);
|
ContextMenuWebView wv = ((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView();
|
||||||
} else {
|
if(wv != null) {
|
||||||
AppLog.e(this, "WebView is null!");
|
AppLog.d(this, "clearing...");
|
||||||
}
|
wv.clearCache(true);
|
||||||
|
} else {
|
||||||
|
AppLog.e(this, "WebView is null!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "text/plain":
|
case "text/plain":
|
||||||
|
@ -750,7 +760,7 @@ public class MainActivity extends ThemedActivity
|
||||||
if (WebHelper.isOnline(MainActivity.this)) {
|
if (WebHelper.isOnline(MainActivity.this)) {
|
||||||
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
|
||||||
View layout = getLayoutInflater().inflate(R.layout.ui__dialog_search__people_tags, null, false);
|
View layout = getLayoutInflater().inflate(R.layout.ui__dialog_search__people_tags, this.appBarLayout, false);
|
||||||
final EditText input = (EditText) layout.findViewById(R.id.dialog_search__input);
|
final EditText input = (EditText) layout.findViewById(R.id.dialog_search__input);
|
||||||
final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
|
final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,6 +17,7 @@ package com.github.dfa.diaspora_android.data;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.R;
|
import com.github.dfa.diaspora_android.R;
|
||||||
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
|
import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
|
||||||
|
@ -434,13 +435,21 @@ public class AppSettings {
|
||||||
|
|
||||||
public int[] getPrimaryColorPickerSettings() {
|
public int[] getPrimaryColorPickerSettings() {
|
||||||
return new int[]{
|
return new int[]{
|
||||||
getInt(prefApp, R.string.pref_key__primary_color_base, context.getResources().getColor(R.color.md_blue_500)),
|
getInt(prefApp, R.string.pref_key__primary_color_base, getColor(R.color.md_blue_500)),
|
||||||
getInt(prefApp, R.string.pref_key__primary_color_shade, context.getResources().getColor(R.color.primary))
|
getInt(prefApp, R.string.pref_key__primary_color_shade, getColor(R.color.primary))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPrimaryColor() {
|
public int getPrimaryColor() {
|
||||||
return getInt(prefApp, R.string.pref_key__primary_color_shade, context.getResources().getColor(R.color.primary));
|
return getInt(prefApp, R.string.pref_key__primary_color_shade, getColor(R.color.primary));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getColor(int id) {
|
||||||
|
if(Build.VERSION.SDK_INT >= 23) {
|
||||||
|
return context.getResources().getColor(id, context.getTheme());
|
||||||
|
} else {
|
||||||
|
return context.getResources().getColor(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccentColorPickerSettings(int base, int shade) {
|
public void setAccentColorPickerSettings(int base, int shade) {
|
||||||
|
@ -450,13 +459,13 @@ public class AppSettings {
|
||||||
|
|
||||||
public int[] getAccentColorPickerSettings() {
|
public int[] getAccentColorPickerSettings() {
|
||||||
return new int[]{
|
return new int[]{
|
||||||
getInt(prefApp, R.string.pref_key__accent_color_base, context.getResources().getColor(R.color.md_deep_orange_500)),
|
getInt(prefApp, R.string.pref_key__accent_color_base, getColor(R.color.md_deep_orange_500)),
|
||||||
getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent))
|
getInt(prefApp, R.string.pref_key__accent_color_shade, getColor(R.color.accent))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAccentColor() {
|
public int getAccentColor() {
|
||||||
return getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent));
|
return getInt(prefApp, R.string.pref_key__accent_color_shade, getColor(R.color.accent));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExtendedNotifications() {
|
public boolean isExtendedNotifications() {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.github.dfa.diaspora_android.data;
|
package com.github.dfa.diaspora_android.data;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
@ -280,13 +282,11 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(DiasporaPod otherPod) {
|
public int compareTo(@NonNull DiasporaPod otherPod) {
|
||||||
if (otherPod != null) {
|
List<DiasporaPodUrl> myPodUrls = getPodUrls();
|
||||||
List<DiasporaPodUrl> myPodUrls = getPodUrls();
|
List<DiasporaPodUrl> otherPodUrls = otherPod.getPodUrls();
|
||||||
List<DiasporaPodUrl> otherPodUrls = otherPod.getPodUrls();
|
if (!myPodUrls.isEmpty() && !otherPodUrls.isEmpty()) {
|
||||||
if (!myPodUrls.isEmpty() && !otherPodUrls.isEmpty()) {
|
return myPodUrls.get(0).getHost().compareTo(otherPodUrls.get(0).getHost());
|
||||||
return myPodUrls.get(0).getHost().compareTo(otherPodUrls.get(0).getHost());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return name.compareTo(otherPod.getName());
|
return name.compareTo(otherPod.getName());
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ public class DiasporaPodList implements Iterable<DiasporaPodList.DiasporaPod>, S
|
||||||
/**
|
/**
|
||||||
* Get the base url
|
* Get the base url
|
||||||
*
|
*
|
||||||
* @return
|
* @return baseUrl
|
||||||
*/
|
*/
|
||||||
public String getBaseUrl() {
|
public String getBaseUrl() {
|
||||||
return protocol + "://" + host + (isPortNeeded() ? port : "");
|
return protocol + "://" + host + (isPortNeeded() ? port : "");
|
||||||
|
|
|
@ -24,21 +24,22 @@ import android.content.ContentProvider;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
public class HashtagProvider extends ContentProvider {
|
public class HashtagProvider extends ContentProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Uri arg0, String arg1, String[] arg2) {
|
public int delete(@NonNull Uri arg0, String arg1, String[] arg2) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType(Uri arg0) {
|
public String getType(@NonNull Uri arg0) {
|
||||||
return "vnd.android.cursor.item/vnd.cc.tag";
|
return "vnd.android.cursor.item/vnd.cc.tag";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Uri insert(Uri arg0, ContentValues arg1) {
|
public Uri insert(@NonNull Uri arg0, ContentValues arg1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,13 +49,13 @@ public class HashtagProvider extends ContentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Cursor query(Uri arg0, String[] arg1, String arg2, String[] arg3,
|
public Cursor query(@NonNull Uri arg0, String[] arg1, String arg2, String[] arg3,
|
||||||
String arg4) {
|
String arg4) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
|
public int update(@NonNull Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -107,9 +107,12 @@ public class BrowserFragment extends ThemedFragment {
|
||||||
loadUrl(pendingUrl);
|
loadUrl(pendingUrl);
|
||||||
pendingUrl = null;
|
pendingUrl = null;
|
||||||
}
|
}
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
webView.setParentActivity(getActivity());
|
@Override
|
||||||
|
public void run() {
|
||||||
|
webView.setParentActivity(getActivity());
|
||||||
|
}
|
||||||
|
});
|
||||||
this.setRetainInstance(true);
|
this.setRetainInstance(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +152,15 @@ public class BrowserFragment extends ThemedFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (webView != null) {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
webSettings.setMinimumFontSize(appSettings.getMinimumFontSize());
|
@Override
|
||||||
webSettings.setLoadsImagesAutomatically(appSettings.isLoadImages());
|
public void run() {
|
||||||
}
|
if (webView != null) {
|
||||||
|
webSettings.setMinimumFontSize(appSettings.getMinimumFontSize());
|
||||||
|
webSettings.setLoadsImagesAutomatically(appSettings.isLoadImages());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
|
@ -249,16 +257,27 @@ public class BrowserFragment extends ThemedFragment {
|
||||||
|
|
||||||
public boolean onBackPressed() {
|
public boolean onBackPressed() {
|
||||||
if (webView.canGoBack()) {
|
if (webView.canGoBack()) {
|
||||||
webView.goBack();
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
webView.goBack();
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadUrl(String url) {
|
public void loadUrl(final String url) {
|
||||||
if (getWebView() != null) {
|
if (getWebView() != null) {
|
||||||
AppLog.v(this, "loadUrl(): load " + url);
|
AppLog.v(this, "loadUrl(): load " + url);
|
||||||
getWebView().loadUrlNew(url);
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
getWebView().loadUrlNew(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
AppLog.v(this, "loadUrl(): WebView null: Set pending url to " + url);
|
AppLog.v(this, "loadUrl(): WebView null: Set pending url to " + url);
|
||||||
pendingUrl = url;
|
pendingUrl = url;
|
||||||
|
@ -275,9 +294,15 @@ public class BrowserFragment extends ThemedFragment {
|
||||||
|
|
||||||
public void reloadUrl() {
|
public void reloadUrl() {
|
||||||
AppLog.v(this, "reloadUrl()");
|
AppLog.v(this, "reloadUrl()");
|
||||||
if (getWebView() != null) {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
getWebView().reload();
|
@Override
|
||||||
}
|
public void run() {
|
||||||
|
if (getWebView() != null) {
|
||||||
|
getWebView().reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContextMenuWebView getWebView() {
|
public ContextMenuWebView getWebView() {
|
||||||
|
|
|
@ -22,7 +22,6 @@ import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
|
@ -52,7 +51,6 @@ import com.github.dfa.diaspora_android.ui.PodSelectionDialog;
|
||||||
import com.github.dfa.diaspora_android.util.AppLog;
|
import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
|
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
|
||||||
import com.github.dfa.diaspora_android.util.Helpers;
|
import com.github.dfa.diaspora_android.util.Helpers;
|
||||||
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
|
AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
|
||||||
|
|
||||||
Uri url = null;
|
Uri url;
|
||||||
try {
|
try {
|
||||||
String sUrl = receiveIntent.getStringExtra(MainActivity.EXTRA_URL);
|
String sUrl = receiveIntent.getStringExtra(MainActivity.EXTRA_URL);
|
||||||
url = Uri.parse(sUrl);
|
url = Uri.parse(sUrl);
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class StatisticsFetchTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
String extractedProfileData = null;
|
|
||||||
final CookieManager cookieManager = app.getCookieManager();
|
final CookieManager cookieManager = app.getCookieManager();
|
||||||
String cookies = cookieManager.getCookie(urls.getPodUrl());
|
String cookies = cookieManager.getCookie(urls.getPodUrl());
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import android.graphics.Rect;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
import android.graphics.drawable.LayerDrawable;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
import com.github.dfa.diaspora_android.R;
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
@ -67,7 +68,7 @@ public class BadgeDrawable extends Drawable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(@NonNull Canvas canvas) {
|
||||||
if (!shouldDraw) {
|
if (!shouldDraw) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.app.Dialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AppCompatDialogFragment;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -35,12 +34,13 @@ import butterknife.OnClick;
|
||||||
import butterknife.OnItemSelected;
|
import butterknife.OnItemSelected;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Dialog that lets the user chose a pod
|
||||||
* Created by gsantner (https://gsantner.github.io) on 06.10.16.
|
* Created by gsantner (https://gsantner.github.io) on 06.10.16.
|
||||||
*/
|
*/
|
||||||
public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
|
public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
|
||||||
public static final String TAG = "com.github.dfa.diaspora_android.PodSelectionDialog";
|
public static final String TAG = "com.github.dfa.diaspora_android.PodSelectionDialog";
|
||||||
|
|
||||||
public static interface PodSelectionDialogResultListener {
|
public interface PodSelectionDialogResultListener {
|
||||||
void onPodSelectionDialogResult(DiasporaPod pod, boolean accepted);
|
void onPodSelectionDialogResult(DiasporaPod pod, boolean accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,8 +118,8 @@ public class PodSelectionDialog extends ThemedAppCompatDialogFragment {
|
||||||
textProfile.setVisibility(View.VISIBLE);
|
textProfile.setVisibility(View.VISIBLE);
|
||||||
spinnerProfile.setVisibility(View.VISIBLE);
|
spinnerProfile.setVisibility(View.VISIBLE);
|
||||||
String[] podUrlss = new String[podUrls.size()];
|
String[] podUrlss = new String[podUrls.size()];
|
||||||
for (int i = 0; i < podUrls.size(); podUrlss[i] = podUrls.get(i++).getBaseUrl()) ;
|
//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);
|
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
spinnerProfile.setAdapter(spinnerAdapter);
|
spinnerProfile.setAdapter(spinnerAdapter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class ThemedIntEditTextPreference extends LinearLayout implements ThemedP
|
||||||
|
|
||||||
AppLog.d(this, "ShowValueInSummary: "+showValueInSummary + " port: "+appSettings.getProxyHttpPort());
|
AppLog.d(this, "ShowValueInSummary: "+showValueInSummary + " port: "+appSettings.getProxyHttpPort());
|
||||||
setTitleText(titleText);
|
setTitleText(titleText);
|
||||||
setSummaryText(showValueInSummary ? ""+appSettings.getThemedIntEditTextPreferenceValue(this) : summaryText);
|
setSummaryText(showValueInSummary ? Integer.toString(appSettings.getThemedIntEditTextPreferenceValue(this)) : summaryText);
|
||||||
setOnClickListener(new OnClickListener() {
|
setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -93,7 +93,7 @@ public class ThemedIntEditTextPreference extends LinearLayout implements ThemedP
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
final EditText dialogLayout = (EditText) LayoutInflater.from(context).inflate(R.layout.settings_activity__dialog_proxy, null, false);
|
final EditText dialogLayout = (EditText) LayoutInflater.from(context).inflate(R.layout.settings_activity__dialog_proxy, null, false);
|
||||||
dialogLayout.setInputType(InputType.TYPE_CLASS_NUMBER);
|
dialogLayout.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
dialogLayout.setText(""+appSettings.getThemedIntEditTextPreferenceValue(this));
|
dialogLayout.setText(Integer.toString(appSettings.getThemedIntEditTextPreferenceValue(this)));
|
||||||
builder.setTitle(title)
|
builder.setTitle(title)
|
||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -140,7 +140,7 @@ public class ThemedIntEditTextPreference extends LinearLayout implements ThemedP
|
||||||
public void setValue(Integer value) {
|
public void setValue(Integer value) {
|
||||||
appSettings.setThemedIntEditTextPreferenceValue(this, value);
|
appSettings.setThemedIntEditTextPreferenceValue(this, value);
|
||||||
if(showValueInSummary) {
|
if(showValueInSummary) {
|
||||||
setSummaryText(""+value);
|
setSummaryText(Integer.toString(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class CustomTabActivityHelper {
|
||||||
/**
|
/**
|
||||||
* Register a Callback to be called when connected or disconnected from the Custom Tabs Service
|
* Register a Callback to be called when connected or disconnected from the Custom Tabs Service
|
||||||
*
|
*
|
||||||
* @param connectionCallback
|
* @param connectionCallback connectionCallback
|
||||||
*/
|
*/
|
||||||
public void setConnectionCallback(ConnectionCallback connectionCallback) {
|
public void setConnectionCallback(ConnectionCallback connectionCallback) {
|
||||||
this.mConnectionCallback = connectionCallback;
|
this.mConnectionCallback = connectionCallback;
|
||||||
|
@ -130,10 +130,14 @@ public class CustomTabActivityHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
|
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
|
||||||
if (mClient == null) return false;
|
if (mClient == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CustomTabsSession session = getSession();
|
CustomTabsSession session = getSession();
|
||||||
if (session == null) return false;
|
if (session == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
|
return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class Helpers {
|
||||||
|
|
||||||
public static String readTextfileFromRawRessource(Context context, int rawRessourceId, String linePrefix, String linePostfix) {
|
public static String readTextfileFromRawRessource(Context context, int rawRessourceId, String linePrefix, String linePostfix) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String line = "";
|
String line;
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
linePrefix = linePrefix == null ? "" : linePrefix;
|
linePrefix = linePrefix == null ? "" : linePrefix;
|
||||||
linePostfix = linePostfix == null ? "" : linePostfix;
|
linePostfix = linePostfix == null ? "" : linePostfix;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.support.v4.graphics.ColorUtils;
|
||||||
import com.github.dfa.diaspora_android.R;
|
import com.github.dfa.diaspora_android.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* ColorPalette
|
||||||
* Created by dnld on 24/02/16.
|
* Created by dnld on 24/02/16.
|
||||||
*/
|
*/
|
||||||
public class ColorPalette {
|
public class ColorPalette {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.github.dfa.diaspora_android.util.AppLog;
|
||||||
import com.github.dfa.diaspora_android.util.WebHelper;
|
import com.github.dfa.diaspora_android.util.WebHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* WebChromeClient for DiasporaStreams
|
||||||
* Created by vanitas on 26.09.16.
|
* Created by vanitas on 26.09.16.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.webkit.WebView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* WebChromeClient that supports uploading images
|
||||||
* Created by vanitas on 26.09.16.
|
* Created by vanitas on 26.09.16.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -35,11 +36,6 @@ public class FileUploadWebChromeClient extends ProgressBarWebChromeClient {
|
||||||
this.fileUploadCallback = fileUploadCallback;
|
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!
|
//For Android 4.1/4.2 only. DO NOT REMOVE!
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
|
protected void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
android:id="@+id/nav_drawer"
|
android:id="@+id/nav_drawer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="110dp"
|
android:layout_height="110dp"
|
||||||
android:background="@color/colorPrimary"
|
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||||
|
|
Loading…
Reference in a new issue