mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-04 03:06:41 -04:00
Migrated contentmanager from v4 appcompat and updated activity to v13 appcompat
This commit is contained in:
parent
ab96375f88
commit
e54b51df47
@ -23,6 +23,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.android.support:appcompat-v7:24.1.0'
|
compile 'com.android.support:appcompat-v7:24.1.0'
|
||||||
|
compile 'com.android.support:support-v13:24.1.0'
|
||||||
compile 'com.android.support:support-v4:24.1.0'
|
compile 'com.android.support:support-v4:24.1.0'
|
||||||
compile 'com.android.support:design:24.1.0'
|
compile 'com.android.support:design:24.1.0'
|
||||||
compile 'com.android.support:cardview-v7:21.0.+'
|
compile 'com.android.support:cardview-v7:21.0.+'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.kiwix.kiwixmobile;
|
package org.kiwix.kiwixmobile;
|
||||||
|
|
||||||
|
import android.app.FragmentManager;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -7,6 +8,8 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -14,7 +17,9 @@ import android.os.Bundle;
|
|||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -45,11 +50,13 @@ import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity;
|
|||||||
import org.kiwix.kiwixmobile.network.KiwixService;
|
import org.kiwix.kiwixmobile.network.KiwixService;
|
||||||
import org.kiwix.kiwixmobile.utils.StorageUtils;
|
import org.kiwix.kiwixmobile.utils.StorageUtils;
|
||||||
|
|
||||||
|
import eu.mhutti1.utils.storage.StorageDevice;
|
||||||
|
import eu.mhutti1.utils.storage.StorageSelectDialog;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
|
|
||||||
import static org.kiwix.kiwixmobile.downloader.DownloadService.KIWIX_ROOT;
|
import static org.kiwix.kiwixmobile.downloader.DownloadService.KIWIX_ROOT;
|
||||||
|
|
||||||
public class LibraryFragment extends Fragment implements AdapterView.OnItemClickListener {
|
public class LibraryFragment extends Fragment implements AdapterView.OnItemClickListener, StorageSelectDialog.OnSelectListener {
|
||||||
|
|
||||||
public @BindView(R.id.library_list) ListView libraryList;
|
public @BindView(R.id.library_list) ListView libraryList;
|
||||||
@BindView(R.id.progressBar) ProgressBar progressBar;
|
@BindView(R.id.progressBar) ProgressBar progressBar;
|
||||||
@ -99,7 +106,7 @@ public class LibraryFragment extends Fragment implements AdapterView.OnItemClick
|
|||||||
noNetworkConnection();
|
noNetworkConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getContext().registerReceiver(new BroadcastReceiver() {
|
faActivity.registerReceiver(new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
NetworkInfo network = conMan.getActiveNetworkInfo();
|
NetworkInfo network = conMan.getActiveNetworkInfo();
|
||||||
|
@ -27,7 +27,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -334,7 +334,7 @@ public class ZimFileSelectFragment extends Fragment
|
|||||||
ViewHolder holder;
|
ViewHolder holder;
|
||||||
LibraryNetworkEntity.Book book = getItem(position);
|
LibraryNetworkEntity.Book book = getItem(position);
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = View.inflate(getContext(), R.layout.library_item, null);
|
convertView = View.inflate(context, R.layout.library_item, null);
|
||||||
holder = new ViewHolder();
|
holder = new ViewHolder();
|
||||||
holder.title = (TextView) convertView.findViewById(R.id.title);
|
holder.title = (TextView) convertView.findViewById(R.id.title);
|
||||||
holder.description = (TextView) convertView.findViewById(R.id.description);
|
holder.description = (TextView) convertView.findViewById(R.id.description);
|
||||||
|
@ -5,9 +5,9 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.v4.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v13.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
@ -66,7 +66,7 @@ public class ZimManageActivity extends AppCompatActivity {
|
|||||||
setUpToolbar();
|
setUpToolbar();
|
||||||
// Create the adapter that will return a fragment for each of the three
|
// Create the adapter that will return a fragment for each of the three
|
||||||
// primary sections of the activity.
|
// primary sections of the activity.
|
||||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
|
||||||
|
|
||||||
// Set up the ViewPager with the sections adapter.
|
// Set up the ViewPager with the sections adapter.
|
||||||
mViewPager = (ViewPager) findViewById(R.id.container);
|
mViewPager = (ViewPager) findViewById(R.id.container);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.kiwix.kiwixmobile.downloader;
|
package org.kiwix.kiwixmobile.downloader;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
@ -8,8 +9,7 @@ import android.os.Bundle;
|
|||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.CoordinatorLayout;
|
import android.support.design.widget.CoordinatorLayout;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -42,7 +42,7 @@ public class DownloadFragment extends Fragment {
|
|||||||
public static DownloadAdapter downloadAdapter;
|
public static DownloadAdapter downloadAdapter;
|
||||||
private ZimManageActivity zimManageActivity;
|
private ZimManageActivity zimManageActivity;
|
||||||
CoordinatorLayout mainLayout;
|
CoordinatorLayout mainLayout;
|
||||||
private FragmentActivity faActivity;
|
private Activity faActivity;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
@ -141,7 +141,7 @@ public class DownloadFragment extends Fragment {
|
|||||||
// Get the data item for this position
|
// Get the data item for this position
|
||||||
// Check if an existing view is being reused, otherwise inflate the view
|
// Check if an existing view is being reused, otherwise inflate the view
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.download_item, parent, false);
|
convertView = LayoutInflater.from(faActivity).inflate(R.layout.download_item, parent, false);
|
||||||
}
|
}
|
||||||
mKeys = mData.keySet().toArray(new Integer[mData.size()]);
|
mKeys = mData.keySet().toArray(new Integer[mData.size()]);
|
||||||
// Lookup view for data population
|
// Lookup view for data population
|
||||||
@ -180,7 +180,7 @@ public class DownloadFragment extends Fragment {
|
|||||||
|
|
||||||
ImageView stop = (ImageView) convertView.findViewById(R.id.stop);
|
ImageView stop = (ImageView) convertView.findViewById(R.id.stop);
|
||||||
stop.setOnClickListener(v -> {
|
stop.setOnClickListener(v -> {
|
||||||
new AlertDialog.Builder(getContext())
|
new AlertDialog.Builder(faActivity)
|
||||||
.setTitle(R.string.confirm_stop_download_title)
|
.setTitle(R.string.confirm_stop_download_title)
|
||||||
.setMessage(R.string.confirm_stop_download_msg)
|
.setMessage(R.string.confirm_stop_download_msg)
|
||||||
.setPositiveButton(R.string.yes, (dialog, i) -> {
|
.setPositiveButton(R.string.yes, (dialog, i) -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user