mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-25 15:16:01 +00:00
Added qrcode library. Added qr code imageview to account details
This commit is contained in:
parent
d89609d562
commit
d65212f4d2
4 changed files with 43 additions and 13 deletions
|
|
@ -81,6 +81,9 @@ dependencies {
|
|||
// Image Loading/Caching
|
||||
compile 'com.squareup.picasso:picasso:2.5.2'
|
||||
|
||||
//QR Code
|
||||
compile 'com.github.kenglxn.QRGen:android:2.2.0'
|
||||
|
||||
// Emojis
|
||||
compile 'com.github.viirus:emoji-lib:0.0.3.2'
|
||||
|
||||
|
|
@ -161,11 +164,6 @@ android {
|
|||
release
|
||||
}
|
||||
|
||||
dexOptions{
|
||||
javaMaxHeapSize "4g"
|
||||
preDexLibraries = false
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
|
|
@ -206,8 +204,8 @@ android {
|
|||
}
|
||||
|
||||
dexOptions {
|
||||
preDexLibraries true
|
||||
javaMaxHeapSize "2g" // Use gig increments depending on needs
|
||||
preDexLibraries false
|
||||
javaMaxHeapSize "4g" // Use gig increments depending on needs
|
||||
incremental true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,6 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.MainActivity">
|
||||
|
||||
<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.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
|
@ -33,4 +27,20 @@
|
|||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
</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>
|
||||
|
|
@ -15,6 +15,8 @@ import android.preference.PreferenceManager;
|
|||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
|
|
@ -24,6 +26,9 @@ public class PrefsActivity extends BaseActivity implements
|
|||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
@BindView(R.id.imageView)
|
||||
ImageView qrImageView;
|
||||
|
||||
// TODO:
|
||||
// This method should be moved to HabiticaApplication
|
||||
public static HostConfig fromContext(Context ctx) {
|
||||
|
|
@ -51,6 +56,8 @@ public class PrefsActivity extends BaseActivity implements
|
|||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.fragment_container, new PreferencesFragment())
|
||||
.commit();
|
||||
|
||||
qrImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -5,9 +5,15 @@ import com.habitrpg.android.habitica.R;
|
|||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.glxn.qrgen.android.QRCode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -22,6 +28,15 @@ public class AccountDetailsFragment extends BasePreferencesFragment {
|
|||
findPreference(key).setSummary(preference.getValue().toString());
|
||||
}
|
||||
}
|
||||
|
||||
displayQRCode();
|
||||
}
|
||||
|
||||
protected void displayQRCode() {
|
||||
Bitmap myBitmap = QRCode.from("www.example.org").bitmap();
|
||||
ImageView myImage = (ImageView) getActivity().findViewById(R.id.imageView);
|
||||
myImage.setVisibility(View.VISIBLE);
|
||||
myImage.setImageBitmap(myBitmap);
|
||||
}
|
||||
|
||||
protected List<String> getAccountDetailsPreferences() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue