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

Merged proper-themes

This commit is contained in:
vanitasvitae 2016-10-13 17:51:35 +02:00
commit 26751ff931
Signed by: vanitasvitae
GPG key ID: DCCFB3302C9E4615
31 changed files with 1446 additions and 112 deletions

View file

@ -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/. 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

View file

@ -41,3 +41,6 @@ Diaspora for Android requires access to the Internet and to external storage to
## Maintainers ## Maintainers
- gsantner ([GitHub](https://github.com/gsantner), [Web](https://gsantner.github.io), [diaspora*](https://pod.geraspora.de/people/d1cbdd70095301341e834860008dbc6c)) - 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)) - 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!

View file

@ -31,6 +31,13 @@ android {
} }
} }
repositories {
maven {
//Color picker
url "http://dl.bintray.com/dasar/maven"
}
}
dependencies { dependencies {
// Sub-Projects // Sub-Projects
//compile project(':subprojectFromRoot') //compile project(':subprojectFromRoot')
@ -49,6 +56,7 @@ dependencies {
compile 'com.jakewharton:butterknife:8.0.1' compile 'com.jakewharton:butterknife:8.0.1'
compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1' compile 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
compile 'info.guardianproject.netcipher:netcipher-webkit: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' apt 'com.jakewharton:butterknife-compiler:8.0.1'
} }

View file

@ -11,7 +11,7 @@
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:name="com.github.dfa.diaspora_android.App" android:name="com.github.dfa.diaspora_android.App"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" > android:theme="@style/DiasporaLight" >
<provider <provider
android:name="com.github.dfa.diaspora_android.data.HashtagProvider" android:name="com.github.dfa.diaspora_android.data.HashtagProvider"
@ -25,20 +25,20 @@
<activity <activity
android:name=".activity.SettingsActivity" android:name=".activity.SettingsActivity"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/AppTheme" android:theme="@style/DiasporaLight.NoActionBar"
android:label="@string/settings" /> android:label="@string/settings" />
<activity <activity
android:name=".activity.AboutActivity" android:name=".activity.AboutActivity"
android:label="@string/about_activity__title_about_app" android:label="@string/about_activity__title_about_app"
android:theme="@style/AppTheme.NoActionBar"/> android:theme="@style/DiasporaLight.NoActionBar"/>
<activity <activity
android:name=".activity.MainActivity" android:name=".activity.MainActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustResize"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/DiasporaLight.NoActionBar"
android:label="@string/diaspora"> android:label="@string/diaspora">
<intent-filter> <intent-filter>

View file

@ -31,9 +31,10 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; 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.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings; 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.HtmlTextView;
import com.github.dfa.diaspora_android.ui.IntellihideToolbarActivityListener;
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.Helpers; import com.github.dfa.diaspora_android.util.Helpers;
import com.github.dfa.diaspora_android.util.Log; import com.github.dfa.diaspora_android.util.Log;
import com.github.dfa.diaspora_android.util.theming.ThemeHelper;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; 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 * 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 SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager; private ViewPager mViewPager;
@BindView(R.id.about__appbar)
AppBarLayout appBarLayout;
@BindView(R.id.main__topbar) @BindView(R.id.main__topbar)
protected Toolbar toolbar; protected Toolbar toolbar;
@BindView(R.id.appbar_linear_layout) @BindView(R.id.appbar_linear_layout)
protected LinearLayout linearLayout; protected LinearLayout linearLayout;
@BindView(R.id.tabs)
protected TabLayout tabLayout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -87,23 +99,58 @@ public class AboutActivity extends AppCompatActivity {
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter. // Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container); mViewPager = ButterKnife.findById(this, R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager); tabLayout.setupWithViewPager(mViewPager);
}
//Apply intellihide @Override
if (!((App) getApplication()).getSettings().isIntellihideToolbars()) { public void onResume() {
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams(); super.onResume();
params.setScrollFlags(0); 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 * 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() { public AboutFragment() {
} }
@ -112,8 +159,7 @@ public class AboutActivity extends AppCompatActivity {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.about__fragment_about, container, false); 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()) { if (isAdded()) {
try { try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
@ -125,18 +171,42 @@ public class AboutActivity extends AppCompatActivity {
} }
return rootView; 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 * 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) @BindView(R.id.fragment_license__licensetext)
HtmlTextView textLicenseBox; HtmlTextView textLicenseBox;
@BindView(R.id.fragment_license__3rdparty) @BindView(R.id.fragment_license__3rdparty)
HtmlTextView textLicense3partyBox; HtmlTextView textLicense3partyBox;
private String accentColor;
public LicenseFragment() { public LicenseFragment() {
} }
@ -146,7 +216,7 @@ public class AboutActivity extends AppCompatActivity {
View rootView = inflater.inflate(R.layout.about__fragment_license, container, false); View rootView = inflater.inflate(R.layout.about__fragment_license, container, false);
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
final Context context = rootView.getContext(); 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, textLicenseBox.setTextFormatted(getString(R.string.fragment_license__license_content,
getMaintainersHtml(context), getMaintainersHtml(context),
@ -160,8 +230,6 @@ public class AboutActivity extends AppCompatActivity {
return rootView; return rootView;
} }
private String accentColor;
public String getContributorsHtml(Context context) { public String getContributorsHtml(Context context) {
String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors, String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors,
"<font color='" + accentColor + "'><b>*</b></font> ", "<br>"); "<font color='" + accentColor + "'><b>*</b></font> ", "<br>");
@ -187,13 +255,52 @@ public class AboutActivity extends AppCompatActivity {
text = text.replace("NEWENTRY", "<font color='" + accentColor + "'><b>*</b></font> "); text = text.replace("NEWENTRY", "<font color='" + accentColor + "'><b>*</b></font> ");
return text; 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... * Fragment that shows debug information like app version, pod version...
*/ */
public static class DebugFragment extends Fragment implements Observer { 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() { public DebugFragment() {
} }
@ -202,16 +309,10 @@ public class AboutActivity extends AppCompatActivity {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.about__fragment_debug, container, false); View rootView = inflater.inflate(R.layout.about__fragment_debug, container, false);
TextView packageName = (TextView) rootView.findViewById(R.id.fragment_debug__package_name); ButterKnife.bind(this, rootView);
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);
logBox.setOnLongClickListener(new View.OnLongClickListener() { logBox.setOnLongClickListener(new View.OnLongClickListener() {
@Override @Override
public boolean onLongClick(View view) { public boolean onLongClick(View view) {
AppLog.d(this, "Long click registered");
if (isAdded()) { if (isAdded()) {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("DEBUG_LOG", Log.getLogBuffer()); ClipData clip = ClipData.newPlainText("DEBUG_LOG", Log.getLogBuffer());
@ -229,14 +330,14 @@ public class AboutActivity extends AppCompatActivity {
if (isAdded()) { if (isAdded()) {
try { try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); 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); packageName.setText(pInfo.packageName);
appVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName + " (" + pInfo.versionCode + ")")); 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)); 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)); 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) { } catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -40,7 +40,6 @@ import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.GravityCompat; import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -54,6 +53,7 @@ import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; 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.util.ProxyHandler;
import com.github.dfa.diaspora_android.receiver.UpdateTitleReceiver; import com.github.dfa.diaspora_android.receiver.UpdateTitleReceiver;
import com.github.dfa.diaspora_android.ui.BadgeDrawable; 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.AppLog;
import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper; import com.github.dfa.diaspora_android.util.CustomTabHelpers.CustomTabActivityHelper;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; 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 com.github.dfa.diaspora_android.util.WebHelper;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
public class MainActivity extends AppCompatActivity public class MainActivity extends ThemedActivity
implements NavigationView.OnNavigationItemSelectedListener, WebUserProfileChangedListener, CustomTabActivityHelper.ConnectionCallback { implements NavigationView.OnNavigationItemSelectedListener,
WebUserProfileChangedListener,
CustomTabActivityHelper.ConnectionCallback,
IntellihideToolbarActivityListener {
public static final int REQUEST_CODE_ASK_PERMISSIONS = 123; 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_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_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_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 URL_MESSAGE = "URL_MESSAGE";
public static final String EXTRA_URL = "com.github.dfa.diaspora_android.extra_url"; 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/"; public static final String CONTENT_HASHTAG = "content://com.github.dfa.diaspora_android.mainactivity/";
@ -114,6 +118,9 @@ public class MainActivity extends AppCompatActivity
/** /**
* UI Bindings * UI Bindings
*/ */
@BindView(R.id.main__appbar)
AppBarLayout appBarLayout;
@BindView(R.id.main__topbar) @BindView(R.id.main__topbar)
Toolbar toolbarTop; Toolbar toolbarTop;
@ -129,6 +136,9 @@ public class MainActivity extends AppCompatActivity
@BindView(R.id.main__navdrawer) @BindView(R.id.main__navdrawer)
DrawerLayout navDrawer; DrawerLayout navDrawer;
RelativeLayout navDrawerLayout;
LinearLayout navProfilePictureArea;
// NavHeader cannot be bound by Butterknife // NavHeader cannot be bound by Butterknife
private TextView navheaderTitle; 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"); AppLog.d(this, "We have no pod. Show PodSelectionFragment");
showFragment(getFragment(PodSelectionFragment.TAG)); showFragment(getFragment(PodSelectionFragment.TAG));
} else { } else {
@ -231,13 +241,6 @@ public class MainActivity extends AppCompatActivity
// Load app settings // Load app settings
setupNavigationSlider(); 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"); AppLog.v(this, "UI successfully set up");
} }
@ -261,7 +264,7 @@ public class MainActivity extends AppCompatActivity
*/ */
protected CustomFragment getFragment(String fragmentTag) { protected CustomFragment getFragment(String fragmentTag) {
CustomFragment fragment = (CustomFragment) fm.findFragmentByTag(fragmentTag); CustomFragment fragment = (CustomFragment) fm.findFragmentByTag(fragmentTag);
if(fragment != null) { if (fragment != null) {
return fragment; return fragment;
} else { } else {
switch (fragmentTag) { switch (fragmentTag) {
@ -282,8 +285,8 @@ public class MainActivity extends AppCompatActivity
fm.beginTransaction().add(psf, fragmentTag).commit(); fm.beginTransaction().add(psf, fragmentTag).commit();
return psf; return psf;
default: default:
AppLog.e(this,"Invalid Fragment Tag: "+fragmentTag AppLog.e(this, "Invalid Fragment Tag: " + fragmentTag
+"\nAdd Fragments Tag to getFragment()'s switch case."); + "\nAdd Fragments Tag to getFragment()'s switch case.");
return getTopFragment(); return getTopFragment();
} }
} }
@ -296,7 +299,7 @@ public class MainActivity extends AppCompatActivity
protected void showFragment(CustomFragment fragment) { protected void showFragment(CustomFragment fragment) {
AppLog.v(this, "showFragment()"); AppLog.v(this, "showFragment()");
CustomFragment currentTop = (CustomFragment) fm.findFragmentById(R.id.fragment_container); 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."); AppLog.v(this, "Fragment was not visible. Replace it.");
fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit(); fm.beginTransaction().addToBackStack(null).replace(R.id.fragment_container, fragment, fragment.getFragmentTag()).commit();
invalidateOptionsMenu(); invalidateOptionsMenu();
@ -318,9 +321,10 @@ public class MainActivity extends AppCompatActivity
navView.setNavigationItemSelectedListener(this); navView.setNavigationItemSelectedListener(this);
View navHeader = navView.getHeaderView(0); 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 //Handle clicks on profile picture
navheaderProfileSection.setOnClickListener(new View.OnClickListener() { navProfilePictureArea.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
navDrawer.closeDrawer(GravityCompat.START); navDrawer.closeDrawer(GravityCompat.START);
@ -357,8 +361,10 @@ public class MainActivity extends AppCompatActivity
} }
} }
} }
updateNavigationViewEntryVisibilities();
}
// Set visibility protected void updateNavigationViewEntryVisibilities() {
Menu navMenu = navView.getMenu(); Menu navMenu = navView.getMenu();
navMenu.findItem(R.id.nav_exit).setVisible(appSettings.isVisibleInNavExit()); navMenu.findItem(R.id.nav_exit).setVisible(appSettings.isVisibleInNavExit());
navMenu.findItem(R.id.nav_activities).setVisible(appSettings.isVisibleInNavActivities()); navMenu.findItem(R.id.nav_activities).setVisible(appSettings.isVisibleInNavActivities());
@ -408,7 +414,7 @@ public class MainActivity extends AppCompatActivity
return; return;
} else { } else {
loadUrl = intent.getDataString(); 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)) { } 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");
@ -417,10 +423,6 @@ public class MainActivity extends AppCompatActivity
} 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");
((DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG)).getWebView().clearCache(true); ((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) { } else if (Intent.ACTION_SEND.equals(action) && type != null) {
switch (type) { switch (type) {
case "text/plain": case "text/plain":
@ -447,13 +449,14 @@ public class MainActivity extends AppCompatActivity
/** /**
* Handle activity results * Handle activity results
*
* @param requestCode reqCode * @param requestCode reqCode
* @param resultCode resCode * @param resultCode resCode
* @param data data * @param data data
*/ */
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
AppLog.v(this, "onActivityResult(): "+requestCode); AppLog.v(this, "onActivityResult(): " + requestCode);
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }
@ -463,7 +466,7 @@ public class MainActivity extends AppCompatActivity
*/ */
private CustomFragment getTopFragment() { private CustomFragment getTopFragment() {
Fragment top = fm.findFragmentById(R.id.fragment_container); Fragment top = fm.findFragmentById(R.id.fragment_container);
if(top != null) { if (top != null) {
return (CustomFragment) top; return (CustomFragment) top;
} }
return null; return null;
@ -480,12 +483,12 @@ public class MainActivity extends AppCompatActivity
return; return;
} }
CustomFragment top = getTopFragment(); CustomFragment top = getTopFragment();
if(top != null) { if (top != null) {
AppLog.v(this, "Top Fragment is not 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, "Top Fragment.onBackPressed was false");
AppLog.v(this, "BackStackEntryCount: "+fm.getBackStackEntryCount()); AppLog.v(this, "BackStackEntryCount: " + fm.getBackStackEntryCount());
if(fm.getBackStackEntryCount()>0) { if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack(); fm.popBackStack();
} else { } else {
snackbarExitApp.show(); snackbarExitApp.show();
@ -530,6 +533,13 @@ public class MainActivity extends AppCompatActivity
AppLog.v(this, "Register BroadcastReceivers"); AppLog.v(this, "Register BroadcastReceivers");
LocalBroadcastManager.getInstance(this).registerReceiver(brSetTitle, new IntentFilter(ACTION_UPDATE_TITLE_FROM_URL)); LocalBroadcastManager.getInstance(this).registerReceiver(brSetTitle, new IntentFilter(ACTION_UPDATE_TITLE_FROM_URL));
LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_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); toolbarBottom.setVisibility(View.VISIBLE);
CustomFragment top = getTopFragment(); CustomFragment top = getTopFragment();
if(top != null) { if (top != null) {
//Are we displaying a Fragment other than PodSelectionFragment? //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_top, menu);
getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu()); getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu());
top.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater()); top.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater());
@ -814,8 +824,8 @@ public class MainActivity extends AppCompatActivity
@Override @Override
public void onCustomTabsConnected() { public void onCustomTabsConnected() {
if(customTabsSession == null) { if (customTabsSession == null) {
AppLog.i(this, "CustomTabs warmup: "+customTabActivityHelper.warmup(0)); AppLog.i(this, "CustomTabs warmup: " + customTabActivityHelper.warmup(0));
customTabsSession = customTabActivityHelper.getSession(); customTabsSession = customTabActivityHelper.getSession();
} }
} }
@ -973,4 +983,29 @@ public class MainActivity extends AppCompatActivity
public void setTextToBeShared(String textToBeShared) { public void setTextToBeShared(String textToBeShared) {
this.textToBeShared = 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);
}
} }

View file

@ -1,19 +1,15 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the Diaspora for Android.
Diaspora for Android is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, Diaspora for Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.activity; package com.github.dfa.diaspora_android.activity;
@ -25,37 +21,63 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.support.v7.app.ActionBar; import android.support.design.widget.AppBarLayout;
import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem; 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.App;
import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.AppSettings; 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.ProxyHandler;
import com.github.dfa.diaspora_android.util.AppLog; 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 * @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 ProxyHandler.ProxySettings oldProxySettings;
private AppSettings appSettings;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActionBar toolbar = getSupportActionBar(); setContentView(R.layout.settings__activity);
if (toolbar != null) ButterKnife.bind(this);
toolbar.setDisplayHomeAsUpEnabled(true); setSupportActionBar(toolbar);
this.appSettings = new AppSettings(this); toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
oldProxySettings = appSettings.getProxySettings(); toolbar.setNavigationOnClickListener(new View.OnClickListener() {
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit(); @Override
public void onClick(View v) {
SettingsActivity.this.onBackPressed();
}
});
oldProxySettings = getAppSettings().getProxySettings();
getFragmentManager().beginTransaction().replace(R.id.settings__fragment_container, new SettingsFragment()).commit();
} }
@Override @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 { public static class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
private SharedPreferences sharedPreferences; private SharedPreferences sharedPreferences;
@ -96,6 +140,13 @@ public class SettingsActivity extends AppCompatActivity {
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
updatePreference(findPreference(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) { private void updatePreference(Preference preference) {
@ -117,10 +168,29 @@ public class SettingsActivity extends AppCompatActivity {
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) { public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
App app = ((App) getActivity().getApplication()); App app = ((App) getActivity().getApplication());
AppSettings appSettings = app.getSettings(); 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); Intent intent = new Intent(getActivity(), MainActivity.class);
String podDomain = appSettings.getPodDomain(); String podDomain = appSettings.getPodDomain();
switch (preference.getTitleRes()) { 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: { case R.string.pref_title__personal_settings: {
intent.setAction(MainActivity.ACTION_OPEN_URL); intent.setAction(MainActivity.ACTION_OPEN_URL);
intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/user/edit"); intent.putExtra(MainActivity.URL_MESSAGE, "https://" + podDomain + "/user/edit");
@ -177,6 +247,71 @@ public class SettingsActivity extends AppCompatActivity {
} }
return super.onPreferenceTreeClick(screen, preference); 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 @Override
@ -191,7 +326,7 @@ public class SettingsActivity extends AppCompatActivity {
@Override @Override
protected void onStop() { protected void onStop() {
ProxyHandler.ProxySettings newProxySettings = appSettings.getProxySettings(); ProxyHandler.ProxySettings newProxySettings = getAppSettings().getProxySettings();
if(!oldProxySettings.equals(newProxySettings)) { if(!oldProxySettings.equals(newProxySettings)) {
AppLog.d(this, "ProxySettings changed."); AppLog.d(this, "ProxySettings changed.");
//Proxy on-off? => Restart app //Proxy on-off? => Restart app

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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()));
}
}
}
}

View file

@ -1,19 +1,15 @@
/* /*
This file is part of the Diaspora for Android. This file is part of the Diaspora for Android.
Diaspora for Android is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Diaspora for Android is distributed in the hope that it will be useful, Diaspora for Android is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the Diaspora for Android. along with the Diaspora for Android.
If not, see <http://www.gnu.org/licenses/>. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.github.dfa.diaspora_android.data; package com.github.dfa.diaspora_android.data;
@ -319,4 +315,36 @@ public class AppSettings {
public boolean isVisibleInNavProfile() { public boolean isVisibleInNavProfile() {
return getBoolean(prefApp, R.string.pref_key__visibility_nav__profile, false); 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));
}
} }

View file

@ -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.data.AppSettings;
import com.github.dfa.diaspora_android.util.ProxyHandler; import com.github.dfa.diaspora_android.util.ProxyHandler;
import com.github.dfa.diaspora_android.ui.ContextMenuWebView; 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.util.AppLog;
import com.github.dfa.diaspora_android.webview.CustomWebViewClient; import com.github.dfa.diaspora_android.webview.CustomWebViewClient;
import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient; import com.github.dfa.diaspora_android.webview.ProgressBarWebChromeClient;
@ -62,7 +63,7 @@ import java.util.Locale;
* Created by vanitas on 26.09.16. * 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"; public static final String TAG = "com.github.dfa.diaspora_android.BrowserFragment";
protected View rootLayout; protected View rootLayout;
@ -145,6 +146,15 @@ public class BrowserFragment extends CustomFragment {
webView.setWebChromeClient(new ProgressBarWebChromeClient(webView, progressBar)); 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") @SuppressWarnings("ResultOfMethodCallIgnored")
protected boolean makeScreenshotOfWebView(boolean hasToShareScreenshot) { protected boolean makeScreenshotOfWebView(boolean hasToShareScreenshot) {
AppLog.i(this, "StreamFragment.makeScreenshotOfWebView()"); AppLog.i(this, "StreamFragment.makeScreenshotOfWebView()");
@ -273,4 +283,9 @@ public class BrowserFragment extends CustomFragment {
public ContextMenuWebView getWebView() { public ContextMenuWebView getWebView() {
return this.webView; return this.webView;
} }
@Override
protected void applyColorToViews() {
ThemeHelper.updateProgressBarColor(progressBar);
}
} }

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}

View file

@ -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.AppLog;
import com.github.dfa.diaspora_android.util.CustomTabHelpers.BrowserFallback; 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.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 * BroadcastReceiver that opens links in a Chrome CustomTab
@ -48,9 +48,10 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context c, Intent receiveIntent) { 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; Uri url = null;
try { try {
@ -61,10 +62,10 @@ public class OpenExternalLinkReceiver extends BroadcastReceiver {
return; return;
} }
if (settings.isChromeCustomTabsEnabled()) { if (appSettings.isChromeCustomTabsEnabled()) {
// Setup Chrome Custom Tab // Setup Chrome Custom Tab
CustomTabsIntent.Builder customTab = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder customTab = new CustomTabsIntent.Builder();
customTab.setToolbarColor(Helpers.getColorFromRessource(c, R.color.colorPrimary)); customTab.setToolbarColor(ThemeHelper.getPrimaryColor());
customTab.addDefaultShareMenuItem(); customTab.addDefaultShareMenuItem();
Bitmap backButtonIcon = BitmapFactory.decodeResource(c.getResources(), R.drawable.chrome_custom_tab__back); Bitmap backButtonIcon = BitmapFactory.decodeResource(c.getResources(), R.drawable.chrome_custom_tab__back);

View file

@ -48,7 +48,7 @@ public class BadgeDrawable extends Drawable {
float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count); float textSize = context.getResources().getDimension(R.dimen.textsize_badge_count);
badgeBackground = new Paint(); 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.setAntiAlias(true);
badgeBackground.setStyle(Paint.Style.FILL); badgeBackground.setStyle(Paint.Style.FILL);
badgeStroke = new Paint(); badgeStroke = new Paint();

View file

@ -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();
}

View file

@ -113,6 +113,10 @@ public class Helpers {
return "#" + Integer.toHexString(context.getResources().getColor(idColor) & 0x00ffffff); 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) { public static void printBundle(Bundle savedInstanceState, String k) {
if (savedInstanceState != null) { if (savedInstanceState != null) {
for (String key : savedInstanceState.keySet()) { for (String key : savedInstanceState.keySet()) {

View file

@ -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)
};
}
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
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);
}
}
}

View file

@ -1,5 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/white"/>
</shape>
</clip>
</item>
<!-- Old progressbar
<item android:id="@android:id/background"> <item android:id="@android:id/background">
<shape> <shape>
<solid android:color="@color/colorPrimaryDark"/> <solid android:color="@color/colorPrimaryDark"/>
@ -12,4 +22,6 @@
</shape> </shape>
</clip> </clip>
</item> </item>
-->
</layer-list> </layer-list>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content" android:id="@+id/main_content"
@ -9,7 +10,7 @@
tools:context="com.github.dfa.diaspora_android.activity.AboutActivity"> tools:context="com.github.dfa.diaspora_android.activity.AboutActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/about__appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">

View file

@ -35,6 +35,7 @@
android:layout_height="16dp" /> android:layout_height="16dp" />
<com.github.dfa.diaspora_android.ui.HtmlTextView <com.github.dfa.diaspora_android.ui.HtmlTextView
android:id="@+id/fragment_about__about_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/fragment_about__about_content" android:text="@string/fragment_about__about_content"

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/color_picker_dialog__title_background"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/color_picker_dialog__title"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Large.Inverse"
/>
</FrameLayout>
<uz.shift.colorpicker.LineColorPicker
android:id="@+id/color_picker_dialog__base_picker"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:layout_margin="10dp"
app:orientation="horizontal"/>
<uz.shift.colorpicker.LineColorPicker
android:id="@+id/color_picker_dialog__shade_picker"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="30dp"
android:layout_margin="10dp"
android:layout_marginBottom="10dp"
app:orientation="horizontal"/>
</LinearLayout>

View file

@ -8,9 +8,9 @@
tools:context=".activity.MainActivity"> tools:context=".activity.MainActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/main__appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/nav_drawer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="110dp" android:layout_height="110dp"
android:gravity="bottom" android:gravity="bottom"

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activity.SettingsActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/settings__appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/settings__toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/settings__fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

View file

@ -4,6 +4,9 @@ https://github.com/guardianproject/NetCipher
NEWENTRY ButterKnife NEWENTRY ButterKnife
https://jakewharton.github.io/butterknife https://jakewharton.github.io/butterknife
NEWENTRY ShiftColorPicker
https://github.com/DASAR/ShiftColorPicker
NEWENTRY Android Support Library NEWENTRY Android Support Library
https://developer.android.com/topic/libraries/support-library/index.html https://developer.android.com/topic/libraries/support-library/index.html

View file

@ -14,6 +14,13 @@
<string name="pref_title__sub_nav_slider">Navigations Slider</string> <string name="pref_title__sub_nav_slider">Navigations Slider</string>
<string name="pref_desc__sub_nav_slider">Konfiguration der Sichtbarkeit von Einträgen im Navigation-Slider</string> <string name="pref_desc__sub_nav_slider">Konfiguration der Sichtbarkeit von Einträgen im Navigation-Slider</string>
<string name="pref_cat__visibility_nav_items">Sichtbarkeit der Einträge</string> <string name="pref_cat__visibility_nav_items">Sichtbarkeit der Einträge</string>
<!-- Themes -->
<string name="pref_title__themes">Farbschema</string>
<string name="pref_desc__themes">Einstellungen des Farbdesigns</string>
<string name="pref_title__primary_color">Primärfarbe</string>
<string name="pref_desc__primary_color">Färbung der Werkzeugleisten</string>
<string name="pref_title__accent_color">Akzentfarbe</string>
<string name="pref_desc__accent_color">Färbung der Details</string>
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Schriftgröße</string> <string name="pref_title__font_size">Schriftgröße</string>
<!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash --> <!-- prefix 's' is needed to make this a string array. Otherwise ListPreference would crash -->

View file

@ -1,6 +1,6 @@
<resources>> <resources>>
<style name="AppTheme.NoActionBar"> <style name="DiasporaLight.NoActionBar">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item>

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">@color/primary</color> <color name="colorPrimary">@color/md_blue_650</color>
<color name="colorPrimaryDark">@color/primary_dark</color> <color name="colorPrimaryDark">@color/md_blue_750</color>
<color name="colorAccent">@color/accent</color> <color name="colorAccent">@color/md_deep_orange_650</color>
<!-- Colors from Palette --> <!-- Colors from Palette -->
<color name="primary">#207be6</color> <color name="primary">@color/md_blue_650</color>
<color name="primary_dark">#195ed2</color> <color name="primary_dark">@color/md_blue_750</color>
<color name="accent">@color/md_deep_orange_650</color>
<color name="primary_light">#BBDEFB</color> <color name="primary_light">#BBDEFB</color>
<color name="accent">#FF5300</color>
<color name="primary_text">#212121</color> <color name="primary_text">#212121</color>
<color name="secondary_text">#727272</color> <color name="secondary_text">#727272</color>
<color name="icons">#FFFFFF</color> <color name="icons">#FFFFFF</color>
@ -17,4 +17,331 @@
<color name="white">#ffffff</color> <color name="white">#ffffff</color>
<color name="black">#000000</color> <color name="black">#000000</color>
<!-- Taken from org.horaapps.leafpic -->
<!--Accent Color Collection-->
<color name="accent_red">#f44336</color>
<color name="accent_pink">#e91e63</color>
<color name="accent_purple">#9c27b0</color>
<color name="accent_deep_purple">#673ab7</color>
<color name="accent_indago">#3f51b5</color>
<color name="accent_blue">#2196f3</color>
<color name="accent_cyan">#00bcd4</color>
<color name="accent_teal">#009688</color>
<color name="accent_green">#4caf50</color>
<color name="accent_yellow">#ffeb3b</color>
<color name="accent_amber">#ffc107</color>
<color name="accent_orange">#ff9800</color>
<color name="accent_brown">#795548</color>
<color name="accent_white">#FFFFFF</color>
<color name="accent_grey">#9e9e9e</color>
<color name="accent_black">#000000</color>
<!--MATERIAL COLORS-->
<color name="md_black_1000">#000000</color>
<color name="md_light_primary_icon">#8A000000</color>
<color name="md_light_primary_text">#DE000000</color>
<color name="md_light_secondary">#8A000000</color>
<color name="md_light_statusbar">@color/md_grey_300</color>
<color name="md_light_appbar">@color/md_grey_100</color>
<color name="md_light_background">@color/md_grey_200</color>
<color name="md_light_cards">@color/md_white_1000</color>
<color name="md_light_dialogs">@color/md_white_1000</color>
<color name="md_light_disabled">#61000000</color>
<color name="md_light_dividers">#1F000000</color>
<color name="md_dark_appbar">@color/md_grey_900</color>
<color name="md_dark_background">@color/md_grey_850</color>
<color name="md_dark_cards">@color/md_grey_800</color>
<color name="md_dark_dialogs">@color/md_grey_800</color>
<color name="md_dark_disabled">#4DFFFFFF</color>
<color name="md_dark_dividers">#1FFFFFFF</color>
<color name="md_dark_primary_icon">#B3FFFFFF</color>
<color name="md_dark_primary_text">#FFFFFFFF</color>
<color name="md_dark_secondary">#B3FFFFFF</color>
<color name="md_dark_statusbar">@color/md_black_1000</color>
<!--ALL COLOURS-->
<color name="md_amber_100">#FFECB3</color>
<color name="md_amber_200">#FFE082</color>
<color name="md_amber_300">#FFD54F</color>
<color name="md_amber_400">#FFCA28</color>
<color name="md_amber_50">#FFF8E1</color>
<color name="md_amber_500">#FFC107</color>
<color name="md_amber_600">#FFB300</color>
<color name="md_amber_700">#FFA000</color>
<color name="md_amber_800">#FF8F00</color>
<color name="md_amber_900">#FF6F00</color>
<color name="md_amber_A100">#FFE57F</color>
<color name="md_amber_A200">#FFD740</color>
<color name="md_amber_A400">#FFC400</color>
<color name="md_amber_A700">#FFAB00</color>
<color name="md_blue_100">#BBDEFB</color>
<color name="md_blue_200">#90CAF9</color>
<color name="md_blue_300">#64B5F6</color>
<color name="md_blue_400">#42A5F5</color>
<color name="md_blue_50">#E3F2FD</color>
<color name="md_blue_500">#2196F3</color>
<color name="md_blue_600">#1E88E5</color>
<color name="md_blue_650">#207be6</color>
<color name="md_blue_700">#1976D2</color>
<color name="md_blue_750">#195ed2</color>
<color name="md_blue_800">#1565C0</color>
<color name="md_blue_900">#0D47A1</color>
<color name="md_blue_A100">#82B1FF</color>
<color name="md_blue_A200">#448AFF</color>
<color name="md_blue_A400">#2979FF</color>
<color name="md_blue_A700">#2962FF</color>
<color name="md_blue_grey_100">#CFD8DC</color>
<color name="md_blue_grey_200">#B0BEC5</color>
<color name="md_blue_grey_300">#90A4AE</color>
<color name="md_blue_grey_400">#78909C</color>
<color name="md_blue_grey_50">#ECEFF1</color>
<color name="md_blue_grey_500">#607D8B</color>
<color name="md_blue_grey_600">#546E7A</color>
<color name="md_blue_grey_700">#455A64</color>
<color name="md_blue_grey_800">#37474F</color>
<color name="md_blue_grey_900">#263238</color>
<color name="md_brown_100">#D7CCC8</color>
<color name="md_brown_200">#BCAAA4</color>
<color name="md_brown_300">#A1887F</color>
<color name="md_brown_400">#8D6E63</color>
<color name="md_brown_50">#EFEBE9</color>
<color name="md_brown_500">#795548</color>
<color name="md_brown_600">#6D4C41</color>
<color name="md_brown_700">#5D4037</color>
<color name="md_brown_800">#4E342E</color>
<color name="md_brown_900">#3E2723</color>
<color name="md_cyan_100">#B2EBF2</color>
<color name="md_cyan_200">#80DEEA</color>
<color name="md_cyan_300">#4DD0E1</color>
<color name="md_cyan_400">#26C6DA</color>
<color name="md_cyan_50">#E0F7FA</color>
<color name="md_cyan_500">#00BCD4</color>
<color name="md_cyan_600">#00ACC1</color>
<color name="md_cyan_700">#0097A7</color>
<color name="md_cyan_800">#00838F</color>
<color name="md_cyan_900">#006064</color>
<color name="md_cyan_A100">#84FFFF</color>
<color name="md_cyan_A200">#18FFFF</color>
<color name="md_cyan_A400">#00E5FF</color>
<color name="md_cyan_A700">#00B8D4</color>
<color name="md_deep_orange_100">#FFCCBC</color>
<color name="md_deep_orange_200">#FFAB91</color>
<color name="md_deep_orange_300">#FF8A65</color>
<color name="md_deep_orange_400">#FF7043</color>
<color name="md_deep_orange_50">#FBE9E7</color>
<color name="md_deep_orange_500">#FF5722</color>
<color name="md_deep_orange_600">#F4511E</color>
<color name="md_deep_orange_650">#FF5300</color>
<color name="md_deep_orange_700">#E64A19</color>
<color name="md_deep_orange_800">#D84315</color>
<color name="md_deep_orange_900">#BF360C</color>
<color name="md_deep_orange_A100">#FF9E80</color>
<color name="md_deep_orange_A200">#FF6E40</color>
<color name="md_deep_orange_A400">#FF3D00</color>
<color name="md_deep_orange_A700">#DD2C00</color>
<color name="md_deep_purple_100">#D1C4E9</color>
<color name="md_deep_purple_200">#B39DDB</color>
<color name="md_deep_purple_300">#9575CD</color>
<color name="md_deep_purple_400">#7E57C2</color>
<color name="md_deep_purple_50">#EDE7F6</color>
<color name="md_deep_purple_500">#673AB7</color>
<color name="md_deep_purple_600">#5E35B1</color>
<color name="md_deep_purple_700">#512DA8</color>
<color name="md_deep_purple_800">#4527A0</color>
<color name="md_deep_purple_900">#311B92</color>
<color name="md_deep_purple_A100">#B388FF</color>
<color name="md_deep_purple_A200">#7C4DFF</color>
<color name="md_deep_purple_A400">#651FFF</color>
<color name="md_deep_purple_A700">#6200EA</color>
<color name="md_green_100">#C8E6C9</color>
<color name="md_green_200">#A5D6A7</color>
<color name="md_green_300">#81C784</color>
<color name="md_green_400">#66BB6A</color>
<color name="md_green_50">#E8F5E9</color>
<color name="md_green_500">#4CAF50</color>
<color name="md_green_600">#43A047</color>
<color name="md_green_700">#388E3C</color>
<color name="md_green_800">#2E7D32</color>
<color name="md_green_900">#1B5E20</color>
<color name="md_green_A100">#B9F6CA</color>
<color name="md_green_A200">#69F0AE</color>
<color name="md_green_A400">#00E676</color>
<color name="md_green_A700">#00C853</color>
<color name="md_grey_100">#F5F5F5</color>
<color name="md_grey_200">#EEEEEE</color>
<color name="md_grey_300">#E0E0E0</color>
<color name="md_grey_400">#BDBDBD</color>
<color name="md_grey_50">#FAFAFA</color>
<color name="md_grey_500">#9E9E9E</color>
<color name="md_grey_600">#757575</color>
<color name="md_grey_700">#616161</color>
<color name="md_grey_800">#424242</color>
<color name="md_grey_850">#303030</color>
<color name="md_grey_900">#212121</color>
<color name="md_indigo_100">#C5CAE9</color>
<color name="md_indigo_200">#9FA8DA</color>
<color name="md_indigo_300">#7986CB</color>
<color name="md_indigo_400">#5C6BC0</color>
<color name="md_indigo_50">#E8EAF6</color>
<color name="md_indigo_500">#3F51B5</color>
<color name="md_indigo_600">#3949AB</color>
<color name="md_indigo_700">#303F9F</color>
<color name="md_indigo_800">#283593</color>
<color name="md_indigo_900">#1A237E</color>
<color name="md_indigo_A100">#8C9EFF</color>
<color name="md_indigo_A200">#536DFE</color>
<color name="md_indigo_A400">#3D5AFE</color>
<color name="md_indigo_A700">#304FFE</color>
<color name="md_light_blue_100">#B3E5FC</color>
<color name="md_light_blue_200">#81D4FA</color>
<color name="md_light_blue_300">#4FC3F7</color>
<color name="md_light_blue_400">#29B6F6</color>
<color name="md_light_blue_50">#E1F5FE</color>
<color name="md_light_blue_500">#03A9F4</color>
<color name="md_light_blue_600">#039BE5</color>
<color name="md_light_blue_700">#0288D1</color>
<color name="md_light_blue_800">#0277BD</color>
<color name="md_light_blue_900">#01579B</color>
<color name="md_light_blue_A100">#80D8FF</color>
<color name="md_light_blue_A200">#40C4FF</color>
<color name="md_light_blue_A400">#00B0FF</color>
<color name="md_light_blue_A700">#0091EA</color>
<color name="md_light_green_100">#DCEDC8</color>
<color name="md_light_green_200">#C5E1A5</color>
<color name="md_light_green_300">#AED581</color>
<color name="md_light_green_400">#9CCC65</color>
<color name="md_light_green_50">#F1F8E9</color>
<color name="md_light_green_500">#8BC34A</color>
<color name="md_light_green_600">#7CB342</color>
<color name="md_light_green_700">#689F38</color>
<color name="md_light_green_800">#558B2F</color>
<color name="md_light_green_900">#33691E</color>
<color name="md_light_green_A100">#CCFF90</color>
<color name="md_light_green_A200">#B2FF59</color>
<color name="md_light_green_A400">#76FF03</color>
<color name="md_light_green_A700">#64DD17</color>
<color name="md_lime_100">#F0F4C3</color>
<color name="md_lime_200">#E6EE9C</color>
<color name="md_lime_300">#DCE775</color>
<color name="md_lime_400">#D4E157</color>
<color name="md_lime_50">#F9FBE7</color>
<color name="md_lime_500">#CDDC39</color>
<color name="md_lime_600">#C0CA33</color>
<color name="md_lime_700">#AFB42B</color>
<color name="md_lime_800">#9E9D24</color>
<color name="md_lime_900">#827717</color>
<color name="md_lime_A100">#F4FF81</color>
<color name="md_lime_A200">#EEFF41</color>
<color name="md_lime_A400">#C6FF00</color>
<color name="md_lime_A700">#AEEA00</color>
<color name="md_orange_100">#FFE0B2</color>
<color name="md_orange_200">#FFCC80</color>
<color name="md_orange_300">#FFB74D</color>
<color name="md_orange_400">#FFA726</color>
<color name="md_orange_50">#FFF3E0</color>
<color name="md_orange_500">#FF9800</color>
<color name="md_orange_600">#FB8C00</color>
<color name="md_orange_700">#F57C00</color>
<color name="md_orange_800">#EF6C00</color>
<color name="md_orange_900">#E65100</color>
<color name="md_orange_A100">#FFD180</color>
<color name="md_orange_A200">#FFAB40</color>
<color name="md_orange_A400">#FF9100</color>
<color name="md_orange_A700">#FF6D00</color>
<color name="md_pink_100">#F8BBD0</color>
<color name="md_pink_200">#F48FB1</color>
<color name="md_pink_300">#F06292</color>
<color name="md_pink_400">#EC407A</color>
<color name="md_pink_50">#FCE4EC</color>
<color name="md_pink_500">#E91E63</color>
<color name="md_pink_600">#D81B60</color>
<color name="md_pink_700">#C2185B</color>
<color name="md_pink_800">#AD1457</color>
<color name="md_pink_900">#880E4F</color>
<color name="md_pink_A100">#FF80AB</color>
<color name="md_pink_A200">#FF4081</color>
<color name="md_pink_A400">#F50057</color>
<color name="md_pink_A700">#C51162</color>
<color name="md_purple_100">#E1BEE7</color>
<color name="md_purple_200">#CE93D8</color>
<color name="md_purple_300">#BA68C8</color>
<color name="md_purple_400">#AB47BC</color>
<color name="md_purple_50">#F3E5F5</color>
<color name="md_purple_500">#9C27B0</color>
<color name="md_purple_600">#8E24AA</color>
<color name="md_purple_700">#7B1FA2</color>
<color name="md_purple_800">#6A1B9A</color>
<color name="md_purple_900">#4A148C</color>
<color name="md_purple_A100">#EA80FC</color>
<color name="md_purple_A200">#E040FB</color>
<color name="md_purple_A400">#D500F9</color>
<color name="md_purple_A700">#AA00FF</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
<color name="md_red_300">#E57373</color>
<color name="md_red_400">#EF5350</color>
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_500">#F44336</color>
<color name="md_red_600">#E53935</color>
<color name="md_red_700">#D32F2F</color>
<color name="md_red_800">#C62828</color>
<color name="md_red_900">#B71C1C</color>
<color name="md_red_A100">#FF8A80</color>
<color name="md_red_A200">#FF5252</color>
<color name="md_red_A400">#FF1744</color>
<color name="md_red_A700">#D50000</color>
<color name="md_teal_100">#B2DFDB</color>
<color name="md_teal_200">#80CBC4</color>
<color name="md_teal_300">#4DB6AC</color>
<color name="md_teal_400">#26A69A</color>
<color name="md_teal_50">#E0F2F1</color>
<color name="md_teal_500">#009688</color>
<color name="md_teal_600">#00897B</color>
<color name="md_teal_700">#00796B</color>
<color name="md_teal_800">#00695C</color>
<color name="md_teal_900">#004D40</color>
<color name="md_teal_A100">#A7FFEB</color>
<color name="md_teal_A200">#64FFDA</color>
<color name="md_teal_A400">#1DE9B6</color>
<color name="md_teal_A700">#00BFA5</color>
<color name="md_white_1000">#FFFFFF</color>
<color name="md_yellow_100">#FFF9C4</color>
<color name="md_yellow_200">#FFF59D</color>
<color name="md_yellow_300">#FFF176</color>
<color name="md_yellow_400">#FFEE58</color>
<color name="md_yellow_50">#FFFDE7</color>
<color name="md_yellow_500">#FFEB3B</color>
<color name="md_yellow_600">#FDD835</color>
<color name="md_yellow_700">#FBC02D</color>
<color name="md_yellow_800">#F9A825</color>
<color name="md_yellow_900">#F57F17</color>
<color name="md_yellow_A100">#FFFF8D</color>
<color name="md_yellow_A200">#FFFF00</color>
<color name="md_yellow_A400">#FFEA00</color>
<color name="md_yellow_A700">#FFD600</color>
<color name="transparent_black">#c4000000</color>
</resources> </resources>

View file

@ -17,6 +17,14 @@
<string name="pref_key__chrome_custom_tabs_enabled" translatable="false">pref_key__chrome_custom_tabs_enabled</string> <string name="pref_key__chrome_custom_tabs_enabled" translatable="false">pref_key__chrome_custom_tabs_enabled</string>
<string name="pref_key__http_proxy_load_tor_preset">pref_key__http_proxy_load_tor_preset</string> <string name="pref_key__http_proxy_load_tor_preset">pref_key__http_proxy_load_tor_preset</string>
<!-- Themes -->
<string name="pref_key__primary_color__preference_click" translatable="false">pref_key_primary_color</string>
<string name="pref_key__primary_color_base" translatable="false">pref_key_primary_color_base</string>
<string name="pref_key__primary_color_shade" translatable="false">pref_key_primary_color_shade</string>
<string name="pref_key__accent_color__preference_click" translatable="false">pref_key_accent_color</string>
<string name="pref_key__accent_color_base" translatable="false">pref_key_accent_color_base</string>
<string name="pref_key__accent_color_shade" translatable="false">pref_key_accent_color_shade</string>
<string name="pref_key__append_shared_via_app" translatable="false">pref_key_append_shared_via_app</string> <string name="pref_key__append_shared_via_app" translatable="false">pref_key_append_shared_via_app</string>
<string name="pref_key__http_proxy_enabled" translatable="false">pref_key_proxy_enabled</string> <string name="pref_key__http_proxy_enabled" translatable="false">pref_key_proxy_enabled</string>
<string name="pref_key__http_proxy_host" translatable="false">pref_key_proxy_host</string> <string name="pref_key__http_proxy_host" translatable="false">pref_key_proxy_host</string>
@ -62,6 +70,13 @@
<string name="pref_desc__sub_nav_slider">Control visibility of entries in the navigation drawer</string> <string name="pref_desc__sub_nav_slider">Control visibility of entries in the navigation drawer</string>
<string name="pref_cat__visibility_nav_items">Item visibility</string> <string name="pref_cat__visibility_nav_items">Item visibility</string>
<!-- Themes -->
<string name="pref_title__themes">Theme and Colors</string>
<string name="pref_desc__themes">Control, which colors are used throughout the app</string>
<string name="pref_title__primary_color">Primary Color</string>
<string name="pref_desc__primary_color">Color of the toolbars</string>
<string name="pref_title__accent_color">Accent Color</string>
<string name="pref_desc__accent_color">Color of the progressbar</string>
<!-- Font size --> <!-- Font size -->
<string name="pref_title__font_size">Font size</string> <string name="pref_title__font_size">Font size</string>

View file

@ -1,7 +1,7 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="DiasporaLight" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@ -9,11 +9,14 @@
<item name="actionMenuTextColor">@color/colorAccent</item> <item name="actionMenuTextColor">@color/colorAccent</item>
</style> </style>
<style name="AppTheme.NoActionBar"> <style name="DiasporaLight.NoActionBar">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="Settings" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

View file

@ -57,6 +57,22 @@
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>
<PreferenceScreen
android:title="@string/pref_title__themes"
android:summary="@string/pref_desc__themes" >
<Preference
android:key="@string/pref_key__primary_color__preference_click"
android:summary="@string/pref_desc__primary_color"
android:title="@string/pref_title__primary_color" />
<Preference
android:key="@string/pref_key__accent_color__preference_click"
android:summary="@string/pref_desc__accent_color"
android:title="@string/pref_title__accent_color" />
</PreferenceScreen>
<ListPreference <ListPreference
android:dialogTitle="@string/pref_title__font_size" android:dialogTitle="@string/pref_title__font_size"
android:entries="@array/pref_entries__font_size" android:entries="@array/pref_entries__font_size"
@ -177,8 +193,6 @@
android:defaultValue="true" android:defaultValue="true"
android:key="@string/pref_key__logging_spam_enabled" android:key="@string/pref_key__logging_spam_enabled"
android:title="@string/pref_title__logging_spam_enabled"/> android:title="@string/pref_title__logging_spam_enabled"/>
</PreferenceScreen> </PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>