Skip to content

Commit b7818d1

Browse files
authored
Merge pull request #70 from Electric1447/master
Charge icon fix
2 parents 7a4cb6c + 4a8ba85 commit b7818d1

File tree

24 files changed

+216
-103
lines changed

24 files changed

+216
-103
lines changed

OpenPods/app/src/main/java/com/dosse/airpods/AboutActivity.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,42 @@
1010

1111
public class AboutActivity extends AppCompatActivity {
1212

13-
final String githubURL = "https://github.com/adolfintel/OpenPods";
14-
final String websiteURL = "https://fdossena.com/?p=openPods/index.frag";
15-
final String donateURL = "https://paypal.me/sineisochronic";
1613

17-
@SuppressWarnings("DanglingJavadoc")
14+
public static final String websiteURL = "https://fdossena.com/?p=openPods/index.frag";
15+
public static final String githubURL = "https://github.com/adolfintel/OpenPods";
16+
public static final String donateURL = "https://paypal.me/sineisochronic";
17+
public static final String fdroidURL = "https://f-droid.org/packages/com.dosse.airpods/";
18+
1819
@Override
1920
protected void onCreate (Bundle savedInstanceState) {
2021
super.onCreate(savedInstanceState);
2122
setContentView(R.layout.activity_about);
2223

23-
/**
24-
* LEGAL DANGER ZONE!
25-
*
24+
// --------------- LEGAL DANGER ZONE! --------------- //
25+
26+
/*
2627
* The following actions are a violation of the GNU GPLv3 License:
2728
* - Removing, hiding or altering the license or the code that displays it
2829
* - Removing or changing the link to the original source code or the code that displays it
2930
* - Removing or changing the donation link of the original project or the code that displays it
3031
*
31-
* If you're forking the application, it MUST be made clear that your version is a fork, who the original author is, and all references to the original project and license must not be removed.
32+
* If you're forking the application, it MUST be made clear that your version is a fork,
33+
* who the original author is, and all references to the original project and license must not be removed.
3234
* You are free to add links to your project, donations, whatever to this activity.
3335
*
3436
* I am constantly monitoring all major Android app stores for violations. You have been warned.
3537
*/
3638

3739
((WebView)(findViewById(R.id.license))).loadUrl("file:///android_asset/license.html");
3840

39-
findViewById(R.id.github).setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(githubURL))));
4041
findViewById(R.id.website).setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(websiteURL))));
42+
findViewById(R.id.github).setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(githubURL))));
4143
findViewById(R.id.donate).setOnClickListener(v -> {
4244
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(donateURL)));
4345
Toast.makeText(AboutActivity.this, "❤️", Toast.LENGTH_SHORT).show();
4446
});
4547

46-
//END OF LEGAL DANGER ZONE
48+
// ------------ END OF LEGAL DANGER ZONE ------------ //
4749
}
4850

4951
}

OpenPods/app/src/main/java/com/dosse/airpods/SettingsFragment.java

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,33 @@
44
import android.content.Context;
55
import android.content.Intent;
66
import android.content.pm.PackageManager;
7+
import android.net.Uri;
78
import android.os.Bundle;
89
import android.widget.Toast;
910

1011
import androidx.preference.Preference;
1112
import androidx.preference.PreferenceFragmentCompat;
1213

13-
import java.util.Objects;
14+
import static com.dosse.airpods.AboutActivity.donateURL;
15+
import static com.dosse.airpods.AboutActivity.fdroidURL;
16+
import static com.dosse.airpods.AboutActivity.githubURL;
17+
import static com.dosse.airpods.AboutActivity.websiteURL;
1418

1519
public class SettingsFragment extends PreferenceFragmentCompat {
1620

1721
private Context context;
1822

1923
@SuppressWarnings("FieldCanBeLocal")
20-
private Preference mAboutPreference, mHideAppPreference;
24+
private Preference mAboutPreference, mHideAppPreference, mFDroidPreference, mWebsitePreference, mGithubPreference, mDonationPreference;
2125

2226
@Override
2327
public void onCreatePreferences (Bundle savedInstanceState, String rootKey) {
2428
setPreferencesFromResource(R.xml.preference_screen, rootKey);
2529
context = getContext();
2630

27-
mAboutPreference = getPreferenceManager().findPreference("about");
28-
Objects.requireNonNull(mAboutPreference).setOnPreferenceClickListener(preference -> {
29-
startActivity(new Intent(context, AboutActivity.class));
30-
return true;
31-
});
32-
3331
mHideAppPreference = getPreferenceManager().findPreference("hideApp");
34-
Objects.requireNonNull(mHideAppPreference).setOnPreferenceClickListener(preference -> {
32+
assert mHideAppPreference != null;
33+
mHideAppPreference.setOnPreferenceClickListener(preference -> {
3534
PackageManager p = requireContext().getPackageManager();
3635
p.setComponentEnabledSetting(new ComponentName(context, MainActivity.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
3736
Toast.makeText(context, getString(R.string.hideClicked), Toast.LENGTH_LONG).show();
@@ -46,6 +45,43 @@ public void onCreatePreferences (Bundle savedInstanceState, String rootKey) {
4645
return true;
4746
});
4847

48+
mAboutPreference = getPreferenceManager().findPreference("about");
49+
assert mAboutPreference != null;
50+
mAboutPreference.setSummary(String.format("%s v%s", getString(R.string.app_name), BuildConfig.VERSION_NAME));
51+
mAboutPreference.setOnPreferenceClickListener(preference -> {
52+
startActivity(new Intent(context, AboutActivity.class));
53+
return true;
54+
});
55+
56+
mFDroidPreference = getPreferenceManager().findPreference("fdroid");
57+
assert mFDroidPreference != null;
58+
mFDroidPreference.setOnPreferenceClickListener(preference -> {
59+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(fdroidURL)));
60+
return true;
61+
});
62+
63+
mGithubPreference = getPreferenceManager().findPreference("github");
64+
assert mGithubPreference != null;
65+
mGithubPreference.setOnPreferenceClickListener(preference -> {
66+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(githubURL)));
67+
return true;
68+
});
69+
70+
mWebsitePreference = getPreferenceManager().findPreference("website");
71+
assert mWebsitePreference != null;
72+
mWebsitePreference.setOnPreferenceClickListener(preference -> {
73+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(websiteURL)));
74+
return true;
75+
});
76+
77+
mDonationPreference = getPreferenceManager().findPreference("donate");
78+
assert mDonationPreference != null;
79+
mDonationPreference.setOnPreferenceClickListener(preference -> {
80+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(donateURL)));
81+
Toast.makeText(getContext(), "❤️", Toast.LENGTH_SHORT).show();
82+
return true;
83+
});
84+
4985
enableDisableOptions();
5086
}
5187

OpenPods/app/src/main/res/layout-land/activity_about.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
66
android:background="#FFFFFF"
7-
android:paddingLeft="12dp"
8-
android:paddingTop="12dp"
9-
android:paddingRight="12dp"
7+
android:paddingLeft="@dimen/padding_default"
8+
android:paddingTop="@dimen/padding_default"
9+
android:paddingRight="@dimen/padding_default"
1010
tools:context=".AboutActivity"
1111
tools:ignore="ContentDescription,ButtonStyle">
1212

@@ -24,11 +24,11 @@
2424
- Removing or changing the link to the original source code or the code that displays it
2525
- Removing or changing the donation link of the original project or the code that displays it
2626
27-
If you're forking the application, it MUST be made clear that your version is a fork, who the original author is, and all references to the original project and license must not be removed.
27+
If you're forking the application, it MUST be made clear that your version is a fork,
28+
who the original author is, and all references to the original project and license must not be removed.
2829
You are free to add links to your project, donations, whatever to this activity.
2930
3031
I am constantly monitoring all major Android app stores for violations. You have been warned.
31-
3232
-->
3333

3434
<TextView

OpenPods/app/src/main/res/layout-land/activity_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:padding="16dp"
6+
android:padding="@dimen/padding_main"
77
tools:ignore="ContentDescription">
88

99
<ImageView

OpenPods/app/src/main/res/layout/activity_about.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
66
android:background="#FFFFFF"
7-
android:paddingLeft="12dp"
8-
android:paddingTop="12dp"
9-
android:paddingRight="12dp"
7+
android:paddingLeft="@dimen/padding_default"
8+
android:paddingTop="@dimen/padding_default"
9+
android:paddingRight="@dimen/padding_default"
1010
tools:context=".AboutActivity"
1111
tools:ignore="ContentDescription,ButtonStyle">
1212

@@ -23,11 +23,11 @@
2323
- Removing or changing the link to the original source code or the code that displays it
2424
- Removing or changing the donation link of the original project or the code that displays it
2525
26-
If you're forking the application, it MUST be made clear that your version is a fork, who the original author is, and all references to the original project and license must not be removed.
26+
If you're forking the application, it MUST be made clear that your version is a fork,
27+
who the original author is, and all references to the original project and license must not be removed.
2728
You are free to add links to your project, donations, whatever to this activity.
2829
2930
I am constantly monitoring all major Android app stores for violations. You have been warned.
30-
3131
-->
3232

3333
<TextView

OpenPods/app/src/main/res/layout/activity_intro.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:layout_gravity="center"
1111
android:gravity="center"
1212
android:orientation="vertical"
13-
android:padding="12dp">
13+
android:padding="@dimen/padding_default">
1414

1515
<ImageView
1616
android:id="@+id/introImg1"

OpenPods/app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:padding="16dp"
6+
android:padding="@dimen/padding_main"
77
tools:ignore="ContentDescription">
88

99
<LinearLayout

OpenPods/app/src/main/res/layout/activity_no_bt.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:layout_gravity="center"
1111
android:gravity="center"
1212
android:orientation="vertical"
13-
android:padding="12dp">
13+
android:padding="@dimen/padding_default">
1414

1515
<ImageView
1616
android:layout_width="wrap_content"
@@ -24,11 +24,12 @@
2424
<TextView
2525
android:layout_width="match_parent"
2626
android:layout_height="wrap_content"
27+
android:layout_gravity="center"
28+
android:layout_marginBottom="24dp"
2729
android:gravity="center"
2830
android:text="@string/noBtText"
29-
android:textColor="#000"
30-
android:textSize="15sp"
31-
android:textStyle="" />
31+
android:textColor="@color/textColorPrimary"
32+
android:textSize="15sp" />
3233

3334
</LinearLayout>
3435

OpenPods/app/src/main/res/layout/location_disabled_big.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="120dp"
4+
android:layout_height="@dimen/noti_location_big_height"
55
android:background="@color/bgColorPrimary"
66
android:gravity="center"
7-
android:padding="12dp">
7+
android:padding="@dimen/padding_default">
88

99
<TextView
1010
android:layout_width="match_parent"

OpenPods/app/src/main/res/layout/location_disabled_small.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="70dp"
4+
android:layout_height="@dimen/noti_location_small_height"
55
android:background="@color/bgColorPrimary"
66
android:gravity="center"
7-
android:padding="12dp">
7+
android:padding="@dimen/padding_default">
88

99
<TextView
1010
android:layout_width="match_parent"

0 commit comments

Comments
 (0)