├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── values
│ │ │ ├── ids.xml
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings_settings.xml
│ │ │ ├── styles.xml
│ │ │ ├── strings.xml
│ │ │ └── strings_about.xml
│ │ ├── xml
│ │ │ ├── provider_paths.xml
│ │ │ └── settings.xml
│ │ ├── drawable
│ │ │ ├── circle.xml
│ │ │ ├── ic_title_24dp.xml
│ │ │ ├── ic_layers_24dp.xml
│ │ │ ├── ic_audiotrack_24dp.xml
│ │ │ ├── ic_mode_edit_24dp.xml
│ │ │ ├── ic_more_vert_24dp.xml
│ │ │ ├── ic_build_24dp.xml
│ │ │ ├── ic_build_white_24dp.xml
│ │ │ ├── ic_delete_forever_24dp.xml
│ │ │ ├── ic_unarchive_24dp.xml
│ │ │ └── ic_attach_file_24dp.xml
│ │ ├── menu
│ │ │ ├── menu_patcher.xml
│ │ │ └── menu_main.xml
│ │ └── layout
│ │ │ ├── fragment_assets_list.xml
│ │ │ ├── view_empty_assets.xml
│ │ │ ├── view_template_item.xml
│ │ │ ├── view_color_picker.xml
│ │ │ ├── activity_settings.xml
│ │ │ ├── activity_patcher.xml
│ │ │ ├── fragment_theme_patcher.xml
│ │ │ ├── item_assets_adapter.xml
│ │ │ ├── fragment_assets_picker.xml
│ │ │ └── activity_main.xml
│ │ ├── java
│ │ └── com
│ │ │ └── pddstudio
│ │ │ └── otgsubs
│ │ │ ├── events
│ │ │ ├── RefreshItemListEvent.java
│ │ │ ├── PatchThemeDialogEvent.java
│ │ │ ├── ImportAssetsFromApkEvent.java
│ │ │ ├── FileChooserDialogEvent.java
│ │ │ ├── AssetTypeAddedEvent.java
│ │ │ ├── ExistingAssetsItemEvent.java
│ │ │ ├── ColorChooserDialogEvent.java
│ │ │ └── PatchThemePreparationEvent.java
│ │ │ ├── models
│ │ │ ├── ColorChooserType.java
│ │ │ ├── AssetsModificationType.java
│ │ │ ├── FileChooserType.java
│ │ │ └── AssetsAdapterItem.java
│ │ │ ├── utils
│ │ │ ├── FormattingUtils.java
│ │ │ ├── Preferences.java
│ │ │ ├── DialogUtils.java
│ │ │ ├── DeviceUtils.java
│ │ │ ├── ThemeUtils.java
│ │ │ └── DrawerUtils.java
│ │ │ ├── OTGSubsApplication.java
│ │ │ ├── beans
│ │ │ ├── EventBusBean.java
│ │ │ ├── NavigationBean.java
│ │ │ ├── ManifestProcessorBean.java
│ │ │ └── PackageInfoBean.java
│ │ │ ├── dialogs
│ │ │ ├── InfoDialog.java
│ │ │ └── InputDialog.java
│ │ │ ├── views
│ │ │ ├── EmptyAssetsView.java
│ │ │ ├── TemplateItemView.java
│ │ │ └── ColorPickerView.java
│ │ │ ├── adapters
│ │ │ └── AssetsPageAdapter.java
│ │ │ ├── receivers
│ │ │ └── PackageManagerReceiver.java
│ │ │ ├── services
│ │ │ ├── ImportApkService.java
│ │ │ ├── PackageService.java
│ │ │ └── PatchTemplateService.java
│ │ │ ├── fragments
│ │ │ ├── AssetsPickerFragment.java
│ │ │ ├── AssetsListFragment.java
│ │ │ └── ThemePatcherFragment.java
│ │ │ ├── SettingsActivity.java
│ │ │ └── PatcherActivity.java
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── substratum-packager
├── .gitignore
├── libs
│ ├── zipio-lib-1.8.jar
│ ├── zipsigner-lib-1.17.jar
│ ├── kellinwood-logging-lib-1.1.jar
│ ├── zipsigner-lib-optional-1.16.jar
│ ├── kellinwood-logging-log4j-1.0.jar
│ └── kellinwood-logging-android-1.4.jar
├── src
│ └── main
│ │ ├── assets
│ │ ├── source.zip
│ │ └── substratum.zip
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── pddstudio
│ │ │ └── substratum
│ │ │ └── packager
│ │ │ ├── PackageCallback.java
│ │ │ ├── models
│ │ │ ├── AssetsType.java
│ │ │ ├── AssetFileInfo.java
│ │ │ └── ApkInfo.java
│ │ │ ├── utils
│ │ │ ├── AssetUtils.java
│ │ │ ├── ZipUtils.java
│ │ │ └── ApkHelper.java
│ │ │ ├── ApkExtractor.java
│ │ │ └── SubstratumPackager.java
│ │ └── res
│ │ └── values
│ │ └── strings.xml
├── proguard-rules.pro
└── build.gradle
├── .hgignore
├── substratum-template-patcher
├── .gitignore
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ └── java
│ │ └── com
│ │ └── pddstudio
│ │ └── substratum
│ │ └── template
│ │ └── patcher
│ │ ├── internal
│ │ ├── Patcher.java
│ │ ├── LinePatcher.java
│ │ └── model
│ │ │ ├── JsonConfigModel.java
│ │ │ └── Template.java
│ │ ├── ThemeConfiguration.java
│ │ ├── PatchingException.java
│ │ ├── TemplateConfiguration.java
│ │ ├── XmlPatcher.java
│ │ └── TemplatePatcher.java
├── proguard-rules.pro
└── build.gradle
├── gfx
├── otgsubs.png
├── en-play-badge.png
└── otgsubs_banner.jpg
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── .gitignore
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/substratum-packager/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/.hgignore:
--------------------------------------------------------------------------------
1 |
2 | .idea/instapk.xml
3 | instapk.log*
--------------------------------------------------------------------------------
/substratum-template-patcher/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/gfx/otgsubs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/gfx/otgsubs.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':substratum-packager', ':substratum-template-patcher'
2 |
--------------------------------------------------------------------------------
/gfx/en-play-badge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/gfx/en-play-badge.png
--------------------------------------------------------------------------------
/gfx/otgsubs_banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/gfx/otgsubs_banner.jpg
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/substratum-packager/libs/zipio-lib-1.8.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/libs/zipio-lib-1.8.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/substratum-packager/src/main/assets/source.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/src/main/assets/source.zip
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/substratum-packager/libs/zipsigner-lib-1.17.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/libs/zipsigner-lib-1.17.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/substratum-packager/src/main/assets/substratum.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/src/main/assets/substratum.zip
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | substratum-template-patcher
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/substratum-packager/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/substratum-packager/libs/kellinwood-logging-lib-1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/libs/kellinwood-logging-lib-1.1.jar
--------------------------------------------------------------------------------
/substratum-packager/libs/zipsigner-lib-optional-1.16.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/libs/zipsigner-lib-optional-1.16.jar
--------------------------------------------------------------------------------
/substratum-packager/libs/kellinwood-logging-log4j-1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/libs/kellinwood-logging-log4j-1.0.jar
--------------------------------------------------------------------------------
/substratum-packager/libs/kellinwood-logging-android-1.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PDDStudio/OTGSubs/develop/substratum-packager/libs/kellinwood-logging-android-1.4.jar
--------------------------------------------------------------------------------
/app/src/main/res/xml/provider_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/RefreshItemListEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | /**
4 | * Created by pddstudio on 24/04/2017.
5 | */
6 |
7 | public class RefreshItemListEvent {}
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/models/ColorChooserType.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.models;
2 |
3 | /**
4 | * Created by pddstudio on 26/04/2017.
5 | */
6 |
7 | public enum ColorChooserType {
8 | PRIMARY_COLOR,
9 | PRIMARY_DARK_COLOR,
10 | IGNORE
11 | }
12 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Apr 20 14:42:44 CEST 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-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/models/AssetsModificationType.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.models;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by pddstudio on 25/04/2017.
7 | */
8 |
9 | public enum AssetsModificationType implements Serializable {
10 | RENAME,
11 | DELETE
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/models/FileChooserType.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.models;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by pddstudio on 24/04/2017.
7 | */
8 |
9 | public enum FileChooserType implements Serializable {
10 | DIRECTORY,
11 | ZIP_FILE,
12 | IGNORE
13 | }
14 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/internal/Patcher.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher.internal;
2 |
3 | /**
4 | * Created by pddstudio on 25/04/2017.
5 | */
6 |
7 | public interface Patcher {
8 | F patch(F target, K key, V value);
9 | }
10 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/PackageCallback.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager;
2 |
3 | import java.io.File;
4 |
5 | /**
6 | * Created by pddstudio on 21/04/2017.
7 | */
8 |
9 | public interface PackageCallback {
10 | void onPackagingFailed(int errorCode);
11 | void onPackagingSucceeded(File signedApk);
12 | }
13 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | substratum-packager
3 | Fonts
4 | Overlays
5 | Audio
6 | Boot Animations
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_title_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/ThemeConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by pddstudio on 04/05/2017.
7 | */
8 |
9 | public interface ThemeConfiguration {
10 | String getThemeName();
11 | String getThemeAuthor();
12 | List getThemeTemplates();
13 | }
14 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/PatchingException.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher;
2 |
3 | /**
4 | * Created by pddstudio on 25/04/2017.
5 | */
6 |
7 | public class PatchingException extends Exception {
8 |
9 | public PatchingException(Exception e) {
10 | super(e);
11 | }
12 |
13 | public PatchingException(String message) {
14 | super(message);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/PatchThemeDialogEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | /**
4 | * Created by pddstudio on 04/05/2017.
5 | */
6 |
7 | public class PatchThemeDialogEvent {
8 |
9 | private final boolean showDialog;
10 |
11 | public PatchThemeDialogEvent(boolean showDialog) {
12 | this.showDialog = showDialog;
13 | }
14 |
15 | public boolean isShowDialogEvent() {
16 | return showDialog;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_layers_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_audiotrack_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/utils/FormattingUtils.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.utils;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 |
5 | /**
6 | * Created by pddstudio on 08/05/2017.
7 | */
8 |
9 | public class FormattingUtils {
10 |
11 | private FormattingUtils() {
12 | //disable instance creation
13 | }
14 |
15 | public static String formatUserThemeName(String userThemeName) {
16 | return StringUtils.replace(userThemeName, " ", "_");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_mode_edit_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_more_vert_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_build_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_build_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/internal/LinePatcher.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher.internal;
2 |
3 | /**
4 | * Created by pddstudio on 25/04/2017.
5 | */
6 |
7 | public abstract class LinePatcher implements Patcher {
8 |
9 | @Override
10 | public String patch(String target, String key, String value) {
11 | return patchLine(target, key, value);
12 | }
13 |
14 | public abstract String patchLine(String line, String targetKey, String replacementValue);
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_delete_forever_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_patcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_unarchive_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/OTGSubsApplication.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs;
2 |
3 | import android.app.Application;
4 |
5 | import com.google.firebase.analytics.FirebaseAnalytics;
6 |
7 | import org.androidannotations.annotations.EApplication;
8 |
9 | /**
10 | * Created by pddstudio on 25/04/2017.
11 | */
12 |
13 | @EApplication
14 | public class OTGSubsApplication extends Application {
15 |
16 | @Override
17 | public void onCreate() {
18 | super.onCreate();
19 | if(BuildConfig.DEBUG) {
20 | FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false);
21 | }
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_attach_file_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/TemplateConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher;
2 |
3 | import java.util.HashMap;
4 |
5 | /**
6 | * Created by pddstudio on 25/04/2017.
7 | */
8 |
9 | public interface TemplateConfiguration {
10 | HashMap getThemeMappings();
11 | void updateThemeMappings(HashMap updatedMap);
12 | void setTemplateName(String templateName);
13 | String getTemplateName();
14 | String getTemplateFileName();
15 | String getTemplateId();
16 | String getTemplateTitle();
17 | String getTemplateType();
18 | String getTemplateDescription();
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/ImportAssetsFromApkEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | import com.pddstudio.substratum.packager.models.AssetFileInfo;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by pddstudio on 24/04/2017.
10 | */
11 |
12 | public class ImportAssetsFromApkEvent {
13 |
14 | private final List assets;
15 |
16 | public ImportAssetsFromApkEvent() {
17 | assets = new ArrayList<>();
18 | }
19 |
20 | public ImportAssetsFromApkEvent withList(List files) {
21 | this.assets.addAll(files);
22 | return this;
23 | }
24 |
25 | public List getAssets() {
26 | return assets;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/models/AssetsType.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager.models;
2 |
3 | import com.pddstudio.substratum.packager.R;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by pddstudio on 24/04/2017.
9 | */
10 |
11 | public enum AssetsType implements Serializable {
12 | FONTS(R.string.fragment_title_fonts),
13 | OVERLAYS(R.string.fragment_title_overlays),
14 | AUDIO(R.string.fragment_title_audio),
15 | BOOT_ANIMATIONS(R.string.fragment_title_boot_animations);
16 |
17 | private final int titleName;
18 |
19 | AssetsType(int title) {
20 | this.titleName = title;
21 | }
22 |
23 | public int getTitleRes() {
24 | return titleName;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/beans/EventBusBean.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.beans;
2 |
3 | import org.androidannotations.annotations.AfterInject;
4 | import org.androidannotations.annotations.EBean;
5 | import org.greenrobot.eventbus.EventBus;
6 |
7 | /**
8 | * Created by pddstudio on 21/04/2017.
9 | */
10 |
11 | @EBean(scope = EBean.Scope.Singleton)
12 | public class EventBusBean {
13 |
14 | private EventBus bus;
15 |
16 | @AfterInject
17 | protected void prepareBean() {
18 | if(bus == null) {
19 | bus = EventBus.getDefault();
20 | }
21 | }
22 |
23 | public EventBus getEventBus() {
24 | return bus;
25 | }
26 |
27 | public void post(Object o) {
28 | getEventBus().post(o);
29 | }
30 |
31 | public void register(Object o) {
32 | getEventBus().register(o);
33 | }
34 |
35 | public void unregister(Object o) {
36 | getEventBus().unregister(o);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/dialogs/InfoDialog.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.dialogs;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.StringRes;
5 |
6 | import com.afollestad.materialdialogs.MaterialDialog;
7 |
8 | import org.androidannotations.annotations.EBean;
9 | import org.androidannotations.annotations.RootContext;
10 |
11 | /**
12 | * Created by pddstudio on 08/05/2017.
13 | */
14 |
15 | @EBean
16 | public class InfoDialog {
17 |
18 | @RootContext
19 | Context context;
20 |
21 | private MaterialDialog infoDialog;
22 |
23 | public void show(@StringRes int title, @StringRes int content) {
24 | infoDialog = new MaterialDialog.Builder(context).title(title).content(content).positiveText(android.R.string.ok).show();
25 | }
26 |
27 | public void dismiss() {
28 | if(infoDialog != null && infoDialog.isShowing()) {
29 | infoDialog.dismiss();
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | -
10 |
11 |
12 |
13 |
17 |
18 |
22 |
23 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_assets_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
18 |
19 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #3F51B5
5 | #303F9F
6 | #FF4081
7 |
8 | #F44336
9 | #D32F2F
10 | #607D8B
11 |
12 | #4CAF50
13 | #388E3C
14 | #795548
15 |
16 | #FF9800
17 | #F57C00
18 | #9E9E9E
19 |
20 | #66000000
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/FileChooserDialogEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | import com.pddstudio.otgsubs.models.FileChooserType;
4 |
5 | /**
6 | * Created by pddstudio on 21/04/2017.
7 | */
8 |
9 | public class FileChooserDialogEvent {
10 |
11 | private String resultLocation;
12 | private boolean openRequest;
13 | private FileChooserType fileChooserType;
14 |
15 | public FileChooserDialogEvent(boolean openRequest, FileChooserType fileChooserType) {
16 | this.openRequest = openRequest;
17 | this.fileChooserType = fileChooserType;
18 | }
19 |
20 | public void setResult(String resultLocation) {
21 | this.resultLocation = resultLocation;
22 | }
23 |
24 | public String getResultLocation() {
25 | return resultLocation;
26 | }
27 |
28 | public boolean isOpenRequest() {
29 | return openRequest;
30 | }
31 |
32 | public FileChooserType getFileChooserType() {
33 | return fileChooserType;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/AssetTypeAddedEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | import com.pddstudio.substratum.packager.models.AssetFileInfo;
4 | import com.pddstudio.substratum.packager.models.AssetsType;
5 |
6 | /**
7 | * Created by pddstudio on 24/04/2017.
8 | */
9 |
10 | public class AssetTypeAddedEvent {
11 |
12 | private final AssetsType assetsType;
13 | private final AssetFileInfo assetFileInfo;
14 | private boolean fragmentIgnore = true;
15 |
16 | public AssetTypeAddedEvent(AssetsType assetsType, AssetFileInfo assetFileInfo) {
17 | this.assetsType = assetsType;
18 | this.assetFileInfo = assetFileInfo;
19 | }
20 |
21 | public AssetsType getAssetsType() {
22 | return assetsType;
23 | }
24 |
25 | public AssetFileInfo getAssetFileInfo() {
26 | return assetFileInfo;
27 | }
28 |
29 | public boolean isIgnore() {
30 | return fragmentIgnore;
31 | }
32 |
33 | public void setFragmentIgnore(boolean fragmentIgnore) {
34 | this.fragmentIgnore = fragmentIgnore;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/pddstudio/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 14sp
6 | 18sp
7 | 2dp
8 | 20sp
9 | 16sp
10 | 16dp
11 | 12dp
12 |
13 |
14 | 0dp
15 |
16 | 16dp
17 | 56dp
18 |
19 | 0x02000000
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/ExistingAssetsItemEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | import com.pddstudio.otgsubs.models.AssetsModificationType;
4 | import com.pddstudio.substratum.packager.models.AssetFileInfo;
5 |
6 | /**
7 | * Created by pddstudio on 25/04/2017.
8 | */
9 |
10 | public class ExistingAssetsItemEvent {
11 |
12 | private AssetFileInfo assetFileInfo;
13 | private AssetsModificationType modificationType;
14 | private String newName;
15 |
16 | public ExistingAssetsItemEvent(AssetFileInfo assetFileInfo, AssetsModificationType modificationType) {
17 | this.assetFileInfo = assetFileInfo;
18 | this.modificationType = modificationType;
19 | }
20 |
21 | public void setNewName(String newName) {
22 | this.newName = newName;
23 | }
24 |
25 | public AssetFileInfo getAssetFileInfo() {
26 | return assetFileInfo;
27 | }
28 |
29 | public AssetsModificationType getModificationType() {
30 | return modificationType;
31 | }
32 |
33 | public String getNewName() {
34 | return newName;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/substratum-packager/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/pddstudio/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/substratum-template-patcher/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/pddstudio/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Base .gitignore taken from "https://raw.githubusercontent.com/github/gitignore/master/Android.gitignore"
2 | # Built application files
3 | *.apk
4 | *.ap_
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 |
17 | # Gradle files
18 | .gradle/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | # Android Studio Navigation editor temp files
31 | .navigation/
32 |
33 | # Android Studio captures folder
34 | captures/
35 |
36 | # Intellij
37 | *.iml
38 | .idea/workspace.xml
39 | .idea/tasks.xml
40 | .idea/libraries
41 | .idea/misc.xml
42 | .idea/
43 |
44 | # Keystore files
45 | *.jks
46 |
47 | # Google Firebase Configuration
48 | app/google-services.json
49 |
50 | # External native build folder generated in Android Studio 2.2 and later
51 | .externalNativeBuild
52 | .idea/vcs.xml
53 | .idea/misc.xml
54 |
55 | .idea/instapk.xml
56 | instapk.log*
57 | .playstore/*
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/utils/Preferences.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.utils;
2 |
3 | import com.pddstudio.otgsubs.R;
4 |
5 | import org.androidannotations.annotations.sharedpreferences.DefaultBoolean;
6 | import org.androidannotations.annotations.sharedpreferences.DefaultInt;
7 | import org.androidannotations.annotations.sharedpreferences.SharedPref;
8 |
9 | /**
10 | * Created by pddstudio on 28/07/16.
11 | */
12 | @SharedPref(SharedPref.Scope.UNIQUE)
13 | public interface Preferences {
14 |
15 | @DefaultBoolean(value = false, keyRes = R.string.pref_item_tint_nav_bar_key)
16 | boolean tintNavigationBar();
17 |
18 | @DefaultBoolean(value = true, keyRes = R.string.pref_item_crash_reports_key)
19 | boolean crashReportEnabled();
20 |
21 | @DefaultBoolean(value = true, keyRes = R.string.pref_item_install_build_apk_key)
22 | boolean openPackageInstaller();
23 |
24 | @DefaultInt(value = 0, keyRes = R.string.pref_item_app_theme_key)
25 | int themeId();
26 |
27 | @DefaultBoolean(value = false, keyRes = R.string.pref_item_app_theme_changed_runtime_key)
28 | boolean themeChanged();
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/utils/AssetUtils.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager.utils;
2 |
3 | import android.content.res.AssetManager;
4 |
5 | import java.io.File;
6 | import java.io.FileOutputStream;
7 | import java.io.IOException;
8 | import java.io.InputStream;
9 | import java.io.OutputStream;
10 |
11 | /**
12 | * Created by pddstudio on 20/04/2017.
13 | */
14 |
15 | public class AssetUtils {
16 |
17 | public static boolean copyFromAssetsToCache(File cacheDir, AssetManager assetManager, String assetFileName) throws IOException {
18 | InputStream inputStream = assetManager.open(assetFileName);
19 | File outputFile = new File(cacheDir, assetFileName);
20 | OutputStream outputStream = new FileOutputStream(outputFile);
21 | copyFile(inputStream, outputStream);
22 | return outputFile.exists();
23 | }
24 |
25 | private static void copyFile(InputStream in, OutputStream out) throws IOException {
26 | byte[] buffer = new byte[1024];
27 | int read;
28 | while((read = in.read(buffer)) != -1){
29 | out.write(buffer, 0, read);
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_empty_assets.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
20 |
21 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_template_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
18 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/ColorChooserDialogEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | /**
4 | * Created by pddstudio on 26/04/2017.
5 | */
6 |
7 | public class ColorChooserDialogEvent {
8 |
9 | private String resultColor;
10 | private boolean openRequest;
11 | private String templateId;
12 | private String templateKey;
13 |
14 | public ColorChooserDialogEvent(boolean openRequest, String templateId) {
15 | this.openRequest = openRequest;
16 | this.templateId = templateId;
17 | }
18 |
19 | public ColorChooserDialogEvent withTemplateKey(String templateKey) {
20 | this.templateKey = templateKey;
21 | return this;
22 |
23 | }
24 |
25 | public void setOpenRequest(boolean openRequest) {
26 | this.openRequest = openRequest;
27 | }
28 |
29 | public void setResult(String resultLocation) {
30 | this.resultColor = resultLocation;
31 | }
32 |
33 | public String getResultColor() {
34 | return resultColor;
35 | }
36 |
37 | public boolean isOpenRequest() {
38 | return openRequest;
39 | }
40 |
41 | public String getTemplateId() {
42 | return templateId;
43 | }
44 |
45 | public String getTemplateKey() {
46 | return templateKey;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_color_picker.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
18 |
23 |
24 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/events/PatchThemePreparationEvent.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.events;
2 |
3 | import com.pddstudio.substratum.template.patcher.TemplateConfiguration;
4 | import com.pddstudio.substratum.template.patcher.ThemeConfiguration;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by pddstudio on 04/05/2017.
10 | */
11 |
12 | public class PatchThemePreparationEvent {
13 |
14 | private boolean success;
15 | private List templateConfigurations;
16 | private ThemeConfiguration themeConfiguration;
17 |
18 | public PatchThemePreparationEvent(boolean success, List templateConfigurations) {
19 | this.success = success;
20 | this.templateConfigurations = templateConfigurations;
21 | }
22 |
23 | public PatchThemePreparationEvent withThemeConfiguration(ThemeConfiguration themeConfiguration) {
24 | this.themeConfiguration = themeConfiguration;
25 | return this;
26 | }
27 |
28 | public boolean isSuccess() {
29 | return success;
30 | }
31 |
32 | public List getTemplateConfigurations() {
33 | return templateConfigurations;
34 | }
35 |
36 | public ThemeConfiguration getThemeConfiguration() {
37 | return themeConfiguration;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/models/AssetFileInfo.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager.models;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by pddstudio on 24/04/2017.
7 | */
8 |
9 | public class AssetFileInfo implements Serializable {
10 |
11 | private AssetsType type;
12 | private String fileLocation;
13 | private String fileName;
14 | private String relativeAssetsDestinationLocation;
15 |
16 | public AssetFileInfo(AssetsType type, String fileLocation, String fileName) {
17 | this.type = type;
18 | this.fileLocation = fileLocation;
19 | this.fileName = fileName;
20 | }
21 |
22 | public AssetsType getType() {
23 | return type;
24 | }
25 |
26 | public String getFileLocation() {
27 | return fileLocation;
28 | }
29 |
30 | public String getFileName() {
31 | return fileName;
32 | }
33 |
34 | public String getRelativeAssetsDestinationLocation() {
35 | return relativeAssetsDestinationLocation;
36 | }
37 |
38 | public void setRelativeAssetsDestinationLocation(String relativeAssetsDestinationLocation) {
39 | this.relativeAssetsDestinationLocation = relativeAssetsDestinationLocation;
40 | }
41 |
42 | public void setFileName(String fileName) {
43 | this.fileName = fileName;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/XmlPatcher.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher;
2 |
3 | import android.util.Log;
4 |
5 | import com.pddstudio.phrase.java.Phrase;
6 | import com.pddstudio.substratum.template.patcher.internal.LinePatcher;
7 |
8 | /**
9 | * Created by pddstudio on 25/04/2017.
10 | */
11 |
12 | final class XmlPatcher extends LinePatcher {
13 |
14 | private static final String TAG = XmlPatcher.class.getSimpleName();
15 |
16 | private static XmlPatcher INSTANCE;
17 |
18 | static XmlPatcher getInstance() {
19 | if(INSTANCE == null) {
20 | INSTANCE = new XmlPatcher();
21 | }
22 | return INSTANCE;
23 | }
24 |
25 | private XmlPatcher() {}
26 |
27 | @Override
28 | public String patchLine(String line, String targetKey, String replacementValue) {
29 | try {
30 | Log.d(TAG, "Patch Line: " + line + " key: " + targetKey + " value: " + replacementValue);
31 | String result = Phrase.from(line, Phrase.KeyIdentifier.CURLY_BRACKETS).put(targetKey, replacementValue).formatString();
32 | Log.d(TAG, "Patch Succeeded! => " + result);
33 | return result;
34 | } catch (IllegalArgumentException e) {
35 | String replaceLine = line.replace("{" + targetKey + "}", replacementValue);
36 | Log.d(TAG, "Patching failed! Replacing legacy => " + replaceLine);
37 | return replaceLine;
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/internal/model/JsonConfigModel.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher.internal.model;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 | import com.pddstudio.substratum.template.patcher.TemplateConfiguration;
5 | import com.pddstudio.substratum.template.patcher.ThemeConfiguration;
6 |
7 | import java.io.Serializable;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import java8.util.Objects;
12 | import java8.util.stream.StreamSupport;
13 |
14 | /**
15 | * Created by pddstudio on 25/04/2017.
16 | */
17 |
18 | public class JsonConfigModel implements Serializable, ThemeConfiguration {
19 |
20 | @SerializedName("themeName")
21 | private String themeName;
22 |
23 | @SerializedName("themeAuthor")
24 | private String themeAuthor;
25 |
26 | @SerializedName("themeTemplates")
27 | private List templateList;
28 |
29 | @Override
30 | public String getThemeName() {
31 | return themeName;
32 | }
33 |
34 | @Override
35 | public String getThemeAuthor() {
36 | return themeAuthor;
37 | }
38 |
39 | @Override
40 | public List getThemeTemplates() {
41 | List configurations = new ArrayList<>();
42 | StreamSupport.stream(templateList).filter(Objects::nonNull).forEach(configurations::add);
43 | return configurations;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/views/EmptyAssetsView.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.views;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.StringRes;
5 | import android.util.AttributeSet;
6 | import android.widget.RelativeLayout;
7 | import android.widget.TextView;
8 |
9 | import com.pddstudio.otgsubs.R;
10 |
11 | import org.androidannotations.annotations.EViewGroup;
12 | import org.androidannotations.annotations.ViewById;
13 |
14 | /**
15 | * Created by pddstudio on 24/04/2017.
16 | */
17 |
18 | @EViewGroup(R.layout.view_empty_assets)
19 | public class EmptyAssetsView extends RelativeLayout {
20 |
21 | @ViewById(R.id.empty_text)
22 | protected TextView emptyText;
23 |
24 | public EmptyAssetsView(Context context) {
25 | super(context);
26 | }
27 |
28 | public EmptyAssetsView(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | }
31 |
32 | public EmptyAssetsView(Context context, AttributeSet attrs, int defStyleAttr) {
33 | super(context, attrs, defStyleAttr);
34 | }
35 |
36 | public EmptyAssetsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
37 | super(context, attrs, defStyleAttr, defStyleRes);
38 | }
39 |
40 | public void setViewVisible(boolean visible) {
41 | setVisibility(visible ? VISIBLE : GONE);
42 | }
43 |
44 | public void setEmptyText(@StringRes int text, Object... formatArgs) {
45 | emptyText.setText(getContext().getString(text, formatArgs));
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/substratum-packager/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'me.tatarka.retrolambda'
3 |
4 | android {
5 | compileSdkVersion rootProject.ext.targetSdk
6 | buildToolsVersion rootProject.ext.buildToolsVersion
7 |
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.minSdk
10 | targetSdkVersion rootProject.ext.targetSdk
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | compileOptions {
24 | targetCompatibility 1.8
25 | sourceCompatibility 1.8
26 | }
27 | }
28 |
29 | dependencies {
30 | compile fileTree(dir: 'libs', include: ['*.jar'])
31 | compile "org.zeroturnaround:zt-zip:${rootProject.ext.ztZipLibraryVersion}"
32 | compile "com.google.code.gson:gson:${rootProject.ext.gsonLibraryVersion}"
33 | compile "commons-io:commons-io:${rootProject.ext.commonsIoLibraryVersion}"
34 | compile "net.sourceforge.streamsupport:streamsupport:${rootProject.ext.streamSupportLibraryVersion}"
35 | annotationProcessor "org.androidannotations:androidannotations:${rootProject.ext.androidAnnotationsVersion}"
36 | compile "org.androidannotations:androidannotations-api:${rootProject.ext.androidAnnotationsVersion}"
37 | }
38 |
--------------------------------------------------------------------------------
/substratum-template-patcher/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'me.tatarka.retrolambda'
3 |
4 | android {
5 | compileSdkVersion rootProject.ext.targetSdk
6 | buildToolsVersion rootProject.ext.buildToolsVersion
7 |
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.minSdk
10 | targetSdkVersion rootProject.ext.targetSdk
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | compileOptions {
24 | targetCompatibility 1.8
25 | sourceCompatibility 1.8
26 | }
27 | }
28 |
29 | dependencies {
30 | compile fileTree(dir: 'libs', include: ['*.jar'])
31 | compile "com.google.code.gson:gson:${rootProject.ext.gsonLibraryVersion}"
32 | compile "commons-io:commons-io:${rootProject.ext.commonsIoLibraryVersion}"
33 | compile "com.github.pddstudio:phrase-java:${rootProject.ext.phraseJavaLibraryVersion}"
34 | compile "net.sourceforge.streamsupport:streamsupport:${rootProject.ext.streamSupportLibraryVersion}"
35 | annotationProcessor "org.androidannotations:androidannotations:${rootProject.ext.androidAnnotationsVersion}"
36 | compile "org.androidannotations:androidannotations-api:${rootProject.ext.androidAnnotationsVersion}"
37 | }
38 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/models/ApkInfo.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager.models;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.GsonBuilder;
5 |
6 | import java.io.Serializable;
7 |
8 | /**
9 | * Created by pddstudio on 21/04/2017.
10 | */
11 |
12 | public class ApkInfo implements Serializable {
13 |
14 | private String appName;
15 | private String apk;
16 | private String version;
17 | private String source;
18 | private String data;
19 |
20 | public ApkInfo(String appName, String apk, String version, String source, String data) {
21 | this.appName = appName;
22 | this.apk = apk;
23 | this.version = version;
24 | this.source = source;
25 | this.data = data;
26 | }
27 |
28 | public String getAppName() {
29 | return appName;
30 | }
31 |
32 | public void setAppName(String appName) {
33 | this.appName = appName;
34 | }
35 |
36 | public String getPackageName() {
37 | return apk;
38 | }
39 |
40 | public void setApk(String apk) {
41 | this.apk = apk;
42 | }
43 |
44 | public String getVersion() {
45 | return version;
46 | }
47 |
48 | public void setVersion(String version) {
49 | this.version = version;
50 | }
51 |
52 | public String getSource() {
53 | return source;
54 | }
55 |
56 | public void setSource(String source) {
57 | this.source = source;
58 | }
59 |
60 | public String getData() {
61 | return data;
62 | }
63 |
64 | public void setData(String data) {
65 | this.data = data;
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | Gson gson = new GsonBuilder().setPrettyPrinting().create();
71 | return gson.toJson(this);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_patcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
24 |
25 |
30 |
31 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
12 |
13 |
14 |
15 |
17 |
18 |
24 |
25 |
29 |
30 |
31 |
32 |
34 |
35 |
39 |
40 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/ApkExtractor.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager;
2 |
3 | import android.util.Log;
4 |
5 | import com.pddstudio.substratum.packager.models.ApkInfo;
6 | import com.pddstudio.substratum.packager.utils.ApkHelper;
7 |
8 | import org.androidannotations.annotations.AfterInject;
9 | import org.androidannotations.annotations.Bean;
10 | import org.androidannotations.annotations.EBean;
11 | import org.zeroturnaround.zip.ZipUtil;
12 | import org.zeroturnaround.zip.commons.FileUtils;
13 |
14 | import java.io.File;
15 | import java.io.IOException;
16 | import java.util.List;
17 |
18 | import java8.util.stream.StreamSupport;
19 |
20 | /**
21 | * Created by pddstudio on 21/04/2017.
22 | */
23 |
24 | @EBean(scope = EBean.Scope.Singleton)
25 | public class ApkExtractor {
26 |
27 | private static final String TAG = ApkExtractor.class.getSimpleName();
28 |
29 | private List apkInfos;
30 |
31 | @Bean
32 | protected ApkHelper apkHelper;
33 |
34 | @AfterInject
35 | protected void loadApks() {
36 | apkInfos = apkHelper.getInstalledApks();
37 | StreamSupport.stream(apkInfos).forEach(apkInfo -> Log.d(TAG, "APK INFO: " + apkInfo));
38 | }
39 |
40 | public File copyApkToCache(File cacheDir, ApkInfo apkInfo) throws IOException {
41 | File apkSource = new File(apkInfo.getSource());
42 | File outputLoc = new File(cacheDir, apkSource.getName());
43 | FileUtils.copyFile(apkSource, outputLoc);
44 | return outputLoc;
45 | }
46 |
47 | public List getApkInfoList() {
48 | return apkInfos;
49 | }
50 |
51 | public void extractAssetsFromApk(File cachedApkFile, File destDir) {
52 | ZipUtil.unpack(cachedApkFile, destDir, name -> name.startsWith("assets/") ? name : null);
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/utils/ZipUtils.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager.utils;
2 |
3 | import android.util.Log;
4 |
5 | import org.zeroturnaround.zip.ZipUtil;
6 | import org.zeroturnaround.zip.commons.FileUtils;
7 |
8 | import java.io.File;
9 | import java.io.IOException;
10 |
11 | import java8.util.stream.StreamSupport;
12 | import kellinwood.security.zipsigner.ZipSigner;
13 |
14 | /**
15 | * Created by pddstudio on 20/04/2017.
16 | */
17 |
18 | public class ZipUtils {
19 |
20 | private static final String TAG = ZipUtils.class.getSimpleName();
21 |
22 | public static void extractZip(File zipFile, File destFile) {
23 | ZipUtil.unpack(zipFile, destFile);
24 | }
25 |
26 | public static void mergeDirectories(File destDir, File... directories) throws IOException {
27 | if(!destDir.exists()) {
28 | destDir.mkdirs();
29 | }
30 | for(File dir : directories) {
31 | Log.d(TAG, "Copying from " + dir.getAbsolutePath() + " to " + destDir.getAbsolutePath());
32 | StreamSupport.stream(org.apache.commons.io.FileUtils.listFiles(dir, null, true)).forEach(file -> {
33 | Log.d(TAG, "Content: " + file.getAbsolutePath());
34 | });
35 | FileUtils.copyDirectory(dir, destDir);
36 | }
37 | }
38 |
39 | public static File createApkFromDir(File dir, File destFile) throws Exception {
40 | ZipUtil.pack(dir, destFile);
41 | File signedApk = new File(destFile.getParent(), "app-signed.apk");
42 | ZipSigner zipSigner = new ZipSigner();
43 | zipSigner.setKeymode("auto-testkey");
44 | zipSigner.signZip(destFile.getAbsolutePath(), signedApk.getAbsolutePath());
45 | Log.d("ZipUtils", "signedZip() : file present -> " + signedApk.exists() + " at " + signedApk.getAbsolutePath());
46 | return signedApk;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/beans/NavigationBean.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.beans;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 |
7 | import com.mikepenz.aboutlibraries.Libs;
8 | import com.mikepenz.aboutlibraries.LibsBuilder;
9 | import com.pddstudio.otgsubs.R;
10 | import com.pddstudio.otgsubs.SettingsActivity;
11 |
12 | import org.androidannotations.annotations.EBean;
13 | import org.androidannotations.annotations.RootContext;
14 |
15 | /**
16 | * Created by pddstudio on 11/05/2017.
17 | */
18 |
19 | @EBean
20 | public class NavigationBean {
21 |
22 | @RootContext
23 | protected Context context;
24 |
25 | public void openAboutScreen() {
26 | String aboutAppName = context.getString(R.string.app_name);
27 | String aboutAppDesc = context.getString(R.string.about_app_desc);
28 | String activityTitle = context.getString(R.string.about_app_title);
29 |
30 | new LibsBuilder().withAboutAppName(aboutAppName)
31 | .withAboutIconShown(true)
32 | .withAboutDescription(aboutAppDesc)
33 | .withAboutVersionShown(true)
34 | .withAboutVersionShownName(true)
35 | .withAboutVersionShownCode(true)
36 | .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
37 | .withActivityTitle(activityTitle)
38 | .withAutoDetect(true)
39 | .start(context);
40 | }
41 |
42 | public void openSettingsScreen(int settingsRequestCode) {
43 | SettingsActivity.open(context, settingsRequestCode);
44 | }
45 |
46 | public void openGitHubPage() {
47 | openWebUrl("https://github.com/PDDStudio/OTGSubs");
48 | }
49 |
50 | public void openWebUrl(String url) {
51 | Intent intent = new Intent(Intent.ACTION_VIEW);
52 | intent.setData(Uri.parse(url));
53 | context.startActivity(intent);
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/dialogs/InputDialog.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.dialogs;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.StringRes;
6 |
7 | import com.afollestad.materialdialogs.MaterialDialog;
8 | import com.pddstudio.otgsubs.R;
9 |
10 | import org.androidannotations.annotations.EBean;
11 | import org.androidannotations.annotations.RootContext;
12 |
13 | /**
14 | * Created by pddstudio on 08/05/2017.
15 | */
16 |
17 | @EBean
18 | public class InputDialog implements MaterialDialog.InputCallback {
19 |
20 | public interface InputCallback {
21 | void onInputReceived(String dialogInput);
22 | }
23 |
24 | @RootContext
25 | protected Context context;
26 |
27 | private MaterialDialog inputDialog;
28 | private InputCallback callback;
29 |
30 | @StringRes
31 | private int inputHint = 0;
32 |
33 | @StringRes
34 | private int inputPreFill = 0;
35 |
36 | public void setInputHint(@StringRes int inputHint) {
37 | this.inputHint = inputHint;
38 | }
39 |
40 | public void setInputPreFill(@StringRes int inputPreFill) {
41 | this.inputPreFill = inputPreFill;
42 | }
43 |
44 | public void show(@StringRes int titleRes, @StringRes int contentRes, InputCallback callback) {
45 | this.callback = callback;
46 | inputDialog = new MaterialDialog.Builder(context).title(titleRes).content(contentRes).input(inputHint, inputPreFill, false, this).inputRangeRes(1, 20, R.color.md_red_500).show();
47 | }
48 |
49 | public void dismiss() {
50 | if (inputDialog != null && inputDialog.isShowing()) {
51 | inputDialog.dismiss();
52 | }
53 | inputPreFill = 0;
54 | inputHint = 0;
55 | }
56 |
57 | @Override
58 | public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
59 | if (callback != null) {
60 | callback.onInputReceived(input.toString());
61 | }
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/utils/DialogUtils.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.utils;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 |
6 | import com.afollestad.materialdialogs.simplelist.MaterialSimpleListAdapter;
7 | import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem;
8 | import com.pddstudio.otgsubs.R;
9 | import com.pddstudio.otgsubs.models.AssetsModificationType;
10 | import com.pddstudio.substratum.packager.models.AssetFileInfo;
11 |
12 | /**
13 | * Created by pddstudio on 25/04/2017.
14 | */
15 |
16 | public class DialogUtils {
17 |
18 | private DialogUtils() {}
19 |
20 | public static MaterialSimpleListAdapter createAssetsItemSelectionAdapter(@NonNull Context context, @NonNull MaterialSimpleListAdapter.Callback callback, @NonNull AssetFileInfo assetFileInfo) {
21 | MaterialSimpleListAdapter adapter = new MaterialSimpleListAdapter(callback);
22 | /*adapter.add(new MaterialSimpleListItem.Builder(context).content("Rename Item")
23 | .iconPaddingDp(4)
24 | .icon(R.drawable.ic_mode_edit_24dp)
25 | .tag(new TagPair<>(assetFileInfo, AssetsModificationType.RENAME))
26 | .build());*/
27 | //TODO: fix rename action not working properly
28 | adapter.add(new MaterialSimpleListItem.Builder(context).content("Delete Item")
29 | .iconPaddingDp(4)
30 | .icon(R.drawable.ic_delete_forever_24dp)
31 | .tag(new TagPair<>(assetFileInfo, AssetsModificationType.DELETE))
32 | .build());
33 | return adapter;
34 | }
35 |
36 | public static class TagPair {
37 |
38 | private final K key;
39 | private final V value;
40 |
41 | private TagPair(K key, V value) {
42 | this.key = key;
43 | this.value = value;
44 | }
45 |
46 | public K getKey() {
47 | return key;
48 | }
49 |
50 | public V getValue() {
51 | return value;
52 | }
53 |
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/adapters/AssetsPageAdapter.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.adapters;
2 |
3 | import android.content.Context;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentManager;
6 | import android.support.v4.app.FragmentStatePagerAdapter;
7 |
8 | import com.pddstudio.otgsubs.fragments.AssetsListFragment;
9 | import com.pddstudio.substratum.packager.models.AssetsType;
10 |
11 | /**
12 | * Created by pddstudio on 24/04/2017.
13 | */
14 |
15 | public class AssetsPageAdapter extends FragmentStatePagerAdapter {
16 |
17 | private static final int PAGES_COUNT = 4;
18 |
19 | private Context context;
20 |
21 | public AssetsPageAdapter(Context context, FragmentManager fm) {
22 | super(fm);
23 | this.context = context.getApplicationContext();
24 | }
25 |
26 | private String getTitleForAssetsType(AssetsType assetsType) {
27 | return context.getString(assetsType.getTitleRes());
28 | }
29 |
30 | @Override
31 | public Fragment getItem(int position) {
32 | switch (position) {
33 | case 0:
34 | return AssetsListFragment.newInstance(AssetsType.FONTS);
35 | case 1:
36 | return AssetsListFragment.newInstance(AssetsType.OVERLAYS);
37 | case 2:
38 | return AssetsListFragment.newInstance(AssetsType.AUDIO);
39 | case 3:
40 | return AssetsListFragment.newInstance(AssetsType.BOOT_ANIMATIONS);
41 | default:
42 | throw new RuntimeException("Unknown fragment position " + position);
43 |
44 | }
45 | }
46 |
47 | @Override
48 | public int getCount() {
49 | return PAGES_COUNT;
50 | }
51 |
52 | @Override
53 | public CharSequence getPageTitle(int position) {
54 | switch (position) {
55 | case 0:
56 | return getTitleForAssetsType(AssetsType.FONTS);
57 | case 1:
58 | return getTitleForAssetsType(AssetsType.OVERLAYS);
59 | case 2:
60 | return getTitleForAssetsType(AssetsType.AUDIO);
61 | case 3:
62 | return getTitleForAssetsType(AssetsType.BOOT_ANIMATIONS);
63 | default:
64 | throw new RuntimeException("Unknown fragment position " + position);
65 |
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_theme_patcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
21 |
22 |
26 |
27 |
34 |
35 |
42 |
43 |
44 |
45 |
46 |
47 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
51 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/substratum-template-patcher/src/main/java/com/pddstudio/substratum/template/patcher/internal/model/Template.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.template.patcher.internal.model;
2 |
3 | import com.google.gson.annotations.Expose;
4 | import com.google.gson.annotations.SerializedName;
5 | import com.pddstudio.substratum.template.patcher.TemplateConfiguration;
6 |
7 | import java.io.Serializable;
8 | import java.util.HashMap;
9 |
10 | import java8.util.stream.StreamSupport;
11 |
12 | /**
13 | * Created by pddstudio on 04/05/2017.
14 | */
15 |
16 | public class Template implements Serializable, TemplateConfiguration {
17 |
18 | @SerializedName("id")
19 | private String id;
20 |
21 | @SerializedName("title")
22 | private String title;
23 |
24 | @SerializedName("description")
25 | private String description;
26 |
27 | @SerializedName("templateFile")
28 | private String templateFile;
29 |
30 | @SerializedName("templateType")
31 | private String templateType;
32 |
33 | @SerializedName("themes")
34 | private HashMap themeValueMap;
35 |
36 | @Expose
37 | private String templateName;
38 |
39 | @Override
40 | public HashMap getThemeMappings() {
41 | return themeValueMap;
42 | }
43 |
44 | @Override
45 | public void updateThemeMappings(HashMap updatedMap) {
46 | StreamSupport.stream(updatedMap.keySet()).forEachOrdered(key -> themeValueMap.put(key, updatedMap.get(key)));
47 | }
48 |
49 | @Override
50 | public void setTemplateName(String templateName) {
51 | this.templateName = templateName;
52 | }
53 |
54 | @Override
55 | public String getTemplateName() {
56 | return templateName;
57 | }
58 |
59 | @Override
60 | public String getTemplateFileName() {
61 | return templateFile;
62 | }
63 |
64 | @Override
65 | public String getTemplateId() {
66 | return id;
67 | }
68 |
69 | @Override
70 | public String getTemplateTitle() {
71 | return title;
72 | }
73 |
74 | @Override
75 | public String getTemplateType() {
76 | return templateType;
77 | }
78 |
79 | @Override
80 | public String getTemplateDescription() {
81 | return description;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/substratum-packager/src/main/java/com/pddstudio/substratum/packager/utils/ApkHelper.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.substratum.packager.utils;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.pm.ApplicationInfo;
6 | import android.content.pm.PackageInfo;
7 | import android.content.pm.PackageManager;
8 | import android.net.Uri;
9 |
10 | import com.pddstudio.substratum.packager.models.ApkInfo;
11 |
12 | import org.androidannotations.annotations.EBean;
13 | import org.androidannotations.annotations.RootContext;
14 |
15 | import java.io.File;
16 | import java.util.List;
17 |
18 | import java8.util.stream.Collectors;
19 | import java8.util.stream.StreamSupport;
20 |
21 | /**
22 | * Created by pddstudio on 21/04/2017.
23 | */
24 |
25 | @EBean(scope = EBean.Scope.Singleton)
26 | public class ApkHelper {
27 |
28 | private static final String TAG = ApkHelper.class.getSimpleName();
29 |
30 | @RootContext
31 | Context context;
32 | PackageManager packageManager;
33 |
34 | public List getInstalledApks() {
35 | packageManager = context.getPackageManager();
36 | List packages = packageManager.getInstalledPackages(PackageManager.GET_META_DATA);
37 | return StreamSupport.stream(packages).map(this::convertPackageInfoToApkInfo).filter(apkInfo -> apkInfo != null).collect(Collectors.toList());
38 | }
39 |
40 | private ApkInfo convertPackageInfoToApkInfo(PackageInfo packageInfo) {
41 | if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
42 | return new ApkInfo(packageManager.getApplicationLabel(packageInfo.applicationInfo).toString(),
43 | packageInfo.packageName,
44 | packageInfo.versionName,
45 | packageInfo.applicationInfo.sourceDir,
46 | packageInfo.applicationInfo.dataDir);
47 | } else {
48 | return null;
49 | }
50 | }
51 |
52 | public static Intent getShareIntent(File file) {
53 | Intent intent = new Intent();
54 | intent.setAction(Intent.ACTION_SEND);
55 | intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
56 | intent.setType("application/vnd.android.package-archive");
57 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
58 |
59 | return intent;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/utils/DeviceUtils.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.utils;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.res.TypedArray;
6 | import android.os.Build;
7 | import android.support.annotation.ColorInt;
8 | import android.util.Log;
9 | import android.util.TypedValue;
10 |
11 | import com.google.firebase.analytics.FirebaseAnalytics;
12 | import com.pddstudio.otgsubs.R;
13 |
14 | import org.androidannotations.annotations.EBean;
15 | import org.androidannotations.annotations.RootContext;
16 | import org.androidannotations.annotations.sharedpreferences.Pref;
17 |
18 | /**
19 | * Created by pddstudio on 29/07/16.
20 | */
21 | @EBean(scope = EBean.Scope.Singleton)
22 | public class DeviceUtils {
23 |
24 | @RootContext
25 | Context context;
26 |
27 | @Pref
28 | Preferences_ preferences;
29 |
30 | public boolean isLollipopOrHigher() {
31 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
32 | }
33 |
34 | public Context getRootContext() {
35 | return context;
36 | }
37 |
38 | @ColorInt
39 | private int getColorForTheme(Activity activity) {
40 | TypedValue typedValue = new TypedValue();
41 |
42 | TypedArray a = activity.obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorPrimary});
43 | int color = a.getColor(0, 0);
44 |
45 | a.recycle();
46 |
47 | return color;
48 | }
49 |
50 | public void setNavigationBarColor(Activity activity) {
51 | if (isLollipopOrHigher()) {
52 | if (preferences.tintNavigationBar().get()) {
53 | activity.getWindow().setNavigationBarColor(getColorForTheme(activity));
54 | } else {
55 | activity.getWindow().setNavigationBarColor(context.getResources().getColor(android.R.color.black));
56 | }
57 | }
58 | }
59 |
60 | public void reloadCrashReportConfig() {
61 | Log.d("DeviceUtils", "reloadCrashReportConfig() enabled => " + preferences.crashReportEnabled().get());
62 | FirebaseAnalytics.getInstance(context).setAnalyticsCollectionEnabled(preferences.crashReportEnabled().get());
63 | }
64 |
65 | public void setCrashReportsEnabled(boolean enabled) {
66 | Log.d("DeviceUtils", "setCrashReportsEnabled() changed to => " + enabled);
67 | FirebaseAnalytics.getInstance(context).setAnalyticsCollectionEnabled(enabled);
68 | }
69 |
70 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/strings_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | General
5 | Appearance
6 | Miscellaneous
7 |
8 | Enable Navigation Bar Tint
9 | Note: Works only on Android 5.0 and higher.]]>
10 | Theme
11 | Current: %s
12 |
13 | Build Information
14 | Version: %1$s (%2$s)
15 |
16 | Crash Reports
17 | Automatically collect and send anonymous crash reports. This helps improving the application\'s stability.
18 |
19 | Automatically Open Theme Installer
20 | Open the Package Installer after a Theme was build successfully.
21 |
22 | buildInfo
23 | tintNavigationBar
24 | enableCrashReports
25 | installBuildApk
26 | applicationTheme
27 | appThemeChangedRuntime
28 |
29 |
30 | - Blue
31 | - Red
32 | - Green
33 | - Dark Orange
34 |
35 |
36 | - 0
37 | - 1
38 | - 2
39 | - 3
40 |
41 | Settings
42 | About
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/views/TemplateItemView.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.views;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.LinearLayout;
7 | import android.widget.RelativeLayout;
8 | import android.widget.TextView;
9 |
10 | import com.pddstudio.otgsubs.R;
11 | import com.pddstudio.substratum.template.patcher.TemplateConfiguration;
12 |
13 | import java8.util.stream.StreamSupport;
14 |
15 | /**
16 | * Created by pddstudio on 04/05/2017.
17 | */
18 |
19 | public class TemplateItemView extends RelativeLayout {
20 |
21 | private TemplateConfiguration templateConfiguration;
22 | private OpenColorPickerCallback callback;
23 |
24 | private LinearLayout layout;
25 | private TextView titleText;
26 | private TextView descText;
27 |
28 | public TemplateItemView(Context context) {
29 | super(context);
30 | View view = LayoutInflater.from(context).inflate(R.layout.view_template_item, this, true);
31 | layout = (LinearLayout) view.findViewById(R.id.template_layout);
32 | titleText = (TextView) view.findViewById(R.id.template_title);
33 | descText = (TextView) view.findViewById(R.id.template_description);
34 | }
35 |
36 | public void setTemplateConfiguration(TemplateConfiguration templateConfiguration, OpenColorPickerCallback callback) {
37 | this.templateConfiguration = templateConfiguration;
38 | this.callback = callback;
39 | createItemsForTemplateConfiguration();
40 | }
41 |
42 | public void setTitle(String title) {
43 | this.titleText.setText(title);
44 | }
45 |
46 | public void setDescription(String description) {
47 | this.descText.setText(description);
48 | }
49 |
50 | private void createItemsForTemplateConfiguration() {
51 | StreamSupport.stream(templateConfiguration.getThemeMappings().keySet()).forEach(key -> {
52 | String value = templateConfiguration.getThemeMappings().get(key);
53 | ColorPickerView colorPickerView = new ColorPickerView(getContext());
54 | colorPickerView.setPickerConfig(templateConfiguration, callback, key, value);
55 | layout.addView(colorPickerView);
56 | });
57 | }
58 |
59 | public interface OpenColorPickerCallback {
60 | void openColorPicker(TemplateConfiguration templateConfiguration, String forKey, String forValue);
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_assets_adapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
26 |
27 |
37 |
38 |
45 |
46 |
54 |
55 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/utils/ThemeUtils.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.utils;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.content.SharedPreferences;
6 | import android.content.res.TypedArray;
7 | import android.support.annotation.ColorInt;
8 | import android.util.TypedValue;
9 |
10 | import com.pddstudio.otgsubs.R;
11 |
12 | /**
13 | * Created by pddstudio on 29/07/16.
14 | */
15 | public class ThemeUtils {
16 |
17 | public static final String PREFERENCE_NAME = Preferences.class.getSimpleName();
18 |
19 | public static void applySelectedTheme(Activity activity) {
20 | SharedPreferences preferences = activity.getSharedPreferences(PREFERENCE_NAME, 0);
21 | String themePreference = activity.getString(R.string.pref_item_app_theme_key);
22 | switch (preferences.getString(themePreference, "0")) {
23 | case "0":
24 | activity.setTheme(R.style.AppTheme_Blue);
25 | break;
26 | case "1":
27 | activity.setTheme(R.style.AppTheme_Red);
28 | break;
29 | case "2":
30 | activity.setTheme(R.style.AppTheme_Green);
31 | break;
32 | case "3":
33 | activity.setTheme(R.style.AppTheme_DarkOrange);
34 | break;
35 | }
36 | }
37 |
38 | public static int getDrawerHeaderColorForSelectedTheme(Activity activity) {
39 | SharedPreferences preferences = activity.getSharedPreferences(PREFERENCE_NAME, 0);
40 | String themePreference = activity.getString(R.string.pref_item_app_theme_key);
41 | switch (preferences.getString(themePreference, "0")) {
42 | case "0":
43 | default:
44 | return R.color.colorPrimary;
45 | case "1":
46 | return R.color.colorPrimaryRed;
47 | case "2":
48 | return R.color.colorPrimaryGreen;
49 | case "3":
50 | return R.color.colorPrimaryDarkOrange;
51 | }
52 | }
53 |
54 | public static void restartActivity(Activity activity) {
55 | activity.finish();
56 | final Intent intent = activity.getIntent();
57 | activity.startActivity(intent);
58 | }
59 |
60 | @ColorInt
61 | public static int getPrimaryColorForTheme(Activity activity) {
62 | TypedValue typedValue = new TypedValue();
63 |
64 | TypedArray a = activity.obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorPrimary});
65 | int color = a.getColor(0, 0);
66 |
67 | a.recycle();
68 |
69 | return color;
70 | }
71 |
72 | @ColorInt
73 | public static int getAccentColorForTheme(Activity activity) {
74 | TypedValue typedValue = new TypedValue();
75 |
76 | TypedArray a = activity.obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorAccent});
77 | int color = a.getColor(0, 0);
78 |
79 | a.recycle();
80 |
81 | return color;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/beans/ManifestProcessorBean.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.beans;
2 |
3 | import android.content.Context;
4 | import android.content.pm.ApplicationInfo;
5 | import android.content.pm.PackageManager;
6 | import android.os.Bundle;
7 | import android.util.Log;
8 |
9 | import com.pddstudio.substratum.packager.models.ApkInfo;
10 | import com.pddstudio.substratum.packager.utils.ApkHelper;
11 |
12 | import org.androidannotations.annotations.Bean;
13 | import org.androidannotations.annotations.EBean;
14 | import org.androidannotations.annotations.RootContext;
15 |
16 | import java.util.List;
17 |
18 | import java8.util.Objects;
19 | import java8.util.stream.Collectors;
20 | import java8.util.stream.StreamSupport;
21 |
22 | /**
23 | * Created by pddstudio on 28/04/2017.
24 | */
25 |
26 | @EBean(scope = EBean.Scope.Singleton)
27 | public class ManifestProcessorBean {
28 |
29 | private static final String TAG = ManifestProcessorBean.class.getSimpleName();
30 |
31 | private static final String OTG_SUBS_META_DATA_FLAG = "OTGSubs_Supported";
32 |
33 | @RootContext
34 | protected Context context;
35 |
36 | @Bean
37 | ApkHelper apkHelper;
38 |
39 | public List getSupportedThemes() {
40 | return StreamSupport.stream(apkHelper.getInstalledApks()).map(apkInfo -> {
41 | try {
42 | ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(apkInfo.getPackageName(), PackageManager.GET_META_DATA);
43 | if(applicationInfo == null) {
44 | return null;
45 | }
46 |
47 | Bundle bundle = applicationInfo.metaData;
48 | if(bundle == null) {
49 | return null;
50 | }
51 |
52 | boolean supported = bundle.getBoolean(OTG_SUBS_META_DATA_FLAG, false);
53 | if(supported) {
54 | Log.d(TAG, "Found OTGSubs supported apk: " + apkInfo.getPackageName());
55 | return apkInfo;
56 | } else {
57 | return null;
58 | }
59 | } catch (PackageManager.NameNotFoundException e) {
60 | //ignore
61 | return null;
62 | }
63 | }).filter(Objects::nonNull).collect(Collectors.toList());
64 | }
65 |
66 | public boolean isPackageSupported(String packageName) {
67 | if(packageName == null || packageName.isEmpty()) {
68 | return false;
69 | }
70 | return StreamSupport.stream(getSupportedThemes()).anyMatch(apkInfo -> apkInfo.getPackageName().equals(packageName));
71 | }
72 |
73 | public ApkInfo getApkInfoForPackage(String packageName) {
74 | if(!isPackageSupported(packageName)) {
75 | return null;
76 | }
77 | return StreamSupport.stream(getSupportedThemes()).filter(apkInfo -> apkInfo.getPackageName().equals(packageName)).findAny().orElse(null);
78 | }
79 |
80 | public Context getRootContext() {
81 | return context;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
18 |
19 |
24 |
25 |
30 |
31 |
36 |
37 |
48 |
49 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/views/ColorPickerView.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.views;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.graphics.drawable.GradientDrawable;
6 | import android.util.AttributeSet;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.ImageView;
11 | import android.widget.RelativeLayout;
12 |
13 | import com.pddstudio.otgsubs.R;
14 | import com.pddstudio.substratum.template.patcher.TemplateConfiguration;
15 |
16 | /**
17 | * Created by pddstudio on 04/05/2017.
18 | */
19 |
20 | public class ColorPickerView extends RelativeLayout implements View.OnClickListener {
21 |
22 | private Button colorPickerButton;
23 | private ImageView colorImageView;
24 |
25 | private TemplateConfiguration templateConfiguration;
26 | private TemplateItemView.OpenColorPickerCallback callback;
27 |
28 | private String key;
29 | private String value;
30 |
31 | public ColorPickerView(Context context) {
32 | super(context);
33 | init();
34 | }
35 |
36 | public ColorPickerView(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | init();
39 | }
40 |
41 | public ColorPickerView(Context context, AttributeSet attrs, int defStyleAttr) {
42 | super(context, attrs, defStyleAttr);
43 | init();
44 | }
45 |
46 | public ColorPickerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
47 | super(context, attrs, defStyleAttr, defStyleRes);
48 | init();
49 | }
50 |
51 | public void setColorPickerCallback(TemplateItemView.OpenColorPickerCallback callback) {
52 | this.callback = callback;
53 | }
54 |
55 | public void setPickerConfig(TemplateConfiguration templateConfiguration, TemplateItemView.OpenColorPickerCallback callback, String key, String value) {
56 | this.templateConfiguration = templateConfiguration;
57 | this.callback = callback;
58 | this.key = key;
59 | this.value = value;
60 | colorPickerButton.setText(getContext().getString(R.string.patcher_btn_color, key, value));
61 | changeCircleColor(value);
62 | }
63 |
64 | private void init() {
65 | View view = LayoutInflater.from(getContext()).inflate(R.layout.view_color_picker, this, true);
66 | colorPickerButton = (Button) view.findViewById(R.id.color_btn);
67 | colorPickerButton.setOnClickListener(this);
68 | colorImageView = (ImageView) view.findViewById(R.id.color_img);
69 | }
70 |
71 | @Override
72 | public void onClick(View v) {
73 | if(callback != null) {
74 | callback.openColorPicker(templateConfiguration, key, value);
75 | }
76 | }
77 |
78 | private void changeCircleColor(String colorValue) {
79 | GradientDrawable bgShape = (GradientDrawable) colorImageView.getDrawable();
80 | bgShape.setColor(Color.parseColor(colorValue));
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## OTGSubs
2 |
3 | [](https://www.codacy.com/app/PDDStudio/OTGSubs?utm_source=github.com&utm_medium=referral&utm_content=PDDStudio/OTGSubs&utm_campaign=badger)
4 |
5 | [](https://play.google.com/store/apps/details?id=com.pddstudio.otgsubs)
6 |
7 | > An Application to create and package Substratum Themes directly on your Android Phone.
8 | >
9 | > OTGSubs is a synonym for On-The-Go Substratum
10 |
11 | ### UPDATE: Project Status
12 |
13 | This project has not received any updates in the last years and has not been tested on never Susbtratum compatible ROMs.
14 | I'll keep this project archived so it's still available to browse the code and see how it worked internally.
15 |
16 | **Note:**
17 |
18 | This project is still in **Alpha Stage** and might contain several rough edges that need to be fixed!
19 |
20 | This project was featured @ XDA-Developer: [Read it here](https://www.xda-developers.com/otgsubs-lets-you-create-and-package-substratum-themes-directly-on-a-phone-or-tablet/)
21 |
22 | ### PlayStore Alpha Testing
23 |
24 | You can opt-in to test the first Alpha Versions of OTGSubs directly via Google PlayStore™
25 |
26 | [](https://play.google.com/store/apps/details?id=com.pddstudio.otgsubs)
27 |
28 | [PlayStore Opt-In Link](https://play.google.com/apps/testing/com.pddstudio.otgsubs)
29 |
30 | or
31 |
32 | [Watch the Demo Video on YouTube](https://www.youtube.com/watch?v=c860SBdufzQ)
33 |
34 | ### Integrate OTGSubs Support (for Themers)
35 |
36 | You can find a detailed Instruction to include OTGSubs support in the [Wiki](https://github.com/PDDStudio/OTGSubs/wiki/Themers:-Add-OTGSubs-Support-to-your-Theme)
37 |
38 | ### Project Setup
39 |
40 | The project contains three modules:
41 |
42 | * `app` Module contains all application related classes and layouts
43 | * `substratum-packager` Library Module which allows packaging and signing of Substratum Themes on the device
44 | * `substratum-template-patcher` Library Module for patching XML Theme Templates
45 |
46 | ### Author
47 |
48 | * Patrick Jung (patrick.pddstudio [] gmail.com)
49 |
50 | ### Contributors
51 |
52 | Special Thanks to everyone who contributed to this project!
53 |
54 | * Sasi Kanth ([@sasikanth01](https://github.com/sasikanth01))
55 |
56 | ### License
57 |
58 | Copyright 2017 Patrick Jung
59 |
60 | Licensed under the Apache License, Version 2.0 (the "License");
61 | you may not use this file except in compliance with the License.
62 | You may obtain a copy of the License at
63 |
64 | http://www.apache.org/licenses/LICENSE-2.0
65 |
66 | Unless required by applicable law or agreed to in writing, software
67 | distributed under the License is distributed on an "AS IS" BASIS,
68 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69 | See the License for the specific language governing permissions and
70 | limitations under the License.
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/java/com/pddstudio/otgsubs/models/AssetsAdapterItem.java:
--------------------------------------------------------------------------------
1 | package com.pddstudio.otgsubs.models;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import com.mikepenz.fastadapter.items.AbstractItem;
8 | import com.mikepenz.fontawesome_typeface_library.FontAwesome;
9 | import com.mikepenz.iconics.typeface.IIcon;
10 | import com.mikepenz.iconics.view.IconicsImageView;
11 | import com.pddstudio.otgsubs.R;
12 | import com.pddstudio.substratum.packager.models.AssetFileInfo;
13 | import com.pddstudio.substratum.packager.models.AssetsType;
14 |
15 | import org.apache.commons.io.FilenameUtils;
16 |
17 | import java.io.File;
18 | import java.util.List;
19 |
20 | /**
21 | * Created by pddstudio on 24/04/2017.
22 | */
23 |
24 | public class AssetsAdapterItem extends AbstractItem {
25 |
26 | private AssetFileInfo fileInfo;
27 |
28 | public AssetsAdapterItem(AssetFileInfo fileInfo) {
29 | this.fileInfo = fileInfo;
30 | }
31 |
32 | private IIcon getIconForAssetsInfo() {
33 | if (fileInfo.getType().equals(AssetsType.AUDIO)) {
34 | return FontAwesome.Icon.faw_file_audio_o;
35 | } else if(new File(fileInfo.getFileLocation()).isDirectory()) {
36 | return FontAwesome.Icon.faw_folder;
37 | }
38 | String extension = FilenameUtils.getExtension(fileInfo.getFileName());
39 | if(extension.equals("jpg") || extension.equals("png")) {
40 | return FontAwesome.Icon.faw_file_image_o;
41 | } else if (extension.equals("xml")) {
42 | return FontAwesome.Icon.faw_file_code_o;
43 | } else if (extension.equals("zip")) {
44 | return FontAwesome.Icon.faw_file_archive_o;
45 | } else {
46 | return FontAwesome.Icon.faw_file_o;
47 | }
48 | }
49 |
50 | public AssetFileInfo getAssetFileInfo() {
51 | return fileInfo;
52 | }
53 |
54 | @Override
55 | public ViewHolder getViewHolder(View v) {
56 | return new ViewHolder(v);
57 | }
58 |
59 | @Override
60 | public int getType() {
61 | return R.id.assets_adapter_item;
62 | }
63 |
64 | @Override
65 | public int getLayoutRes() {
66 | return R.layout.item_assets_adapter;
67 | }
68 |
69 | @Override
70 | public void bindView(ViewHolder holder, List