mirror of
https://framagit.org/tom79/nitterizeme
synced 2025-01-26 15:04:49 +01:00
Add a message for default apps.
This commit is contained in:
parent
863f9a989d
commit
8838c40101
@ -19,6 +19,8 @@ import android.content.pm.PackageInfo;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@ -58,6 +60,10 @@ public class DefaultAppActivity extends AppCompatActivity {
|
||||
ArrayList<DefaultApp> appInfos = getAppInfo();
|
||||
DefaultAppAdapter defaultAppAdapter = new DefaultAppAdapter(appInfos);
|
||||
list_apps.setAdapter(defaultAppAdapter);
|
||||
if (appInfos.size() == 0) {
|
||||
TextView no_apps = findViewById(R.id.no_apps);
|
||||
no_apps.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ package app.fedilab.nitterizeme.adapters;
|
||||
* You should have received a copy of the GNU General Public License along with UntrackMe; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
@ -79,6 +80,12 @@ public class DefaultAppAdapter extends RecyclerView.Adapter {
|
||||
new DefaultAppDAO(context, db).removeApp(app_package);
|
||||
defaultApps.remove(defaultApp);
|
||||
notifyItemRemoved(i);
|
||||
if (defaultApps.size() == 0) {
|
||||
TextView no_apps = ((Activity) context).findViewById(R.id.no_apps);
|
||||
if (no_apps != null) {
|
||||
no_apps.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
dialog.dismiss();
|
||||
});
|
||||
confirmDialog.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||
|
@ -25,5 +25,13 @@
|
||||
android:id="@+id/list_apps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_apps"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/no_apps_set_as_default"
|
||||
/>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -76,4 +76,5 @@
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="delete_app_from_default">Delete %1$s from default apps?</string>
|
||||
<string name="copy_done">Copied</string>
|
||||
<string name="no_apps_set_as_default">No apps set as default!</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user