Some changes
@ -21,7 +21,7 @@ Github project: [/omarroth/invidious](https://github.com/omarroth/invidious)
|
||||
|
||||
### Screenshots:
|
||||
|
||||
 
|
||||
 
|
||||
|
||||
 
|
||||
  
|
||||
|
||||
|
@ -23,6 +23,14 @@
|
||||
</activity>
|
||||
<activity android:name=".TransformActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<!-- The app should handle these domains, more can be added here -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https"
|
||||
android:host="mobile.twitter.com"
|
||||
android:pathPattern=".*"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@ -44,14 +52,14 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https"
|
||||
android:host="m.twitter.com" />
|
||||
android:host="www.youtube.com" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https"
|
||||
android:host="www.youtube.com" />
|
||||
android:host="m.youtube.com" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
38
app/src/main/java/app/fedilab/nitterizeme/AppInfo.java
Normal file
@ -0,0 +1,38 @@
|
||||
package app.fedilab.nitterizeme;
|
||||
/* Copyright 2020 Thomas Schneider
|
||||
*
|
||||
* This file is a part of NitterizeMe
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* NitterizeMe is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with NitterizeMe; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
|
||||
public class AppInfo {
|
||||
|
||||
private String domain;
|
||||
private android.content.pm.ApplicationInfo ApplicationInfo;
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public android.content.pm.ApplicationInfo getApplicationInfo() {
|
||||
return ApplicationInfo;
|
||||
}
|
||||
|
||||
public void setApplicationInfo(android.content.pm.ApplicationInfo applicationInfo) {
|
||||
ApplicationInfo = applicationInfo;
|
||||
}
|
||||
}
|
116
app/src/main/java/app/fedilab/nitterizeme/AppInfoAdapter.java
Normal file
@ -0,0 +1,116 @@
|
||||
package app.fedilab.nitterizeme;
|
||||
/* Copyright 2020 Thomas Schneider
|
||||
*
|
||||
* This file is a part of NitterizeMe
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* NitterizeMe is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with NitterizeMe; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AppInfoAdapter extends RecyclerView.Adapter {
|
||||
|
||||
private List<AppInfo> appInfos;
|
||||
|
||||
AppInfoAdapter(List<AppInfo> appInfos) {
|
||||
this.appInfos = appInfos;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int position) {
|
||||
Context context = parent.getContext();
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(context);
|
||||
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_app_info, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
|
||||
|
||||
ViewHolder holder = (ViewHolder) viewHolder;
|
||||
AppInfo appInfo = appInfos.get(viewHolder.getAdapterPosition());
|
||||
Context context = holder.itemView.getContext();
|
||||
holder.domain.setText(appInfo.getDomain());
|
||||
if( appInfo.getApplicationInfo() != null ) {
|
||||
Drawable icon = appInfo.getApplicationInfo().loadIcon(context.getPackageManager());
|
||||
try {
|
||||
holder.app_icon.setImageDrawable(icon);
|
||||
} catch (Resources.NotFoundException e) {
|
||||
holder.app_icon.setImageResource(R.drawable.ic_android);
|
||||
}
|
||||
holder.information.setText(appInfo.getApplicationInfo().packageName);
|
||||
if( appInfo.getApplicationInfo().packageName.compareTo(BuildConfig.APPLICATION_ID) == 0 ) {
|
||||
holder.valid.setImageResource(R.drawable.ic_check);
|
||||
}else {
|
||||
holder.valid.setImageResource(R.drawable.ic_error);
|
||||
}
|
||||
holder.main_container.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", appInfo.getApplicationInfo().packageName, null);
|
||||
intent.setData(uri);
|
||||
context.startActivity(intent);
|
||||
});
|
||||
}else{
|
||||
holder.information.setText(R.string.no_apps);
|
||||
holder.app_icon.setImageResource(R.drawable.ic_android);
|
||||
holder.valid.setImageResource(R.drawable.ic_warning);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return appInfos.size();
|
||||
}
|
||||
|
||||
|
||||
class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView app_icon, valid;
|
||||
TextView information, domain;
|
||||
LinearLayout main_container;
|
||||
|
||||
ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
app_icon = itemView.findViewById(R.id.app_icon);
|
||||
valid = itemView.findViewById(R.id.valid);
|
||||
information = itemView.findViewById(R.id.information);
|
||||
domain = itemView.findViewById(R.id.domain);
|
||||
main_container = itemView.findViewById(R.id.main_container);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -16,11 +16,18 @@ package app.fedilab.nitterizeme;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -30,6 +37,7 @@ import android.widget.Button;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
@ -42,6 +50,18 @@ public class MainActivity extends AppCompatActivity {
|
||||
public static String DEFAULT_INVIDIOUS_HOST = "invidio.us";
|
||||
public static final String APP_PREFS = "app_prefs";
|
||||
|
||||
//Supported domains
|
||||
private String[] domains = {
|
||||
"twitter.com",
|
||||
"mobile.twitter.com",
|
||||
"www.twitter.com",
|
||||
"www.youtube.com",
|
||||
"youtube.com",
|
||||
"m.youtube.com",
|
||||
"youtu.be",
|
||||
"youtube-nocookie.com"
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -56,7 +76,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
TextInputEditText nitter_instance = findViewById(R.id.nitter_instance);
|
||||
TextInputEditText invidious_instance = findViewById(R.id.invidious_instance);
|
||||
Button button_save = findViewById(R.id.button_save);
|
||||
|
||||
RecyclerView list_apps = findViewById(R.id.list_apps);
|
||||
String nitterHost = sharedpreferences.getString(SET_NITTER_HOST, null);
|
||||
String invidiousHost = sharedpreferences.getString(SET_INVIDIOUS_HOST, null);
|
||||
if(nitterHost!=null) {
|
||||
@ -82,6 +102,40 @@ public class MainActivity extends AppCompatActivity {
|
||||
View parentLayout = findViewById(android.R.id.content);
|
||||
Snackbar.make(parentLayout, R.string.instances_saved, Snackbar.LENGTH_LONG).show();
|
||||
});
|
||||
|
||||
ArrayList<AppInfo> appInfos = new ArrayList<>();
|
||||
for(String domain: domains) {
|
||||
AppInfo appInfo = new AppInfo();
|
||||
appInfo.setDomain(domain);
|
||||
appInfo.setApplicationInfo(getDefaultApp("https://"+domain));
|
||||
appInfos.add(appInfo);
|
||||
}
|
||||
|
||||
AppInfoAdapter appInfoAdapter = new AppInfoAdapter(appInfos);
|
||||
list_apps.setAdapter(appInfoAdapter);
|
||||
final LinearLayoutManager mLayoutManager;
|
||||
mLayoutManager = new LinearLayoutManager(MainActivity.this);
|
||||
list_apps.setLayoutManager(mLayoutManager);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allow to get info about application that opens the link by default
|
||||
* @param url String url for test
|
||||
* @return ApplicationInfo info about the application
|
||||
*/
|
||||
ApplicationInfo getDefaultApp(String url) {
|
||||
final Intent browserIntent = new Intent(Intent.ACTION_VIEW);
|
||||
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
browserIntent.setData(Uri.parse(url));
|
||||
final ResolveInfo defaultResolution = getPackageManager().resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if (defaultResolution != null) {
|
||||
final ActivityInfo activity = defaultResolution.activityInfo;
|
||||
if (!activity.name.equals("com.android.internal.app.ResolverActivity")) {
|
||||
return activity.applicationInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
5
app/src/main/res/drawable/ic_android.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#78909C"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_check.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#388E3C"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_error.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#E64A19"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_warning.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#FBC02D"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M1,21h22L12,2 1,21zM13,18h-2v-2h2v2zM13,14h-2v-4h2v4z"/>
|
||||
</vector>
|
@ -75,4 +75,14 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_save"
|
||||
android:id="@+id/list_apps"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
34
app/src/main/res/layout/drawer_app_info.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:id="@+id/main_container"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:id="@+id/app_icon"/>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:textStyle="bold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/domain"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/information"/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/valid"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"/>
|
||||
</LinearLayout>
|
@ -14,4 +14,5 @@
|
||||
<string name="close">Close</string>
|
||||
<string name="instances_saved">Custom instances have been saved!</string>
|
||||
<string name="custom_invidious">Custom Invidious instance</string>
|
||||
<string name="no_apps">No applications by default</string>
|
||||
</resources>
|
||||
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 189 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 163 KiB |
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 404 KiB After Width: | Height: | Size: 310 KiB |
BIN
fastlane/metadata/android/en-US/images/phoneScreenshots/img5.png
Normal file
After Width: | Height: | Size: 404 KiB |
BIN
images/img1.png
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 58 KiB |
BIN
images/img2.png
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 53 KiB |
BIN
images/img3.png
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 18 KiB |
BIN
images/img4.png
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 57 KiB |
BIN
images/img5.png
Normal file
After Width: | Height: | Size: 66 KiB |