mirror of
https://github.com/gsantner/dandelion
synced 2025-09-11 03:09:48 +02:00
Improve AMOLED mode
This commit is contained in:
parent
2d7d898bfe
commit
6d93db79b8
19 changed files with 114 additions and 32 deletions
|
@ -19,6 +19,7 @@
|
|||
package com.github.dfa.diaspora_android.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
|
@ -56,7 +57,15 @@ public class AspectListFragment extends ThemedFragment implements OnSomethingCli
|
|||
|
||||
public static final String TAG = "com.github.dfa.diaspora_android.AspectListFragment";
|
||||
|
||||
protected RecyclerView aspectsRecyclerView;
|
||||
@BindView(R.id.fragment_list__recycler_view)
|
||||
public RecyclerView aspectsRecyclerView;
|
||||
|
||||
@BindView(R.id.fragment_list__spacer)
|
||||
public View space;
|
||||
|
||||
@BindView(R.id.fragment_list__root)
|
||||
public RelativeLayout rootView;
|
||||
|
||||
protected App app;
|
||||
protected DiasporaUrlHelper urls;
|
||||
|
||||
|
@ -69,7 +78,7 @@ public class AspectListFragment extends ThemedFragment implements OnSomethingCli
|
|||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
aspectsRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_list__recycler_view);
|
||||
ButterKnife.bind(this, view);
|
||||
app = (App) getActivity().getApplication();
|
||||
AppSettings appSettings = app.getSettings();
|
||||
urls = new DiasporaUrlHelper(appSettings);
|
||||
|
@ -110,9 +119,14 @@ public class AspectListFragment extends ThemedFragment implements OnSomethingCli
|
|||
@Override
|
||||
protected void applyColorToViews() {
|
||||
aspectsRecyclerView.invalidate();
|
||||
if (getAppSettings().isAmoledColorMode()) {
|
||||
rootView.setBackgroundColor(Color.BLACK);
|
||||
space.setBackgroundColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AspectAdapter extends RecyclerView.Adapter<AspectAdapter.ViewHolder> {
|
||||
private boolean isAmoledColorMode;
|
||||
private final AppSettings appSettings;
|
||||
private final DiasporaAspect[] aspectList;
|
||||
private final List<String> aspectFavsList;
|
||||
|
@ -138,6 +152,7 @@ public class AspectListFragment extends ThemedFragment implements OnSomethingCli
|
|||
this.aspectList = appSettings.getAspects();
|
||||
this.aspectFavsList = new ArrayList<>(Arrays.asList(appSettings.getAspectFavs()));
|
||||
this.aspectClickedListener = aspectClickedListener;
|
||||
this.isAmoledColorMode = appSettings.isAmoledColorMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +174,11 @@ public class AspectListFragment extends ThemedFragment implements OnSomethingCli
|
|||
final DiasporaAspect aspect = aspectList[position];
|
||||
holder.title.setText(aspect.name);
|
||||
if (position % 2 == 1) {
|
||||
holder.root.setBackgroundColor(Helpers.get().color(R.color.alternate_row_color));
|
||||
holder.root.setBackgroundColor(isAmoledColorMode ? Color.BLACK : Helpers.get().color(R.color.alternate_row_color));
|
||||
holder.title.setTextColor(isAmoledColorMode ? Color.GRAY : Color.BLACK);
|
||||
} else {
|
||||
holder.root.setBackgroundColor(isAmoledColorMode ? Color.BLACK : Color.WHITE);
|
||||
holder.title.setTextColor(isAmoledColorMode ? Color.GRAY : Color.BLACK);
|
||||
}
|
||||
|
||||
// Favourite (Star) Image
|
||||
|
@ -191,7 +210,7 @@ public class AspectListFragment extends ThemedFragment implements OnSomethingCli
|
|||
|
||||
private void applyFavouriteImage(AppCompatImageView imageView, boolean isFaved) {
|
||||
imageView.setImageResource(isFaved ? R.drawable.ic_star_filled_48px : R.drawable.ic_star_border_black_48px);
|
||||
imageView.setColorFilter(isFaved ? appSettings.getAccentColor() : 0, PorterDuff.Mode.SRC_ATOP);
|
||||
imageView.setColorFilter(isFaved ? appSettings.getAccentColor() : (isAmoledColorMode ? Color.GRAY : 0), PorterDuff.Mode.SRC_ATOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -426,14 +426,6 @@ public class MainActivity extends ThemedActivity
|
|||
navheaderImage.setImageResource(R.drawable.ic_launcher_test);
|
||||
}
|
||||
updateNavigationViewEntryVisibilities();
|
||||
|
||||
if (appSettings.isAmoledColorMode()) {
|
||||
navView.setItemTextColor(ColorStateList.valueOf(Color.LTGRAY));
|
||||
navView.setItemIconTintList(ColorStateList.valueOf(Color.LTGRAY));
|
||||
navView.setBackgroundColor(Color.BLACK);
|
||||
navheaderTitle.setTextColor(Color.LTGRAY);
|
||||
navheaderDescription.setTextColor(Color.GRAY);
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateNavigationViewEntryVisibilities() {
|
||||
|
@ -1203,6 +1195,13 @@ public class MainActivity extends ThemedActivity
|
|||
ThemeHelper.updateActionMenuViewColor(toolbarBottom);
|
||||
navDrawerLayout.setBackgroundColor(appSettings.getPrimaryColor());
|
||||
navProfilePictureArea.setBackgroundColor(appSettings.getPrimaryColor());
|
||||
if (appSettings.isAmoledColorMode()) {
|
||||
navView.setItemTextColor(ColorStateList.valueOf(Color.GRAY));
|
||||
navView.setItemIconTintList(ColorStateList.valueOf(Color.GRAY));
|
||||
navView.setBackgroundColor(Color.BLACK);
|
||||
navheaderTitle.setTextColor(Color.GRAY);
|
||||
navheaderDescription.setTextColor(Color.DKGRAY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,12 +22,15 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -39,6 +42,7 @@ import android.webkit.CookieManager;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.dfa.diaspora_android.App;
|
||||
|
@ -73,6 +77,13 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
|
|||
@BindView(R.id.podselection__fragment__listpods)
|
||||
protected ListView listViewPod;
|
||||
|
||||
@BindView(R.id.podselection__fragment__root)
|
||||
RelativeLayout rootView;
|
||||
|
||||
@BindView(R.id.podselection__fragment__button_use_custom_pod)
|
||||
AppCompatButton buttonUseCustomPod;
|
||||
|
||||
|
||||
protected App app;
|
||||
protected AppSettings appSettings;
|
||||
private DiasporaPodList podList;
|
||||
|
@ -161,7 +172,12 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
|
|||
|
||||
@Override
|
||||
protected void applyColorToViews() {
|
||||
/* Not really anything to do. Maybe later */
|
||||
int dividerHeight = listViewPod.getDividerHeight();
|
||||
rootView.setBackgroundColor(appSettings.isAmoledColorMode() ? Color.BLACK : Color.WHITE);
|
||||
listViewPod.setDivider(new ColorDrawable(Color.GRAY));
|
||||
listViewPod.setDividerHeight(dividerHeight);
|
||||
buttonUseCustomPod.setSupportBackgroundTintList(ColorStateList.valueOf(appSettings.isAmoledColorMode() ? Color.DKGRAY : Color.WHITE));
|
||||
buttonUseCustomPod.setTextColor(appSettings.isAmoledColorMode() ? Color.WHITE : Color.BLACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -185,7 +201,7 @@ public class PodSelectionFragment extends ThemedFragment implements SearchView.O
|
|||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View view = super.getView(position, convertView, parent);
|
||||
TextView textView = (TextView) view.findViewById(android.R.id.text1);
|
||||
textView.setTextColor(Color.BLACK);
|
||||
textView.setTextColor(appSettings.isAmoledColorMode() ? Color.GRAY : Color.BLACK);
|
||||
return view;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package com.github.dfa.diaspora_android.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
|
@ -55,7 +56,15 @@ public class TagListFragment extends ThemedFragment implements OnSomethingClickL
|
|||
|
||||
public static final String TAG = "com.github.dfa.diaspora_android.TagListFragment";
|
||||
|
||||
protected RecyclerView followedTagsRecyclerView;
|
||||
@BindView(R.id.fragment_list__recycler_view)
|
||||
public RecyclerView followedTagsRecyclerView;
|
||||
|
||||
@BindView(R.id.fragment_list__spacer)
|
||||
public View space;
|
||||
|
||||
@BindView(R.id.fragment_list__root)
|
||||
public RelativeLayout rootView;
|
||||
|
||||
protected App app;
|
||||
protected DiasporaUrlHelper urls;
|
||||
|
||||
|
@ -68,7 +77,7 @@ public class TagListFragment extends ThemedFragment implements OnSomethingClickL
|
|||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
followedTagsRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_list__recycler_view);
|
||||
ButterKnife.bind(this, view);
|
||||
app = (App) getActivity().getApplication();
|
||||
AppSettings appSettings = app.getSettings();
|
||||
urls = new DiasporaUrlHelper(appSettings);
|
||||
|
@ -109,9 +118,14 @@ public class TagListFragment extends ThemedFragment implements OnSomethingClickL
|
|||
@Override
|
||||
protected void applyColorToViews() {
|
||||
followedTagsRecyclerView.invalidate();
|
||||
if (getAppSettings().isAmoledColorMode()) {
|
||||
rootView.setBackgroundColor(Color.BLACK);
|
||||
space.setBackgroundColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
public static class FollowedTagsAdapter extends RecyclerView.Adapter<FollowedTagsAdapter.ViewHolder> {
|
||||
private boolean isAmoledColorMode;
|
||||
private AppSettings appSettings;
|
||||
private String[] followedTagsList;
|
||||
private List<String> followedTagsFavsList;
|
||||
|
@ -137,6 +151,7 @@ public class TagListFragment extends ThemedFragment implements OnSomethingClickL
|
|||
this.followedTagsList = appSettings.getFollowedTags();
|
||||
this.followedTagsFavsList = new ArrayList<>(Arrays.asList(appSettings.getFollowedTagsFavs()));
|
||||
this.tagClickedListener = tagClickedListener;
|
||||
this.isAmoledColorMode = appSettings.isAmoledColorMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,7 +173,11 @@ public class TagListFragment extends ThemedFragment implements OnSomethingClickL
|
|||
final String tag = followedTagsList[position];
|
||||
holder.title.setText(tag);
|
||||
if (position % 2 == 1) {
|
||||
holder.root.setBackgroundColor(Helpers.get().color(R.color.alternate_row_color));
|
||||
holder.root.setBackgroundColor(isAmoledColorMode ? Color.BLACK : Helpers.get().color(R.color.alternate_row_color));
|
||||
holder.title.setTextColor(isAmoledColorMode ? Color.GRAY : Color.BLACK);
|
||||
} else {
|
||||
holder.root.setBackgroundColor(isAmoledColorMode ? Color.BLACK : Color.WHITE);
|
||||
holder.title.setTextColor(isAmoledColorMode ? Color.GRAY : Color.BLACK);
|
||||
}
|
||||
|
||||
// Favourite (Star) Image
|
||||
|
@ -190,7 +209,7 @@ public class TagListFragment extends ThemedFragment implements OnSomethingClickL
|
|||
|
||||
private void applyFavouriteImage(AppCompatImageView imageView, boolean isFaved) {
|
||||
imageView.setImageResource(isFaved ? R.drawable.ic_star_filled_48px : R.drawable.ic_star_border_black_48px);
|
||||
imageView.setColorFilter(isFaved ? appSettings.getAccentColor() : 0, PorterDuff.Mode.SRC_ATOP);
|
||||
imageView.setColorFilter(isFaved ? appSettings.getAccentColor() : (isAmoledColorMode ? Color.GRAY : 0), PorterDuff.Mode.SRC_ATOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import info.guardianproject.netcipher.NetCipher;
|
|||
public class FetchPodsService extends Service {
|
||||
public static final String MESSAGE_PODS_RECEIVED = "com.github.dfa.diaspora.podsreceived";
|
||||
public static final String EXTRA_PODLIST = "pods";
|
||||
|
||||
public FetchPodsService() {
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.content.pm.PackageManager;
|
|||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -110,14 +109,14 @@ public class ContextMenuWebView extends NestedWebView {
|
|||
if (writeToStoragePermitted) {
|
||||
//Make sure, Diaspora Folder exists
|
||||
File destinationFolder = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora");
|
||||
if(!destinationFolder.exists()) {
|
||||
if (!destinationFolder.exists()) {
|
||||
destinationFolder.mkdirs();
|
||||
}
|
||||
|
||||
if (url != null) {
|
||||
Uri source = Uri.parse(url);
|
||||
DownloadManager.Request request = new DownloadManager.Request(source);
|
||||
File destinationFile = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"+ System.currentTimeMillis() + ".png");
|
||||
File destinationFile = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + System.currentTimeMillis() + ".png");
|
||||
|
||||
request.setDestinationUri(Uri.fromFile(destinationFile));
|
||||
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
|
@ -158,7 +157,7 @@ public class ContextMenuWebView extends NestedWebView {
|
|||
if (writeToStoragePermitted) {
|
||||
//Make sure, Diaspora Folder exists
|
||||
File destinationFolder = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora");
|
||||
if(!destinationFolder.exists()) {
|
||||
if (!destinationFolder.exists()) {
|
||||
destinationFolder.mkdirs();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.github.dfa.diaspora_android.web;
|
|||
import android.annotation.TargetApi;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.WebResourceResponse;
|
||||
|
|
|
@ -89,9 +89,9 @@ public class NestedWebView extends WebView implements NestedScrollingChild {
|
|||
stopNestedScroll();
|
||||
break;
|
||||
}
|
||||
if (event != null) {
|
||||
event.recycle();
|
||||
}
|
||||
if (event != null) {
|
||||
event.recycle();
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,10 +107,11 @@ public class WebHelper {
|
|||
"})();");
|
||||
}
|
||||
|
||||
private static String lastUpdateTitleByUrl ="";
|
||||
public static synchronized void sendUpdateTitleByUrlIntent(String url, Context context){
|
||||
private static String lastUpdateTitleByUrl = "";
|
||||
|
||||
public static synchronized void sendUpdateTitleByUrlIntent(String url, Context context) {
|
||||
// Ignore javascript stuff
|
||||
if (url != null && url.startsWith("javascript:")){
|
||||
if (url != null && url.startsWith("javascript:")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ import android.content.Context;
|
|||
import android.util.Log;
|
||||
import android.webkit.WebResourceResponse;
|
||||
|
||||
import com.github.dfa.diaspora_android.R;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -42,8 +44,6 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.github.dfa.diaspora_android.R;
|
||||
|
||||
/**
|
||||
* Simple Host-Based AdBlocker
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue