Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 20 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
if (getGradle().getStartParameter().getTaskRequests().toString().toLowerCase().contains("google")) {
apply plugin: 'io.fabric'
}

android {
compileSdkVersion 27
Expand All @@ -17,6 +19,17 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "store"
productFlavors {
fdroid {
dimension "store"
versionNameSuffix "-fdroid"
}
google {
dimension "store"
versionNameSuffix "-google"
}
}
}

repositories {
Expand All @@ -40,13 +53,14 @@ dependencies {
implementation 'com.github.GrenderG:Toasty:1.3.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
googleImplementation 'com.google.firebase:firebase-core:16.0.3'
googleImplementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
googleImplementation 'com.google.firebase:firebase-messaging:17.3.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'
if (getGradle().getStartParameter().getTaskRequests().toString().toLowerCase().contains("google")) {
apply plugin: 'com.google.gms.google-services'
}
20 changes: 20 additions & 0 deletions app/src/fdroid/java/ca/pkay/rcloneexplorer/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ca.pkay.rcloneexplorer;

import android.content.SharedPreferences;

public class MainActivity extends BaseMainActivity {
@Override
protected boolean updateCheck() {
return false;
}

@Override
protected void checkEnableCrashReports(SharedPreferences sharedPreferences) {

}

@Override
protected void checkSubscribeToUpdates(SharedPreferences sharedPreferences) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package ca.pkay.rcloneexplorer.Settings;

public class LoggingSettingsFragment extends BaseLoggingSettingsFragment {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package ca.pkay.rcloneexplorer.Settings;

public class NotificationsSettingsFragment extends BaseNotificationsSettingsFragment {
}
65 changes: 65 additions & 0 deletions app/src/fdroid/res/layout/logging_settings_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".Settings.SettingsActivity"
tools:showIn="@layout/activity_settings"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp">

<RelativeLayout
android:id="@+id/use_logs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:clickable="true"
android:focusable="true"
android:background="?selectableItemBackground" >

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/textColorPrimary"
android:textStyle="bold"
android:text="@string/use_logs"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/textColorSecondary"
android:text="@string/use_logs_summary"/>

</LinearLayout>

<Switch
android:id="@+id/use_logs_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true" />

</RelativeLayout>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dividerColor"/>
</LinearLayout>

</ScrollView>
46 changes: 46 additions & 0 deletions app/src/fdroid/res/layout/notification_settings_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".Settings.SettingsActivity"
tools:showIn="@layout/activity_settings"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp"
android:animateLayoutChanges="true">

<RelativeLayout
android:id="@+id/notifications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:clickable="true"
android:focusable="true"
android:background="?selectableItemBackground" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/textColorPrimary"
android:textStyle="bold"
android:text="@string/open_system_settings"/>
</RelativeLayout>

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dividerColor"/>
</LinearLayout>

</ScrollView>
24 changes: 24 additions & 0 deletions app/src/google/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ca.pkay.rcloneexplorer">

<application>
<service android:name=".Services.FirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name=".Services.FirebaseIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />

<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />
</application>

</manifest>
62 changes: 62 additions & 0 deletions app/src/google/java/ca/pkay/rcloneexplorer/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package ca.pkay.rcloneexplorer;

import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;

import com.crashlytics.android.Crashlytics;
import com.google.firebase.messaging.FirebaseMessaging;

import io.fabric.sdk.android.Fabric;

public class MainActivity extends BaseMainActivity {

@Override
protected boolean updateCheck() {
if (getIntent() != null) {
String s = getIntent().getStringExtra(getString(R.string.firebase_msg_app_updates_topic));
if (s != null && s.equals("true")) {
openAppUpdate();
finish();
return true;
}

s = getIntent().getStringExtra(getString(R.string.firebase_msg_beta_app_updates_topic));
if (s != null) {
openBetaUpdate(s);
finish();
return true;
}
}
return false;
}

@Override
protected void checkEnableCrashReports(SharedPreferences sharedPreferences) {
boolean enableCrashReports = sharedPreferences.getBoolean(getString(R.string.pref_key_crash_reports), false);
if (enableCrashReports) {
Fabric.with(this, new Crashlytics());
}
}

@Override
protected void checkSubscribeToUpdates(SharedPreferences sharedPreferences) {
boolean appUpdates = sharedPreferences.getBoolean(getString(R.string.pref_key_app_updates), false);
if (appUpdates) {
FirebaseMessaging.getInstance().subscribeToTopic(getString(R.string.firebase_msg_app_updates_topic));
}
}

private void openAppUpdate() {
Uri uri = Uri.parse(getString(R.string.app_latest_release_url));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}

private void openBetaUpdate(String url) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package ca.pkay.rcloneexplorer.Settings;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.Toast;

import ca.pkay.rcloneexplorer.R;
import es.dmoral.toasty.Toasty;

public class LoggingSettingsFragment extends BaseLoggingSettingsFragment {

private View crashReportsElement;
private Switch crashReportsSwitch;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
getViews(view);
setDefaultStates();
setClickListeners();

return view;
}

private void getViews(View view) {
crashReportsElement = view.findViewById(R.id.crash_reporting);
crashReportsSwitch = view.findViewById(R.id.crash_reporting_switch);
}

private void setDefaultStates() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
boolean useLogs = sharedPreferences.getBoolean(getString(R.string.pref_key_logs), false);
boolean crashReports = sharedPreferences.getBoolean(getString(R.string.pref_key_crash_reports), false);

crashReportsSwitch.setChecked(crashReports);
}

private void setClickListeners() {
crashReportsElement.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (crashReportsSwitch.isChecked()) {
crashReportsSwitch.setChecked(false);
} else {
crashReportsSwitch.setChecked(true);
}
}
});
crashReportsSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
crashReportsClicked(isChecked);
}
});
}

private void crashReportsClicked(boolean isChecked) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(getString(R.string.pref_key_crash_reports), isChecked);
editor.apply();

Toasty.info(context, getString(R.string.restart_required), Toast.LENGTH_SHORT, true).show();
}
}
Loading