mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-24 22:55:59 +00:00
Added QR Code to party page if you are not in a party
This commit is contained in:
parent
d65212f4d2
commit
30b736d9a1
5 changed files with 76 additions and 27 deletions
|
|
@ -6,6 +6,21 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.PrefsActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_gravity="center" >
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_gravity="center_horizontal|bottom" />
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
@ -28,19 +43,4 @@
|
|||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:layout_gravity="center" >
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_gravity="center_horizontal|bottom" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -34,7 +34,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -42,6 +41,34 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Have someone invite you with this QR Code"
|
||||
style="@style/SectionTitle"
|
||||
android:visibility="@{user.party != null ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CardView.Default"
|
||||
android:visibility="@{user.party != null ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/CardContent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:id="@+id/QRImageView"
|
||||
android:layout_gravity="center_horizontal|bottom" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class AccountDetailsFragment extends BasePreferencesFragment {
|
|||
}
|
||||
|
||||
protected void displayQRCode() {
|
||||
Bitmap myBitmap = QRCode.from("www.example.org").bitmap();
|
||||
Bitmap myBitmap = QRCode.from(getString(R.string.SP_userID)).bitmap();
|
||||
ImageView myImage = (ImageView) getActivity().findViewById(R.id.imageView);
|
||||
myImage.setVisibility(View.VISIBLE);
|
||||
myImage.setImageBitmap(myBitmap);
|
||||
|
|
|
|||
|
|
@ -14,17 +14,22 @@ import com.magicmicky.habitrpgwrapper.lib.models.inventory.QuestContent;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
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 net.glxn.qrgen.android.QRCode;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
|
@ -37,10 +42,16 @@ public class GroupInformationFragment extends BaseFragment {
|
|||
FragmentGroupInfoBinding viewBinding;
|
||||
@Inject
|
||||
APIHelper apiHelper;
|
||||
|
||||
@BindView(R.id.questMemberView)
|
||||
LinearLayout questMemberView;
|
||||
|
||||
@BindView(R.id.collectionStats)
|
||||
RecyclerView collectionStats;
|
||||
|
||||
@BindView(R.id.QRImageView)
|
||||
ImageView qrImageView;
|
||||
|
||||
private View view;
|
||||
private Group group;
|
||||
private HabitRPGUser user;
|
||||
|
|
@ -55,7 +66,6 @@ public class GroupInformationFragment extends BaseFragment {
|
|||
}
|
||||
|
||||
public static GroupInformationFragment newInstance(Group group, HabitRPGUser user) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
GroupInformationFragment fragment = new GroupInformationFragment();
|
||||
|
|
@ -74,6 +84,7 @@ public class GroupInformationFragment extends BaseFragment {
|
|||
|
||||
viewBinding = DataBindingUtil.bind(view);
|
||||
viewBinding.setHideParticipantCard(false);
|
||||
|
||||
if (user != null) {
|
||||
viewBinding.setUser(user);
|
||||
}
|
||||
|
|
@ -89,6 +100,10 @@ public class GroupInformationFragment extends BaseFragment {
|
|||
bossHpBar = DataBindingUtil.bind(view.findViewById(R.id.bossHpBar));
|
||||
bossRageBar = DataBindingUtil.bind(view.findViewById(R.id.bossRageBar));
|
||||
|
||||
if (this.group == null) {
|
||||
displayQRCode();
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
@ -292,4 +307,11 @@ public class GroupInformationFragment extends BaseFragment {
|
|||
builder.show();
|
||||
}
|
||||
|
||||
protected void displayQRCode() {
|
||||
Bitmap myBitmap = QRCode.from(getString(R.string.SP_userID)).bitmap();
|
||||
|
||||
if (qrImageView != null) {
|
||||
qrImageView.setImageBitmap(myBitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,15 +78,15 @@ public class PartyFragment extends BaseMainFragment {
|
|||
}, throwable -> {
|
||||
});
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity)
|
||||
.setMessage(activity.getString(R.string.no_party_message))
|
||||
.setNeutralButton(android.R.string.ok, (dialog, which) -> {
|
||||
activity.getSupportFragmentManager().popBackStackImmediate();
|
||||
});
|
||||
builder.show();
|
||||
if (tabLayout != null) {
|
||||
tabLayout.removeAllTabs();
|
||||
}
|
||||
// AlertDialog.Builder builder = new AlertDialog.Builder(activity)
|
||||
// .setMessage(activity.getString(R.string.no_party_message))
|
||||
// .setNeutralButton(android.R.string.ok, (dialog, which) -> {
|
||||
// activity.getSupportFragmentManager().popBackStackImmediate();
|
||||
// });
|
||||
// builder.show();
|
||||
// if (tabLayout != null) {
|
||||
// tabLayout.removeAllTabs();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue