*Made pull to refresh as option *Added shortcut to Hubzilla theme settings
*Added refresh button in menu as option(disabled by default) *Added Zotum to the hub list
This commit is contained in:
parent
712c088280
commit
83c7cfeac4
|
@ -14,8 +14,8 @@
|
|||
<option name="values">
|
||||
<map>
|
||||
<entry key="assetSourceType" value="FILE" />
|
||||
<entry key="outputName" value="ic_invite_black_48px" />
|
||||
<entry key="sourceFile" value="$PROJECT_DIR$/../user-plus.svg" />
|
||||
<entry key="outputName" value="ic_swipe" />
|
||||
<entry key="sourceFile" value="$PROJECT_DIR$/../hubzilla-graphics/swipe.svg" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
|
|
Binary file not shown.
|
@ -1,3 +1,8 @@
|
|||
## 0.8.14
|
||||
* Added Zotum to the hub list
|
||||
* Made pull to refresh as option(enabled by default)
|
||||
* Added refresh button in menu as option(disabled by default)
|
||||
* Added shortcut to Hubzilla theme settings
|
||||
## 0.8.13
|
||||
* Added user choice to open youtube links external or not
|
||||
* Adjusted triggersync value for swipe to refresh
|
||||
|
|
88
app/app.iml
88
app/app.iml
|
@ -8,11 +8,11 @@
|
|||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="SELECTED_BUILD_VARIANT" value="flavorDefaultDebug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleFlavorDefaultDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileFlavorDefaultDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
<task>generateFlavorDefaultDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
|
@ -23,25 +23,67 @@
|
|||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/javac/flavorDefaultDebug/compileFlavorDefaultDebugJavaWithJavac/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/flavorDefaultDebugUnitTest/compileFlavorDefaultDebugUnitTestJavaWithJavac/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/debugAndroidTest/processDebugAndroidTestResources/r" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/flavorDefault/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/flavorDefaultDebug/processFlavorDefaultDebugResources/r" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/flavorDefault/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/flavorDefault/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/flavorDefault/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/flavorDefault/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/flavorDefault/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefaultDebug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefaultDebug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefaultDebug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefaultDebug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefaultDebug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefaultDebug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefaultDebug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/flavorDefault/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/flavorDefaultDebugAndroidTest/processFlavorDefaultDebugAndroidTestResources/r" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/flavorDefault/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/flavorDefault/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/flavorDefault/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/flavorDefault/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/flavorDefault/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefaultDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefaultDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefaultDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefaultDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefaultDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefaultDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefaultDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/flavorDefault/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefaultDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefaultDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefaultDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefaultDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefaultDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefaultDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefaultDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefault/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefault/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefault/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefault/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefault/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefault/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/flavorDefault/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefault/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefault/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefault/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefault/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefault/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefault/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestFlavorDefault/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefault/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefault/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefault/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefault/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefault/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefault/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testFlavorDefault/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
|
@ -64,10 +106,13 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/thirdparty/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/thirdparty/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/thirdparty/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
|
@ -92,6 +137,7 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-libraries" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkDebugClasspath" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkFlavorDefaultDebugClasspath" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
|
||||
|
|
107
app/build.gradle
107
app/build.gradle
|
@ -4,31 +4,57 @@ if (enable_plugin_kotlin) {
|
|||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
}
|
||||
|
||||
android {
|
||||
buildToolsVersion rootProject.ext.version_buildTools
|
||||
compileSdkVersion 28
|
||||
flavorDimensions "default"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
minSdkVersion rootProject.ext.version_minSdk
|
||||
targetSdkVersion rootProject.ext.version_compileSdk
|
||||
buildConfigField "boolean", "IS_TEST_BUILD", "false"
|
||||
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
|
||||
buildConfigField "String[]", "DETECTED_ANDROID_LOCALES", "${findUsedAndroidLocales()}"
|
||||
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
|
||||
|
||||
applicationId "com.dfa.hubzilla_android"
|
||||
versionName "0.8.13"
|
||||
versionCode 43
|
||||
|
||||
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
resValue 'string', 'app_name', "Nomad"
|
||||
manifestPlaceholders = [appIcon: "@drawable/ic_launcher"]
|
||||
applicationId "com.dfa.hubzilla_android"
|
||||
versionName "0.8.14"
|
||||
versionCode 44
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
flavorDimensions "default"
|
||||
productFlavors {
|
||||
flavorDefault {
|
||||
}
|
||||
|
||||
/*
|
||||
flavorGplay {
|
||||
buildConfigField "boolean", "IS_GPLAY_BUILD", "true"
|
||||
}
|
||||
|
||||
flavorDandelior {
|
||||
applicationId "net.gsantner.dandelior"
|
||||
}
|
||||
|
||||
flavorTest {
|
||||
applicationId "net.gsantner.secondlion"
|
||||
versionCode = Integer.parseInt(new Date().format('yyMMdd'))
|
||||
versionName = new Date().format('yyMMdd')
|
||||
buildConfigField "boolean", "IS_TEST_BUILD", "true"
|
||||
}*/
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main { assets.srcDirs = ['src/main/assets'] }
|
||||
if (enable_plugin_kotlin) {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
main.java.srcDirs += 'thirdparty/java'
|
||||
main.res.srcDirs += 'thirdparty/res'
|
||||
main.assets.srcDirs += 'thirdparty/assets'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
@ -38,48 +64,55 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
if (enable_plugin_kotlin) {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
eachDependency { details ->
|
||||
if (details.requested.group == 'com.android.support') {
|
||||
if (details.requested.name != 'multidex' && details.requested.name != 'multidex-instrumentation') {
|
||||
details.useVersion "${rootProject.ext.version_library_appcompat}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* productFlavors {
|
||||
flavorDefault {}*/
|
||||
/*
|
||||
flavorGplay {
|
||||
buildConfigField "boolean", "IS_GPLAY_BUILD", "true"
|
||||
}*/
|
||||
/*
|
||||
flavorTest {
|
||||
applicationId "com.dfa.NomadTest"
|
||||
resValue 'string', 'app_name', "NomadTest"
|
||||
manifestPlaceholders = [appIcon: "@drawable/ic_launcher_test"]
|
||||
versionCode = Integer.parseInt(new Date().format('yyMMdd'))
|
||||
versionName = new Date().format('yyMMdd')
|
||||
buildConfigField "boolean", "IS_TEST_BUILD", "true"
|
||||
}*/
|
||||
//}
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE-LGPL-2.1.txt'
|
||||
exclude 'META-INF/LICENSE-LGPL-3.txt'
|
||||
exclude 'META-INF/LICENSE-W3C-TEST'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
encoding = 'UTF-8'
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'MissingTranslation'
|
||||
disable 'InvalidPackage'
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Sub-Projects
|
||||
//implementation project(':subprojectFromRoot')
|
||||
|
||||
// Jars
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
||||
// Android standard libs
|
||||
implementation "com.android.support:appcompat-v7:${version_library_appcompat}"
|
||||
implementation "com.android.support:design:${version_library_appcompat}"
|
||||
implementation "com.android.support:support-v4:${version_library_appcompat}"
|
||||
implementation "com.android.support:customtabs:${version_library_appcompat}"
|
||||
implementation "com.android.support:cardview-v7:${version_library_appcompat}"
|
||||
|
||||
// UI libraries
|
||||
// commented beacouse didn't work and added line below --> implementation "com.github.DASAR:ShiftColorPicker:v0.5"
|
||||
//implementation (group: 'uz.shift', name: 'colorpicker', version: '0.5', ext: 'aar')
|
||||
implementation 'com.github.DASAR:ShiftColorPicker:v0.5'
|
||||
implementation "com.github.DASAR:ShiftColorPicker:v0.5"
|
||||
|
||||
// Tool libraries
|
||||
implementation "info.guardianproject.netcipher:netcipher:${version_library_netcipher}"
|
||||
implementation "info.guardianproject.netcipher:netcipher-webkit:${version_library_netcipher}"
|
||||
|
@ -87,6 +120,7 @@ dependencies {
|
|||
if (enable_plugin_kotlin) {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$version_plugin_kotlin"
|
||||
}
|
||||
|
||||
// Processors
|
||||
def anpros = ["com.jakewharton:butterknife-compiler:${version_library_butterknife}"]
|
||||
for (anpro in anpros) {
|
||||
|
@ -97,6 +131,3 @@ dependencies {
|
|||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
|
|
@ -125,6 +125,12 @@
|
|||
<data
|
||||
android:host="gerzilla.de"
|
||||
android:scheme="https" />
|
||||
<data
|
||||
android:host="hubzilla.eu"
|
||||
android:scheme="https" />
|
||||
<data
|
||||
android:host="zotum.net"
|
||||
android:scheme="https" />
|
||||
<data
|
||||
android:host="hub.transition-regensburg.de"
|
||||
android:scheme="https" />
|
||||
|
@ -248,9 +254,6 @@
|
|||
<data
|
||||
android:host="social.codigoparallevar.com"
|
||||
android:scheme="https" />
|
||||
<data
|
||||
android:host="hubzilla.eu"
|
||||
android:scheme="https" />
|
||||
<data
|
||||
android:host="peacepharm.org"
|
||||
android:scheme="https" />
|
||||
|
|
|
@ -175,13 +175,6 @@ public class DiasporaStreamFragment extends BrowserFragment {
|
|||
}
|
||||
}
|
||||
|
||||
case R.id.action_go_to_top: {
|
||||
ObjectAnimator anim = ObjectAnimator.ofInt(webView, "scrollY", webView.getScrollY(), 0);
|
||||
anim.setDuration(400);
|
||||
anim.start();
|
||||
return true;
|
||||
}
|
||||
|
||||
case R.id.action_share_link: {
|
||||
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||
sharingIntent.setType("text/plain");
|
||||
|
|
|
@ -67,7 +67,6 @@ import com.dfa.hubzilla_android.listener.DiasporaUserProfileChangedListener;
|
|||
import com.dfa.hubzilla_android.listener.IntellihideToolbarActivityListener;
|
||||
import com.dfa.hubzilla_android.receiver.OpenExternalLinkReceiver;
|
||||
import com.dfa.hubzilla_android.receiver.UpdateTitleReceiver;
|
||||
import com.dfa.hubzilla_android.ui.PodSelectionDialog;
|
||||
import com.dfa.hubzilla_android.ui.theme.ThemeHelper;
|
||||
import com.dfa.hubzilla_android.ui.theme.ThemedActivity;
|
||||
import com.dfa.hubzilla_android.ui.theme.ThemedAlertDialogBuilder;
|
||||
|
@ -93,12 +92,14 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static com.dfa.hubzilla_android.ui.PodSelectionDialog.PodSelectionDialogResultListener;
|
||||
|
||||
public class MainActivity extends ThemedActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener,
|
||||
DiasporaUserProfileChangedListener,
|
||||
CustomTabActivityHelper.ConnectionCallback,
|
||||
IntellihideToolbarActivityListener,
|
||||
PodSelectionDialog.PodSelectionDialogResultListener {
|
||||
PodSelectionDialogResultListener {
|
||||
|
||||
|
||||
public static final int REQUEST_CODE_ASK_PERMISSIONS = 123;
|
||||
|
@ -669,7 +670,6 @@ public class MainActivity extends ThemedActivity
|
|||
menu.findItem(R.id.action_directory).setVisible(_appSettings.isVisibleInDirectory());
|
||||
menu.findItem(R.id.action_search).setVisible(_appSettings.isVisibleInSearch());
|
||||
menu.findItem(R.id.action_reload).setVisible(_appSettings.isVisibleInReload());
|
||||
menu.findItem(R.id.action_go_to_top).setVisible(_appSettings.isVisibleInGoToTop());
|
||||
menu.findItem(R.id.action_suggestions).setVisible(_appSettings.isVisibleInSuggestions());
|
||||
menu.findItem(R.id.action_conversations).setVisible(_appSettings.isVisibleInConversations());
|
||||
menu.findItem(R.id.action_about).setVisible(_appSettings.isVisibleInAbout());
|
||||
|
@ -1126,4 +1126,4 @@ return super.onOptionsItemSelected(item);
|
|||
}
|
||||
appBarLayout.setExpanded(true, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -78,9 +78,9 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
|
|||
case SettingsFragmentNavSlider.TAG:
|
||||
fragment = new SettingsFragmentNavSlider();
|
||||
break;
|
||||
case SettingsFragmentMenuTop.TAG:
|
||||
fragment = new SettingsFragmentMenuTop();
|
||||
break;
|
||||
//case SettingsFragmentMenuTop.TAG:
|
||||
// fragment = new SettingsFragmentMenuTop();
|
||||
// break;
|
||||
case SettingsFragmentProxy.TAG:
|
||||
fragment = new SettingsFragmentProxy();
|
||||
break;
|
||||
|
@ -284,6 +284,8 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
|
|||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
||||
AppSettings settings = ((App) getActivity().getApplication()).getSettings();
|
||||
DiasporaUrlHelper diasporaUrlHelper = new DiasporaUrlHelper(settings);
|
||||
if (isAdded() && preference.hasKey()) {
|
||||
String key = preference.getKey();
|
||||
if (key.equals(getString(R.string.pref_key__primary_color__preference_click))) {
|
||||
|
@ -292,6 +294,13 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
|
|||
} else if (key.equals(getString(R.string.pref_key__accent_color__preference_click))) {
|
||||
showColorPickerDialog(2);
|
||||
return true;
|
||||
} else if (key.equals(getString(R.string.pref_key__manage_theme))) {
|
||||
Intent intent = new Intent(getActivity(), MainActivity.class);
|
||||
intent.setAction(MainActivity.ACTION_OPEN_URL);
|
||||
intent.putExtra(MainActivity.URL_MESSAGE, diasporaUrlHelper.getThemeUrl());
|
||||
startActivity(intent);
|
||||
getActivity().finish();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onPreferenceTreeClick(screen, preference);
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
*/
|
||||
package com.dfa.hubzilla_android.data;
|
||||
|
||||
import com.dfa.hubzilla_android.App;
|
||||
import com.dfa.hubzilla_android.util.AppSettings;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
@ -31,20 +28,6 @@ public class DiasporaAspect {
|
|||
public String name;
|
||||
public boolean selected;
|
||||
|
||||
public DiasporaAspect(long id, String name, boolean selected) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
|
||||
public DiasporaAspect(String shareabletext) {
|
||||
// fromShareAbleText
|
||||
String[] str = shareabletext.split("%");
|
||||
selected = Integer.parseInt(str[0]) == 1;
|
||||
id = Long.parseLong(str[1]);
|
||||
name = shareabletext.substring(shareabletext.indexOf(str[1]) + str[1].length() + 1);
|
||||
}
|
||||
|
||||
public DiasporaAspect(JSONObject json) throws JSONException {
|
||||
if (json.has("id")) {
|
||||
|
@ -58,23 +41,6 @@ public class DiasporaAspect {
|
|||
}
|
||||
}
|
||||
|
||||
public String toJsonString() {
|
||||
JSONObject j = new JSONObject();
|
||||
try {
|
||||
j.put("id", id);
|
||||
j.put("name", name);
|
||||
j.put("selected", selected);
|
||||
} catch (JSONException e) {/*Nothing*/}
|
||||
return j.toString();
|
||||
}
|
||||
/**
|
||||
public String toHtmlLink(final App app) {
|
||||
final AppSettings appSettings = app.getSettings();
|
||||
return String.format(Locale.getDefault(),
|
||||
"<a href='%s/aspects?a_ids[]=%d' style='color: #000000; text-decoration: none;'>%s</a>",
|
||||
appSettings.getPod().getPodUrl().getBaseUrl(), id, name);
|
||||
}
|
||||
**/
|
||||
@Override
|
||||
public String toString() {
|
||||
return toShareAbleText();
|
||||
|
|
|
@ -115,7 +115,7 @@ public class DiasporaUserProfile {
|
|||
}
|
||||
|
||||
public void analyzeUrl(String url) {
|
||||
String prefix = urls.getPodUrl() + DiasporaUrlHelper.SUBURL_STREAM_WITH_TIMESTAMP;
|
||||
String prefix = "https://hub.disroot.org/api/z/1.0/channel/export/basic";
|
||||
if (url.startsWith(prefix)) {
|
||||
try {
|
||||
setLastVisitedPositionInStream(Long.parseLong(url.replace(prefix, "")));
|
||||
|
|
|
@ -249,19 +249,7 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
|||
public boolean isVisibleInNavPublic_activities() {
|
||||
return getBool(R.string.pref_key__visibility_nav__public_activities, true);
|
||||
}
|
||||
/**
|
||||
* public boolean isVisibleInNavMentions() {
|
||||
* return getBool(R.string.pref_key__visibility_nav__mentions, false);
|
||||
* }
|
||||
*
|
||||
* public boolean isVisibleInNavCommented() {
|
||||
* return getBool(R.string.pref_key__visibility_nav__commented, false);
|
||||
* }
|
||||
*
|
||||
* public boolean isVisibleInNavLiked() {
|
||||
* return getBool(R.string.pref_key__visibility_nav__liked, false);
|
||||
* }
|
||||
**/
|
||||
|
||||
public boolean isVisibleInNavActivities() {
|
||||
return getBool(R.string.pref_key__visibility_nav__activities, true);
|
||||
}
|
||||
|
@ -270,10 +258,6 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
|||
return getBool(R.string.pref_key__visibility_nav__aspects, false);
|
||||
}
|
||||
|
||||
// public boolean isVisibleInNavFollowed_tags() {
|
||||
// return getBool(R.string.pref_key__visibility_nav__followed_tags, false);
|
||||
// }
|
||||
|
||||
public boolean isVisibleInNavProfile() {
|
||||
return getBool(R.string.pref_key__visibility_nav__profile, true);
|
||||
}
|
||||
|
@ -281,23 +265,7 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
|||
public boolean isVisibleInNavContacts() {
|
||||
return getBool(R.string.pref_key__visibility_nav__contacts, true);
|
||||
}
|
||||
/**
|
||||
* public boolean isVisibleInNavStatistics() {
|
||||
* return getBool(R.string.pref_key__visibility_nav__statistics, false);
|
||||
* }
|
||||
*
|
||||
* public boolean isVisibleInNavReports() {
|
||||
* return getBool(R.string.pref_key__visibility_nav__reports, false);
|
||||
* }
|
||||
*
|
||||
* public boolean isVisibleInNavDandelionAccount() {
|
||||
* return getBool(R.string.pref_key__visibility_nav__dandelion_account, false);
|
||||
* }
|
||||
*
|
||||
* public boolean isVisibleInNavToggleMobileDesktop() {
|
||||
* return getBool(R.string.pref_key__visibility_nav__toggle_mobile_desktop, false);
|
||||
* }
|
||||
**/
|
||||
|
||||
public boolean isVisibleInNavEvents() {
|
||||
return getBool(R.string.pref_key__visibility_nav__events, true);
|
||||
}
|
||||
|
@ -312,6 +280,9 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
|||
public boolean isOpenYoutubeExternalEnabled() {
|
||||
return getBool(R.string.pref_key__open_youtube_external_enabled, true);
|
||||
}
|
||||
public boolean isSwipeRefreshEnabled() {
|
||||
return getBool(R.string.pref_key__swipe_refresh_enabled, true);
|
||||
}
|
||||
// Nomad add for menu visibility
|
||||
public boolean isVisibleInHome() {
|
||||
return getBool(R.string.pref_key__visibility_home, true);
|
||||
|
@ -334,9 +305,6 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
|||
public boolean isVisibleInReload() {
|
||||
return getBool(R.string.pref_key__visibility_reload, false);
|
||||
}
|
||||
public boolean isVisibleInGoToTop() {
|
||||
return getBool(R.string.pref_key__visibility_go_to_top, false);
|
||||
}
|
||||
public boolean isVisibleInSuggestions() {
|
||||
return getBool(R.string.pref_key__visibility_suggestions, true);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class DiasporaUrlHelper {
|
|||
public static final String SUBURL_PERSONAL_SETTINGS = "/settings"; //edited for hub
|
||||
public static final String SUBURL_SIGN_IN = "#"; //edited for hub
|
||||
public static final String SUBURL_CONTACTS = "/connections"; //edited for hub
|
||||
public static final String SUBURL_THEME = "/settings/display"; //edited for hub
|
||||
public static final String SUBURL_HOME = "/channel"; //added for hub
|
||||
public static final String SUBURL_PROFILE = "/profiles"; //added for hub
|
||||
public static final String SUBURL_EVENTS = "/events"; //added for hub
|
||||
|
@ -262,6 +263,15 @@ public class DiasporaUrlHelper {
|
|||
public String getContactsUrl() {
|
||||
return getPodUrl() + SUBURL_CONTACTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a url that points to the manage tags page of the pod.
|
||||
*
|
||||
* @return https://(pod-domain.tld)/contacts
|
||||
*/
|
||||
public String getThemeUrl() {
|
||||
return getPodUrl() + SUBURL_THEME;
|
||||
}
|
||||
/**
|
||||
* Returns the url of the blank WebView
|
||||
*
|
||||
|
|
|
@ -20,7 +20,9 @@ package com.dfa.hubzilla_android.web;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.MutableContextWrapper;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.renderscript.Sampler;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -35,6 +37,8 @@ import com.dfa.hubzilla_android.ui.theme.ThemedFragment;
|
|||
import com.dfa.hubzilla_android.util.AppLog;
|
||||
import com.dfa.hubzilla_android.util.AppSettings;
|
||||
|
||||
import static java.lang.Boolean.valueOf;
|
||||
|
||||
/**
|
||||
* Fragment with a webView and a ProgressBar.
|
||||
* This Fragment retains its instance.
|
||||
|
@ -94,9 +98,17 @@ public class BrowserFragment extends ThemedFragment {
|
|||
this.setRetainInstance(true);
|
||||
|
||||
//pull to refresh
|
||||
swipe = view.findViewById(R.id.swipe);
|
||||
swipe.setOnRefreshListener(() -> reloadUrl());
|
||||
swipe.setDistanceToTriggerSync(2000);
|
||||
swipe = view.findViewById( R.id.swipe );
|
||||
swipe.setDistanceToTriggerSync( 2000 );
|
||||
swipe.setOnRefreshListener( () -> reloadUrl() );
|
||||
if (appSettings.isSwipeRefreshEnabled()){
|
||||
swipe.setEnabled( true );
|
||||
|
||||
}else {
|
||||
swipe.setRefreshing(false);
|
||||
swipe.setEnabled( false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Maintained by Gregor Santner, 2016-
|
||||
* https://gsantner.net/
|
||||
*
|
||||
* License: Apache 2.0
|
||||
* License: Apache 2.0 / Commercial
|
||||
* https://github.com/gsantner/opoc/#licensing
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
|
@ -44,6 +44,7 @@ import android.text.TextUtils;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
@ -163,6 +164,14 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
|
|||
return ContextCompat.getColor(_context, resColorId);
|
||||
}
|
||||
|
||||
public String[] rstrs(int... keyResourceIds) {
|
||||
String[] ret = new String[keyResourceIds.length];
|
||||
for (int i = 0; i < keyResourceIds.length; i++) {
|
||||
ret[i] = rstr(keyResourceIds[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Getter & Setter for String
|
||||
|
@ -209,7 +218,7 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
|
|||
String value = pref
|
||||
.getString(key, ARRAY_SEPARATOR)
|
||||
.replace(ARRAY_SEPARATOR_SUBSTITUTE, ARRAY_SEPARATOR);
|
||||
if (value.equals(ARRAY_SEPARATOR)) {
|
||||
if (value.equals(ARRAY_SEPARATOR) || TextUtils.isEmpty(value)) {
|
||||
return ret;
|
||||
}
|
||||
ret.addAll(Arrays.asList(value.split(ARRAY_SEPARATOR)));
|
||||
|
@ -243,6 +252,7 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
|
|||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<String> getStringList(@StringRes int keyResourceId, final SharedPreferences... pref) {
|
||||
return getStringListOne(rstr(keyResourceId), gp(pref));
|
||||
}
|
||||
|
@ -512,4 +522,15 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
|
|||
setStringListOne(key, value, _prefApp);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to determine if current hour is between begin and end.
|
||||
* This is especially useful for time-based light/dark mode
|
||||
*/
|
||||
public boolean isCurrentHourOfDayBetween(int begin, int end) {
|
||||
begin = (begin >= 23 || begin < 0) ? 0 : begin;
|
||||
end = (end >= 23 || end < 0) ? 0 : end;
|
||||
int h = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
|
||||
return h >= begin && h <= end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,20 @@
|
|||
* Maintained by Gregor Santner, 2016-
|
||||
* https://gsantner.net/
|
||||
*
|
||||
* License: Apache 2.0
|
||||
* https://github.com/gsantner/opoc/#licensing
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* License of this file: Apache 2.0 (Commercial upon request)
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://github.com/gsantner/opoc/#licensing
|
||||
*
|
||||
#########################################################*/
|
||||
package net.opoc.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.StringRes;
|
||||
|
@ -29,6 +32,7 @@ import android.view.View;
|
|||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
|
||||
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection"})
|
||||
|
@ -112,18 +116,18 @@ public class ActivityUtils extends net.opoc.util.ContextUtils {
|
|||
}
|
||||
|
||||
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) {
|
||||
ScrollView scroll = new ScrollView(_context);
|
||||
AppCompatTextView textView = new AppCompatTextView(_context);
|
||||
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16,
|
||||
_context.getResources().getDisplayMetrics());
|
||||
textView.setMovementMethod(new LinkMovementMethod());
|
||||
textView.setPadding(padding, 0, padding, 0);
|
||||
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics());
|
||||
|
||||
scroll.setPadding(padding, 0, padding, 0);
|
||||
scroll.addView(textView);
|
||||
textView.setMovementMethod(new LinkMovementMethod());
|
||||
textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
|
||||
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(_context)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setOnDismissListener(dismissedListener)
|
||||
.setTitle(resTitleId)
|
||||
.setView(textView);
|
||||
.setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener)
|
||||
.setTitle(resTitleId).setView(scroll);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
@ -161,7 +165,7 @@ public class ActivityUtils extends net.opoc.util.ContextUtils {
|
|||
_activity.startActivity(goToMarket);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
_activity.startActivity(new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse("http://play.google.com/store/apps/" + pkgId)));
|
||||
Uri.parse("https://play.google.com/store/apps/" + pkgId)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,4 +178,12 @@ public class ActivityUtils extends net.opoc.util.ContextUtils {
|
|||
_activity.getWindow().setStatusBarColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLauncherActivityEnabled(Class activityClass, boolean enable) {
|
||||
Context context = _context.getApplicationContext();
|
||||
PackageManager pkg = context.getPackageManager();
|
||||
ComponentName component = new ComponentName(context, activityClass);
|
||||
pkg.setComponentEnabledSetting(component, enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||
, PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,19 @@
|
|||
* Maintained by Gregor Santner, 2016-
|
||||
* https://gsantner.net/
|
||||
*
|
||||
* License: Apache 2.0
|
||||
* https://github.com/gsantner/opoc/#licensing
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* License of this file: Apache 2.0 (Commercial upon request)
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://github.com/gsantner/opoc/#licensing
|
||||
*
|
||||
#########################################################*/
|
||||
package net.opoc.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
|
@ -36,6 +38,7 @@ import android.net.ConnectivityManager;
|
|||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
@ -46,6 +49,7 @@ import android.support.graphics.drawable.VectorDrawableCompat;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.text.Html;
|
||||
import android.text.InputFilter;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
|
@ -54,6 +58,9 @@ import android.util.DisplayMetrics;
|
|||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -66,6 +73,7 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
|
@ -166,7 +174,7 @@ public class ContextUtils {
|
|||
public String getAppVersionName() {
|
||||
try {
|
||||
PackageManager manager = _context.getPackageManager();
|
||||
PackageInfo info = manager.getPackageInfo(getPackageName(), 0);
|
||||
PackageInfo info = manager.getPackageInfo(getPackageIdManifest(), 0);
|
||||
return info.versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -177,7 +185,7 @@ public class ContextUtils {
|
|||
public String getAppInstallationSource() {
|
||||
String src = null;
|
||||
try {
|
||||
src = _context.getPackageManager().getInstallerPackageName(getPackageName());
|
||||
src = _context.getPackageManager().getInstallerPackageName(getPackageIdManifest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
if (TextUtils.isEmpty(src)) {
|
||||
|
@ -223,13 +231,20 @@ public class ContextUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get this apps package name. The builtin method may fail when used with flavors
|
||||
* Get the apps base packagename, which is equal with all build flavors and variants
|
||||
*/
|
||||
public String getPackageName() {
|
||||
public String getPackageIdManifest() {
|
||||
String pkg = rstr("manifest_package_id");
|
||||
return pkg != null ? pkg : _context.getPackageName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this apps package name, returns the flavor specific package name.
|
||||
*/
|
||||
public String getPackageIdReal() {
|
||||
return _context.getPackageName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field from ${applicationId}.BuildConfig
|
||||
* May be helpful in libraries, where a access to
|
||||
|
@ -239,7 +254,7 @@ public class ContextUtils {
|
|||
* Falls back to applicationId of the app which may differ from manifest.
|
||||
*/
|
||||
public Object getBuildConfigValue(String fieldName) {
|
||||
String pkg = getPackageName() + ".BuildConfig";
|
||||
String pkg = getPackageIdManifest() + ".BuildConfig";
|
||||
try {
|
||||
Class<?> c = Class.forName(pkg);
|
||||
return c.getField(fieldName).get(null);
|
||||
|
@ -380,6 +395,9 @@ public class ContextUtils {
|
|||
Intent inte = new Intent(_context, classToStart);
|
||||
PendingIntent inteP = PendingIntent.getActivity(_context, 555, inte, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
AlarmManager mgr = (AlarmManager) _context.getSystemService(Context.ALARM_SERVICE);
|
||||
if (_context instanceof Activity) {
|
||||
((Activity) _context).finish();
|
||||
}
|
||||
if (mgr != null) {
|
||||
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, inteP);
|
||||
} else {
|
||||
|
@ -498,6 +516,17 @@ public class ContextUtils {
|
|||
return dp * _context.getResources().getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the private directory for the current package (usually /data/data/package.name/)
|
||||
*/
|
||||
public String getAppDataDir() {
|
||||
try {
|
||||
return _context.getPackageManager().getPackageInfo(getPackageIdReal(), 0).applicationInfo.dataDir;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return _context.getFilesDir().getParent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the givens paths to be scanned by MediaScanner
|
||||
*
|
||||
|
@ -683,9 +712,13 @@ public class ContextUtils {
|
|||
public void tintMenuItems(Menu menu, boolean recurse, @ColorInt int iconColor) {
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
MenuItem item = menu.getItem(i);
|
||||
tintDrawable(item.getIcon(), iconColor);
|
||||
if (item.hasSubMenu() && recurse) {
|
||||
tintMenuItems(item.getSubMenu(), recurse, iconColor);
|
||||
try {
|
||||
tintDrawable(item.getIcon(), iconColor);
|
||||
if (item.hasSubMenu() && recurse) {
|
||||
tintMenuItems(item.getSubMenu(), recurse, iconColor);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
// This should not happen at all, but may in bad menu.xml configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -723,4 +756,104 @@ public class ContextUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getLocalizedDateFormat() {
|
||||
return ((SimpleDateFormat) android.text.format.DateFormat.getDateFormat(_context)).toPattern();
|
||||
}
|
||||
|
||||
public String getLocalizedTimeFormat() {
|
||||
return ((SimpleDateFormat) android.text.format.DateFormat.getTimeFormat(_context)).toPattern();
|
||||
}
|
||||
|
||||
public String getLocalizedDateTimeFormat() {
|
||||
return getLocalizedDateFormat() + " " + getLocalizedTimeFormat();
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link InputFilter} for filenames
|
||||
*/
|
||||
@SuppressWarnings("Convert2Lambda")
|
||||
public static final InputFilter INPUTFILTER_FILENAME = new InputFilter() {
|
||||
public CharSequence filter(CharSequence src, int start, int end, Spanned dest, int dstart, int dend) {
|
||||
if (src.length() < 1) return null;
|
||||
char last = src.charAt(src.length() - 1);
|
||||
String illegal = "|\\?*<\":>+[]/'";
|
||||
if (illegal.indexOf(last) > -1) return src.subSequence(0, src.length() - 1);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A simple {@link Runnable} which does a touch event on a view.
|
||||
* This pops up e.g. the keyboard on a {@link android.widget.EditText}
|
||||
* <p>
|
||||
* Example: new Handler().postDelayed(new DoTouchView(editView), 200);
|
||||
*/
|
||||
public static class DoTouchView implements Runnable {
|
||||
View _view;
|
||||
|
||||
public DoTouchView(View view) {
|
||||
_view = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
_view.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, 0, 0, 0));
|
||||
_view.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getMimeType(File file) {
|
||||
return getMimeType(Uri.fromFile(file));
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect MimeType of given file
|
||||
* Android/Java's own MimeType map is very very small and detection barely works at all
|
||||
* Hence use custom map for some file extensions
|
||||
*/
|
||||
public String getMimeType(Uri uri) {
|
||||
String mimeType = null;
|
||||
if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
|
||||
ContentResolver cr = _context.getContentResolver();
|
||||
mimeType = cr.getType(uri);
|
||||
} else {
|
||||
String ext = MimeTypeMap.getFileExtensionFromUrl(uri.toString());
|
||||
mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.toLowerCase());
|
||||
|
||||
// Try to guess if the recommended methods fail
|
||||
if (TextUtils.isEmpty(mimeType)) {
|
||||
switch (ext) {
|
||||
case "md":
|
||||
case "markdown":
|
||||
case "mkd":
|
||||
case "mdown":
|
||||
case "mkdn":
|
||||
case "mdwn":
|
||||
case "rmd":
|
||||
mimeType = "text/markdown";
|
||||
break;
|
||||
case "yaml":
|
||||
case "yml":
|
||||
mimeType = "text/yaml";
|
||||
break;
|
||||
case "json":
|
||||
mimeType = "text/json";
|
||||
break;
|
||||
case "txt":
|
||||
mimeType = "text/plain";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(mimeType)) {
|
||||
mimeType = "*/*";
|
||||
}
|
||||
return mimeType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -71,11 +71,6 @@
|
|||
android:icon="@drawable/ic_refresh_white_48px"
|
||||
android:title="@string/reload"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_go_to_top"
|
||||
android:icon="@drawable/ic_arrow_upward_white_48px"
|
||||
android:title="@string/action_go_to_top"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_search"
|
||||
android:icon="@drawable/ic_search_white_48px"
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
## 0.8.14
|
||||
* Added Zotum to the hub list
|
||||
* Made pull to refresh as option(enabled by default)
|
||||
* Added refresh button in menu as option(disabled by default)
|
||||
* Added shortcut to Hubzilla theme settings
|
||||
## 0.8.13
|
||||
* Added user choice to open youtube links external or not
|
||||
* Adjusted triggersync value for swipe to refresh
|
||||
|
|
|
@ -43,6 +43,20 @@
|
|||
"mainLangs": ["en"],
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"score": 20,
|
||||
"podUrls": [{"host": "hubzilla.eu"}],
|
||||
"name": "hubzilla.eu",
|
||||
"mainLangs": ["en"],
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"score": 20,
|
||||
"podUrls": [{"host": "zotum.net"}],
|
||||
"name": "Zotum",
|
||||
"mainLangs": ["en"],
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"score": 20,
|
||||
"podUrls": [{"host": "elsmussols.org"}],
|
||||
|
@ -386,13 +400,6 @@
|
|||
"mainLangs": ["en"],
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"score": 20,
|
||||
"podUrls": [{"host": "hubzilla.eu"}],
|
||||
"name": "hubzilla.eu",
|
||||
"mainLangs": ["en"],
|
||||
"id": 0
|
||||
},
|
||||
{
|
||||
"score": 20,
|
||||
"podUrls": [{"host": "node.hfrc.de"}],
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
<string name="pref_key__personal_settings" translatable="false">pref_key_personal_settings</string>
|
||||
<string name="pref_key__manage_addon" translatable="false">pref_key_manage_addon</string>
|
||||
<string name="pref_key__manage_contacts" translatable="false">pref_key_manage_contacts</string>
|
||||
<string name="pref_key__manage_theme" translatable="false">pref_key_manage_theme</string>
|
||||
<string name="pref_key__change_account" translatable="false">pref_key_change_account</string>
|
||||
<string name="pref_key__load_images" translatable="false">pref_key_load_images</string>
|
||||
<string name="pref_key__clear_cache" translatable="false">pref_key_clear_cache</string>
|
||||
|
@ -126,6 +127,7 @@
|
|||
<string name="pdf" translatable="false">PDF</string>
|
||||
<string name="pref_key__cat_menu_vis" translatable="false">pref_key__cat_menu_vis</string>
|
||||
<string name="pref_key__open_youtube_external_enabled" translatable="false">pref_key__open_youtube_external_enabled</string>
|
||||
<string name="pref_key__swipe_refresh_enabled" translatable="false">pref_key__swipe_refresh_enabled</string>
|
||||
<!-- Nomad add for visibility option -->
|
||||
<string name="pref_key__visibility_home" translatable="false">pref_key__visibility_home</string>
|
||||
<string name="pref_key__visibility_activities" translatable="false">pref_key__visibility_activities</string>
|
||||
|
|
|
@ -247,4 +247,8 @@
|
|||
<string name="invite">Invite</string>
|
||||
<string name="open_youtube_external_tabs_description">Enable to open Youtube links on external app</string>
|
||||
<string name="pref_title__open_youtube_external">Youtube links</string>
|
||||
<string name="pref_desc__sub_theme">Change the theme of your channel</string>
|
||||
<string name="pref_title__sub_theme">Hubzilla theme settings</string>
|
||||
<string name="pref_title_swipe_refresh">Pull to refresh</string>
|
||||
<string name="swipe_refresh_description">Pulling down on top of page to refresh.\nYou need to restart the app for changes to take effect.</string>
|
||||
</resources>
|
||||
|
|
|
@ -102,6 +102,13 @@
|
|||
android:summary="@string/pref_desc__screen_rotation"
|
||||
android:title="@string/pref_title__screen_rotation"/>
|
||||
|
||||
<com.dfa.hubzilla_android.ui.theme.ThemedCheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_touch_app_black_24px"
|
||||
android:key="@string/pref_key__swipe_refresh_enabled"
|
||||
android:title="@string/pref_title_swipe_refresh"
|
||||
android:summary="@string/swipe_refresh_description"/>
|
||||
|
||||
</com.dfa.hubzilla_android.ui.theme.ThemedPreferenceCategory>
|
||||
|
||||
<!-- Diaspora Pod Settings -->
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
android:defaultValue="true"
|
||||
android:key="@string/pref_key__visibility_search"
|
||||
android:title="@string/search"/>
|
||||
<com.dfa.hubzilla_android.ui.theme.ThemedVisibilityPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key__visibility_reload"
|
||||
android:title="@string/reload"/>
|
||||
<com.dfa.hubzilla_android.ui.theme.ThemedVisibilityPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/pref_key__visibility_suggestions"
|
||||
|
|
|
@ -21,5 +21,11 @@
|
|||
android:summary="@string/pref_desc__primary_color__amoled_mode"
|
||||
android:title="@string/pref_title__primary_color__amoled_mode"
|
||||
android:icon="@drawable/ic_color_lens_black_24px" />
|
||||
<Preference
|
||||
android:icon="@drawable/ic_color_lens_black_24px"
|
||||
android:key="@string/pref_key__manage_theme"
|
||||
android:summary="@string/pref_desc__sub_theme"
|
||||
android:title="@string/pref_title__sub_theme"/>
|
||||
|
||||
</com.dfa.hubzilla_android.ui.theme.ThemedPreferenceCategory>
|
||||
</PreferenceScreen>
|
66
build.gradle
66
build.gradle
|
@ -1,34 +1,46 @@
|
|||
import java.text.SimpleDateFormat
|
||||
|
||||
/*#######################################################
|
||||
*
|
||||
* Maintained by Gregor Santner, 2017-
|
||||
* https://gsantner.net/
|
||||
*
|
||||
* License of this file: Apache 2.0 (Commercial upon request)
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
#########################################################*/
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.version_setup_compileSdk = 27
|
||||
ext.version_setup_minSdk = 17
|
||||
ext.version_setup_targetSdk = ext.version_setup_compileSdk
|
||||
ext.version_setup_buildTools = "27.0.3" // Specifying optional
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
// https://developer.android.com/studio/releases/gradle-plugin.html
|
||||
ext.version_gradle_tools = "3.2.0"
|
||||
// https://developer.android.com/topic/libraries/support-library/revisions.html
|
||||
ext.version_library_appcompat = "28.0.0"
|
||||
// https://github.com/JakeWharton/butterknife/releases
|
||||
ext.version_library_butterknife = "8.8.1"
|
||||
// https://github.com/guardianproject/NetCipher/releases
|
||||
ext.version_library_netcipher = "2.0.0-alpha1"
|
||||
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin#LookAtCentral
|
||||
ext.version_plugin_kotlin = "1.2.21"
|
||||
ext.enable_plugin_kotlin = false
|
||||
buildscript {
|
||||
ext {
|
||||
version_gradle_tools = "3.2.1"
|
||||
version_plugin_kotlin = "1.3.11"
|
||||
enable_plugin_kotlin = false
|
||||
|
||||
version_compileSdk = 28
|
||||
version_buildTools = "28.0.3"
|
||||
version_minSdk = 17
|
||||
|
||||
// https://developer.android.com/topic/libraries/support-library/
|
||||
version_library_appcompat = "28.0.0" //androidx
|
||||
// https://github.com/JakeWharton/butterknife/releases
|
||||
version_library_butterknife = "8.8.1" //9.0.0-rc2
|
||||
// https://github.com/guardianproject/NetCipher/releases
|
||||
version_library_netcipher = "2.0.0-alpha1"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url 'https://maven.google.com' }
|
||||
jcenter()
|
||||
google()
|
||||
maven { url "https://jitpack.io" }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
classpath "com.android.tools.build:gradle:${version_gradle_tools}"
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
||||
if (project.enable_plugin_kotlin) {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_plugin_kotlin"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${version_plugin_kotlin}"
|
||||
}
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
@ -38,11 +50,10 @@ buildscript {
|
|||
|
||||
allprojects {
|
||||
repositories {
|
||||
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
jcenter()
|
||||
google()
|
||||
maven { url 'https://maven.google.com' }
|
||||
jcenter()
|
||||
maven { url "https://jitpack.io" }
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
tasks.matching { task -> task.name.matches('.*generate.*Resources') }.all {
|
||||
|
@ -91,6 +102,7 @@ ext.getGitHash = { ->
|
|||
return 'unknown'
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection", "GroovyUnusedDeclaration"])
|
||||
// Returns the build date in a RFC3339 compatible format. TZ is always converted to UTC
|
||||
static String getBuildDate() {
|
||||
|
|
Reference in New Issue