diff --git a/LICENSE.md b/LICENSE.md
index d1628af1..a9a829ca 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
-# Splashscreen-Images
+# Miscellaneous
-The splashscreen images can be found on [flickr](https://www.flickr.com/photos/129581906@N06/sets/72157651933980136/with/16594947123/).
+We took some inspiration and code from LeafPic. Go check it out, its free software as well!
+https://github.com/HoraApps/LeafPic
\ No newline at end of file
diff --git a/README.md b/README.md
index cc8704d6..3ef91253 100644
--- a/README.md
+++ b/README.md
@@ -41,3 +41,6 @@ Diaspora for Android requires access to the Internet and to external storage to
## Maintainers
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.github.io), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c))
- vanitasvitae ([GitHub](https://github.com/vanitasvitae), [Diaspora](https://pod.geraspora.de/people/bbd7af90fbec013213e34860008dbc6c))
+
+## Acknowledgements
+- We took some inspiration and code from [LeafPic](https://github.com/HoraApps/LeafPic), big thanks to Donald Shtjefni and the LeafPic Team!
diff --git a/app/build.gradle b/app/build.gradle
index 32fc1384..ff64f587 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -31,6 +31,13 @@ android {
}
}
+repositories {
+ maven {
+ //Color picker
+ url "http://dl.bintray.com/dasar/maven"
+ }
+}
+
dependencies {
// Sub-Projects
//compile project(':subprojectFromRoot')
@@ -49,6 +56,7 @@ dependencies {
compile 'com.jakewharton:butterknife:8.0.1'
compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
compile 'info.guardianproject.netcipher:netcipher-webkit:2.0.0-alpha1'
+ compile(group: 'uz.shift', name: 'colorpicker', version: '0.5', ext: 'aar') //Color picker
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3ee52fa8..1fa2f2e4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,7 +11,7 @@
android:icon="@drawable/ic_launcher"
android:name="com.github.dfa.diaspora_android.App"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
+ android:theme="@style/DiasporaLight" >
+ android:theme="@style/DiasporaLight.NoActionBar"/>
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java
index cc9cf36d..424a1d22 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java
@@ -31,9 +31,10 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
@@ -43,10 +44,14 @@ import android.widget.Toast;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings;
+import com.github.dfa.diaspora_android.fragment.ThemedFragment;
import com.github.dfa.diaspora_android.ui.HtmlTextView;
+import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
import com.github.dfa.diaspora_android.util.AppLog;
+import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.Helpers;
import com.github.dfa.diaspora_android.util.Log;
+import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import java.util.Observable;
import java.util.Observer;
@@ -57,17 +62,24 @@ import butterknife.ButterKnife;
/**
* Activity that holds some fragments that show information about the app in a tab layout
*/
-public class AboutActivity extends AppCompatActivity {
+public class AboutActivity extends ThemedActivity
+implements IntellihideToolbarActivityListener {
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
+ @BindView(R.id.about__appbar)
+ AppBarLayout appBarLayout;
+
@BindView(R.id.main__topbar)
protected Toolbar toolbar;
@BindView(R.id.appbar_linear_layout)
protected LinearLayout linearLayout;
+ @BindView(R.id.tabs)
+ protected TabLayout tabLayout;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -87,23 +99,58 @@ public class AboutActivity extends AppCompatActivity {
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
- mViewPager = (ViewPager) findViewById(R.id.container);
+ mViewPager = ButterKnife.findById(this, R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
- TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
+ }
- //Apply intellihide
- if (!((App) getApplication()).getSettings().isIntellihideToolbars()) {
- AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
- params.setScrollFlags(0);
+ @Override
+ public void onResume() {
+ super.onResume();
+ if(getAppSettings().isIntellihideToolbars()) {
+ this.enableToolbarHiding();
+ } else {
+ this.disableToolbarHiding();
}
}
+ @Override
+ protected void applyColorToViews() {
+ ThemeHelper.updateToolbarColor(toolbar);
+ ThemeHelper.updateTabLayoutColor(tabLayout);
+ ThemeHelper.setPrimaryColorAsBackground(linearLayout);
+ }
+
+ @Override
+ public void enableToolbarHiding() {
+ AppLog.d(this, "Enable Intellihide");
+ AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
+ //scroll|enterAlways|snap
+ params.setScrollFlags(toolbarDefaultScrollFlags);
+ appBarLayout.setExpanded(true, true);
+ }
+
+ @Override
+ public void disableToolbarHiding() {
+ AppLog.d(this, "Disable Intellihide");
+ AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
+ params.setScrollFlags(0); // clear all scroll flags
+ appBarLayout.setExpanded(true, true);
+ }
+
/**
* Fragment that shows general information about the app
*/
- public static class AboutFragment extends Fragment {
+ public static class AboutFragment extends ThemedFragment {
+
+ public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.AboutFragment";
+
+ @BindView(R.id.fragment_about__about_text)
+ TextView aboutText;
+
+ @BindView(R.id.fragment_about__app_version)
+ TextView appVersion;
public AboutFragment() {
}
@@ -112,8 +159,7 @@ public class AboutActivity extends AppCompatActivity {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.about__fragment_about, container, false);
- TextView appVersion = (TextView) rootView.findViewById(R.id.fragment_about__app_version);
-
+ ButterKnife.bind(this, rootView);
if (isAdded()) {
try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
@@ -125,18 +171,42 @@ public class AboutActivity extends AppCompatActivity {
}
return rootView;
}
+
+ @Override
+ protected void applyColorToViews() {
+ ThemeHelper.updateTextViewColor(aboutText);
+ }
+
+ @Override
+ public String getFragmentTag() {
+ return TAG;
+ }
+
+ @Override
+ public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
+ /* Nothing to do */
+ }
+
+ @Override
+ public boolean onBackPressed() {
+ return false;
+ }
}
/**
* Fragment that shows information about the license of the app and used 3rd party libraries
*/
- public static class LicenseFragment extends Fragment {
+ public static class LicenseFragment extends ThemedFragment {
+ public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.LicenseFragment";
+
@BindView(R.id.fragment_license__licensetext)
HtmlTextView textLicenseBox;
@BindView(R.id.fragment_license__3rdparty)
HtmlTextView textLicense3partyBox;
+ private String accentColor;
+
public LicenseFragment() {
}
@@ -146,7 +216,7 @@ public class AboutActivity extends AppCompatActivity {
View rootView = inflater.inflate(R.layout.about__fragment_license, container, false);
ButterKnife.bind(this, rootView);
final Context context = rootView.getContext();
- accentColor = Helpers.hexColorFromRessourceColor(context, R.color.colorAccent);
+ accentColor = Helpers.colorToHex(ThemeHelper.getAccentColor());
textLicenseBox.setTextFormatted(getString(R.string.fragment_license__license_content,
getMaintainersHtml(context),
@@ -160,8 +230,6 @@ public class AboutActivity extends AppCompatActivity {
return rootView;
}
- private String accentColor;
-
public String getContributorsHtml(Context context) {
String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors,
"* ", "
");
@@ -187,13 +255,52 @@ public class AboutActivity extends AppCompatActivity {
text = text.replace("NEWENTRY", "* ");
return text;
}
+
+ @Override
+ protected void applyColorToViews() {
+ ThemeHelper.updateTextViewColor(textLicense3partyBox);
+ ThemeHelper.updateTextViewColor(textLicenseBox);
+ }
+
+ @Override
+ public String getFragmentTag() {
+ return TAG;
+ }
+
+ @Override
+ public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) {
+ /* Nothing to do */
+ }
+
+ @Override
+ public boolean onBackPressed() {
+ return false;
+ }
}
/**
* Fragment that shows debug information like app version, pod version...
*/
public static class DebugFragment extends Fragment implements Observer {
- private TextView logBox;
+ public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.DebugFragment";
+
+ @BindView(R.id.fragment_debug__package_name)
+ TextView packageName;
+
+ @BindView(R.id.fragment_debug__app_version)
+ TextView appVersion;
+
+ @BindView(R.id.fragment_debug__android_version)
+ TextView osVersion;
+
+ @BindView(R.id.fragment_debug__device_name)
+ TextView deviceName;
+
+ @BindView(R.id.fragment_debug__pod_domain)
+ TextView podDomain;
+
+ @BindView(R.id.fragment_debug__log_box)
+ TextView logBox;
public DebugFragment() {
}
@@ -202,16 +309,10 @@ public class AboutActivity extends AppCompatActivity {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.about__fragment_debug, container, false);
- TextView packageName = (TextView) rootView.findViewById(R.id.fragment_debug__package_name);
- TextView appVersion = (TextView) rootView.findViewById(R.id.fragment_debug__app_version);
- TextView osVersion = (TextView) rootView.findViewById(R.id.fragment_debug__android_version);
- TextView deviceName = (TextView) rootView.findViewById(R.id.fragment_debug__device_name);
- TextView podDomain = (TextView) rootView.findViewById(R.id.fragment_debug__pod_domain);
- logBox = (TextView) rootView.findViewById(R.id.fragment_debug__log_box);
+ ButterKnife.bind(this, rootView);
logBox.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
- AppLog.d(this, "Long click registered");
if (isAdded()) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("DEBUG_LOG", Log.getLogBuffer());
@@ -229,14 +330,14 @@ public class AboutActivity extends AppCompatActivity {
if (isAdded()) {
try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
- AppSettings settings = ((App) getActivity().getApplication()).getSettings();
-
+ 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 + ")"));
osVersion.setText(getString(R.string.fragment_debug__android_version, Build.VERSION.RELEASE));
deviceName.setText(getString(R.string.fragment_debug__device_name, Build.MANUFACTURER + " " + Build.MODEL));
- podDomain.setText(getString(R.string.fragment_debug__pod_domain, settings.getPodDomain()));
+ podDomain.setText(getString(R.string.fragment_debug__pod_domain, urls.getPodUrl()));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java
index 6f7741fe..28a132eb 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java
@@ -40,7 +40,6 @@ import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent;
@@ -54,6 +53,7 @@ import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -71,16 +71,21 @@ import com.github.dfa.diaspora_android.receiver.OpenExternalLinkReceiver;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.receiver.UpdateTitleReceiver;
import com.github.dfa.diaspora_android.ui.BadgeDrawable;
+import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
+import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import com.github.dfa.diaspora_android.util.WebHelper;
import butterknife.BindView;
import butterknife.ButterKnife;
-public class MainActivity extends AppCompatActivity
- implements NavigationView.OnNavigationItemSelectedListener, WebUserProfileChangedListener, CustomTabActivityHelper.ConnectionCallback {
+public class MainActivity extends ThemedActivity
+ implements NavigationView.OnNavigationItemSelectedListener,
+ WebUserProfileChangedListener,
+ CustomTabActivityHelper.ConnectionCallback,
+ IntellihideToolbarActivityListener {
public static final int REQUEST_CODE_ASK_PERMISSIONS = 123;
@@ -93,7 +98,6 @@ public class MainActivity extends AppCompatActivity
public static final String ACTION_CHANGE_ACCOUNT = "com.github.dfa.diaspora_android.MainActivity.change_account";
public static final String ACTION_CLEAR_CACHE = "com.github.dfa.diaspora_android.MainActivity.clear_cache";
public static final String ACTION_UPDATE_TITLE_FROM_URL = "com.github.dfa.diaspora_android.MainActivity.set_title";
- public static final String ACTION_RELOAD_ACTIVITY = "com.github.dfa.diaspora_android.MainActivity.reload_activity";
public static final String URL_MESSAGE = "URL_MESSAGE";
public static final String EXTRA_URL = "com.github.dfa.diaspora_android.extra_url";
public static final String CONTENT_HASHTAG = "content://com.github.dfa.diaspora_android.mainactivity/";
@@ -114,6 +118,9 @@ public class MainActivity extends AppCompatActivity
/**
* UI Bindings
*/
+ @BindView(R.id.main__appbar)
+ AppBarLayout appBarLayout;
+
@BindView(R.id.main__topbar)
Toolbar toolbarTop;
@@ -129,6 +136,9 @@ public class MainActivity extends AppCompatActivity
@BindView(R.id.main__navdrawer)
DrawerLayout navDrawer;
+ RelativeLayout navDrawerLayout;
+ LinearLayout navProfilePictureArea;
+
// NavHeader cannot be bound by Butterknife
private TextView navheaderTitle;
@@ -185,7 +195,7 @@ public class MainActivity extends AppCompatActivity
}
});
- if(!appSettings.hasPodDomain()) {
+ if (!appSettings.hasPodDomain()) {
AppLog.d(this, "We have no pod. Show PodSelectionFragment");
showFragment(getFragment(PodSelectionFragment.TAG));
} else {
@@ -231,13 +241,6 @@ public class MainActivity extends AppCompatActivity
// Load app settings
setupNavigationSlider();
-
- if (!appSettings.isIntellihideToolbars()) {
- AppLog.v(this, "Disable intelligent hiding of toolbars");
- AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams();
- params.setScrollFlags(0); // clear all scroll flags
- }
-
AppLog.v(this, "UI successfully set up");
}
@@ -261,7 +264,7 @@ public class MainActivity extends AppCompatActivity
*/
protected CustomFragment getFragment(String fragmentTag) {
CustomFragment fragment = (CustomFragment) fm.findFragmentByTag(fragmentTag);
- if(fragment != null) {
+ if (fragment != null) {
return fragment;
} else {
switch (fragmentTag) {
@@ -282,8 +285,8 @@ public class MainActivity extends AppCompatActivity
fm.beginTransaction().add(psf, fragmentTag).commit();
return psf;
default:
- AppLog.e(this,"Invalid Fragment Tag: "+fragmentTag
- +"\nAdd Fragments Tag to getFragment()'s switch case.");
+ AppLog.e(this, "Invalid Fragment Tag: " + fragmentTag
+ + "\nAdd Fragments Tag to getFragment()'s switch case.");
return getTopFragment();
}
}
@@ -296,7 +299,7 @@ public class MainActivity extends AppCompatActivity
protected void showFragment(CustomFragment fragment) {
AppLog.v(this, "showFragment()");
CustomFragment currentTop = (CustomFragment) fm.findFragmentById(R.id.fragment_container);
- if(currentTop == null || !currentTop.getFragmentTag().equals(fragment.getFragmentTag())) {
+ if (currentTop == null || !currentTop.getFragmentTag().equals(fragment.getFragmentTag())) {
AppLog.v(this, "Fragment was not visible. Replace it.");
fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit();
invalidateOptionsMenu();
@@ -318,9 +321,10 @@ public class MainActivity extends AppCompatActivity
navView.setNavigationItemSelectedListener(this);
View navHeader = navView.getHeaderView(0);
- LinearLayout navheaderProfileSection = ButterKnife.findById(navHeader, R.id.nav_profile_picture);
+ navProfilePictureArea = ButterKnife.findById(navHeader, R.id.nav_profile_picture);
+ navDrawerLayout = ButterKnife.findById(navHeader, R.id.nav_drawer);
//Handle clicks on profile picture
- navheaderProfileSection.setOnClickListener(new View.OnClickListener() {
+ navProfilePictureArea.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
navDrawer.closeDrawer(GravityCompat.START);
@@ -357,8 +361,10 @@ public class MainActivity extends AppCompatActivity
}
}
}
+ updateNavigationViewEntryVisibilities();
+ }
- // Set visibility
+ protected void updateNavigationViewEntryVisibilities() {
Menu navMenu = navView.getMenu();
navMenu.findItem(R.id.nav_exit).setVisible(appSettings.isVisibleInNavExit());
navMenu.findItem(R.id.nav_activities).setVisible(appSettings.isVisibleInNavActivities());
@@ -371,7 +377,7 @@ public class MainActivity extends AppCompatActivity
navMenu.findItem(R.id.nav_profile).setVisible(appSettings.isVisibleInNavProfile());
navMenu.findItem(R.id.nav_public).setVisible(appSettings.isVisibleInNavPublic_activities());
}
-
+
/**
* Forward incoming intents to handleIntent()
* @param intent incoming
@@ -408,7 +414,7 @@ public class MainActivity extends AppCompatActivity
return;
} else {
loadUrl = intent.getDataString();
- AppLog.v(this, "Intent has a delicious URL for us: "+loadUrl);
+ AppLog.v(this, "Intent has a delicious URL for us: " + loadUrl);
}
} else if (ACTION_CHANGE_ACCOUNT.equals(action)) {
AppLog.v(this, "Reset pod data and show PodSelectionFragment");
@@ -417,10 +423,6 @@ public class MainActivity extends AppCompatActivity
} else if (ACTION_CLEAR_CACHE.equals(action)) {
AppLog.v(this, "Clear WebView cache");
((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView().clearCache(true);
- } else if (ACTION_RELOAD_ACTIVITY.equals(action)) {
- AppLog.v(this, "Recreate activity");
- recreate();
- return;
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
switch (type) {
case "text/plain":
@@ -447,13 +449,14 @@ public class MainActivity extends AppCompatActivity
/**
* Handle activity results
+ *
* @param requestCode reqCode
- * @param resultCode resCode
- * @param data data
+ * @param resultCode resCode
+ * @param data data
*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
- AppLog.v(this, "onActivityResult(): "+requestCode);
+ AppLog.v(this, "onActivityResult(): " + requestCode);
super.onActivityResult(requestCode, resultCode, data);
}
@@ -463,7 +466,7 @@ public class MainActivity extends AppCompatActivity
*/
private CustomFragment getTopFragment() {
Fragment top = fm.findFragmentById(R.id.fragment_container);
- if(top != null) {
+ if (top != null) {
return (CustomFragment) top;
}
return null;
@@ -480,12 +483,12 @@ public class MainActivity extends AppCompatActivity
return;
}
CustomFragment top = getTopFragment();
- if(top != null) {
+ if (top != null) {
AppLog.v(this, "Top Fragment is not null");
- if(!top.onBackPressed()) {
+ if (!top.onBackPressed()) {
AppLog.v(this, "Top Fragment.onBackPressed was false");
- AppLog.v(this, "BackStackEntryCount: "+fm.getBackStackEntryCount());
- if(fm.getBackStackEntryCount()>0) {
+ AppLog.v(this, "BackStackEntryCount: " + fm.getBackStackEntryCount());
+ if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
} else {
snackbarExitApp.show();
@@ -530,6 +533,13 @@ public class MainActivity extends AppCompatActivity
AppLog.v(this, "Register BroadcastReceivers");
LocalBroadcastManager.getInstance(this).registerReceiver(brSetTitle, new IntentFilter(ACTION_UPDATE_TITLE_FROM_URL));
LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_URL));
+ this.appSettings = getAppSettings();
+ if (appSettings.isIntellihideToolbars()) {
+ this.enableToolbarHiding();
+ } else {
+ this.disableToolbarHiding();
+ }
+ updateNavigationViewEntryVisibilities();
}
/**
@@ -547,9 +557,9 @@ public class MainActivity extends AppCompatActivity
toolbarBottom.setVisibility(View.VISIBLE);
CustomFragment top = getTopFragment();
- if(top != null) {
+ if (top != null) {
//Are we displaying a Fragment other than PodSelectionFragment?
- if(!top.getFragmentTag().equals(PodSelectionFragment.TAG)) {
+ if (!top.getFragmentTag().equals(PodSelectionFragment.TAG)) {
getMenuInflater().inflate(R.menu.main__menu_top, menu);
getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu());
top.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater());
@@ -814,8 +824,8 @@ public class MainActivity extends AppCompatActivity
@Override
public void onCustomTabsConnected() {
- if(customTabsSession == null) {
- AppLog.i(this, "CustomTabs warmup: "+customTabActivityHelper.warmup(0));
+ if (customTabsSession == null) {
+ AppLog.i(this, "CustomTabs warmup: " + customTabActivityHelper.warmup(0));
customTabsSession = customTabActivityHelper.getSession();
}
}
@@ -973,4 +983,29 @@ public class MainActivity extends AppCompatActivity
public void setTextToBeShared(String textToBeShared) {
this.textToBeShared = textToBeShared;
}
-}
+
+ @Override
+ protected void applyColorToViews() {
+ ThemeHelper.updateToolbarColor(toolbarTop);
+ ThemeHelper.updateActionMenuViewColor(toolbarBottom);
+ navDrawerLayout.setBackgroundColor(appSettings.getPrimaryColor());
+ navProfilePictureArea.setBackgroundColor(appSettings.getPrimaryColor());
+ }
+
+ @Override
+ public void enableToolbarHiding() {
+ AppLog.d(this, "Enable Intellihide");
+ AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams();
+ //scroll|enterAlways|snap
+ params.setScrollFlags(toolbarDefaultScrollFlags);
+ appBarLayout.setExpanded(true, true);
+ }
+
+ @Override
+ public void disableToolbarHiding() {
+ AppLog.d(this, "Disable Intellihide");
+ AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarTop.getLayoutParams();
+ params.setScrollFlags(0); // clear all scroll flags
+ appBarLayout.setExpanded(true, true);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java
index 5b45bbd0..89ec73d5 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java
@@ -1,19 +1,15 @@
/*
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 .
*/
package com.github.dfa.diaspora_android.activity;
@@ -25,37 +21,63 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.os.Build;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
+import android.support.design.widget.AppBarLayout;
+import android.support.v7.widget.Toolbar;
+import android.view.LayoutInflater;
import android.view.MenuItem;
+import android.view.View;
+import android.view.Window;
+import android.widget.FrameLayout;
+import android.widget.TextView;
import com.github.dfa.diaspora_android.App;
import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings;
+import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
+import com.github.dfa.diaspora_android.util.theming.ColorPalette;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.util.AppLog;
+import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import uz.shift.colorpicker.LineColorPicker;
+import uz.shift.colorpicker.OnColorChangedListener;
/**
* @author vanitas
*/
-public class SettingsActivity extends AppCompatActivity {
+public class SettingsActivity extends ThemedActivity implements IntellihideToolbarActivityListener {
+ @BindView(R.id.settings__appbar)
+ protected AppBarLayout appBarLayout;
+
+ @BindView(R.id.settings__toolbar)
+ protected Toolbar toolbar;
+
private ProxyHandler.ProxySettings oldProxySettings;
- private AppSettings appSettings;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- ActionBar toolbar = getSupportActionBar();
- if (toolbar != null)
- toolbar.setDisplayHomeAsUpEnabled(true);
- this.appSettings = new AppSettings(this);
- oldProxySettings = appSettings.getProxySettings();
- getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
+ setContentView(R.layout.settings__activity);
+ ButterKnife.bind(this);
+ setSupportActionBar(toolbar);
+ toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
+ toolbar.setNavigationOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ SettingsActivity.this.onBackPressed();
+ }
+ });
+ oldProxySettings = getAppSettings().getProxySettings();
+ getFragmentManager().beginTransaction().replace(R.id.settings__fragment_container, new SettingsFragment()).commit();
}
@Override
@@ -69,6 +91,28 @@ public class SettingsActivity extends AppCompatActivity {
}
}
+ @Override
+ protected void applyColorToViews() {
+ ThemeHelper.updateToolbarColor(toolbar);
+ }
+
+ @Override
+ public void enableToolbarHiding() {
+ AppLog.d(this, "Enable Intellihide");
+ AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
+ //scroll|enterAlways|snap
+ params.setScrollFlags(toolbarDefaultScrollFlags);
+ appBarLayout.setExpanded(true, true);
+ }
+
+ @Override
+ public void disableToolbarHiding() {
+ AppLog.d(this, "Disable Intellihide");
+ AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
+ params.setScrollFlags(0); // clear all scroll flags
+ appBarLayout.setExpanded(true, true);
+ }
+
public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
private SharedPreferences sharedPreferences;
@@ -96,6 +140,13 @@ public class SettingsActivity extends AppCompatActivity {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
updatePreference(findPreference(key));
+ if(key.equals(getString(R.string.pref_key__intellihide_toolbars))) {
+ if(sharedPreferences.getBoolean(getString(R.string.pref_key__intellihide_toolbars), false)) {
+ ((SettingsActivity)getActivity()).enableToolbarHiding();
+ } else {
+ ((SettingsActivity)getActivity()).disableToolbarHiding();
+ }
+ }
}
private void updatePreference(Preference preference) {
@@ -117,10 +168,29 @@ public class SettingsActivity extends AppCompatActivity {
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
App app = ((App) getActivity().getApplication());
AppSettings appSettings = app.getSettings();
+ if(Build.VERSION.SDK_INT >= 21) {
+ if (preference instanceof PreferenceScreen && ((PreferenceScreen) preference).getDialog() != null) {
+ Window window = ((PreferenceScreen) preference).getDialog().getWindow();
+ if (window != null) {
+ window.setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
+ }
+ }
+ }
+
Intent intent = new Intent(getActivity(), MainActivity.class);
String podDomain = appSettings.getPodDomain();
switch (preference.getTitleRes()) {
+ case R.string.pref_title__primary_color: {
+ showColorPickerDialog(1);
+ intent = null;
+ break;
+ }
+ case R.string.pref_title__accent_color: {
+ showColorPickerDialog(2);
+ intent = null;
+ break;
+ }
case R.string.pref_title__personal_settings: {
intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/user/edit");
@@ -177,6 +247,71 @@ public class SettingsActivity extends AppCompatActivity {
}
return super.onPreferenceTreeClick(screen, preference);
}
+
+ /**
+ * Show a colorPicker Dialog
+ * @param type 1 -> Primary Color, 2 -> Accent Color
+ */
+ public void showColorPickerDialog(final int type) {
+ final AppSettings appSettings = ((App)getActivity().getApplication()).getSettings();
+ final Context context = getActivity();
+
+ //Inflate dialog layout
+ LayoutInflater inflater = getActivity().getLayoutInflater();
+ View dialogLayout = inflater.inflate(R.layout.color_picker__dialog, null);
+ final android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(context);
+ builder.setView(dialogLayout);
+
+ final FrameLayout titleBackground = (FrameLayout) dialogLayout.findViewById(R.id.color_picker_dialog__title_background);
+ final TextView title = (TextView) dialogLayout.findViewById(R.id.color_picker_dialog__title);
+ final LineColorPicker base = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_dialog__base_picker);
+ final LineColorPicker shade = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_dialog__shade_picker);
+
+ title.setText(type == 1 ? R.string.pref_title__primary_color : R.string.pref_title__accent_color);
+ title.setTextColor(getResources().getColor(R.color.white));
+ final int[] current = (type == 1 ? appSettings.getPrimaryColorSettings() : appSettings.getAccentColorSettings());
+ base.setColors((type == 1 ? ColorPalette.getBaseColors(context) : ColorPalette.getAccentColors(context)));
+ base.setSelectedColor(current[0]);
+ shade.setColors(ColorPalette.getColors(context, current[0]));
+ shade.setSelectedColor(current[1]);
+ titleBackground.setBackgroundColor(shade.getColor());
+ base.setOnColorChangedListener(new OnColorChangedListener() {
+ @Override
+ public void onColorChanged(int i) {
+ AppLog.d(this, "Selected Base color changed: "+i);
+ shade.setColors(ColorPalette.getColors(context, i));
+ titleBackground.setBackgroundColor(i);
+ if(i == current[0]) {
+ shade.setSelectedColor(current[1]);
+ titleBackground.setBackgroundColor(shade.getColor());
+ }
+ }
+ });
+ shade.setOnColorChangedListener(new OnColorChangedListener() {
+ @Override
+ public void onColorChanged(int i) {
+ titleBackground.setBackgroundColor(i);
+ }
+ });
+
+ //Build dialog
+ builder
+ .setNegativeButton(android.R.string.cancel, null)
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i) {
+ if(type == 1) {
+ appSettings.setPrimaryColorSettings(base.getColor(), shade.getColor());
+ if(Build.VERSION.SDK_INT >= 21) {
+ getActivity().getWindow().setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
+ }
+ ((ThemedActivity)getActivity()).applyColorToViews();
+ } else {
+ appSettings.setAccentColorSettings(base.getColor(), shade.getColor());
+ }
+ }
+ }).show();
+ }
}
@Override
@@ -191,7 +326,7 @@ public class SettingsActivity extends AppCompatActivity {
@Override
protected void onStop() {
- ProxyHandler.ProxySettings newProxySettings = appSettings.getProxySettings();
+ ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings();
if(!oldProxySettings.equals(newProxySettings)) {
AppLog.d(this, "ProxySettings changed.");
//Proxy on-off? => Restart app
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/ThemedActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/ThemedActivity.java
new file mode 100644
index 00000000..840b1964
--- /dev/null
+++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/ThemedActivity.java
@@ -0,0 +1,78 @@
+/*
+ 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 .
+ */
+package com.github.dfa.diaspora_android.activity;
+
+import android.annotation.TargetApi;
+import android.app.ActivityManager;
+import android.graphics.drawable.BitmapDrawable;
+import android.os.Build;
+import android.support.v7.app.AppCompatActivity;
+
+import com.github.dfa.diaspora_android.App;
+import com.github.dfa.diaspora_android.R;
+import com.github.dfa.diaspora_android.data.AppSettings;
+import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
+
+/**
+ * Activity that supports color schemes
+ * Created by vanitas on 06.10.16.
+ */
+
+public abstract class ThemedActivity extends AppCompatActivity {
+
+ protected AppSettings getAppSettings() {
+ return ((App)getApplication()).getSettings();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ ThemeHelper.getInstance(getAppSettings());
+ updateStatusBarColor();
+ updateRecentAppColor();
+ applyColorToViews();
+ }
+ protected abstract void applyColorToViews();
+
+ /**
+ * Update color of the status bar
+ */
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private void updateStatusBarColor() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ getWindow().setStatusBarColor(ThemeHelper.getPrimaryDarkColor());
+ }
+ }
+
+ /**
+ * Update primary color in recent apps overview
+ */
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ private void updateRecentAppColor(){
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ BitmapDrawable drawable = ((BitmapDrawable) getDrawable(R.drawable.ic_launcher));
+ if(drawable != null) {
+ setTaskDescription(new ActivityManager.TaskDescription(
+ getResources().getString(R.string.app_name),
+ drawable.getBitmap(),
+ getAppSettings().getPrimaryColor()));
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java
index 6cb84890..b6cb17b2 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java
@@ -1,19 +1,15 @@
/*
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 .
*/
package com.github.dfa.diaspora_android.data;
@@ -319,4 +315,36 @@ public class AppSettings {
public boolean isVisibleInNavProfile() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__profile, false);
}
-}
+
+ public void setPrimaryColorSettings(int base, int shade) {
+ setInt(prefApp, R.string.pref_key__primary_color_base, base);
+ setInt(prefApp, R.string.pref_key__primary_color_shade, shade);
+ }
+
+ public int[] getPrimaryColorSettings() {
+ 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_shade, context.getResources().getColor(R.color.primary))
+ };
+ }
+
+ public int getPrimaryColor() {
+ return getInt(prefApp, R.string.pref_key__primary_color_shade, context.getResources().getColor(R.color.primary));
+ }
+
+ public void setAccentColorSettings(int base, int shade) {
+ setInt(prefApp, R.string.pref_key__accent_color_base, base);
+ setInt(prefApp, R.string.pref_key__accent_color_shade, shade);
+ }
+
+ public int[] getAccentColorSettings() {
+ 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_shade, context.getResources().getColor(R.color.accent))
+ };
+ }
+
+ public int getAccentColor() {
+ return getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent));
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java b/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java
index fab00027..9213ca9f 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/fragment/BrowserFragment.java
@@ -43,6 +43,7 @@ import com.github.dfa.diaspora_android.activity.MainActivity;
import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.ui.ContextMenuWebView;
+import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.webview.CustomWebViewClient;
import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient;
@@ -62,7 +63,7 @@ import java.util.Locale;
* Created by vanitas on 26.09.16.
*/
-public class BrowserFragment extends CustomFragment {
+public class BrowserFragment extends ThemedFragment {
public static final String TAG = "com.github.dfa.diaspora_android.BrowserFragment";
protected View rootLayout;
@@ -145,6 +146,15 @@ public class BrowserFragment extends CustomFragment {
webView.setWebChromeClient(new ProgressBarWebChromeClient(webView, progressBar));
}
+ @Override
+ public void onResume() {
+ super.onResume();
+ if(webView != null) {
+ webSettings.setMinimumFontSize(appSettings.getMinimumFontSize());
+ webSettings.setLoadsImagesAutomatically(appSettings.isLoadImages());
+ }
+ }
+
@SuppressWarnings("ResultOfMethodCallIgnored")
protected boolean makeScreenshotOfWebView(boolean hasToShareScreenshot) {
AppLog.i(this, "StreamFragment.makeScreenshotOfWebView()");
@@ -273,4 +283,9 @@ public class BrowserFragment extends CustomFragment {
public ContextMenuWebView getWebView() {
return this.webView;
}
+
+ @Override
+ protected void applyColorToViews() {
+ ThemeHelper.updateProgressBarColor(progressBar);
+ }
}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/fragment/ThemedFragment.java b/app/src/main/java/com/github/dfa/diaspora_android/fragment/ThemedFragment.java
new file mode 100644
index 00000000..ca3f3965
--- /dev/null
+++ b/app/src/main/java/com/github/dfa/diaspora_android/fragment/ThemedFragment.java
@@ -0,0 +1,43 @@
+/*
+ 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 .
+ */
+package com.github.dfa.diaspora_android.fragment;
+
+import com.github.dfa.diaspora_android.App;
+import com.github.dfa.diaspora_android.data.AppSettings;
+import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
+
+/**
+ * Fragment that supports color schemes
+ * Created by vanitas on 06.10.16.
+ */
+
+public abstract class ThemedFragment extends CustomFragment {
+ protected AppSettings getAppSettings() {
+ return ((App)getActivity().getApplication()).getSettings();
+ }
+
+ protected abstract void applyColorToViews();
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ ThemeHelper.getInstance(getAppSettings());
+ applyColorToViews();
+ }
+}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/receiver/OpenExternalLinkReceiver.java b/app/src/main/java/com/github/dfa/diaspora_android/receiver/OpenExternalLinkReceiver.java
index e52b24ea..41ef57a5 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/receiver/OpenExternalLinkReceiver.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/receiver/OpenExternalLinkReceiver.java
@@ -33,7 +33,7 @@ import com.github.dfa.diaspora_android.data.AppSettings;
import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.CustomTabHelpers.BrowserFallback;
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
-import com.github.dfa.diaspora_android.util.Helpers;
+import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
/**
* BroadcastReceiver that opens links in a Chrome CustomTab
@@ -48,9 +48,10 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context c, Intent receiveIntent) {
- AppSettings settings = new AppSettings(c);
+ AppSettings appSettings = new AppSettings(c);
+ ThemeHelper.getInstance(appSettings);
- AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
+ AppLog.v(this, "OpenExternalLinkReceiver.onReceive(): url");
Uri url = null;
try {
@@ -61,10 +62,10 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
return;
}
- if (settings.isChromeCustomTabsEnabled()) {
+ if (appSettings.isChromeCustomTabsEnabled()) {
// Setup Chrome Custom Tab
CustomTabsIntent.Builder customTab = new CustomTabsIntent.Builder();
- customTab.setToolbarColor(Helpers.getColorFromRessource(c, R.color.colorPrimary));
+ customTab.setToolbarColor(ThemeHelper.getPrimaryColor());
customTab.addDefaultShareMenuItem();
Bitmap backButtonIcon = BitmapFactory.decodeResource(c.getResources(), R.drawable.chrome_custom_tab__back);
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java
index fab514ab..370b822f 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java
@@ -48,7 +48,7 @@ public class BadgeDrawable extends Drawable {
float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count);
badgeBackground = new Paint();
- badgeBackground.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.accent));
+ badgeBackground.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.md_deep_orange_650));
badgeBackground.setAntiAlias(true);
badgeBackground.setStyle(Paint.Style.FILL);
badgeStroke = new Paint();
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/IntellihideToolbarActivityListener.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/IntellihideToolbarActivityListener.java
new file mode 100644
index 00000000..61b68a2e
--- /dev/null
+++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/IntellihideToolbarActivityListener.java
@@ -0,0 +1,14 @@
+package com.github.dfa.diaspora_android.ui;
+
+import android.support.design.widget.AppBarLayout;
+
+/**
+ * interface that adds options to control intellihide of toolbars to the Activity
+ * Created by vanitas on 08.10.16.
+ */
+
+public interface IntellihideToolbarActivityListener {
+ int toolbarDefaultScrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP;
+ void enableToolbarHiding();
+ void disableToolbarHiding();
+}
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java b/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java
index 830380ec..2c4ba62b 100644
--- a/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java
+++ b/app/src/main/java/com/github/dfa/diaspora_android/util/Helpers.java
@@ -113,6 +113,10 @@ public class Helpers {
return "#" + Integer.toHexString(context.getResources().getColor(idColor) & 0x00ffffff);
}
+ public static String colorToHex(int color) {
+ return "#" + Integer.toHexString(color & 0x00ffffff);
+ }
+
public static void printBundle(Bundle savedInstanceState, String k) {
if (savedInstanceState != null) {
for (String key : savedInstanceState.keySet()) {
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/theming/ColorPalette.java b/app/src/main/java/com/github/dfa/diaspora_android/util/theming/ColorPalette.java
new file mode 100644
index 00000000..16f02b90
--- /dev/null
+++ b/app/src/main/java/com/github/dfa/diaspora_android/util/theming/ColorPalette.java
@@ -0,0 +1,288 @@
+package com.github.dfa.diaspora_android.util.theming;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.support.v4.content.ContextCompat;
+import android.support.v4.graphics.ColorUtils;
+
+import com.github.dfa.diaspora_android.R;
+
+/**
+ * Created by dnld on 24/02/16.
+ */
+public class ColorPalette {
+
+ public static int[] getAccentColors(Context context){
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_red_500),
+ ContextCompat.getColor(context, R.color.md_purple_500),
+ ContextCompat.getColor(context, R.color.md_deep_purple_500),
+ ContextCompat.getColor(context, R.color.md_blue_500),
+ ContextCompat.getColor(context, R.color.md_light_blue_500),
+ ContextCompat.getColor(context, R.color.md_cyan_500),
+ ContextCompat.getColor(context, R.color.md_teal_500),
+ ContextCompat.getColor(context, R.color.md_green_500),
+ ContextCompat.getColor(context, R.color.md_yellow_500),
+ ContextCompat.getColor(context, R.color.md_orange_500),
+ ContextCompat.getColor(context, R.color.md_deep_orange_500),
+ ContextCompat.getColor(context, R.color.md_brown_500),
+ ContextCompat.getColor(context, R.color.md_blue_grey_500),
+ };
+ }
+
+ public static int getObscuredColor(int c){
+ float[] hsv = new float[3];
+ int color = c;
+ Color.colorToHSV(color, hsv);
+ hsv[2] *= 0.85f; // value component
+ color = Color.HSVToColor(hsv);
+ return color;
+ }
+
+ public static int getTransparentColor(int color, int alpha){
+ return ColorUtils.setAlphaComponent(color, alpha);
+ }
+
+ public static int[] getTransparencyShadows(int color) {
+ int[] shadows = new int[10];
+ for (int i=0; i<10;i++)
+ shadows[i]= (ColorPalette.getTransparentColor(color, ((100-(i*10))*255) /100));
+ return shadows;
+ }
+
+ public static int[] getBaseColors(Context context) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_red_500),
+ ContextCompat.getColor(context, R.color.md_pink_500),
+ ContextCompat.getColor(context, R.color.md_purple_500),
+ ContextCompat.getColor(context, R.color.md_deep_purple_500),
+ ContextCompat.getColor(context, R.color.md_indigo_500),
+ ContextCompat.getColor(context, R.color.md_blue_500),
+ ContextCompat.getColor(context, R.color.md_light_blue_500),
+ ContextCompat.getColor(context, R.color.md_cyan_500),
+ ContextCompat.getColor(context, R.color.md_teal_500),
+ ContextCompat.getColor(context, R.color.md_green_500),
+ ContextCompat.getColor(context, R.color.md_light_green_500),
+ ContextCompat.getColor(context, R.color.md_lime_500),
+ ContextCompat.getColor(context, R.color.md_yellow_500),
+ ContextCompat.getColor(context, R.color.md_amber_500),
+ ContextCompat.getColor(context, R.color.md_orange_500),
+ ContextCompat.getColor(context, R.color.md_deep_orange_500),
+ ContextCompat.getColor(context, R.color.md_brown_500),
+ ContextCompat.getColor(context, R.color.md_blue_grey_500),
+ ContextCompat.getColor(context, R.color.md_grey_500)
+ };
+ }
+
+ public static int[] getColors(Context context, int c) {
+ if (c == ContextCompat.getColor(context, R.color.md_red_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_red_200),
+ ContextCompat.getColor(context, R.color.md_red_300),
+ ContextCompat.getColor(context, R.color.md_red_400),
+ ContextCompat.getColor(context, R.color.md_red_500),
+ ContextCompat.getColor(context, R.color.md_red_600),
+ ContextCompat.getColor(context, R.color.md_red_700),
+ ContextCompat.getColor(context, R.color.md_red_800),
+ ContextCompat.getColor(context, R.color.md_red_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_pink_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_pink_200),
+ ContextCompat.getColor(context, R.color.md_pink_300),
+ ContextCompat.getColor(context, R.color.md_pink_400),
+ ContextCompat.getColor(context, R.color.md_pink_500),
+ ContextCompat.getColor(context, R.color.md_pink_600),
+ ContextCompat.getColor(context, R.color.md_pink_700),
+ ContextCompat.getColor(context, R.color.md_pink_800),
+ ContextCompat.getColor(context, R.color.md_pink_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_purple_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_purple_200),
+ ContextCompat.getColor(context, R.color.md_purple_300),
+ ContextCompat.getColor(context, R.color.md_purple_400),
+ ContextCompat.getColor(context, R.color.md_purple_500),
+ ContextCompat.getColor(context, R.color.md_purple_600),
+ ContextCompat.getColor(context, R.color.md_purple_700),
+ ContextCompat.getColor(context, R.color.md_purple_800),
+ ContextCompat.getColor(context, R.color.md_purple_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_deep_purple_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_deep_purple_200),
+ ContextCompat.getColor(context, R.color.md_deep_purple_300),
+ ContextCompat.getColor(context, R.color.md_deep_purple_400),
+ ContextCompat.getColor(context, R.color.md_deep_purple_500),
+ ContextCompat.getColor(context, R.color.md_deep_purple_600),
+ ContextCompat.getColor(context, R.color.md_deep_purple_700),
+ ContextCompat.getColor(context, R.color.md_deep_purple_800),
+ ContextCompat.getColor(context, R.color.md_deep_purple_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_indigo_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_indigo_200),
+ ContextCompat.getColor(context, R.color.md_indigo_300),
+ ContextCompat.getColor(context, R.color.md_indigo_400),
+ ContextCompat.getColor(context, R.color.md_indigo_500),
+ ContextCompat.getColor(context, R.color.md_indigo_600),
+ ContextCompat.getColor(context, R.color.md_indigo_700),
+ ContextCompat.getColor(context, R.color.md_indigo_800),
+ ContextCompat.getColor(context, R.color.md_indigo_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_blue_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_blue_200),
+ ContextCompat.getColor(context, R.color.md_blue_300),
+ ContextCompat.getColor(context, R.color.md_blue_400),
+ ContextCompat.getColor(context, R.color.md_blue_500),
+ ContextCompat.getColor(context, R.color.md_blue_600),
+ ContextCompat.getColor(context, R.color.md_blue_650),
+ ContextCompat.getColor(context, R.color.md_blue_700),
+ ContextCompat.getColor(context, R.color.md_blue_750),
+ ContextCompat.getColor(context, R.color.md_blue_800),
+ ContextCompat.getColor(context, R.color.md_blue_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_light_blue_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_light_blue_200),
+ ContextCompat.getColor(context, R.color.md_light_blue_300),
+ ContextCompat.getColor(context, R.color.md_light_blue_400),
+ ContextCompat.getColor(context, R.color.md_light_blue_500),
+ ContextCompat.getColor(context, R.color.md_light_blue_600),
+ ContextCompat.getColor(context, R.color.md_light_blue_700),
+ ContextCompat.getColor(context, R.color.md_light_blue_800),
+ ContextCompat.getColor(context, R.color.md_light_blue_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_cyan_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_cyan_200),
+ ContextCompat.getColor(context, R.color.md_cyan_300),
+ ContextCompat.getColor(context, R.color.md_cyan_400),
+ ContextCompat.getColor(context, R.color.md_cyan_500),
+ ContextCompat.getColor(context, R.color.md_cyan_600),
+ ContextCompat.getColor(context, R.color.md_cyan_700),
+ ContextCompat.getColor(context, R.color.md_cyan_800),
+ ContextCompat.getColor(context, R.color.md_cyan_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_teal_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_teal_200),
+ ContextCompat.getColor(context, R.color.md_teal_300),
+ ContextCompat.getColor(context, R.color.md_teal_400),
+ ContextCompat.getColor(context, R.color.md_teal_500),
+ ContextCompat.getColor(context, R.color.md_teal_600),
+ ContextCompat.getColor(context, R.color.md_teal_700),
+ ContextCompat.getColor(context, R.color.md_teal_800),
+ ContextCompat.getColor(context, R.color.md_teal_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_green_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_green_200),
+ ContextCompat.getColor(context, R.color.md_green_300),
+ ContextCompat.getColor(context, R.color.md_green_400),
+ ContextCompat.getColor(context, R.color.md_green_500),
+ ContextCompat.getColor(context, R.color.md_green_600),
+ ContextCompat.getColor(context, R.color.md_green_700),
+ ContextCompat.getColor(context, R.color.md_green_800),
+ ContextCompat.getColor(context, R.color.md_green_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_light_green_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_light_green_200),
+ ContextCompat.getColor(context, R.color.md_light_green_300),
+ ContextCompat.getColor(context, R.color.md_light_green_400),
+ ContextCompat.getColor(context, R.color.md_light_green_500),
+ ContextCompat.getColor(context, R.color.md_light_green_600),
+ ContextCompat.getColor(context, R.color.md_light_green_700),
+ ContextCompat.getColor(context, R.color.md_light_green_800),
+ ContextCompat.getColor(context, R.color.md_light_green_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_lime_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_lime_200),
+ ContextCompat.getColor(context, R.color.md_lime_300),
+ ContextCompat.getColor(context, R.color.md_lime_400),
+ ContextCompat.getColor(context, R.color.md_lime_500),
+ ContextCompat.getColor(context, R.color.md_lime_600),
+ ContextCompat.getColor(context, R.color.md_lime_700),
+ ContextCompat.getColor(context, R.color.md_lime_800),
+ ContextCompat.getColor(context, R.color.md_lime_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_yellow_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_yellow_400),
+ ContextCompat.getColor(context, R.color.md_yellow_500),
+ ContextCompat.getColor(context, R.color.md_yellow_600),
+ ContextCompat.getColor(context, R.color.md_yellow_700),
+ ContextCompat.getColor(context, R.color.md_yellow_800),
+ ContextCompat.getColor(context, R.color.md_yellow_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_amber_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_amber_200),
+ ContextCompat.getColor(context, R.color.md_amber_300),
+ ContextCompat.getColor(context, R.color.md_amber_400),
+ ContextCompat.getColor(context, R.color.md_amber_500),
+ ContextCompat.getColor(context, R.color.md_amber_600),
+ ContextCompat.getColor(context, R.color.md_amber_700),
+ ContextCompat.getColor(context, R.color.md_amber_800),
+ ContextCompat.getColor(context, R.color.md_amber_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_orange_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_orange_200),
+ ContextCompat.getColor(context, R.color.md_orange_300),
+ ContextCompat.getColor(context, R.color.md_orange_400),
+ ContextCompat.getColor(context, R.color.md_orange_500),
+ ContextCompat.getColor(context, R.color.md_orange_600),
+ ContextCompat.getColor(context, R.color.md_orange_700),
+ ContextCompat.getColor(context, R.color.md_orange_800),
+ ContextCompat.getColor(context, R.color.md_orange_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_deep_orange_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_deep_orange_200),
+ ContextCompat.getColor(context, R.color.md_deep_orange_300),
+ ContextCompat.getColor(context, R.color.md_deep_orange_400),
+ ContextCompat.getColor(context, R.color.md_deep_orange_500),
+ ContextCompat.getColor(context, R.color.md_deep_orange_600),
+ ContextCompat.getColor(context, R.color.md_deep_orange_650),
+ ContextCompat.getColor(context, R.color.md_deep_orange_700),
+ ContextCompat.getColor(context, R.color.md_deep_orange_800),
+ ContextCompat.getColor(context, R.color.md_deep_orange_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_brown_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_brown_200),
+ ContextCompat.getColor(context, R.color.md_brown_300),
+ ContextCompat.getColor(context, R.color.md_brown_400),
+ ContextCompat.getColor(context, R.color.md_brown_500),
+ ContextCompat.getColor(context, R.color.md_brown_600),
+ ContextCompat.getColor(context, R.color.md_brown_700),
+ ContextCompat.getColor(context, R.color.md_brown_800),
+ ContextCompat.getColor(context, R.color.md_brown_900)
+ };
+ } else if (c == ContextCompat.getColor(context, R.color.md_grey_500)) {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_grey_400),
+ ContextCompat.getColor(context, R.color.md_grey_500),
+ ContextCompat.getColor(context, R.color.md_grey_600),
+ ContextCompat.getColor(context, R.color.md_grey_700),
+ ContextCompat.getColor(context, R.color.md_grey_800),
+ ContextCompat.getColor(context, R.color.md_grey_900),
+ Color.parseColor("#000000")
+ };
+ } else {
+ return new int[]{
+ ContextCompat.getColor(context, R.color.md_blue_grey_300),
+ ContextCompat.getColor(context, R.color.md_blue_grey_400),
+ ContextCompat.getColor(context, R.color.md_blue_grey_500),
+ ContextCompat.getColor(context, R.color.md_blue_grey_600),
+ ContextCompat.getColor(context, R.color.md_blue_grey_700),
+ ContextCompat.getColor(context, R.color.md_blue_grey_800),
+ ContextCompat.getColor(context, R.color.md_blue_grey_900)
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/theming/ThemeHelper.java b/app/src/main/java/com/github/dfa/diaspora_android/util/theming/ThemeHelper.java
new file mode 100644
index 00000000..2900663a
--- /dev/null
+++ b/app/src/main/java/com/github/dfa/diaspora_android/util/theming/ThemeHelper.java
@@ -0,0 +1,128 @@
+/*
+ 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 .
+ This class is inspired by org.horasapps.LeafPic
+ */
+package com.github.dfa.diaspora_android.util.theming;
+
+import android.graphics.PorterDuff;
+import android.graphics.drawable.ColorDrawable;
+import android.support.design.widget.TabLayout;
+import android.support.v7.app.ActionBar;
+import android.support.v7.widget.ActionMenuView;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+import com.github.dfa.diaspora_android.data.AppSettings;
+
+/**
+ * Singleton that can be used to color views
+ * Created by vanitas on 06.10.16.
+ */
+
+public class ThemeHelper {
+ private AppSettings appSettings;
+ private static ThemeHelper instance;
+
+ private ThemeHelper(AppSettings appSettings) {
+ this.appSettings = appSettings;
+ }
+
+ public static ThemeHelper getInstance(AppSettings appSettings) {
+ if(instance == null) {
+ instance = new ThemeHelper(appSettings);
+ }
+ return instance;
+ }
+
+ public static ThemeHelper getInstance() {
+ if(instance == null) throw new IllegalStateException("ThemeHelper must be initialized using getInstance(AppSettings) before it can be used!");
+ return instance;
+ }
+
+ public static void updateEditTextColor(EditText editText) {
+ if(editText != null) {
+ editText.setHighlightColor(getInstance().appSettings.getAccentColor());
+ }
+ }
+
+ public static void updateCheckBoxColor(CheckBox checkBox) {
+ if(checkBox != null) {
+ checkBox.setHighlightColor(getInstance().appSettings.getAccentColor());
+ }
+ }
+
+ public static void updateTabLayoutColor(TabLayout tabLayout) {
+ if(tabLayout != null) {
+ tabLayout.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
+ tabLayout.setSelectedTabIndicatorColor(getInstance().appSettings.getAccentColor());
+ }
+ }
+
+ public static void updateTextViewColor(TextView textView) {
+ if(textView != null) {
+ textView.setHighlightColor(getInstance().appSettings.getAccentColor());
+ textView.setLinkTextColor(getInstance().appSettings.getAccentColor());
+ }
+ }
+
+ public static void updateToolbarColor(Toolbar toolbar) {
+ if(toolbar != null) {
+ toolbar.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
+ }
+ }
+
+ public static void updateActionMenuViewColor(ActionMenuView actionMenuView) {
+ if(actionMenuView != null) {
+ actionMenuView.setBackgroundColor(getInstance().appSettings.getPrimaryColor());
+ }
+ }
+
+ public static int getPrimaryColor() {
+ return getInstance().appSettings.getPrimaryColor();
+ }
+
+ public static int getAccentColor() {
+ return getInstance().appSettings.getAccentColor();
+ }
+
+ public static void setPrimaryColorAsBackground(View view) {
+ if(view != null) {
+ view.setBackgroundColor(getPrimaryColor());
+ }
+ }
+
+ public static int getPrimaryDarkColor() {
+ return ColorPalette.getObscuredColor(getPrimaryColor());
+ }
+
+ public static void updateActionBarColor(ActionBar actionBar) {
+ if(actionBar != null) {
+ actionBar.setBackgroundDrawable(new ColorDrawable(getInstance().appSettings.getPrimaryColor()));
+ }
+ }
+
+ public static void updateProgressBarColor(ProgressBar progressBar) {
+ if(progressBar != null && progressBar.getProgressDrawable() != null) {
+ progressBar.getProgressDrawable().setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN);
+ }
+ }
+}
diff --git a/app/src/main/res/drawable/progressbar.xml b/app/src/main/res/drawable/progressbar.xml
index 44815b57..2a6e82ec 100644
--- a/app/src/main/res/drawable/progressbar.xml
+++ b/app/src/main/res/drawable/progressbar.xml
@@ -1,5 +1,15 @@
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/about__activity.xml b/app/src/main/res/layout/about__activity.xml
index 6a8c3568..6e17bd47 100644
--- a/app/src/main/res/layout/about__activity.xml
+++ b/app/src/main/res/layout/about__activity.xml
@@ -1,5 +1,6 @@
-
diff --git a/app/src/main/res/layout/about__fragment_about.xml b/app/src/main/res/layout/about__fragment_about.xml
index 579b1a2e..d67ec343 100644
--- a/app/src/main/res/layout/about__fragment_about.xml
+++ b/app/src/main/res/layout/about__fragment_about.xml
@@ -35,6 +35,7 @@
android:layout_height="16dp" />
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/main__app_bar.xml b/app/src/main/res/layout/main__app_bar.xml
index e71a1997..c81b49ae 100644
--- a/app/src/main/res/layout/main__app_bar.xml
+++ b/app/src/main/res/layout/main__app_bar.xml
@@ -8,9 +8,9 @@
tools:context=".activity.MainActivity">
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/raw/license_third_party.tpl b/app/src/main/res/raw/license_third_party.tpl
index 6aadb125..6b8a734a 100644
--- a/app/src/main/res/raw/license_third_party.tpl
+++ b/app/src/main/res/raw/license_third_party.tpl
@@ -4,6 +4,9 @@ https://github.com/guardianproject/NetCipher
NEWENTRY ButterKnife
https://jakewharton.github.io/butterknife
+NEWENTRY ShiftColorPicker
+https://github.com/DASAR/ShiftColorPicker
+
NEWENTRY Android Support Library
https://developer.android.com/topic/libraries/support-library/index.html
diff --git a/app/src/main/res/values-de/strings-preferences.xml b/app/src/main/res/values-de/strings-preferences.xml
index 22ba823a..e4eecdb2 100644
--- a/app/src/main/res/values-de/strings-preferences.xml
+++ b/app/src/main/res/values-de/strings-preferences.xml
@@ -14,6 +14,13 @@
Navigations Slider
Konfiguration der Sichtbarkeit von Einträgen im Navigation-Slider
Sichtbarkeit der Einträge
+
+ Farbschema
+ Einstellungen des Farbdesigns
+ Primärfarbe
+ Färbung der Werkzeugleisten
+ Akzentfarbe
+ Färbung der Details
Schriftgröße
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
index e18d571e..5b55f978 100644
--- a/app/src/main/res/values-v21/styles.xml
+++ b/app/src/main/res/values-v21/styles.xml
@@ -1,6 +1,6 @@
>
-
-
+
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index fca5961e..9ba82cc4 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -57,6 +57,22 @@
+
+
+
+
+
+
+
+
-
-