Some changes
|
@ -75,6 +75,12 @@
|
||||||
android:host="youtube-nocookie.com" />
|
android:host="youtube-nocookie.com" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".AboutActivity"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:theme="@style/AppTheme"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
After Width: | Height: | Size: 10 KiB |
|
@ -13,6 +13,9 @@ package app.fedilab.nitterizeme;
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with NitterizeMe; if not,
|
* You should have received a copy of the GNU General Public License along with NitterizeMe; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +24,13 @@ import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@ -29,7 +39,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
public static String SET_NITTER_HOST = "set_nitter_host";
|
public static String SET_NITTER_HOST = "set_nitter_host";
|
||||||
public static String DEFAULT_NITTER_HOST = "nitter.net";
|
public static String DEFAULT_NITTER_HOST = "nitter.net";
|
||||||
public static String SET_INVIDIOUS_HOST = "set_invidious_host";
|
public static String SET_INVIDIOUS_HOST = "set_invidious_host";
|
||||||
public static String DEFAULT_INVIDIOUS_HOST = "invidious.net";
|
public static String DEFAULT_INVIDIOUS_HOST = "invidio.us";
|
||||||
public static final String APP_PREFS = "app_prefs";
|
public static final String APP_PREFS = "app_prefs";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,7 +48,40 @@ public class MainActivity extends AppCompatActivity {
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
Objects.requireNonNull(getSupportActionBar()).setDisplayShowHomeEnabled(true);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
|
||||||
|
TextInputEditText nitter_instance = findViewById(R.id.nitter_instance);
|
||||||
|
TextInputEditText invidious_instance = findViewById(R.id.invidious_instance);
|
||||||
|
Button button_save = findViewById(R.id.button_save);
|
||||||
|
|
||||||
|
String nitterHost = sharedpreferences.getString(SET_NITTER_HOST, null);
|
||||||
|
String invidiousHost = sharedpreferences.getString(SET_INVIDIOUS_HOST, null);
|
||||||
|
if(nitterHost!=null) {
|
||||||
|
nitter_instance.setText(nitterHost);
|
||||||
|
}
|
||||||
|
if(invidiousHost!=null) {
|
||||||
|
invidious_instance.setText(invidiousHost);
|
||||||
|
}
|
||||||
|
button_save.setOnClickListener(v -> {
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
if (nitter_instance.getText() != null && nitter_instance.getText().toString().trim().length() > 0) {
|
||||||
|
editor.putString(SET_NITTER_HOST, nitter_instance.getText().toString().toLowerCase().trim());
|
||||||
|
} else {
|
||||||
|
editor.putString(SET_NITTER_HOST, null);
|
||||||
|
}
|
||||||
|
editor.apply();
|
||||||
|
if (invidious_instance.getText() != null && invidious_instance.getText().toString().trim().length() > 0) {
|
||||||
|
editor.putString(SET_INVIDIOUS_HOST, invidious_instance.getText().toString().toLowerCase().trim());
|
||||||
|
} else {
|
||||||
|
editor.putString(SET_INVIDIOUS_HOST, null);
|
||||||
|
}
|
||||||
|
editor.apply();
|
||||||
|
View parentLayout = findViewById(android.R.id.content);
|
||||||
|
Snackbar.make(parentLayout, R.string.instances_saved, Snackbar.LENGTH_LONG).show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,7 +100,11 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
//noinspection SimplifiableIfStatement
|
//noinspection SimplifiableIfStatement
|
||||||
if (id == R.id.action_about) {
|
if (id == R.id.action_about) {
|
||||||
|
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
}else if(id == android.R.id.home){
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
|
@ -18,7 +18,6 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
@ -61,7 +60,6 @@ public class TransformActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.v(MainActivity.TAG,"newUrl: " + newUrl);
|
|
||||||
Intent delegate = new Intent(Intent.ACTION_VIEW);
|
Intent delegate = new Intent(Intent.ACTION_VIEW);
|
||||||
delegate.setData(Uri.parse(newUrl));
|
delegate.setData(Uri.parse(newUrl));
|
||||||
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="41.37931"
|
||||||
|
android:viewportHeight="41.37931"
|
||||||
|
android:tint="#FFFFFF">
|
||||||
|
<group android:translateX="8.689655"
|
||||||
|
android:translateY="8.689655">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M22,18v-2H8V4h2L7,1 4,4h2v2H2v2h4v8c0,1.1 0.9,2 2,2h8v2h-2l3,3 3,-3h-2v-2h4zM10,8h6v6h2V8c0,-1.1 -0.9,-2 -2,-2h-6v2z"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
|
@ -24,8 +24,6 @@
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
tools:context=".AboutActivity">
|
tools:context=".AboutActivity">
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_marginStart="@dimen/about_margin"
|
|
||||||
android:layout_marginEnd="@dimen/about_margin"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -102,7 +100,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:text="\@fedilab@framapiaf.org"
|
android:text="\@fedilab@toot.fedilab.org"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
|
|
@ -22,15 +22,57 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context=".MainActivity"
|
tools:context=".MainActivity"
|
||||||
|
android:layout_margin="@dimen/fab_margin"
|
||||||
tools:showIn="@layout/activity_main">
|
tools:showIn="@layout/activity_main">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:id="@+id/nitter_container"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Hello World!"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/nitter_instance"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/custom_nitter"
|
||||||
|
android:inputType="textUri"
|
||||||
|
android:maxLines="1" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:id="@+id/invidious_container"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/nitter_container">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/invidious_instance"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/custom_nitter"
|
||||||
|
android:inputType="textUri"
|
||||||
|
android:maxLines="1" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_save"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/invidious_container"
|
||||||
|
android:text="@string/save"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 976 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 9.4 KiB |
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#008577</color>
|
<color name="colorPrimary">#424242</color>
|
||||||
<color name="colorPrimaryDark">#00574B</color>
|
<color name="colorPrimaryDark">#212121</color>
|
||||||
<color name="colorAccent">#D81B60</color>
|
<color name="colorAccent">#607D8B</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#607D8B</color>
|
||||||
|
</resources>
|
|
@ -9,4 +9,8 @@
|
||||||
<string name="issue_tracker">Issue tracker</string>
|
<string name="issue_tracker">Issue tracker</string>
|
||||||
<string name="license">License</string>
|
<string name="license">License</string>
|
||||||
<string name="about_vesrion">Release %1$s</string>
|
<string name="about_vesrion">Release %1$s</string>
|
||||||
|
<string name="custom_nitter">Custom Nitter instance</string>
|
||||||
|
<string name="save">Save</string>
|
||||||
|
<string name="close">Close</string>
|
||||||
|
<string name="instances_saved">Custom instances have been saved!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
|