├── settings.gradle ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── microg-ui-tools ├── src │ └── main │ │ ├── res │ │ ├── drawable-v21 │ │ │ └── switchbar_background.xml │ │ ├── drawable │ │ │ ├── empty.xml │ │ │ ├── switchbar_background.xml │ │ │ ├── self_check.xml │ │ │ ├── ic_expand_less.xml │ │ │ └── ic_expand_more.xml │ │ ├── values-eo │ │ │ └── strings.xml │ │ ├── values-es │ │ │ └── strings.xml │ │ ├── values-ro │ │ │ └── strings.xml │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── themes.xml │ │ │ └── strings.xml │ │ ├── layout │ │ │ ├── preference_widget_radiobutton.xml │ │ │ ├── toolbar.xml │ │ │ ├── self_check.xml │ │ │ ├── dashboard_activity.xml │ │ │ ├── settings_activity.xml │ │ │ ├── self_check_group.xml │ │ │ ├── switch_bar.xml │ │ │ ├── app_bar.xml │ │ │ ├── self_check_entry.xml │ │ │ ├── about_root.xml │ │ │ └── condition_card.xml │ │ ├── values-v14 │ │ │ └── themes.xml │ │ ├── layout-v14 │ │ │ └── preference_category_dashboard.xml │ │ ├── values-sr │ │ │ └── strings.xml │ │ ├── values-pl │ │ │ └── strings.xml │ │ ├── values-zh-rTW │ │ │ └── strings.xml │ │ ├── values-fr │ │ │ └── strings.xml │ │ ├── values-uk │ │ │ └── strings.xml │ │ ├── values-de │ │ │ └── strings.xml │ │ ├── values-ru │ │ │ └── strings.xml │ │ └── layout-v21 │ │ │ └── preference_material.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── org │ │ └── microg │ │ └── tools │ │ ├── selfcheck │ │ ├── SelfCheckGroup.java │ │ └── PermissionCheckGroup.java │ │ └── ui │ │ ├── ResourceSettingsFragment.java │ │ ├── TintIconPreference.java │ │ ├── AbstractSettingsFragment.java │ │ ├── RadioButtonPreference.java │ │ ├── LongTextPreference.java │ │ ├── ToggleSwitch.java │ │ ├── SwitchBarResourceSettingsFragment.java │ │ ├── AbstractSettingsActivity.java │ │ ├── DimmableIconPreference.java │ │ ├── AbstractDashboardActivity.java │ │ ├── DialogPreference.java │ │ ├── AbstractSelfCheckFragment.java │ │ ├── AbstractAboutFragment.java │ │ ├── SwitchBar.java │ │ └── Condition.java └── build.gradle ├── README.md ├── .travis.yml ├── Android.mk ├── gradlew └── LICENSE /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':microg-ui-tools' 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .gradle/ 3 | local.properties 4 | *.iml 5 | .idea/ 6 | BuildConfig.java 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microg/android_external_MicroGUiTools/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Feb 7 18:49:43 UTC 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip 7 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/drawable-v21/switchbar_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | microG UI Tools 2 | ====== 3 | [![Build Status](https://travis-ci.org/microg/android_external_MicroGUiTools.svg?branch=master)](https://travis-ci.org/microg/android_external_MicroGUiTools) 4 | This repository holds a library providing various UI features used in microG apps (GmsCore and UnifiedNlp). 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | sudo: false 3 | before_script: 4 | - echo sdk.dir $ANDROID_HOME > local.properties 5 | script: 6 | - jdk_switcher use oraclejdk8 7 | - export TERM=dumb 8 | - export JAVA_OPTS="-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m" 9 | - ./gradlew build 10 | android: 11 | components: 12 | - tools 13 | - platform-tools 14 | - build-tools-27.0.3 15 | - android-27 16 | - extra-android-m2repository 17 | licenses: 18 | - '.+' 19 | before_install: 20 | - yes | sdkmanager "platforms;android-27" 21 | before_cache: 22 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 23 | cache: 24 | directories: 25 | - $HOME/.gradle/caches/ 26 | - $HOME/.gradle/wrapper/ 27 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/drawable/empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/values-eo/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/values-ro/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/drawable/switchbar_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | #ff263238 19 | #ff21272b 20 | #ff009688 21 | 22 | #ff37474f 23 | #ff7fcac3 24 | 25 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/layout/preference_widget_radiobutton.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/values-v14/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 13 | 14 | 20 | 21 | 24 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/drawable/self_check.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 27 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/layout/self_check.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/layout-v14/preference_category_dashboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 12 | 13 | 24 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/drawable/ic_expand_less.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 25 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/drawable/ic_expand_more.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 25 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/values-sr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | Поставка 20 | 21 | микроГ самопровера 22 | Провера исправности подешавања система за коришћење микроГ услуга. 23 | 24 | Дозволе одобрене 25 | Дозволе за %1$s: 26 | Тапните овде да одобрите дозволе за %1$s. Не одобравање дозвола може да резултира чудним понашањем апликација. 27 | 28 | 29 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/java/org/microg/tools/selfcheck/SelfCheckGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013-2017 microG Project Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.microg.tools.selfcheck; 18 | 19 | import android.content.Context; 20 | import android.support.v4.app.Fragment; 21 | 22 | public interface SelfCheckGroup { 23 | String getGroupName(Context context); 24 | 25 | void doChecks(Context context, ResultCollector collector); 26 | 27 | interface ResultCollector { 28 | void addResult(String name, Result value, String resolution); 29 | 30 | void addResult(String name, Result value, String resolution, CheckResolver resolver); 31 | } 32 | 33 | interface CheckResolver { 34 | void tryResolve(Fragment fragment); 35 | } 36 | 37 | enum Result { 38 | Positive, Negative, Unknown 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/java/org/microg/tools/ui/ResourceSettingsFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 microG Project Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.microg.tools.ui; 18 | 19 | import android.os.Bundle; 20 | import android.support.annotation.Nullable; 21 | 22 | public class ResourceSettingsFragment extends AbstractSettingsFragment { 23 | 24 | public static final String EXTRA_PREFERENCE_RESOURCE = "preferencesResource"; 25 | 26 | protected int preferencesResource; 27 | 28 | @Override 29 | public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) { 30 | Bundle b = getArguments(); 31 | if (b != null) { 32 | preferencesResource = b.getInt(EXTRA_PREFERENCE_RESOURCE, preferencesResource); 33 | } 34 | if (preferencesResource != 0) { 35 | addPreferencesFromResource(preferencesResource); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/layout/dashboard_activity.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 23 | 24 | 29 | 30 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/java/org/microg/tools/ui/TintIconPreference.java: -------------------------------------------------------------------------------- 1 | package org.microg.tools.ui; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.Drawable; 5 | import android.support.v4.graphics.drawable.DrawableCompat; 6 | import android.support.v7.preference.PreferenceViewHolder; 7 | import android.util.AttributeSet; 8 | import android.util.TypedValue; 9 | 10 | import static android.os.Build.VERSION.SDK_INT; 11 | import static android.os.Build.VERSION_CODES.LOLLIPOP; 12 | 13 | public class TintIconPreference extends DimmableIconPreference { 14 | 15 | public TintIconPreference(Context context) { 16 | this(context, (AttributeSet) null); 17 | } 18 | 19 | public TintIconPreference(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | private static int getThemeAccentColor(Context context) { 24 | int colorAttr; 25 | if (SDK_INT >= LOLLIPOP) { 26 | colorAttr = android.R.attr.colorAccent; 27 | } else { 28 | //Get colorAccent defined for AppCompat 29 | colorAttr = context.getResources().getIdentifier("colorAccent", "attr", context.getPackageName()); 30 | } 31 | TypedValue outValue = new TypedValue(); 32 | context.getTheme().resolveAttribute(colorAttr, outValue, true); 33 | return outValue.data; 34 | } 35 | 36 | @Override 37 | public void onBindViewHolder(PreferenceViewHolder view) { 38 | super.onBindViewHolder(view); 39 | Drawable icon = getIcon(); 40 | if (icon != null) { 41 | DrawableCompat.setTint(icon, getThemeAccentColor(getContext())); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # Generate Gradle BuildConfig.mk file since AOSP does not handle that 5 | # Remove the generated file if you want it to be regenerated with new values 6 | 7 | UITOOLS_BUILDCONFIG_CLASS := microg-ui-tools/src/main/java/org/microg/tools/ui/BuildConfig.java 8 | UITOOLS_BC_PATH := $(LOCAL_PATH)/$(UITOOLS_BUILDCONFIG_CLASS) 9 | UITOOLS_BC_APPLICATION_ID := "org.microg.tools.ui" 10 | UITOOLS_BC_VERSION_CODE := -1 11 | 12 | $(UITOOLS_BC_PATH): 13 | echo "/**" > $(UITOOLS_BC_PATH) 14 | echo "* Automatically generated file. DO NOT MODIFY" >> $(UITOOLS_BC_PATH) 15 | echo "*/" >> $(UITOOLS_BC_PATH) 16 | echo "package "$(UITOOLS_BC_APPLICATION_ID)";" >> $(UITOOLS_BC_PATH) 17 | echo "public final class BuildConfig {" >> $(UITOOLS_BC_PATH) 18 | echo " public static final String APPLICATION_ID = \""$(UITOOLS_BC_APPLICATION_ID)"\";" >> $(UITOOLS_BC_PATH) 19 | echo " public static final int VERSION_CODE = "$(UITOOLS_BC_VERSION_CODE)";" >> $(UITOOLS_BC_PATH) 20 | echo " private BuildConfig() {}" >> $(UITOOLS_BC_PATH) 21 | echo "}" >> $(UITOOLS_BC_PATH) 22 | 23 | LOCAL_MODULE := MicroGUiTools 24 | LOCAL_SRC_FILES := $(call all-java-files-under, microg-ui-tools/src/main/java) 25 | LOCAL_SRC_FILES += $(UITOOLS_BUILDCONFIG_CLASS) 26 | 27 | LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/microg-ui-tools/src/main/res 28 | LOCAL_RESOURCE_DIR += frameworks/support/v7/appcompat/res 29 | LOCAL_MANIFEST_FILE := microg-ui-tools/src/main/AndroidManifest.xml 30 | LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 android-support-v7-appcompat 31 | 32 | LOCAL_AAPT_FLAGS := --auto-add-overlay 33 | LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat 34 | 35 | include $(BUILD_STATIC_JAVA_LIBRARY) 36 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/layout/settings_activity.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 23 | 24 | 30 | 31 | 35 | 36 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/layout/self_check_group.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 33 | 34 | 39 | 40 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractSettingsFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013-2017 microG Project Team 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.microg.tools.ui; 18 | 19 | import android.support.v4.app.DialogFragment; 20 | import android.support.v7.preference.Preference; 21 | 22 | import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat; 23 | 24 | public abstract class AbstractSettingsFragment extends PreferenceFragmentCompat { 25 | private static final String TAG = AbstractSettingsFragment.class.getSimpleName(); 26 | 27 | private static final String DIALOG_FRAGMENT_TAG = 28 | "android.support.v7.preference.PreferenceFragment.DIALOG"; 29 | 30 | @Override 31 | public void onDisplayPreferenceDialog(Preference preference) { 32 | if (preference instanceof DialogPreference) { 33 | DialogFragment f = DialogPreference.DialogPreferenceCompatDialogFragment.newInstance(preference.getKey()); 34 | f.setTargetFragment(this, 0); 35 | f.show(getFragmentManager(), DIALOG_FRAGMENT_TAG); 36 | } else { 37 | super.onDisplayPreferenceDialog(preference); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /microg-ui-tools/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 27 | 28 | 32 | 33 |