mirror of
https://framagit.org/tom79/mobilizon-android-app
synced 2025-06-05 21:59:22 +02:00
Change loader + add about page
This commit is contained in:
@ -6,7 +6,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "app.fedilab.mobilizon"
|
applicationId "app.fedilab.mobilizon"
|
||||||
minSdkVersion 21
|
minSdkVersion 23
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
@ -49,6 +49,7 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.13'
|
testImplementation 'junit:junit:4.13'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
|
||||||
|
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
|
@ -5,13 +5,19 @@ import android.annotation.SuppressLint;
|
|||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationListener;
|
import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.style.UnderlineSpan;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -21,6 +27,7 @@ import android.widget.EditText;
|
|||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -49,7 +56,7 @@ import es.dmoral.toasty.Toasty;
|
|||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
||||||
|
|
||||||
public static int PICK_INSTANCE = 5641;
|
//public static int PICK_INSTANCE = 5641;
|
||||||
public static boolean isAuthenticated = false;
|
public static boolean isAuthenticated = false;
|
||||||
final private int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124;
|
final private int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124;
|
||||||
private final LocationListener mLocationListener = new LocationListener() {
|
private final LocationListener mLocationListener = new LocationListener() {
|
||||||
@ -166,6 +173,58 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||||||
if (id == R.id.action_instance) {
|
if (id == R.id.action_instance) {
|
||||||
showRadioButtonDialogFullInstances();
|
showRadioButtonDialogFullInstances();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (id == R.id.action_about) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
|
LayoutInflater inflater = getLayoutInflater();
|
||||||
|
View dialogView = inflater.inflate(R.layout.popup_about, new LinearLayout(MainActivity.this), false);
|
||||||
|
TextView about = dialogView.findViewById(R.id.about);
|
||||||
|
TextView terms = dialogView.findViewById(R.id.terms);
|
||||||
|
TextView license = dialogView.findViewById(R.id.license);
|
||||||
|
TextView about_the_app = dialogView.findViewById(R.id.about_the_app);
|
||||||
|
|
||||||
|
SpannableString contentAbout = new SpannableString(about.getText().toString());
|
||||||
|
contentAbout.setSpan(new UnderlineSpan(), 0, contentAbout.length(), 0);
|
||||||
|
about.setText(contentAbout);
|
||||||
|
about.setOnClickListener(v -> {
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://" + Helper.getLiveInstance(MainActivity.this) + "/about"));
|
||||||
|
startActivity(browserIntent);
|
||||||
|
});
|
||||||
|
|
||||||
|
SpannableString contentTerms = new SpannableString(terms.getText().toString());
|
||||||
|
contentTerms.setSpan(new UnderlineSpan(), 0, contentTerms.length(), 0);
|
||||||
|
terms.setText(contentTerms);
|
||||||
|
terms.setOnClickListener(v -> {
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://" + Helper.getLiveInstance(MainActivity.this) + "/terms"));
|
||||||
|
startActivity(browserIntent);
|
||||||
|
});
|
||||||
|
SpannableString contentLicense = new SpannableString(license.getText().toString());
|
||||||
|
contentLicense.setSpan(new UnderlineSpan(), 0, contentTerms.length(), 0);
|
||||||
|
license.setText(contentLicense);
|
||||||
|
license.setOnClickListener(v -> {
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://framagit.org/framasoft/mobilizon/blob/master/LICENSE"));
|
||||||
|
startActivity(browserIntent);
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||||
|
String version = pInfo.versionName;
|
||||||
|
about_the_app.setText(getResources().getString(R.string.about_the_app, version));
|
||||||
|
} catch (PackageManager.NameNotFoundException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
|
SpannableString contentAboutApp = new SpannableString(about_the_app.getText().toString());
|
||||||
|
contentAboutApp.setSpan(new UnderlineSpan(), 0, contentAboutApp.length(), 0);
|
||||||
|
about_the_app.setText(contentAboutApp);
|
||||||
|
about_the_app.setOnClickListener(v -> {
|
||||||
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://framagit.org/tom79/mobilizon-android-app"));
|
||||||
|
startActivity(browserIntent);
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.setView(dialogView);
|
||||||
|
builder
|
||||||
|
.setPositiveButton(R.string.close, (dialog, which) -> dialog.dismiss())
|
||||||
|
.setIcon(R.drawable.ic_baseline_info_24)
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -19,7 +19,7 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public class WellKnownNodeinfo {
|
public class WellKnownNodeinfo {
|
||||||
|
|
||||||
@SerializedName("links")
|
@SerializedName("links")
|
||||||
|
@ -26,8 +26,6 @@ import android.widget.FrameLayout;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import app.fedilab.mobilizon.MainActivity;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas
|
* Created by Thomas
|
||||||
|
@ -87,7 +87,6 @@ public class MobilizonWebViewClient extends WebViewClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
view.setVisibility(View.INVISIBLE);
|
|
||||||
super.onPageStarted(view, url, favicon);
|
super.onPageStarted(view, url, favicon);
|
||||||
if (activity instanceof MainActivity) {
|
if (activity instanceof MainActivity) {
|
||||||
((MainActivity) activity).showProgressDialog();
|
((MainActivity) activity).showProgressDialog();
|
||||||
|
10
app/src/main/res/drawable/ic_baseline_info_24.xml
Normal file
10
app/src/main/res/drawable/ic_baseline_info_24.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||||
|
</vector>
|
@ -30,17 +30,16 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<ProgressBar
|
<com.github.ybq.android.spinkit.SpinKitView
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_centerInParent="true"
|
style="@style/SpinKitView.Large.FadingCircle"
|
||||||
android:id="@+id/progressBar"
|
|
||||||
style="?android:attr/indeterminate"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
android:layout_gravity="center"
|
||||||
|
app:SpinKit_Color="@color/colorPrimary" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
88
app/src/main/res/layout/popup_about.xml
Normal file
88
app/src/main/res/layout/popup_about.xml
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/logo_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@color/colorPrimaryDark"
|
||||||
|
android:paddingTop="30dp"
|
||||||
|
android:paddingBottom="30dp">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/logo_mobilizon"
|
||||||
|
android:src="@drawable/mobilizon_logo"
|
||||||
|
/>
|
||||||
|
</RelativeLayout>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:paddingTop="30dp"
|
||||||
|
android:paddingBottom="30dp"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/logo_container"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/about"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/about_the_app"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/terms"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/about"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/terms"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:textSize="24sp"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/about"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/about_the_app"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/license"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/terms"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/license"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:textSize="24sp"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/terms"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/about_the_app"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/license"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/about_the_app"
|
||||||
|
android:layout_margin="40dp"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/about"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/about_the_app"
|
||||||
|
/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -13,4 +13,10 @@
|
|||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:title="@string/change_instance"
|
android:title="@string/change_instance"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_about"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/about"
|
||||||
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
@ -31,4 +31,10 @@
|
|||||||
<string name="my_account">My account</string>
|
<string name="my_account">My account</string>
|
||||||
<string name="register">Register</string>
|
<string name="register">Register</string>
|
||||||
<string name="account">Account</string>
|
<string name="account">Account</string>
|
||||||
|
<string name="about">About</string>
|
||||||
|
<string name="logo_mobilizon">Mobilizon logo</string>
|
||||||
|
<string name="close">Close</string>
|
||||||
|
<string name="terms">Terms</string>
|
||||||
|
<string name="license">License</string>
|
||||||
|
<string name="about_the_app">About the app (Release %1$s)</string>
|
||||||
</resources>
|
</resources>
|
Reference in New Issue
Block a user