diff options
author | Thomas <tschneider.ac@gmail.com> | 2020-07-14 19:50:54 +0200 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2020-07-14 19:50:54 +0200 |
commit | cf4c3f2f7aabb4a61c2288a0736c4986055626d6 (patch) | |
tree | 7d2935f7f6fcf42674610c6d9503eaf0841b50ac /app/src/main/java | |
parent | c737afb566afe1e0a3497a6fe4a99549622a8a07 (diff) |
Clean + some changes
Diffstat (limited to 'app/src/main/java')
16 files changed, 70 insertions, 58 deletions
diff --git a/app/src/main/java/app/fedilab/android/activities/AllBaseActivity.java b/app/src/main/java/app/fedilab/android/activities/AllBaseActivity.java index 0a48a6c57..b40dffafa 100644 --- a/app/src/main/java/app/fedilab/android/activities/AllBaseActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/AllBaseActivity.java @@ -20,7 +20,6 @@ import com.franmontiel.localechanger.LocaleChanger; import com.google.android.material.snackbar.Snackbar; import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity; - import org.jetbrains.annotations.NotNull; import java.util.Timer; diff --git a/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java index 05fdb9b1f..eaffb1cfe 100644 --- a/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java @@ -2405,6 +2405,10 @@ public abstract class BaseMainActivity extends BaseActivity super.onDetachedFromWindow(); } + protected abstract void launchOwnerStatusesActivity(); + + protected abstract void launchOwnerNotificationsActivity(); + public enum iconLauncher { BUBBLES, FEDIVERSE, @@ -2568,7 +2572,4 @@ public abstract class BaseMainActivity extends BaseActivity return mNumOfTabs; } } - - protected abstract void launchOwnerStatusesActivity(); - protected abstract void launchOwnerNotificationsActivity(); }
\ No newline at end of file diff --git a/app/src/main/java/app/fedilab/android/activities/BasePixelfedComposeActivity.java b/app/src/main/java/app/fedilab/android/activities/BasePixelfedComposeActivity.java index d774ec0cd..c4d8b73f8 100644 --- a/app/src/main/java/app/fedilab/android/activities/BasePixelfedComposeActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/BasePixelfedComposeActivity.java @@ -180,6 +180,9 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement private final int PICK_IMAGE = 56556; private final int TAKE_PHOTO = 56532; public long currentToId; + protected MastalabAutoCompleteTextView toot_content; + protected ImageButton toot_emoji; + protected LinearLayout drawer_layout; String mCurrentPhotoPath; File photoFile = null; private String visibility; @@ -187,7 +190,6 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement private boolean isSensitive = false; private ImageButton toot_visibility; private Button toot_it; - protected MastalabAutoCompleteTextView toot_content; private CheckBox toot_sensitive; private long restored; private TextView title; @@ -211,8 +213,6 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement private SliderView imageSlider; private SliderAdapter sliderAdapter; private CheckBox pixelfed_story; - protected ImageButton toot_emoji; - protected LinearLayout drawer_layout; private BroadcastReceiver imageReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -1911,6 +1911,10 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement active = false; } + protected abstract void launchPhotoEditor(Uri uri); + + protected abstract void displayEmojiPopup(); + static class asyncPicture extends AsyncTask<Void, Void, Void> { String commpressedFilePath = null; @@ -1969,7 +1973,4 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement } } - protected abstract void launchPhotoEditor(Uri uri); - protected abstract void displayEmojiPopup(); - } diff --git a/app/src/main/java/app/fedilab/android/activities/BaseTootActivity.java b/app/src/main/java/app/fedilab/android/activities/BaseTootActivity.java index 4e6c05db9..a9608b918 100644 --- a/app/src/main/java/app/fedilab/android/activities/BaseTootActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/BaseTootActivity.java @@ -222,6 +222,12 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta private final int PICK_IMAGE = 56556; private final int TAKE_PHOTO = 56532; public long currentToId; + protected MastalabAutoCompleteTextView toot_content; + protected EditText toot_cw_content; + protected LinearLayout drawer_layout; + protected ImageButton toot_emoji; + protected int style; + protected int theme; List<Emojis> emojis; String mCurrentPhotoPath; File photoFile = null; @@ -232,8 +238,6 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta private boolean isSensitive = false; private ImageButton toot_visibility; private Button toot_it; - protected MastalabAutoCompleteTextView toot_content; - protected EditText toot_cw_content; private Status tootReply = null; private String tootMention = null; private String urlMention = null; @@ -244,12 +248,10 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta private ImageView pp_actionBar; private ProgressBar pp_progress; private Toast mToast; - protected LinearLayout drawer_layout; private HorizontalScrollView picture_scrollview; private TextView toot_space_left; private String initialContent; private Account accountReply; - protected ImageButton toot_emoji; private AlertDialog alertDialogEmoji; private String mentionAccount; private Status idRedirect; @@ -259,7 +261,6 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta private int stepSpliToot; private boolean removed; private boolean restoredScheduled; - protected int style; private StoredStatus scheduledstatus; private boolean isScheduled; private List<Boolean> checkedValues; @@ -287,7 +288,6 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta } } }; - protected int theme; private BroadcastReceiver add_new_media = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -3669,6 +3669,12 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta return String.format(Locale.getDefault(), "#%02X%02X%02X", r, g, b); } + protected abstract boolean actionTranslateClick(); + + protected abstract void launchPhotoEditor(Uri uri); + + protected abstract void displayEmojiPopup(); + static class asyncPicture extends AsyncTask<Void, Void, Void> { String commpressedFilePath; @@ -3746,9 +3752,4 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta } } } - - - protected abstract boolean actionTranslateClick(); - protected abstract void launchPhotoEditor(Uri uri); - protected abstract void displayEmojiPopup(); } diff --git a/app/src/main/java/app/fedilab/android/activities/LoginActivity.java b/app/src/main/java/app/fedilab/android/activities/LoginActivity.java index 4f62c8cff..463e1cd5a 100644 --- a/app/src/main/java/app/fedilab/android/activities/LoginActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/LoginActivity.java @@ -248,7 +248,7 @@ public class LoginActivity extends BaseActivity { return; } instance = login_instance.getText().toString().trim().toLowerCase(); - if(instance.length() == 0) { + if (instance.length() == 0) { return; } connect_button.setEnabled(false); diff --git a/app/src/main/java/app/fedilab/android/activities/MainBaseFragmentActivity.java b/app/src/main/java/app/fedilab/android/activities/MainBaseFragmentActivity.java index 2843bfcfc..02da9bbc3 100644 --- a/app/src/main/java/app/fedilab/android/activities/MainBaseFragmentActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/MainBaseFragmentActivity.java @@ -16,4 +16,5 @@ package app.fedilab.android.activities; import androidx.appcompat.app.AppCompatActivity; -public abstract class MainBaseFragmentActivity extends AppCompatActivity {} +public abstract class MainBaseFragmentActivity extends AppCompatActivity { +} diff --git a/app/src/main/java/app/fedilab/android/asynctasks/SyncTimelinesAsyncTask.java b/app/src/main/java/app/fedilab/android/asynctasks/SyncTimelinesAsyncTask.java index 842ebaf0c..46db7326d 100644 --- a/app/src/main/java/app/fedilab/android/asynctasks/SyncTimelinesAsyncTask.java +++ b/app/src/main/java/app/fedilab/android/asynctasks/SyncTimelinesAsyncTask.java @@ -25,6 +25,7 @@ import java.util.Date; import java.util.Iterator; import java.util.List; +import app.fedilab.android.BuildConfig; import app.fedilab.android.activities.MainActivity; import app.fedilab.android.client.API; import app.fedilab.android.client.APIResponse; @@ -114,7 +115,7 @@ public class SyncTimelinesAsyncTask extends AsyncTask<Void, Void, Void> { manageTimelines.add(managePublic); new TimelinesDAO(contextReference.get(), db).insert(managePublic); } - if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) { + if (!BuildConfig.lite && (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)) { //Add Public ART ManageTimelines manageArt = new ManageTimelines(); manageArt.setDisplayed(true); diff --git a/app/src/main/java/app/fedilab/android/client/API.java b/app/src/main/java/app/fedilab/android/client/API.java index dd4508264..f74c09faa 100644 --- a/app/src/main/java/app/fedilab/android/client/API.java +++ b/app/src/main/java/app/fedilab/android/client/API.java @@ -2224,7 +2224,7 @@ public class API { public InstanceNodeInfo displayNodeInfo(String domain) { - if( domain == null) { + if (domain == null) { return null; } String response; diff --git a/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java b/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java index b0017b78d..387cc568f 100644 --- a/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java +++ b/app/src/main/java/app/fedilab/android/client/Entities/Attachment.java @@ -51,14 +51,6 @@ public class Attachment implements Parcelable { } - public int getViewId() { - return viewId; - } - - public void setViewId(int viewId) { - this.viewId = viewId; - } - protected Attachment(Parcel in) { this.id = in.readString(); this.viewId = in.readInt(); @@ -72,6 +64,14 @@ public class Attachment implements Parcelable { this.local_path = in.readString(); } + public int getViewId() { + return viewId; + } + + public void setViewId(int viewId) { + this.viewId = viewId; + } + public String getId() { return id; } diff --git a/app/src/main/java/app/fedilab/android/drawers/BaseNotificationsListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/BaseNotificationsListAdapter.java index 9ac269845..b0cb580e8 100644 --- a/app/src/main/java/app/fedilab/android/drawers/BaseNotificationsListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/BaseNotificationsListAdapter.java @@ -128,6 +128,7 @@ public abstract class BaseNotificationsListAdapter extends RecyclerView.Adapter< private final Object lock = new Object(); protected Context context; + protected Status status; private List<Notification> notifications; private BaseNotificationsListAdapter notificationsListAdapter; private int behaviorWithAttachments; @@ -135,7 +136,6 @@ public abstract class BaseNotificationsListAdapter extends RecyclerView.Adapter< private NotificationsListAdapter.ViewHolder holder; private int style; private RecyclerView mRecyclerView; - protected Status status; private Runnable updateAnimatedEmoji = new Runnable() { @Override public void run() { @@ -371,7 +371,7 @@ public abstract class BaseNotificationsListAdapter extends RecyclerView.Adapter< holder.spark_button_reblog.setImageSize((int) (20 * iconSizePercent / 100 * scale + 0.5f)); holder.spark_button_reblog.setMinimumWidth((int) Helper.convertDpToPixel(((float) (20 * iconSizePercent) / 100 * scale + 0.5f), context)); - status = notification.getStatus(); + status = notification.getStatus(); if (status != null) { if (status.getMedia_attachments() == null || status.getMedia_attachments().size() < 1) holder.status_document_container.setVisibility(View.GONE); @@ -1290,6 +1290,8 @@ public abstract class BaseNotificationsListAdapter extends RecyclerView.Adapter< } } + protected abstract void notificationStatusChart(); + class ViewHolder extends RecyclerView.ViewHolder { FrameLayout card_status_container; @@ -1413,6 +1415,4 @@ public abstract class BaseNotificationsListAdapter extends RecyclerView.Adapter< } } } - - protected abstract void notificationStatusChart(); }
\ No newline at end of file diff --git a/app/src/main/java/app/fedilab/android/drawers/BaseStatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/BaseStatusListAdapter.java index a2617207d..adea41fa8 100644 --- a/app/src/main/java/app/fedilab/android/drawers/BaseStatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/BaseStatusListAdapter.java @@ -110,6 +110,7 @@ import java.util.TimerTask; import java.util.regex.Matcher; import java.util.regex.Pattern; +import app.fedilab.android.BuildConfig; import app.fedilab.android.R; import app.fedilab.android.activities.AccountReportActivity; import app.fedilab.android.activities.BaseActivity; @@ -204,10 +205,11 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle protected Context context; protected Status status; protected ViewHolder holder; + protected RetrieveFeedsAsyncTask.Type type; + protected int style; private List<Status> statuses; private boolean isOnWifi; private BaseStatusListAdapter statusListAdapter; - protected RetrieveFeedsAsyncTask.Type type; private String targetedId; private int conversationPosition; private boolean redraft; @@ -227,7 +229,6 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle private List<Emojis> emojisPicker; private Status statusForQuickReply; private String instanceType; - private Runnable updateAnimatedEmoji = new Runnable() { @Override public void run() { @@ -245,7 +246,6 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle } }; private Handler mHandler = new Handler(); - protected int style; public BaseStatusListAdapter(StatusDrawerParams statusDrawerParams) { statuses = statusDrawerParams.getStatuses(); @@ -576,7 +576,11 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle return COMPACT_STATUS; } else { if (instanceType == null || instanceType.compareTo("NITTER") != 0) { - return statuses.get(position).getViewType(); + if(BuildConfig.lite) { + return COMPACT_STATUS; + }else{ + return statuses.get(position).getViewType(); + } } else { return COMPACT_STATUS; } @@ -614,7 +618,7 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle holder = (ViewHolder) viewHolder; holder.startUpdateTimer(); - status = statuses.get(i); + status = statuses.get(i); if (status == null) @@ -3017,7 +3021,9 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle } + protected abstract void statusAddReactionClick(); + protected abstract void notificationCharts(); private void loadAttachments(final Status status, final ViewHolder holder, boolean blur) { @@ -3903,6 +3909,8 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle } protected class ViewHolder extends RecyclerView.ViewHolder { + public ImageView status_add_reaction; + public MastalabAutoCompleteTextView fake_edittext; LinearLayout status_content_container; LinearLayout status_spoiler_container; CustomTextView status_spoiler; @@ -3971,7 +3979,6 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle Button status_show_more_content; SparkButton spark_button_fav, spark_button_reblog; RelativeLayout horizontal_second_image; - LinearLayout status_peertube_container; TextView status_peertube_reply, status_peertube_delete, show_more_content; ImageView cached_status, status_account_bot; @@ -3986,11 +3993,8 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle //Poll LinearLayout poll_container, single_choice, multiple_choice, rated; RadioGroup radio_group; - TextView number_votes, remaining_time; Button submit_vote, refresh_poll; - - MastalabAutoCompleteTextView quick_reply_text; ImageView quick_reply_switch_to_full; TextView toot_space_left, warning_message; @@ -4002,12 +4006,9 @@ public abstract class BaseStatusListAdapter extends RecyclerView.Adapter<Recycle LinearLayout main_linear_container; View translation_border_view; TextView translation_label; - LinearLayout status_reactions; - public ImageView status_add_reaction; ImageView status_add_custom_emoji; RecyclerView reactions_view; - public MastalabAutoCompleteTextView fake_edittext; @SuppressLint("SetJavaScriptEnabled") ViewHolder(View itemView) { diff --git a/app/src/main/java/app/fedilab/android/drawers/SliderAdapter.java b/app/src/main/java/app/fedilab/android/drawers/SliderAdapter.java index 64208c732..df093d69f 100644 --- a/app/src/main/java/app/fedilab/android/drawers/SliderAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/SliderAdapter.java @@ -112,7 +112,7 @@ public class SliderAdapter extends SliderViewAdapter<SliderAdapter.SliderAdapter intent.putExtras(b); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { ActivityOptionsCompat options = ActivityOptionsCompat - .makeSceneTransitionAnimation((Activity) contextWeakReference.get(), viewHolder.imageViewBackground, attachments.get((position)).getUrl()); + .makeSceneTransitionAnimation(contextWeakReference.get(), viewHolder.imageViewBackground, attachments.get((position)).getUrl()); // start the new activity contextWeakReference.get().startActivity(intent, options.toBundle()); } else { diff --git a/app/src/main/java/app/fedilab/android/helper/BaseHelper.java b/app/src/main/java/app/fedilab/android/helper/BaseHelper.java index 8c7112c6a..9bdd5d426 100644 --- a/app/src/main/java/app/fedilab/android/helper/BaseHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/BaseHelper.java @@ -134,7 +134,6 @@ import com.tonyodev.fetch2core.DownloadBlock; import net.gotev.uploadservice.UploadService; import net.gotev.uploadservice.okhttp.OkHttpStack; - import org.jetbrains.annotations.NotNull; import java.io.ByteArrayInputStream; @@ -156,7 +155,6 @@ import java.net.PasswordAuthentication; import java.net.Proxy; import java.net.URISyntaxException; import java.nio.channels.FileChannel; - import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -1558,6 +1556,15 @@ public class BaseHelper { partnerShipItem.setVisible(false); } } + if (BuildConfig.lite) { + menu.findItem(R.id.nav_archive).setVisible(false); + menu.findItem(R.id.nav_archive_notifications).setVisible(false); + menu.findItem(R.id.nav_who_to_follow).setVisible(false); + menu.findItem(R.id.nav_how_to).setVisible(false); + menu.findItem(R.id.nav_partnership).setVisible(false); + menu.findItem(R.id.nav_news).setVisible(false); + menu.findItem(R.id.nav_trends).setVisible(false); + } } /** @@ -3171,7 +3178,6 @@ public class BaseHelper { } - public static String compressImagePath(Context context, android.net.Uri uriFile) { ContentResolver cr = context.getContentResolver(); diff --git a/app/src/main/java/app/fedilab/android/jobs/BaseScheduledBoostsSyncJob.java b/app/src/main/java/app/fedilab/android/jobs/BaseScheduledBoostsSyncJob.java index 0942d4c7b..0c97259c3 100644 --- a/app/src/main/java/app/fedilab/android/jobs/BaseScheduledBoostsSyncJob.java +++ b/app/src/main/java/app/fedilab/android/jobs/BaseScheduledBoostsSyncJob.java @@ -29,7 +29,6 @@ import app.fedilab.android.client.API; import app.fedilab.android.client.Entities.Account; import app.fedilab.android.client.Entities.Status; import app.fedilab.android.client.Entities.StoredStatus; -import app.fedilab.android.helper.Helper; import app.fedilab.android.sqlite.AccountDAO; import app.fedilab.android.sqlite.BoostScheduleDAO; import app.fedilab.android.sqlite.Sqlite; diff --git a/app/src/main/java/app/fedilab/android/jobs/BaseScheduledTootsSyncJob.java b/app/src/main/java/app/fedilab/android/jobs/BaseScheduledTootsSyncJob.java index 9a11490fc..f0444e111 100644 --- a/app/src/main/java/app/fedilab/android/jobs/BaseScheduledTootsSyncJob.java +++ b/app/src/main/java/app/fedilab/android/jobs/BaseScheduledTootsSyncJob.java @@ -29,7 +29,6 @@ import app.fedilab.android.client.API; import app.fedilab.android.client.Entities.Account; import app.fedilab.android.client.Entities.Status; import app.fedilab.android.client.Entities.StoredStatus; -import app.fedilab.android.helper.Helper; import app.fedilab.android.sqlite.AccountDAO; import app.fedilab.android.sqlite.Sqlite; import app.fedilab.android.sqlite.StatusStoredDAO; diff --git a/app/src/main/java/app/fedilab/android/services/UpgradeReceiver.java b/app/src/main/java/app/fedilab/android/services/UpgradeReceiver.java index a1464d09e..98bd9f980 100644 --- a/app/src/main/java/app/fedilab/android/services/UpgradeReceiver.java +++ b/app/src/main/java/app/fedilab/android/services/UpgradeReceiver.java @@ -13,6 +13,7 @@ package app.fedilab.android.services; * * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ + import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -23,17 +24,19 @@ public class UpgradeReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if( intent.getAction() != null && intent.getAction().compareTo(Intent.ACTION_MY_PACKAGE_REPLACED) == 0) { + if (intent.getAction() != null && intent.getAction().compareTo(Intent.ACTION_MY_PACKAGE_REPLACED) == 0) { Intent streamingServiceIntent = new Intent(context, LiveNotificationDelayedService.class); streamingServiceIntent.putExtra("stop", true); try { context.startService(streamingServiceIntent); - } catch (Exception ignored) {} + } catch (Exception ignored) { + } streamingServiceIntent = new Intent(context, LiveNotificationService.class); streamingServiceIntent.putExtra("stop", true); try { context.startService(streamingServiceIntent); - } catch (Exception ignored) {} + } catch (Exception ignored) { + } } } }
\ No newline at end of file |