make RepoDetails scrollable and add a QR code to the bottom

Having a QR Code of the repo makes it easy for people to share the repo to
someone else.
This commit is contained in:
Hans-Christoph Steiner 2015-06-18 14:35:13 -04:00
parent 7ea294bb66
commit 46978e1086
2 changed files with 30 additions and 8 deletions

View File

@ -1,18 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/repoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:focusable="true"
android:focusableInTouchMode="true"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/padding_top"
android:paddingLeft="@dimen/padding_side"
android:paddingStart="@dimen/padding_side"
android:paddingRight="@dimen/padding_side"
android:paddingEnd="@dimen/padding_side">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/repoView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -132,4 +138,12 @@
android:layout_height="wrap_content"
android:layout_below="@id/text_not_yet_updated"/>
</RelativeLayout>
</RelativeLayout>
<ImageView
android:id="@+id/qr_code"
android:src="@drawable/swap_qr_example"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>

View File

@ -26,12 +26,15 @@ import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.NfcHelper;
import org.fdroid.fdroid.NfcNotEnabledActivity;
import org.fdroid.fdroid.ProgressListener;
import org.fdroid.fdroid.QrGenAsyncTask;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.UpdateService;
import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.data.Repo;
import org.fdroid.fdroid.data.RepoProvider;
import java.util.Locale;
public class RepoDetailsActivity extends ActionBarActivity {
private static final String TAG = "RepoDetailsActivity";
@ -111,6 +114,11 @@ public class RepoDetailsActivity extends ActionBarActivity {
performUpdate();
}
});
Uri uri = Uri.parse(repo.address);
uri = uri.buildUpon().appendQueryParameter("fingerprint", repo.fingerprint).build();
String qrUriString = uri.toString().toUpperCase(Locale.ENGLISH);
new QrGenAsyncTask(this, R.id.qr_code).execute(uri.toString());
}
@TargetApi(14)