compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:${SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:design:${SUPPORT_LIBRARY_VERSION}"
- compile 'com.github.yukuku:ambilwarna:2.0.1'
+ compile 'com.github.enricocid:cpl:1.0.2'
compile 'moe.banana:toast-compat:1.0.5'
}
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
+import android.support.v4.app.DialogFragment;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SwitchCompat;
import android.widget.CompoundButton;
+import com.enrico.colorpicker.colorDialog;
import com.farmerbb.taskbar.activity.HomeActivity;
import com.farmerbb.taskbar.activity.ImportSettingsActivity;
import com.farmerbb.taskbar.activity.KeyboardShortcutActivity;
import com.farmerbb.taskbar.fragment.FreeformModeFragment;
import com.farmerbb.taskbar.fragment.GeneralFragment;
import com.farmerbb.taskbar.fragment.RecentAppsFragment;
+import com.farmerbb.taskbar.fragment.SettingsFragment;
import com.farmerbb.taskbar.service.DashboardService;
import com.farmerbb.taskbar.service.NotificationService;
import com.farmerbb.taskbar.service.StartMenuService;
import java.io.File;
import java.util.Arrays;
-public class MainActivity extends AppCompatActivity {
+public class MainActivity extends AppCompatActivity implements colorDialog.ColorSelectedListener {
private SwitchCompat theSwitch;
}
};
+ public final int BACKGROUND_TINT = 1;
+ public final int ACCENT_COLOR = 2;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
return false;
}
}
+
+ @Override
+ public void onColorSelection(DialogFragment dialogFragment, int color) {
+ SharedPreferences pref = U.getSharedPreferences(this);
+ String preferenceId = null;
+
+ switch(Integer.parseInt(dialogFragment.getTag())) {
+ case BACKGROUND_TINT:
+ preferenceId = "background_tint";
+ break;
+ case ACCENT_COLOR:
+ preferenceId = "accent_color";
+ break;
+ }
+
+ pref.edit().putInt(preferenceId, color).apply();
+
+ SettingsFragment fragment = (SettingsFragment) getFragmentManager().findFragmentById(R.id.fragmentContainer);
+ colorDialog.setColorPreferenceSummary(fragment.findPreference(preferenceId + "_pref"), color, this, getResources());
+
+ fragment.restartTaskbar();
+ }
}
\ No newline at end of file
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
+import com.enrico.colorpicker.colorDialog;
import com.farmerbb.taskbar.BuildConfig;
import com.farmerbb.taskbar.R;
import com.farmerbb.taskbar.util.U;
// Set OnClickListeners for certain preferences
findPreference("icon_pack_list").setOnPreferenceClickListener(this);
findPreference("reset_colors").setOnPreferenceClickListener(this);
+ findPreference("background_tint_pref").setOnPreferenceClickListener(this);
+ findPreference("accent_color_pref").setOnPreferenceClickListener(this);
bindPreferenceSummaryToValue(findPreference("theme"));
bindPreferenceSummaryToValue(findPreference("invisible_button"));
bindPreferenceSummaryToValue(findPreference("app_drawer_icon"));
bindPreferenceSummaryToValue(findPreference("icon_pack_use_mask"));
- bindPreferenceSummaryToValue(findPreference("background_tint"));
- bindPreferenceSummaryToValue(findPreference("accent_color"));
bindPreferenceSummaryToValue(findPreference("visual_feedback"));
bindPreferenceSummaryToValue(findPreference("shortcut_icon"));
if(actionBar != null)
actionBar.setDisplayHomeAsUpEnabled(true);
+ colorDialog.setColorPreferenceSummary(findPreference("background_tint_pref"), U.getBackgroundTint(getActivity()), getActivity(), getResources());
+ colorDialog.setColorPreferenceSummary(findPreference("accent_color_pref"), U.getAccentColor(getActivity()), getActivity(), getResources());
+
finishedLoadingPrefs = true;
}
import android.widget.SeekBar;
import android.widget.TextView;
+import com.enrico.colorpicker.colorDialog;
import com.farmerbb.taskbar.BuildConfig;
import com.farmerbb.taskbar.MainActivity;
import com.farmerbb.taskbar.R;
import java.util.Currency;
import java.util.Locale;
-import yuku.ambilwarna.widget.AmbilWarnaPreference;
-
public class SettingsFragment extends PreferenceFragment implements OnPreferenceClickListener {
boolean finishedLoadingPrefs;
getActivity().overridePendingTransition(0, 0);
}
- } else if(!(preference instanceof CheckBoxPreference || preference instanceof AmbilWarnaPreference)) {
+ } else if(!(preference instanceof CheckBoxPreference)) {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
// Trigger the listener immediately with the preference's
// current value.
- if(!(preference instanceof CheckBoxPreference || preference instanceof AmbilWarnaPreference))
+ if(!(preference instanceof CheckBoxPreference))
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager.getDefaultSharedPreferences(preference.getContext()).getString(preference.getKey(), ""));
}
public void onClick(DialogInterface dialog, int which) {
finishedLoadingPrefs = false;
- AmbilWarnaPreference backgroundTintPref = (AmbilWarnaPreference) findPreference("background_tint");
- backgroundTintPref.forceSetValue(getResources().getInteger(R.integer.translucent_gray));
+ pref.edit().remove("background_tint").remove("accent_color").apply();
- AmbilWarnaPreference accentColorPref = (AmbilWarnaPreference) findPreference("accent_color");
- accentColorPref.forceSetValue(getResources().getInteger(R.integer.translucent_white));
+ colorDialog.setColorPreferenceSummary(findPreference("background_tint_pref"), U.getBackgroundTint(getActivity()), getActivity(), getResources());
+ colorDialog.setColorPreferenceSummary(findPreference("accent_color_pref"), U.getAccentColor(getActivity()), getActivity(), getResources());
finishedLoadingPrefs = true;
restartTaskbar();
AlertDialog dialog7 = builder7.create();
dialog7.show();
break;
+ case "background_tint_pref":
+ MainActivity activity = (MainActivity) getActivity();
+
+ colorDialog.setPickerColor(activity, activity.BACKGROUND_TINT, U.getBackgroundTint(activity));
+ colorDialog.showColorPicker(activity, activity.BACKGROUND_TINT);
+ break;
+ case "accent_color_pref":
+ MainActivity activity2 = (MainActivity) getActivity();
+
+ colorDialog.setPickerColor(activity2, activity2.ACCENT_COLOR, U.getAccentColor(activity2));
+ colorDialog.showColorPicker(activity2, activity2.ACCENT_COLOR);
+ break;
}
return true;
if(fullRestart) getActivity().stopService(new Intent(getActivity(), NotificationService.class));
}
- private void restartTaskbar() {
+ public void restartTaskbar() {
SharedPreferences pref = U.getSharedPreferences(getActivity());
if(pref.getBoolean("taskbar_active", false) && !pref.getBoolean("is_hidden", false)) {
pref.edit().putBoolean("is_restarting", true).apply();
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.Gravity;
+import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
+ searchView.setOnKeyListener(new View.OnKeyListener() {
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+
+ System.out.println(keyCode);
+ System.out.println(event.getAction());
+
+ return false;
+ }
+ });
+
LinearLayout powerButton = (LinearLayout) layout.findViewById(R.id.power_button);
powerButton.setOnClickListener(new View.OnClickListener() {
@Override
android:key="icon_pack_list"
android:title="@string/icon_pack" />
- <yuku.ambilwarna.widget.AmbilWarnaPreference
- android:key="background_tint"
+ <Preference
+ android:key="background_tint_pref"
android:defaultValue="@integer/translucent_gray"
- app:supportsAlpha="true"
android:title="@string/pref_title_background_tint" />
- <yuku.ambilwarna.widget.AmbilWarnaPreference
- android:key="accent_color"
+ <Preference
+ android:key="accent_color_pref"
android:defaultValue="@integer/translucent_white"
- app:supportsAlpha="true"
android:title="@string/pref_title_accent_color" />
<CheckBoxPreference