mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-22 15:30:23 +01:00
progress dialog fix, added comments
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
parent
d74188dd07
commit
b7fb816d59
@ -1,7 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="org.nuclearfog.twidda">
|
package="org.nuclearfog.twidda"
|
||||||
|
tools:ignore="LockedOrientationActivity">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
@ -29,8 +29,8 @@ import org.nuclearfog.twidda.adapter.FragmentAdapter;
|
|||||||
import org.nuclearfog.twidda.backend.LinkLoader;
|
import org.nuclearfog.twidda.backend.LinkLoader;
|
||||||
import org.nuclearfog.twidda.backend.utils.AppStyles;
|
import org.nuclearfog.twidda.backend.utils.AppStyles;
|
||||||
import org.nuclearfog.twidda.database.GlobalSettings;
|
import org.nuclearfog.twidda.database.GlobalSettings;
|
||||||
|
import org.nuclearfog.twidda.dialog.ProgressDialog;
|
||||||
|
|
||||||
import static android.view.Window.FEATURE_NO_TITLE;
|
|
||||||
import static org.nuclearfog.twidda.activity.SearchPage.KEY_SEARCH_QUERY;
|
import static org.nuclearfog.twidda.activity.SearchPage.KEY_SEARCH_QUERY;
|
||||||
import static org.nuclearfog.twidda.activity.UserProfile.KEY_PROFILE_ID;
|
import static org.nuclearfog.twidda.activity.UserProfile.KEY_PROFILE_ID;
|
||||||
|
|
||||||
@ -85,15 +85,11 @@ public class MainActivity extends AppCompatActivity implements OnTabSelectedList
|
|||||||
pager = findViewById(R.id.home_pager);
|
pager = findViewById(R.id.home_pager);
|
||||||
tablayout = findViewById(R.id.home_tab);
|
tablayout = findViewById(R.id.home_tab);
|
||||||
root = findViewById(R.id.main_layout);
|
root = findViewById(R.id.main_layout);
|
||||||
loadingCircle = new Dialog(this, R.style.LoadingDialog);
|
loadingCircle = new ProgressDialog(this, null);
|
||||||
View load = View.inflate(this, R.layout.item_load, null);
|
|
||||||
|
|
||||||
settings = GlobalSettings.getInstance(this);
|
settings = GlobalSettings.getInstance(this);
|
||||||
tablayout.setupWithViewPager(pager);
|
tablayout.setupWithViewPager(pager);
|
||||||
pager.setOffscreenPageLimit(3);
|
pager.setOffscreenPageLimit(3);
|
||||||
loadingCircle.requestWindowFeature(FEATURE_NO_TITLE);
|
|
||||||
loadingCircle.setContentView(load);
|
|
||||||
loadingCircle.setCanceledOnTouchOutside(false);
|
|
||||||
adapter = new FragmentAdapter(getSupportFragmentManager());
|
adapter = new FragmentAdapter(getSupportFragmentManager());
|
||||||
pager.setAdapter(adapter);
|
pager.setAdapter(adapter);
|
||||||
AppStyles.setTheme(settings, root);
|
AppStyles.setTheme(settings, root);
|
||||||
|
@ -36,8 +36,19 @@ import static org.nuclearfog.twidda.backend.utils.StringTools.formatCreationTime
|
|||||||
*/
|
*/
|
||||||
public class MessageAdapter extends Adapter<ViewHolder> {
|
public class MessageAdapter extends Adapter<ViewHolder> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* index of {@link #loadingIndex} if no index is defined
|
||||||
|
*/
|
||||||
private static final int NO_LOADING = -1;
|
private static final int NO_LOADING = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* view type of a message item
|
||||||
|
*/
|
||||||
private static final int TYPE_MESSAGE = 0;
|
private static final int TYPE_MESSAGE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* view type of a footer item
|
||||||
|
*/
|
||||||
private static final int TYPE_FOOTER = 1;
|
private static final int TYPE_FOOTER = 1;
|
||||||
|
|
||||||
private OnItemSelected itemClickListener;
|
private OnItemSelected itemClickListener;
|
||||||
|
@ -7,6 +7,8 @@ import android.view.View.OnClickListener;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.nuclearfog.twidda.R;
|
import org.nuclearfog.twidda.R;
|
||||||
import org.nuclearfog.twidda.backend.utils.AppStyles;
|
import org.nuclearfog.twidda.backend.utils.AppStyles;
|
||||||
import org.nuclearfog.twidda.database.GlobalSettings;
|
import org.nuclearfog.twidda.database.GlobalSettings;
|
||||||
@ -26,9 +28,12 @@ public class ProgressDialog extends Dialog implements OnClickListener {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public ProgressDialog(Context context, OnProgressStopListener l) {
|
public ProgressDialog(Context context, @Nullable OnProgressStopListener l) {
|
||||||
super(context, R.style.LoadingDialog);
|
super(context, R.style.LoadingDialog);
|
||||||
|
// setup dialog
|
||||||
requestWindowFeature(FEATURE_NO_TITLE);
|
requestWindowFeature(FEATURE_NO_TITLE);
|
||||||
|
setCanceledOnTouchOutside(false);
|
||||||
|
setCancelable(false);
|
||||||
|
|
||||||
setContentView(R.layout.item_load);
|
setContentView(R.layout.item_load);
|
||||||
ImageView cancel = findViewById(R.id.kill_button);
|
ImageView cancel = findViewById(R.id.kill_button);
|
||||||
@ -38,18 +43,21 @@ public class ProgressDialog extends Dialog implements OnClickListener {
|
|||||||
AppStyles.setProgressColor(circle, settings.getHighlightColor());
|
AppStyles.setProgressColor(circle, settings.getHighlightColor());
|
||||||
AppStyles.setDrawableColor(cancel, settings.getIconColor());
|
AppStyles.setDrawableColor(cancel, settings.getIconColor());
|
||||||
|
|
||||||
setCancelable(false);
|
if (l != null) {
|
||||||
cancel.setVisibility(VISIBLE);
|
cancel.setVisibility(VISIBLE);
|
||||||
cancel.setImageResource(R.drawable.cross);
|
cancel.setImageResource(R.drawable.cross);
|
||||||
cancel.setOnClickListener(this);
|
cancel.setOnClickListener(this);
|
||||||
this.l = l;
|
this.l = l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
l.stopProgress();
|
if (l != null) {
|
||||||
dismiss();
|
l.stopProgress();
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user